/* Legacy - Faith & Family Games styles
   Card grid + full-screen game overlay. Mobile first. */

/* ── Game card grid ── */

.lg-games-home {
  padding: 16px 4px;
}

.lg-games-home .games-hero-icon,
.lg-games-home .games-title {
  text-align: center;
}

.lg-games-home .games-hero-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.lg-games-home .lg-games-sub {
  text-align: center;
}

.lg-games-sub {
  font-size: 0.85rem;
  color: var(--color-text-mid);
  margin: 4px 0 14px;
  line-height: 1.5;
}

.lg-games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 900px) {
  .section-landing .lg-games-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.lg-game-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--color-cream, #FAF8F3);
  border: 1.5px solid var(--color-gold, #C9963B);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.lg-game-card:active {
  transform: scale(0.99);
}

.lg-game-card:focus-visible {
  outline: 2px solid var(--color-gold, #C9963B);
  outline-offset: 2px;
}

.lg-game-card-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(201, 150, 59, 0.12);
  color: var(--color-gold, #C9963B);
}

.lg-game-card-body {
  flex: 1;
  min-width: 0;
}

.lg-game-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lg-game-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--color-text-dark, #1A1A2E);
}

.lg-level-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-gold, #C9963B);
  border: 1px solid var(--color-gold, #C9963B);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.lg-game-card-desc {
  margin: 4px 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--color-text-mid, #4A5568);
}

.lg-play-btn {
  flex-shrink: 0;
  min-height: 44px;
  min-width: 64px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: var(--color-gold, #C9963B);
  color: #1B2B4B;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
}

.lg-play-btn:active {
  filter: brightness(0.95);
}

/* ── Full-screen game overlay ── */

body.lg-game-open {
  overflow: hidden;
}

.lg-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #16233D 0%, #1B2B4B 55%, #14203A 100%);
  color: #EDF2F7;
  font-family: 'Nunito', sans-serif;
  /* No opacity animation here: on busy main threads the CSS animation can
     start late and leave the game see-through over the chat page. */
}

@keyframes lgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lg-overlay [hidden] {
  display: none !important;
}

.lg-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1.5px solid rgba(201, 150, 59, 0.5);
  flex-shrink: 0;
}

.lg-overlay-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.lg-overlay-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #F7E9CF;
}

.lg-level-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1B2B4B;
  background: var(--color-gold, #C9963B);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.lg-overlay-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid rgba(201, 150, 59, 0.6);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #F7E9CF;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lg-game-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.lg-game-intro {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #C9D4E5;
  text-align: center;
}

/* ── Shared buttons ── */

.lg-btn {
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.lg-btn-gold {
  background: var(--color-gold, #C9963B);
  border: none;
  color: #1B2B4B;
}

.lg-btn-gold:disabled {
  opacity: 0.45;
  cursor: default;
}

.lg-btn-outline {
  background: transparent;
  border: 1.5px solid rgba(201, 150, 59, 0.7);
  color: #F7E9CF;
}

/* ── Win screen ── */

.lg-win {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 8px;
}

.lg-win-glow {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold, #C9963B);
  background: rgba(201, 150, 59, 0.12);
  box-shadow: 0 0 34px rgba(201, 150, 59, 0.45);
  margin-bottom: 18px;
  animation: lgGlow 1.8s ease-in-out infinite alternate;
}

@keyframes lgGlow {
  from { box-shadow: 0 0 22px rgba(201, 150, 59, 0.3); }
  to { box-shadow: 0 0 44px rgba(201, 150, 59, 0.6); }
}

.lg-win-title {
  margin: 0 0 8px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #F7E9CF;
}

.lg-win-detail {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #C9D4E5;
}

.lg-win-verse {
  margin: 6px 0 24px;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--color-gold-light, #E8B96A);
  max-width: 420px;
}

.lg-win-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.lg-win-btns .lg-btn {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
}

/* ── Verse Match ── */

.lg-match-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 540px) {
  .lg-match-board {
    grid-template-columns: repeat(4, 1fr);
  }
}

.lg-match-card {
  position: relative;
  min-height: 108px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  perspective: 700px;
  font-family: inherit;
}

.lg-match-card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.35s ease;
}

.lg-match-card.lg-flipped .lg-match-card-inner,
.lg-match-card.lg-matched .lg-match-card-inner {
  transform: rotateY(180deg);
}

