/* ═════════════════════════════════════════════════════════════════
   MY GAME'S PUZZLES STYLESHEET (my_game_puzzles.css)
   ═════════════════════════════════════════════════════════════════ */

#page-my-game-puzzles {
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

#page-my-game-puzzles.active {
  display: flex !important;
}

.mgp-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 610px 430px;
  gap: 28px;
  padding: 24px 20px;
  max-width: 1560px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
  justify-content: center;
}

@media (max-width: 1420px) {
  .mgp-layout {
    grid-template-columns: 250px 540px 390px;
    gap: 20px;
  }
}

@media (max-width: 1180px) {
  .mgp-layout {
    grid-template-columns: 280px 1fr;
  }
  .mgp-sidebar-right {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 860px) {
  .mgp-layout {
    grid-template-columns: 1fr;
    padding: 10px 8px 30px;
    gap: 14px;
  }

  /* 1. Board section appears TOP first */
  .mgp-center {
    order: 1;
    width: 100%;
  }

  .mgp-board-wrap {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: min(100vw - 20px, 600px);
  }

  .mgp-player-bar {
    width: 100%;
    max-width: min(100vw - 20px, 600px);
  }

  /* 2. Action buttons right under the board on mobile */
  #mgp-mobile-actions {
    display: block;
    width: 100%;
    max-width: min(100vw - 20px, 600px);
    margin-top: 10px;
  }

  #mgp-mobile-actions .mgp-action-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  #mgp-mobile-actions #mgp-btn-next {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 8px;
  }

  #mgp-mobile-actions .mgp-action-subrow {
    display: flex;
    gap: 8px;
    width: 100%;
  }

  #mgp-mobile-actions #mgp-btn-hint,
  #mgp-mobile-actions #mgp-btn-skip {
    flex: 1;
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 8px;
  }

  #mgp-mobile-actions #mgp-btn-analyze,
  #mgp-mobile-actions #mgp-btn-delete {
    width: 100%;
    padding: 10px 14px;
    font-size: 12.5px;
    margin-top: 2px;
  }

  #mgp-desktop-actions:empty {
    display: none;
  }

  /* 3. Game context, prompt, feedback directly below action buttons */
  .mgp-sidebar-right {
    order: 2;
    width: 100%;
    max-width: min(100vw - 20px, 600px);
    margin: 0 auto;
  }

  /* 4. Training mode filters & stats below game context */
  .mgp-sidebar-left {
    order: 3;
    width: 100%;
    max-width: min(100vw - 20px, 600px);
    margin: 0 auto;
  }
}

/* ── Filter Tabs ── */
.mgp-filter-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.mgp-filter-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.mgp-filter-btn:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}

.mgp-filter-btn.active {
  background: rgba(var(--accentRGB, 173, 98, 255), 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.mgp-tab-icon {
  font-size: 16px;
}

.mgp-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Stats Grid ── */
.mgp-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.mgp-stat-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 6px;
  text-align: center;
}

.mgp-stat-val {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.mgp-stat-lbl {
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.mgp-action-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.mgp-action-subrow {
  display: flex;
  gap: 8px;
  width: 100%;
}

.mgp-action-subrow .btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 8px;
}

.mgp-btn-analyze {
  width: 100%;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent, #ad62ff) !important;
  background: rgba(173, 98, 255, 0.08) !important;
  border: 1px solid rgba(173, 98, 255, 0.35) !important;
  border-radius: var(--radius-sm, 6px);
  padding: 8px 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.mgp-btn-analyze:hover {
  background: rgba(173, 98, 255, 0.2) !important;
  border-color: var(--accent, #ad62ff) !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(173, 98, 255, 0.25);
}

.mgp-btn-delete {
  width: 100%;
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.06) !important;
  border: 1px solid rgba(239, 68, 68, 0.22) !important;
  border-radius: var(--radius-sm, 6px);
  padding: 7px 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.mgp-btn-delete:hover {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #ff6b6b !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.18);
}

/* ── Center Board Section ── */
.mgp-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.mgp-player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 600px;
  max-width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--text2);
}

.mgp-player-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mgp-color-dot {
  font-size: 12px;
}

.mgp-player-name {
  font-weight: 600;
  color: var(--text);
}

.mgp-turn-tag {
  font-size: 11px;
  color: var(--text3);
}

.mgp-turn-tag.active {
  color: var(--accent);
  font-weight: 700;
}

.mgp-board-wrap {
  width: 600px;
  height: 600px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border2);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.75);
  background: #1e1e28;
  position: relative;
  touch-action: none;
}

#mgp-board {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 650px) {
  .mgp-board-wrap {
    width: 92vw;
    height: 92vw;
  }
  .mgp-player-bar {
    width: 92vw;
  }
}

/* ── Right Sidebar Context Panel ── */
.mgp-context-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mgp-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mgp-type-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mgp-type-badge.punish {
  background: linear-gradient(135deg, rgba(80, 200, 120, 0.18), rgba(46, 125, 75, 0.1));
  border: 1px solid rgba(80, 200, 120, 0.45);
  color: #50c878;
  box-shadow: 0 0 14px rgba(80, 200, 120, 0.12);
}

