@import url("vendor/fonts.css");
@import url("src/tokens.css");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background-color: var(--paper);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Ambient crosses, sparkles and foliage, as in the mockups — not a grid. */
  background-image: url("assets/decor/tile.svg");
  background-size: 340px 340px;
  background-repeat: repeat;
  padding-top: env(safe-area-inset-top, 0px);
}

@media (min-width: 769px) {
  html, body {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f7f1e9;
    overflow: auto;
  }

  #app {
    width: min(430px, 100vw);
    height: min(920px, 100dvh);
    min-height: 0;
    max-height: 920px;
    border-radius: 36px;
    box-shadow: 0 12px 40px rgba(44, 35, 32, 0.12);
    padding-top: 0;
  }
}

/* Screens */
/* The screen itself never scrolls. Its body does (.screen-scroll), so the tab
   bar below stays a real layout box. When .screen was the scroller, the
   absolutely positioned nav anchored to the bottom of the *scrollable* content
   instead of the visible area: it drifted with scroll and permanently covered
   the last control (Start Game was untappable on a phone). */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Every screen's scrolling region. Fits without scrolling by default; the
   finger only gets a scroll when content genuinely overflows. */
.screen-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* On a short viewport the last control would otherwise sit flush against the
     tab bar once scrolled to the end. */
  scroll-padding-bottom: 12px;
}

.screen-scroll > :last-child {
  margin-bottom: 12px;
}

/* Light app chrome for internal pages: safe-area-aware, centered title and a
   bare back affordance. It reads as native navigation rather than a web card. */
.page-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(253, 248, 242, 0.94);
  border-bottom: 1px solid var(--hairline);
  z-index: 10;
}

.page-header h1 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  font-weight: 700;
}

.page-header-action,
.page-header-spacer {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.page-header-action {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
  cursor: pointer;
}

.page-header-action:active {
  transform: scale(0.92);
}

/* Home Screen */
.screen-home {
  overflow: hidden;
  padding: 0;
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  gap: 0;
}

.home-brand {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 0;
}

.home-body {
  width: 100%;
  box-sizing: border-box;
  padding: max(8px, env(safe-area-inset-top, 0px)) 24px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 0;
}

/* Spare height goes above the lockup and below the buttons at roughly the 2:1
   ratio the mockup uses, instead of collapsing into one gap under the hero. */
.home-body::before,
.home-body::after {
  content: "";
  display: block;
  width: 100%;
}

.home-body::before {
  flex: 2 1 0;
  min-height: 8px;
}

.home-body::after {
  flex: 1 1 0;
  min-height: 0;
}

.logo-wordmark-img {
  width: min(84vw, 320px);
  max-height: clamp(112px, 28dvh, 224px);
  height: auto;
  object-fit: contain;
}

/* The mockup sets the tagline in the display face, dark and bold — it reads as
   part of the lockup, not as secondary copy. */
.tagline {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 4.4vw, 1.25rem);
  color: var(--ink-tagline);
  font-weight: 700;
  line-height: 1.28;
  max-width: 18rem;
  min-height: 2.56em;
  margin: clamp(12px, 4.2vh, 38px) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero {
  width: min(80vw, 310px);
  margin: clamp(4px, 1.2vh, 12px) 0 0;
  display: flex;
  justify-content: center;
}

.hero-bible-img {
  width: 100%;
  max-height: clamp(64px, 15dvh, 120px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(44, 35, 32, 0.12));
}

/* Actions & Buttons */
.home-actions {
  width: 88%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.8vh, 22px);
  margin-top: clamp(20px, 3.5vh, 32px);
  margin-bottom: clamp(20px, 3.5vh, 32px);
  flex-shrink: 0;
}

.screen-home .btn-stacked {
  padding: clamp(11px, 1.8vh, 15px) 20px;
  min-height: 56px;
  max-height: 62px;
  gap: clamp(14px, 5vw, 26px);
  justify-content: center;
}