.lg-match-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
}

.lg-match-back {
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(201, 150, 59, 0.55);
  color: var(--color-gold, #C9963B);
}

.lg-match-front {
  background: #F7F1E3;
  border: 1.5px solid var(--color-gold, #C9963B);
  color: #1B2B4B;
  transform: rotateY(180deg);
}

.lg-match-card.lg-matched .lg-match-front {
  background: #FDF4E3;
  border-color: var(--color-gold-light, #E8B96A);
  box-shadow: 0 0 16px rgba(201, 150, 59, 0.65);
}

.lg-match-text {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: break-word;
}

/* ── Bible Trivia ── */

.lg-trivia-progress {
  margin: 0 0 10px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gold, #C9963B);
}

.lg-trivia-question {
  margin: 0 0 18px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.45;
  color: #F7E9CF;
}

.lg-trivia-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lg-trivia-option {
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(201, 150, 59, 0.45);
  background: rgba(255, 255, 255, 0.06);
  color: #EDF2F7;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.lg-trivia-option.lg-disabled {
  cursor: default;
}

.lg-trivia-option.lg-correct {
  background: rgba(47, 133, 90, 0.3);
  border-color: #48BB78;
  color: #C6F6D5;
}

.lg-trivia-option.lg-wrong {
  background: rgba(197, 48, 48, 0.25);
  border-color: #FC8181;
  color: #FED7D7;
}

.lg-trivia-feedback {
  min-height: 22px;
  margin: 14px 0 6px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.lg-feedback-good { color: #9AE6B4; }
.lg-feedback-soft { color: #E8B96A; }

.lg-trivia-next {
  display: block;
  margin: 8px auto 0;
  min-width: 200px;
}

/* ── Scripture Scramble ── */

.lg-scramble-diff {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.lg-scramble-diff-btn {
  min-height: 40px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1.5px solid rgba(201, 150, 59, 0.5);
  background: rgba(255, 255, 255, 0.04);
  color: #C8D4E6;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.lg-scramble-diff-btn:active {
  transform: scale(0.95);
}

.lg-scramble-diff-btn.lg-scramble-diff-on {
  background: linear-gradient(180deg, #E0B44E, #C9963B);
  border-color: #C9963B;
  color: #1B2A4A;
}

.lg-scramble-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  padding: 12px;
  border: 1.5px dashed rgba(201, 150, 59, 0.6);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 18px;
}

.lg-scramble-hint {
  font-size: 0.85rem;
  color: #8FA0BC;
  font-style: italic;
}

.lg-scramble-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.lg-chip {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(201, 150, 59, 0.6);
  background: rgba(255, 255, 255, 0.07);
  color: #F0E6D2;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.lg-chip-placed {
  background: var(--color-gold, #C9963B);
  border-color: var(--color-gold, #C9963B);
  color: #1B2B4B;
}

.lg-scramble-status,
.lg-order-status {
  min-height: 24px;
  margin: 14px 0 4px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #E8B96A;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lg-status-visible {
  opacity: 1;
}

.lg-scramble-reset {
  display: block;
  margin: 8px auto 0;
  min-width: 160px;
}

/* ── Order the Books ── */

.lg-order-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.lg-order-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1.5px dashed rgba(201, 150, 59, 0.5);
  background: rgba(255, 255, 255, 0.04);
  color: #8FA0BC;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}

.lg-order-slot.lg-slot-filled {
  border-style: solid;
  border-color: rgba(201, 150, 59, 0.75);
  background: rgba(201, 150, 59, 0.12);
  color: #F7E9CF;
}

.lg-order-slot.lg-slot-correct {
  border-color: #48BB78;
  background: rgba(47, 133, 90, 0.22);
  color: #C6F6D5;
}

.lg-order-slot.lg-slot-review {
  border-color: #E8B96A;
  background: rgba(232, 185, 106, 0.14);
}

.lg-order-slot-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(201, 150, 59, 0.2);
  color: var(--color-gold, #C9963B);
  font-weight: 800;
  font-size: 0.85rem;
}

.lg-order-slot-label {
  font-weight: 700;
}

.lg-order-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.lg-order-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ── Doc hint helper ── */

/* Keep game content clear of the fixed hint button and Doc pop-in. */
.lg-overlay.lg-has-hints .lg-game-area {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

.lg-hint-fab {
  position: fixed;
  left: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 520;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 10px 14px 10px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--color-gold, #C9963B);
  background: #1B2B4B;
  color: var(--color-gold-light, #E8B96A);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.lg-hint-fab:active {
  transform: scale(0.97);
}

.lg-hint-fab-count {
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gold, #C9963B);
  color: #1B2B4B;
  font-size: 0.7rem;
  font-weight: 800;
}

.lg-hint-fab-empty {
  opacity: 0.6;
}

.lg-hint-fab-empty .lg-hint-fab-count {
  background: rgba(201, 150, 59, 0.4);
}

.lg-doc-helper {
  position: fixed;
  right: 10px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 10px;
  z-index: 530;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  cursor: pointer;
  pointer-events: auto;
}

.lg-doc-helper[hidden] {
  display: none !important;
}

.lg-doc-in {
  animation: lgDocPop 0.42s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes lgDocPop {
  0% { opacity: 0; transform: translateY(28px) scale(0.92); }
  70% { opacity: 1; transform: translateY(-4px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.lg-doc-bubble {
  position: relative;
  max-width: calc(100vw - 118px);
  background: #F7F1E3;
  border: 1.5px solid var(--color-gold, #C9963B);
  border-radius: 16px;
  border-bottom-right-radius: 4px;
  padding: 12px 14px 8px;
  color: #1B2B4B;
  font-family: 'Nunito', sans-serif;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.lg-doc-bubble::after {
  content: '';
  position: absolute;
  right: -9px;
  bottom: 14px;
  width: 14px;
  height: 14px;
  background: #F7F1E3;
  border-right: 1.5px solid var(--color-gold, #C9963B);
  border-bottom: 1.5px solid var(--color-gold, #C9963B);
  transform: rotate(-45deg);
  border-bottom-right-radius: 3px;
}

.lg-doc-intro {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.4;
  color: #8A6A2F;
}

.lg-doc-intro[hidden] {
  display: none;
}

.lg-doc-hint {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  color: #1B2B4B;
}

.lg-doc-dismiss {
  display: block;
  margin-top: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #A08654;
}

.lg-doc-avatar {
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--color-gold, #C9963B);
  background: #1B2B4B;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.lg-doc-avatar img,
.lg-doc-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gentle glow Doc uses to point at helpful cards, chips, and slots. */
.lg-hint-glow {
  animation: lgHintGlow 0.9s ease-in-out 3;
  border-color: var(--color-gold-light, #E8B96A) !important;
}

@keyframes lgHintGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 185, 106, 0); }
  50% { box-shadow: 0 0 18px rgba(232, 185, 106, 0.95); }
}

/* Trivia option Doc has ruled out for you */
.lg-trivia-option.lg-option-out {
  opacity: 0.4;
  text-decoration: line-through;
  cursor: default;
}

@media (min-width: 768px) {
  .lg-doc-helper {
    left: auto;
    max-width: 460px;
  }
}

.lg-gentle-note {
  text-align: center;
  color: #E8B96A;
  font-size: 0.9rem;
  font-weight: 700;
}

/* ── Mobile carousel integration ──
   app.js injects a legacy "Coming Soon" panel (.carousel-games-panel) on the
   games carousel page and hides the landing. The games are live now, so hide
   that panel and keep the landing (which holds the live game grid) visible. */

@media (max-width: 767px) {
  .carousel-games-panel {
    display: none !important;
  }
  /* The chat suggestion clouds are a fixed overlay across all carousel pages.
     Never let an empty container swallow taps, and hide the clouds entirely
     while the Games view is active (body class set by games.js). */
  .floating-suggestions:empty {
    pointer-events: none !important;
  }
  body.lg-games-view .floating-suggestions {
    display: none !important;
  }
  .carousel-page[data-page="games"] .section-landing,
  .carousel-page[data-page="games"].has-carousel-panel .section-landing {
    display: flex !important;
    flex-direction: column;
    flex: 1;
  }
  .carousel-page[data-page="games"] .section-landing-inner {
    padding: 20px 16px calc(20px + var(--mobile-tab-height, 60px));
  }
}

/* ── Level map ── */

.lg-level-map-wrap {
  max-width: 460px;
  margin: 0 auto;
}

.lg-level-stage {
  margin: 0 auto 18px;
}

.lg-level-stage-locked .lg-level-map {
  opacity: 0.85;
}

.lg-stage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px 8px;
  border-bottom: 1px solid rgba(201, 150, 59, 0.35);
  margin-bottom: 12px;
}

.lg-stage-title {
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: #F2D89A;
}

.lg-stage-sub {
  font-size: 12px;
  color: rgba(247, 233, 207, 0.7);
}

.lg-stage-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(247, 233, 207, 0.75);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(201, 150, 59, 0.45);
  border-radius: 999px;
  padding: 3px 10px;
}

.lg-stage-lock svg {
  width: 12px;
  height: 12px;
}

.lg-level-map {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 6px auto 14px;
}

.lg-level-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px 2px;
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.7);
  background: rgba(255, 255, 255, 0.06);
  color: #F7E9CF;
  font-family: inherit;
  cursor: pointer;
}

.lg-level-node-num {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
}

.lg-level-node.lg-level-done {
  background: rgba(201, 150, 59, 0.16);
  border-color: var(--color-gold, #C9963B);
}

.lg-level-node.lg-level-open {
  border-color: var(--color-gold-light, #E8B96A);
  animation: lgNodePulse 2.2s ease-in-out infinite;
}

@keyframes lgNodePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 185, 106, 0); }
  50% { box-shadow: 0 0 14px rgba(232, 185, 106, 0.55); }
}

.lg-level-node.lg-level-locked {
  border-style: dashed;
  border-color: rgba(201, 150, 59, 0.3);
  color: #5E6E8C;
  background: rgba(255, 255, 255, 0.03);
  cursor: default;
}

.lg-level-node-lock {
  display: flex;
  color: #5E6E8C;
}

.lg-level-node-stars {
  display: flex;
  gap: 2px;
}

.lg-mini-star {
  width: 12px;
  height: 12px;
  color: rgba(255, 255, 255, 0.16);
}

.lg-mini-star svg { display: block; width: 100%; height: 100%; }

.lg-mini-star-on {
  color: var(--color-gold, #C9963B);
}

.lg-map-footnote {
  margin: 4px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #8FA0BC;
  line-height: 1.5;
}

/* Trophy card shown on the map after level 10 */

.lg-trophy-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin: 0 0 16px;
  border-radius: 16px;
  border: 1.5px solid var(--color-gold, #C9963B);
  background: linear-gradient(135deg, rgba(201, 150, 59, 0.22), rgba(201, 150, 59, 0.08));
  box-shadow: 0 0 24px rgba(201, 150, 59, 0.3);
}

.lg-trophy-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  color: var(--color-gold, #C9963B);
}

.lg-trophy-icon svg { width: 100%; height: 100%; }

.lg-trophy-title {
  margin: 0 0 2px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #F7E9CF;
}

.lg-trophy-sub {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #C9D4E5;
}

.lg-level-tag-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(201, 150, 59, 0.14);
}

/* ── Celebration screen ── */

.lg-win {
  position: relative;
}

.lg-confetti-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.lg-confetti {
  position: absolute;
  top: -20px;
  display: block;
  opacity: 0.95;
  animation-name: lgConfettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes lgConfettiFall {
  0% { transform: translateY(-4vh) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(106vh) rotate(560deg); opacity: 0; }
}

.lg-win-rays {
  position: absolute;
  top: -60px;
  left: 50%;
  width: 320px;
  height: 320px;
  margin-left: -160px;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(
    rgba(232, 185, 106, 0.22) 0deg 9deg,
    rgba(232, 185, 106, 0) 9deg 24deg
  );
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 68%);
  mask-image: radial-gradient(circle, #000 0%, transparent 68%);
  animation: lgRaysSpin 16s linear infinite;
  opacity: 0.7;
  z-index: 0;
}

.lg-win-finale .lg-win-rays {
  width: 440px;
  height: 440px;
  margin-left: -220px;
  opacity: 1;
}

@keyframes lgRaysSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.lg-win-finale::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 28%, rgba(201, 150, 59, 0.3), rgba(201, 150, 59, 0) 62%);
  animation: lgFadeIn 0.8s ease;
  z-index: 0;
}

.lg-win-glow,
.lg-win-title,
.lg-win-stars,
.lg-win-docline,
.lg-win-stats,
.lg-win-detail,
.lg-win-verse,
.lg-win-btns {
  position: relative;
  z-index: 2;
}

.lg-win-glow-big {
  width: 104px;
  height: 104px;
  box-shadow: 0 0 54px rgba(201, 150, 59, 0.7);
}

.lg-win-stars {
  display: flex;
  gap: 10px;
  margin: 4px 0 12px;
}

.lg-win-star {
  width: 42px;
  height: 42px;
  color: rgba(255, 255, 255, 0.14);
}

.lg-win-star svg { display: block; width: 100%; height: 100%; }

.lg-win-star-earned {
  color: var(--color-gold, #C9963B);
  filter: drop-shadow(0 0 8px rgba(232, 185, 106, 0.75));
  animation: lgStarPop 0.55s cubic-bezier(0.22, 1.5, 0.36, 1) backwards;
}

@keyframes lgStarPop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.lg-win-docline {
  margin: 0 0 14px;
  max-width: 420px;
  font-size: 0.92rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.55;
  color: var(--color-gold-light, #E8B96A);
}

.lg-win-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 0 0 14px;
}

.lg-win-stat {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(201, 150, 59, 0.5);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #EDF2F7;
  white-space: nowrap;
}

/* ── Micro feedback: sparkle + pop ── */

.lg-spark-host {
  position: relative;
}

.lg-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--color-gold-light, #E8B96A);
  box-shadow: 0 0 6px rgba(232, 185, 106, 0.9);
  pointer-events: none;
  z-index: 5;
  animation: lgSparkFly 0.7s ease-out forwards;
}

@keyframes lgSparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx, 20px), var(--sy, -20px)) scale(0.2); opacity: 0; }
}

.lg-pop {
  animation: lgPopPulse 0.4s ease;
}

@keyframes lgPopPulse {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.07); }
}

/* ── Streak note ── */

.lg-streak-note {
  min-height: 20px;
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-gold-light, #E8B96A);
  opacity: 0;
}

.lg-streak-show {
  animation: lgStreakFlash 2.6s ease forwards;
}

@keyframes lgStreakFlash {
  0% { opacity: 0; transform: translateY(6px); }
  12% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Gentle timer (Verse Match levels 8+) ── */

.lg-timer {
  width: max-content;
  max-width: 100%;
  margin: -6px auto 14px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(201, 150, 59, 0.55);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #F7E9CF;
  text-align: center;
}

.lg-timer-low {
  border-color: var(--color-gold-light, #E8B96A);
  color: var(--color-gold-light, #E8B96A);
  animation: lgNodePulse 1.2s ease-in-out infinite;
}

.lg-timer-done {
  border-color: rgba(201, 150, 59, 0.4);
  color: #C9D4E5;
  animation: none;
  font-style: italic;
}

/* ── Bigger Verse Match boards (6+ pairs) ── */

.lg-match-board-lg {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lg-match-board-lg .lg-match-card {
  min-height: 92px;
}

.lg-match-board-lg .lg-match-text {
  font-size: 0.62rem;
  line-height: 1.3;
}

@media (min-width: 540px) {
  .lg-match-board-lg {
    grid-template-columns: repeat(4, 1fr);
  }
  .lg-match-board-lg .lg-match-text {
    font-size: 0.68rem;
  }
}

/* ── Scramble: fixed words + blanks ── */

.lg-scramble-fixed {
  padding: 6px 2px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #C9D4E5;
}

.lg-scramble-blank {
  min-width: 58px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px dashed rgba(232, 185, 106, 0.8);
  background: rgba(232, 185, 106, 0.08);
  color: #F0E6D2;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.lg-scramble-blank.lg-blank-filled {
  border-style: solid;
  border-color: var(--color-gold, #C9963B);
  background: var(--color-gold, #C9963B);
  color: #1B2B4B;
}

/* ────────────────────────────────────────────
   Leaderboard + player handle
   ──────────────────────────────────────────── */

/* Player bar above each games grid */
.lg-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 auto 16px;
  padding: 12px 16px;
  max-width: 640px;
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.55);
  background: rgba(27, 43, 75, 0.55);
}

.lg-player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lg-player-badge {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1B2B4B;
  background: var(--color-gold, #C9963B);
}

.lg-player-name-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lg-player-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9FB0CC;
}

.lg-player-handle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 800;
  color: #F7E9CF;
}

.lg-player-rank {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--color-gold-light, #E8B96A);
  border: 1px solid rgba(232, 185, 106, 0.6);
  border-radius: 999px;
  padding: 1px 8px;
}

.lg-player-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lg-player-btn {
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid rgba(201, 150, 59, 0.7);
  background: rgba(201, 150, 59, 0.14);
  color: #F7E9CF;
}

.lg-player-btn:hover { background: rgba(201, 150, 59, 0.24); }

.lg-player-btn-ghost {
  background: transparent;
  border-color: rgba(159, 176, 204, 0.45);
  color: #C9D4E5;
}

.lg-player-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
}

.lg-player-prompt-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #E7DFCB;
}

.lg-player-set { min-height: 40px; padding: 9px 18px; font-size: 0.88rem; }

/* Branded name / leaderboard modal (no browser dialogs) */
.lg-name-overlay {
  position: fixed;
  inset: 0;
  z-index: 5200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 18, 34, 0.72);
  backdrop-filter: blur(3px);
  animation: lgFadeIn 0.18s ease;
}

@keyframes lgFadeIn { from { opacity: 0; } to { opacity: 1; } }

.lg-name-modal {
  width: min(440px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  border: 2px solid var(--color-gold, #C9963B);
  background: linear-gradient(160deg, #1F3157, #172440);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 22px 22px 20px;
  animation: lgPopIn 0.2s ease;
}

@keyframes lgPopIn {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.lg-name-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.lg-name-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gold, #C9963B);
  background: rgba(201, 150, 59, 0.14);
}

.lg-name-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #F7E9CF;
}

.lg-name-intro {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #C9D4E5;
}

.lg-name-field { margin-bottom: 18px; }

.lg-name-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid rgba(201, 150, 59, 0.55);
  background: rgba(10, 18, 34, 0.45);
  color: #F7E9CF;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
}

.lg-name-input:focus {
  outline: none;
  border-color: var(--color-gold, #C9963B);
  box-shadow: 0 0 0 3px rgba(201, 150, 59, 0.25);
}

.lg-name-status {
  margin: 8px 2px 0;
  min-height: 18px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #9FB0CC;
}

.lg-name-status.checking { color: #9FB0CC; }
.lg-name-status.good { color: #7FD9A6; }
.lg-name-status.bad { color: #F0A6A6; }

.lg-name-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.lg-name-actions .lg-btn { min-height: 46px; padding: 11px 20px; }

.lg-name-skip {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  color: #9FB0CC;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Leaderboard list */
.lg-lb-modal { width: min(460px, 96vw); }
.lg-lb-body { margin-bottom: 16px; }

.lg-lb-loading, .lg-lb-empty {
  margin: 8px 0;
  padding: 14px;
  text-align: center;
  font-size: 0.9rem;
  color: #C9D4E5;
}

.lg-lb-list { display: flex; flex-direction: column; gap: 6px; }

.lg-lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 18, 34, 0.35);
  border: 1px solid rgba(201, 150, 59, 0.15);
}

.lg-lb-row-me {
  background: rgba(201, 150, 59, 0.16);
  border-color: rgba(201, 150, 59, 0.6);
}

.lg-lb-rank {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #C9D4E5;
  background: rgba(159, 176, 204, 0.14);
}

.lg-lb-rank-1 { color: #1B2B4B; background: var(--color-gold, #C9963B); }
.lg-lb-rank-2 { color: #1B2B4B; background: #C8CEDA; }
.lg-lb-rank-3 { color: #1B2B4B; background: #D8A06A; }

.lg-lb-namecol { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }

.lg-lb-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #F7E9CF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-lb-you {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1B2B4B;
  background: var(--color-gold-light, #E8B96A);
  border-radius: 999px;
  padding: 1px 7px;
}

.lg-lb-sub {
  font-size: 0.76rem;
  font-weight: 700;
  color: #9FB0CC;
}

.lg-lb-score {
  flex: 0 0 auto;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-gold-light, #E8B96A);
}

.lg-lb-divider {
  text-align: center;
  color: #6E7C97;
  font-weight: 800;
  letter-spacing: 4px;
  padding: 2px 0;
}

/* Leaderboard on the win screen */
.lg-win-lb {
  width: 100%;
  max-width: 420px;
  margin: 20px auto 4px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(201, 150, 59, 0.4);
  background: rgba(10, 18, 34, 0.35);
}

.lg-win-lb-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-gold-light, #E8B96A);
}

.lg-win-lb-join { text-align: center; padding: 6px 4px; }

.lg-win-lb-join-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #C9D4E5;
}