.mgp-type-badge.defense {
  background: linear-gradient(135deg, rgba(255, 165, 0, 0.18), rgba(180, 100, 0, 0.1));
  border: 1px solid rgba(255, 165, 0, 0.45);
  color: #ffa500;
  box-shadow: 0 0 14px rgba(255, 165, 0, 0.12);
}

.mgp-swing-badge {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  color: #e2e8f0;
}

.mgp-mastery-badge {
  font-size: 11.5px;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(173, 98, 255, 0.12);
  border: 1px solid rgba(173, 98, 255, 0.35);
  color: var(--accent, #ad62ff);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}

.mgp-mastery-badge strong {
  color: #fff;
  font-weight: 700;
}

.mgp-mastery-badge .mgp-mastery-sub {
  color: var(--text2, #9b94b0);
  font-size: 10px;
  font-weight: normal;
}

.mgp-mastery-badge.penalty {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.4);
  color: #facc15;
}

.mgp-mastery-badge.penalty .mgp-mastery-sub {
  color: #fde047;
}

.mgp-mastery-badge.mastered {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25), rgba(173, 98, 255, 0.25));
  border-color: #facc15;
  color: #fef08a;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.35);
  animation: pulseMastered 1.5s infinite alternate;
}

@keyframes pulseMastered {
  from { transform: scale(1); box-shadow: 0 0 12px rgba(250, 204, 21, 0.25); }
  to   { transform: scale(1.03); box-shadow: 0 0 22px rgba(250, 204, 21, 0.55); }
}

/* ── Meta Grid Cards ── */
.mgp-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mgp-card-block {
  background: rgba(20, 22, 28, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 11px 14px;
  transition: all 0.2s ease;
}

.mgp-card-block:hover {
  background: rgba(25, 28, 36, 0.85);
  border-color: rgba(255, 255, 255, 0.14);
}

.mgp-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.mgp-card-icon {
  font-size: 13px;
  opacity: 0.85;
}

.mgp-card-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mgp-color-pill {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mgp-color-pill.white {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.mgp-color-pill.black {
  background: rgba(0, 0, 0, 0.35);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.15);
}

.mgp-card-body {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.mgp-opening-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.45;
  word-break: break-word;
}

/* ── Interactive Prompt Card ── */
.mgp-prompt-card {
  background: linear-gradient(145deg, rgba(24, 27, 36, 0.9), rgba(16, 18, 25, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.mgp-prompt-card.punish {
  border-left-color: #50c878;
}

.mgp-prompt-card.defense {
  border-left-color: #ffa500;
}

.mgp-prompt-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.mgp-prompt-icon {
  font-size: 15px;
}

.mgp-prompt-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
  letter-spacing: 0.01em;
}

.mgp-prompt-detail {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

/* ── Move Chip Highlight ── */
.mgp-move-chip {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Outfit', monospace;
  font-weight: 700;
  font-size: 13px;
  background: rgba(234, 179, 8, 0.16);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.45);
  padding: 1px 8px;
  border-radius: 6px;
  margin: 0 3px;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.15);
  vertical-align: baseline;
}

.mgp-hint-text {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(var(--accentRGB, 173, 98, 255), 0.1);
  border: 1px solid rgba(var(--accentRGB, 173, 98, 255), 0.3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent);
  font-style: italic;
}

/* ── Feedback Message ── */
.mgp-feedback {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.25s ease;
  padding: 10px 14px;
  text-align: center;
}

.mgp-feedback.correct {
  background: rgba(80, 200, 120, 0.16);
  color: #4ade80;
  border: 1px solid rgba(80, 200, 120, 0.45);
  box-shadow: 0 0 16px rgba(80, 200, 120, 0.18);
}

.mgp-feedback.wrong {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.18);
}

/* ── Tactical Continuation Line ── */
.mgp-continuation-wrap {
  background: rgba(20, 23, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.25s ease;
}

.mgp-continuation-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mgp-continuation-icon {
  font-size: 13px;
  color: var(--accent);
}

.mgp-continuation-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text3);
  text-transform: uppercase;
}

.mgp-continuation-hint {
  margin-left: auto;
  font-size: 10px;
  color: var(--text3);
  font-style: italic;
}

.mgp-continuation-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', 'Outfit', monospace;
  font-size: 13px;
}

.mgp-pv-move {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #f1f5f9;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mgp-pv-move:hover {
  background: rgba(var(--accentRGB, 173, 98, 255), 0.22);
  border-color: var(--accent);
  color: #e9d5ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mgp-pv-num {
  color: var(--text3);
  font-size: 11.5px;
  margin-right: 2px;
}

/* ── Floating Mini-Chessboard Tooltip ── */
.mgp-mini-tooltip {
  position: absolute;
  z-index: 9999;
  background: rgba(20, 18, 29, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(var(--accentRGB, 173, 98, 255), 0.2);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(8px);
  animation: miniFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes miniFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.mgp-mini-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 2px;
}

.mgp-mini-move-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #fde047;
}

.mgp-mini-turn-tag {
  font-size: 10.5px;
  color: var(--text3);
}

.mgp-mini-board-wrap {
  width: 190px;
  height: 190px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
}

#mgp-mini-board {
  width: 100%;
  height: 100%;
  display: block;
}