.screen-home .btn-stacked strong {
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.screen-home .btn-stacked small {
  font-size: clamp(0.8rem, 3.2vw, 0.92rem);
  margin-top: 1px;
}

.screen-home .btn-stacked .icon {
  flex-shrink: 0;
}

.btn {
  border: none;
  border-radius: var(--r-pill);
  padding: 16px 24px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  user-select: none;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: none !important;
}

.btn:disabled {
  background: #c9c6c2;
  color: #f7f6f4;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  opacity: 1;
}

.btn-coral {
  background: var(--grad-coral-btn);
  color: #ffffff;
  box-shadow: var(--shadow-coral);
}

.btn-gold {
  background: var(--grad-gold-btn);
  color: #3b2a12;
  box-shadow: var(--shadow-gold);
}

/* The mockup sets both mode pills in white, gold included, with a soft shadow
   carrying the contrast rather than a darker ink. */
.screen-home .btn-gold {
  color: #ffffff;
}

.screen-home .btn-stacked strong,
.screen-home .btn-stacked small {
  text-shadow: 0 1px 2px rgba(96, 62, 20, 0.28);
}

.btn-outline {
  background: var(--card);
  color: var(--coral);
  border: 2px solid var(--coral-tint);
  box-shadow: var(--shadow-card);
}

.btn-stacked {
  padding: 14px 22px;
  justify-content: flex-start;
  text-align: left;
}

.btn-stacked span {
  display: flex;
  flex-direction: column;
}

.btn-stacked strong {
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.btn-stacked small {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}

.btn-block {
  width: 100%;
}

/* Group Setup Screen */
.screen-setup #btnStart {
  margin-bottom: 4px;
}

.screen-game .reveal-zone {
  padding-bottom: 8px;
}

.sheet-body {
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-title {
  font-family: var(--font-display);
  color: var(--coral);
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 8px;
}

.avatar-grid {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: 82px;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin-inline: -20px;
  padding: 2px 20px 10px;
}

.avatar-grid::-webkit-scrollbar {
  display: none;
}

.avatar-tile {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--r-tile);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, border-color 0.15s ease;
  scroll-snap-align: start;
}

.avatar-tile:active {
  transform: scale(0.95);
}

.avatar-tile.is-selected {
  border-color: var(--coral);
  background: var(--coral-tint);
}

.avatar-tile span {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.avatar-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-sm {
  width: 44px;
  height: 44px;
}

.avatar-lg {
  width: 72px;
  height: 72px;
}

.avatar-add {
  border: 2px dashed var(--coral-soft);
  background: transparent;

}

.add-slot {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
}

/* Game Master Card */
.gm-card {
  background: var(--gold-tint);
  border-radius: var(--r-card);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(237, 202, 115, 0.5);
  flex: 0 0 auto;
  overflow: visible;
}

.gm-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.gm-meta strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--ink);
}

.gm-meta small {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-chip {
  background: var(--card);
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.btn-chip:active {
  transform: scale(0.95);
}

/* Settings List */
.settings-list {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: visible;
}

.setting-row {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

.setup-select {
  border-bottom: 1px solid var(--hairline);
}

.setup-select:last-child {
  border-bottom: none;
}

.setup-select > summary {
  list-style: none;
  border-bottom: none;
}

.setup-select > summary::-webkit-details-marker {
  display: none;
}

.setup-select[open] > summary {
  background: var(--paper);
}

.setup-select[open] > summary .icon:last-child {
  transform: rotate(90deg);
}

.setup-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 14px 14px 48px;
}

.setup-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.setup-option input {
  accent-color: var(--coral);
  flex: 0 0 auto;
}

.setup-option:has(input:checked) {
  background: var(--coral-tint);
  color: var(--coral-deep);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row:active {
  background: var(--paper);
}

.setting-label {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}

.setting-value {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--coral);
  font-size: 0.95rem;
}

.setup-hint {
  font-size: 0.85rem;
  color: var(--coral);
  text-align: center;
  font-weight: 600;
}

.resume-banner {
  width: 100%;
  margin-bottom: 12px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--r-card);
  background: var(--gold-tint);
  color: var(--coral-deep);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.resume-banner:active {
  transform: scale(0.98);
}

/* Game Screen */
.screen-game {
  padding: 0;
  position: relative;
}

.play-wash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 190px;
  background: var(--grad-header);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Lift the play content above the header wash. Named children only: a blanket
   `> *:not(.play-wash)` rule outranks .pause-overlay's own `position: absolute`
   on specificity alone (0,2,0 beats 0,1,0), which dropped the pause sheet into
   normal flow below the tab bar instead of covering the screen. */
.screen-game > .game-scroll,
.screen-game > .bottom-nav {
  position: relative;
  z-index: 1;
}

.game-header {
  background: var(--grad-header);
  padding: max(14px, env(safe-area-inset-top, 0px)) 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
  position: relative;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  box-shadow: 0 6px 16px rgba(248, 109, 86, 0.2);
}

.gh-player {
  display: flex;
  flex-direction: column;
}

.gh-player small {
  text-transform: uppercase;
  font-size: var(--text-caption);
  letter-spacing: 0.5px;
  color: #ffffff;
  opacity: 0.9;
  font-weight: 700;
}

.gh-player strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #ffffff;
}

.gh-mascot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: max(18px, env(safe-area-inset-top, 0px));
  background: #ffffff;
  padding: 4px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  z-index: 3;
}

.gh-mascot .avatar-img {
  width: 60px;
  height: 60px;
}

.gh-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.05;
  text-align: right;
  color: #ffffff;
  opacity: 0.95;
}

.score-block {
  text-align: center;
  margin-top: -12px;
  z-index: 2;
}

.score-block small {
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: var(--text-caption);
  color: var(--ink-soft);
  letter-spacing: 1px;
  font-weight: 700;
}

.score-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--coral);
  line-height: 1;
}

.round-label {
  font-family: var(--font-display);
  font-size: var(--text-round);
  color: var(--coral);
  font-weight: 700;
  margin-top: 2px;
}

/* Timer */
.timer-wrap {
  margin: 10px 20px 0;
  background: transparent;
  border-radius: 0;
  height: auto;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.timer-track {
  flex: 1;
  max-width: 220px;
  height: 6px;
  background: #eae2d7;
  border-radius: var(--r-pill);
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--coral);
  border-radius: var(--r-pill);
  transition: width 0.3s linear, background-color 0.3s ease;
}

.timer-bar.is-low {
  background: var(--incorrect);
}

.timer-text {
  font-size: var(--text-timer);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  position: static;
  min-width: 3ch;
  text-align: right;
}

/* Question deck — stacked cards */
.question-deck {
  margin: 20px 24px 0;
  position: relative;
  perspective: 1000px;
  isolation: isolate;
}

.question-deck::before,
.question-deck::after {
  content: "";
  position: absolute;
  border-radius: var(--r-card);
  border: 2px solid rgba(248, 109, 86, 0.38);
  pointer-events: none;
  inset: 2px;
  box-shadow: var(--shadow-card);
}

.question-deck::before {
  background: #ffe6dd;
  transform: rotate(-2.8deg) translate(-3px, 5px);
  z-index: 0;
}

.question-deck::after {
  background: #fff2cd;
  transform: rotate(2.5deg) translate(3px, 5px);
  z-index: 1;
}

.q-flip {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 280px;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.q-flip.is-flipped {
  transform: rotateY(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .q-flip {
    transition: none;
  }

  .q-face {
    transition: none;
  }
}

.q-face {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 24px 22px;
  box-shadow: var(--shadow-card);
  border: 3px solid var(--coral);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Swap at the midpoint of the 0.4s flip so the incoming face is never blank. */
  transition: visibility 0s linear 0.2s;
}

/* WebKit flattens a preserve-3d child that owns a scroll context, which
   silently disables backface-visibility: the mirrored answer painted on top of
   the question, so the player saw the answer backwards and never the question.
   Keep the faces scroll-free (.game-scroll handles long answers) and drive
   visibility explicitly rather than trusting the backface alone. */
.q-flip:not(.is-flipped) .q-face-back,
.q-flip.is-flipped .q-face-front {
  visibility: hidden;
}

.q-face-front {
  position: relative;
}

.q-face-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background: var(--gold-tint);
  border-color: rgba(237, 202, 115, 0.8);
  justify-content: flex-start;
}

.answer-question {
  width: 100%;
  margin: 0;
  text-align: left;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.35;
  font-weight: 600;
}

.answer-divider {
  width: 100%;
  height: 1px;
  flex: 0 0 1px;
  background: rgba(186, 134, 47, 0.26);
}

.q-meta {
  font-family: var(--font-display);
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.q-text {
  font-family: var(--font-display);
  font-size: var(--text-body);
  line-height: 1.35;
  color: var(--ink);
  font-weight: 600;
}

.q-face-back .q-text {
  text-align: left;
  width: 100%;
}

.answer-line {
  margin-bottom: 4px;
}

.answer-explain {
  color: var(--ink-soft);
  font-weight: 600;
}

.answer-ref {
  color: var(--gold-deep);
  font-weight: 700;
  margin-top: 4px;
}

.category-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin-top: 4px;
}

/* Reveal Zone */
.reveal-zone {
  padding: 12px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.read-aloud {
  font-size: var(--text-caption);
  color: var(--ink-soft);
  font-weight: 600;
}

.judge-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-judge {
  flex: 1;
  padding: 14px;
}

.judge-badge {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Results Screen */
.screen-results {
  text-align: center;
}

.screen-results .results-body {
  padding: 24px 20px;
}

.results-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--coral);
  margin-bottom: 4px;
}

.results-sub {
  font-size: 1rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 24px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-col.place-1 { order: 2; width: 100px; }
.podium-col.place-2 { order: 1; width: 84px; }
.podium-col.place-3 { order: 3; width: 84px; }

.podium-crown {
  color: var(--gold-deep);
  margin-bottom: -6px;
  z-index: 2;
}

.podium-score {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--coral);
  margin: 4px 0;
}

.podium-block {
  width: 100%;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  box-shadow: var(--shadow-card);
}

.place-1 .podium-block { height: 90px; background: var(--grad-gold-btn); color: #3b2a12; }
.place-2 .podium-block { height: 68px; background: #c5ced8; color: #3a4550; }
.place-3 .podium-block { height: 52px; background: #e2a173; color: #401f0a; }

.rank-list {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 8px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
  list-style: none;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.rank-row:last-child { border-bottom: none; }

.rank-n {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-soft);
  width: 20px;
}

.rank-name {
  flex: 1;
  text-align: left;
  font-weight: 600;
}

.rank-score {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--coral);
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bottom Nav */
.bottom-nav {
  position: relative;
  flex: 0 0 auto;
  height: calc(68px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-left: 8px;
  padding-right: 8px;
  z-index: 20;
}

.nav-tab {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  color: var(--ink-mute);
  font-size: var(--text-nav);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 12px;
  transition: color 0.15s ease;
}

.nav-tab.is-active {
  color: var(--coral);
}

.nav-tab svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Toggle Switch */
.toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  background: var(--ink-mute);
  border-radius: var(--r-pill);
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch:checked {
  background: var(--coral);
}

.toggle-switch:checked::after {
  transform: translateX(20px);
}

/* Tab screens (settings, help, leaderboard) */
.screen-tab {
  min-height: 0;
}

.tab-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 1.6rem);
  font-weight: 700;
  color: var(--ink);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 12px;
  background: rgba(253, 248, 242, 0.85);
  margin: 0;
}

.tab-body {
  padding: 0 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-page {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-bottom: 8px;
}

.settings-page .step-title {
  margin-top: 0;
}

.settings-language-wrap {
  overflow: visible;
}

.settings-language-wrap.is-open .settings-item-chevron,
.settings-language-wrap.is-open .setting-value {
  color: var(--coral);
}

.settings-language-dropdown {
  border-top: 1px solid var(--hairline);
}

.settings-language-dropdown[hidden] {
  display: none !important;
}

.language-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.language-option {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hairline);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}

.language-option:last-child {
  border-bottom: none;
}

.language-option.is-selected {
  color: var(--coral);
}

.language-option-check {
  color: var(--coral);
  font-weight: 700;
}

a.setting-row {
  text-decoration: none;
  color: inherit;
}

/* Pause overlay */
.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(44, 35, 32, 0.55);
  backdrop-filter: blur(4px);
}

.pause-sheet {
  width: min(100%, 320px);
  background: var(--card);
  border-radius: 24px;
  padding: 28px 22px;
  box-shadow: 0 16px 40px rgba(44, 35, 32, 0.2);
  text-align: center;
}

.pause-sheet h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--coral);
  margin-bottom: 20px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Helper / settings screens — legacy sheet kept for setup */
.screen-simple .sheet-body {
  padding-bottom: 20px;
}

.settings-page .settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

.help-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.help-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.help-list strong {
  font-family: var(--font-display);
  color: var(--coral);
  font-size: 1.05rem;
}

.empty-note {
  color: var(--ink-soft);
  text-align: center;
  padding: 40px 0;
}

/* Auth gate (Google OAuth) */
body.auth-active {
  overflow: hidden;
}

body.auth-active #app {
  visibility: hidden;
  pointer-events: none;
}

.overlay-auth {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(44, 35, 32, 0.72);
  backdrop-filter: blur(6px);
}

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

.auth-card {
  width: min(92%, 360px);
  text-align: center;
  padding: 28px 22px;
  background: var(--card);
  border: 2px solid var(--hairline);
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(44, 35, 32, 0.22);
  color: var(--ink);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--coral);
  margin: 0 0 12px;
}

.auth-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.4;
}

.auth-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.auth-hint {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink-mute);
  margin: 0 0 14px;
}

.btn-google {
  appearance: none;
  background: #ffffff;
  border: 2px solid var(--hairline);
  border-radius: var(--r-pill);
  color: #202124;
  box-shadow: var(--shadow-card);
  min-height: 48px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-google:active {
  transform: scale(0.98);
}

.btn-secondary {
  appearance: none;
  border: 2px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
  margin-top: 8px;
}

.auth-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--hairline);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
  margin: 12px auto;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

.auth-badge-wait {
  display: inline-block;
  padding: 4px 12px;
  background: var(--gold-tint);
  color: var(--gold-deep);
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 12px;
}
