/* Phase 1 game screen — standalone page on theme.css tokens. */

body {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.card.game {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.ghost {
  background: transparent;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.game-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.game-head h1 { font-family: var(--font-arabic); font-size: 24px; margin: 0; }
.window-time { margin: 4px 0 0; font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scores div {
  background: var(--muted);
  border-radius: var(--radius);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.scores span { font-size: 22px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.scores small { font-size: 11px; color: var(--muted-foreground); }

.notice {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--accent);
  font-size: 14px;
  line-height: 1.7;
}
.notice.reward { animation: reward-arrive 480ms ease-out both; }
/* Messages float as a toast at the bottom of the screen (tap to close). */
#notice {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  max-width: 440px;
  margin-inline: auto;
  border: 1px solid var(--next-item-border, var(--border));
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  animation: toast-in 220ms ease-out both;
}
#notice.reward { animation: toast-in 220ms ease-out both, reward-arrive 480ms ease-out both; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #notice, #notice.reward { animation: none; }
}
/* Signed out: a calm warning above the tasks. */
.guest-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(238, 188, 74, 0.45);
  background: rgba(238, 188, 74, 0.1);
  font-size: 13.5px;
  line-height: 1.6;
}
.guest-note .link { padding: 0; font-weight: 700; }
/* "Try again" after a failed load. */
.retry { margin-inline-start: 6px; font-weight: 700; }
/* Loading placeholders (lists, profile line, year view). */
.skeleton, .skeleton-line, .skeleton-block {
  display: block;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.11) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skeleton { height: 44px; list-style: none; }
.skeleton-line { width: 45%; height: 1.2em; }
.skeleton-block { height: 120px; margin-bottom: 10px; }
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton, .skeleton-line, .skeleton-block { animation: none; }
}
@keyframes reward-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tasks button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--secondary);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: start;
}
.tasks button.locked { opacity: 0.7; }
.done-count { margin: 0 0 8px; font-size: 13px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.tasks .name { font-family: var(--font-arabic); font-size: 18px; }
.tasks .meta { display: block; font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
/* Task names / headings use the Arabic face only for Arabic-script UIs; the
   recitation text (lang="ar") keeps it in every language. */
html:not([lang="ar"]):not([lang="ur"]) .tasks .name,
html:not([lang="ar"]):not([lang="ur"]) .game-head h1,
html:not([lang="ar"]):not([lang="ur"]) .reader h2 { font-family: inherit; }
html:not([lang="ar"]):not([lang="ur"]) .tasks .name { font-size: 16px; font-weight: 600; }
.tasks .pts { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); white-space: nowrap; }
.tasks .done { border-color: var(--primary); }
.tasks .done .pts { color: var(--primary); }

.gift {
  background: linear-gradient(135deg, var(--gold), var(--primary));
  color: var(--primary-foreground);
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 18px;
  font-weight: 700;
  width: 100%;
  margin-top: 8px;
}

.reader { display: flex; flex-direction: column; gap: 10px; }
.reader-head { display: flex; justify-content: space-between; align-items: center; }
.reader-points { font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.reader h2 { font-family: var(--font-arabic); font-size: 20px; margin: 0; }
.source { font-size: 12px; color: var(--muted-foreground); margin: 0; }
.notice.mode { font-size: 13px; }
.hint { font-size: 12px; color: var(--muted-foreground); text-align: center; margin: 0; }

/* Part N of M + text size; --reader-scale is set from the A−/A+ buttons. */
.reader { --reader-scale: 1; }
.reader-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 30px; }
.seg-label { font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.size-ctl { display: inline-flex; gap: 4px; } /* dir="ltr": "A−" / "A+" keep their sign order */
.size-ctl button { padding: 3px 9px; font-size: 13px; line-height: 1.2; min-width: 36px; }
.size-ctl button:disabled, .chunk-nav button:disabled { opacity: 0.35; }
.chunk-nav { display: flex; justify-content: space-between; gap: 8px; }
.chunk-nav button { flex: 1; font-size: 20px; padding: 4px; }
.text { position: relative; } /* offsetParent for keeping the current part in view */

.chunk {
  font-family: var(--font-arabic);
  font-size: calc(32px * var(--reader-scale));
  line-height: 1.9;
  text-align: center;
  margin: 0;
  min-height: 1.9em;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--muted);
}
.text {
  font-family: var(--font-arabic);
  font-size: calc(17px * var(--reader-scale));
  line-height: 2;
  margin: 0;
  color: var(--muted-foreground);
}
.w { transition: color 0.2s; }
.w.hit { color: var(--primary); }
.text .w.cur { color: var(--foreground); text-decoration: underline; text-underline-offset: 6px; }

.progress { height: 6px; border-radius: 3px; background: var(--progress-track-bg); overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--progress-fill); transition: width 0.25s; }
.counter {
  direction: ltr;
  unicode-bidi: isolate;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.mic {
  align-self: center;
  min-width: 200px;
  background: var(--primary);
  color: var(--primary-foreground);
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 700;
}
.mic.on { background: var(--destructive); color: #fff; }
.mic-dock { display: flex; justify-content: center; }
.heard { font-size: 13px; color: var(--muted-foreground); min-height: 1.6em; margin: 0; line-height: 1.7; }

.privacy { font-size: 11px; color: var(--muted-foreground); text-align: center; margin: 0; }

/* ---- tabs + social ---- */
.tabs, .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.tabs button, .seg button {
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] {
  color: var(--foreground);
  border-color: var(--primary);
}
.primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border: 0;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-weight: 700;
}
input[type="search"], #username, #search, #auth input {
  box-sizing: border-box; /* width 100% includes the padding: no overflow past the card */
  width: 100%;
  font: inherit;
  background: var(--input);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin: 6px 0;
}
.muted { color: var(--muted-foreground); font-size: 13px; margin: 0; }
.board, .people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board li.msg, .people li.msg, .row-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 10px 12px;
}
/* Rows are real buttons (keyboard + screen reader), styled like the old rows. */
.row-btn {
  width: 100%;
  color: var(--foreground);
  border: 1px solid transparent;
  text-align: start;
}
.row-btn:focus-visible, .tasks button:focus-visible, .tabs button:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.board .rank { width: 2em; font-weight: 700; color: var(--gold); text-align: center; }
.board .name, .people .name { flex: 1; }
/* Play Integrity pass (Android app on a genuine device), see checkIntegrity(). */
.board .verified { color: var(--accent, #1f8f5f); font-weight: 700; font-size: 0.85em; }
.board .p { font-weight: 700; font-variant-numeric: tabular-nums; }
.board li.me .row-btn { border-color: var(--primary); }
/* Period tabs + the latest winners (points never reset; each period crowns its top player). */
.seg.periods { margin-top: 6px; }
.seg.periods button { font-size: 12px; padding-inline: 2px; }
/* Each period's winners sit in a gold-edged card; the first winner's row is
   the largest (name and points in gold). Only theme tokens + gold tints. */
.winners { display: grid; gap: 10px; margin: 12px 0 10px; }
.winners-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(238, 188, 74, 0.55);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(238, 188, 74, 0.16), rgba(238, 188, 74, 0.04) 70%);
  box-shadow: 0 6px 22px -14px rgba(238, 188, 74, 0.6);
}
.winners-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--gold); line-height: 1.5; overflow-wrap: anywhere; }
.winners .row-btn { border-color: rgba(238, 188, 74, 0.35); background: var(--secondary); }
.winners .name { min-width: 0; overflow-wrap: break-word; }
/* On a narrow screen the points pill wraps under a long name instead of
   splitting the name (Arabic letters must stay joined). */
.winners li.top .row-btn { padding: 12px; border-color: var(--gold); flex-wrap: wrap; row-gap: 6px; }
.winners li.top .rank { font-size: 26px; line-height: 1; width: 1.4em; }
.winners li.top .name { flex: 1 1 auto; min-width: auto; font-size: 17px; font-weight: 700; color: var(--gold); }
.winners li.top .p {
  flex-shrink: 0;
  margin-inline-start: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 15px;
  color: #2a1d00;
  background: var(--gold);
}

/* The verse above the leaderboard: quiet, centered, translation (if any) first.
   Amiri in every theme (bundled), so the ornate brackets ﴿ ﴾ always render. */
.board-verse { margin: 0 0 12px; padding: 4px 8px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.board-verse p { margin: 0; }
.board-verse-tr { font-size: 13px; line-height: 1.6; color: var(--muted-foreground); }
.board-verse-tr:empty { display: none; }
.board-verse-ar { font-family: "Amiri", var(--font-arabic); font-size: 19px; line-height: 1.9; color: var(--foreground); }
.board-verse-ref { font-size: 11.5px; color: var(--muted-foreground); }
.wins { margin: 4px 0 0; font-size: 14px; color: var(--gold); white-space: pre-line; }
.me-line { font-size: 14px; margin: 0; }
.row { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.6; }
#me-view h3 { font-size: 15px; margin: 14px 0 4px; }
.who { margin: 0; }
.note { font-size: 13px; color: var(--muted-foreground); margin: 0 0 8px; }
.danger {
  background: transparent;
  color: var(--destructive);
  border: 1px solid var(--destructive);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-weight: 700;
}

/* ---- sign-in ---- */
.auth { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.auth form, #auth-main { display: flex; flex-direction: column; gap: 6px; }
.google-btn {
  background: #fff;
  color: #1f1f1f;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px;
  font-weight: 700;
}
/* Sign in with Apple: Apple's "white" style for dark backgrounds — white button,
   black logo and title in the system font, same size as the Google button. */
.apple-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: #000;
  border: 1px solid #fff;
  border-radius: var(--radius);
  padding: 11px 16px;
  font: 600 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.apple-btn[hidden] { display: none; }
.apple-logo { width: 17px; height: 17px; flex: none; }
/* Sign-in methods (My account): one row per method, its state and the action. */
.methods .method { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.methods .method .name { flex: 1; }
.methods .method .state { color: var(--muted-foreground); font-size: 13px; }
.methods .method.on .state { color: var(--primary); }
.methods .method button { font-size: 13px; padding: 5px 10px; }
.or { text-align: center; font-size: 12px; color: var(--muted-foreground); margin: 6px 0 2px; }
.link {
  background: none;
  border: 0;
  color: var(--primary);
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  align-self: flex-start;
}
.ghost.wide { width: 100%; margin-top: 14px; padding: 10px; }

/* ---- family ---- */
.count-badge {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #1b1405;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}
#family-view h2 { margin: 10px 0 4px; }
#family-view h3 { font-size: 15px; margin: 16px 0 6px; }
.family-card { background: var(--secondary); border: 1px solid var(--gold); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; }
.family-card p { margin: 0 0 8px; }
.family-actions { display: flex; gap: 8px; }
.family-actions button { flex: 1; padding: 8px; }
.family-member { display: flex; flex-direction: column; gap: 2px; }
.family-member .row-btn.static { cursor: default; box-sizing: border-box; }
.family-who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.family-today { font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }
.family-role { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); white-space: nowrap; }
.family-role.parent { color: #04211c; background: var(--teal, var(--primary)); }
.danger-link { color: var(--destructive); align-self: flex-end; font-size: 13px; padding: 2px 4px; }
.family-form { display: flex; flex-direction: column; gap: 6px; }
.family-form input { font: inherit; color: var(--foreground); background: var(--input); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 10px; }
.family-notify button { font-size: 13px; }
.primary.wide { width: 100%; padding: 10px; margin-top: 6px; }
.wide-danger { width: 100%; margin-top: 18px; }
.family-year-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0; }
.family-year-nav button { padding: 4px 14px; font-size: 18px; }
.family-year-nav button:disabled { opacity: 0.35; }
.family-summary { text-align: center; font-weight: 700; margin: 4px 0 8px; }
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 10px; }
.cal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 4px; font-size: 13px; }
.cal-head .muted { font-size: 11.5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-cell { aspect-ratio: 1; border-radius: 3px; background: rgba(255, 255, 255, 0.07); }
.cal-cell.blank { background: transparent; }
.cal-cell.active.w0 { background: rgba(200, 148, 45, 0.25); }
.cal-cell.w1 { background: color-mix(in srgb, var(--primary) 25%, transparent); }
.cal-cell.w2 { background: color-mix(in srgb, var(--primary) 42%, transparent); }
.cal-cell.w3 { background: color-mix(in srgb, var(--primary) 60%, transparent); }
.cal-cell.w4 { background: color-mix(in srgb, var(--primary) 80%, transparent); }
.cal-cell.w5 { background: var(--primary); }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 10px; font-size: 12px; }
.cal-key { display: inline-flex; align-items: center; gap: 4px; }
.cal-key .cal-cell { width: 12px; height: 12px; }

/* ---- the day's journey ---- */
.journey { background: var(--muted); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.journey-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.journey h2 { font-size: 15px; margin: 0; }
.journey-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-foreground); }
.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.step.some .step-dot { border-color: var(--primary); background: linear-gradient(to top, var(--primary) 45%, transparent 45%); }
.step.now .step-dot { border-color: var(--gold); }
.step.now .step-name { color: var(--foreground); font-weight: 700; }
.journey-all { margin: 10px 0 0; font-size: 13px; color: var(--primary); text-align: center; }
.calendar { margin-top: 10px; font-size: 13px; }
.calendar summary, .rule summary { cursor: pointer; color: var(--muted-foreground); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal-head { text-align: center; font-size: 10px; color: var(--muted-foreground); }
.cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}
.cal-day.some { background: color-mix(in srgb, var(--primary) 25%, transparent); color: var(--foreground); }
.cal-day.full { background: var(--primary); color: var(--primary-foreground); font-weight: 700; }
.cal-day.today { outline: 1px solid var(--gold); }
.cal-legend { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 11px; color: var(--muted-foreground); }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.full { background: var(--primary); }
.dot.some { background: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ---- points rule, continue, groups ---- */
.rule { font-size: 13px; line-height: 1.8; margin-bottom: 10px; }
.rule p { margin: 6px 0 0; }
.rule-now { color: var(--gold); font-variant-numeric: tabular-nums; }
.resume {
  width: 100%;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--foreground);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-weight: 700;
  text-align: start;
  margin-bottom: 8px;
}
.group-title { font-size: 13px; color: var(--muted-foreground); margin: 12px 0 6px; font-weight: 600; }

/* ---- side task: the morning / evening adhkar, a bonus set beside the prayer's tasks ---- */
.side-card {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--gold);
  border-radius: var(--radius);
  background: var(--muted);
}
.side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.side-head h2 { font-family: var(--font-arabic); font-size: 18px; margin: 0; }
html:not([lang="ar"]):not([lang="ur"]) .side-head h2 { font-family: inherit; font-size: 16px; }
.side-head .muted { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.side-time { margin: 4px 0 10px; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.side-card.all-done { border-inline-start-color: var(--primary); }
/* Optional disputed adhkar: muted edge, and each item's grading note under its source. */
.disputed-card { border-inline-start-color: var(--muted-foreground); }
.disputed-card .tasks .pts { color: var(--muted-foreground); font-weight: 600; font-size: 12px; }
.tasks .grading { display: block; font-size: 11px; color: var(--muted-foreground); margin-top: 3px; line-height: 1.6; }

/* ---- celebration: short and calm; no motion when the system asks for less ---- */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--background) 60%, transparent);
}
.celebrate-card {
  max-width: 340px;
  width: 100%;
  text-align: center;
  background: var(--card, var(--secondary));
  border: 1px solid var(--primary);
  border-radius: calc(var(--radius) * 2);
  padding: 22px 18px;
  box-shadow: 0 0 40px color-mix(in srgb, var(--primary) 35%, transparent);
  animation: celebrate-in 420ms ease-out both;
}
.celebrate-mark { font-size: 30px; color: var(--gold); animation: celebrate-glow 1.6s ease-in-out 2; }
.celebrate h2 { font-size: 19px; margin: 8px 0; }
.celebrate p { margin: 0 0 16px; line-height: 1.8; color: var(--muted-foreground); }
@keyframes celebrate-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes celebrate-glow {
  50% { opacity: 0.55; }
}

/* ---- profile: real stats + achievements ---- */
#profile-view { display: flex; flex-direction: column; gap: 10px; }
#profile-view h3 { font-size: 14px; margin: 6px 0; color: var(--muted-foreground); }
.profile-head h2 { margin: 0; font-size: 20px; }
.profile-head p { margin: 2px 0 0; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 0; }
.stats div { background: var(--muted); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.stats dd {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.stats dt { font-size: 11px; color: var(--muted-foreground); line-height: 1.4; }
.achievements { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.achievements li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--muted);
}
.achievements li.earned { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.achievements li.locked { opacity: 0.55; }
.achievements b { display: block; font-size: 14px; }
.achievements small { font-size: 11px; color: var(--muted-foreground); }
.ach-mark { width: 1.4em; text-align: center; color: var(--gold); font-size: 18px; }

/* Compact phone layout: keep the active mission and progress above the fold. */
@media (max-width: 600px) {
  body {
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }
  .card.game {
    max-width: none;
    padding: 12px;
    gap: 10px;
    border-radius: 16px;
  }
  .game-head { align-items: center; }
  .game-head h1 { font-size: 20px; line-height: 1.25; }
  .window-time { margin-top: 2px; font-size: 11px; }
  .game-head .ghost { padding: 5px 8px; font-size: 13px; }
  .tabs { gap: 4px; }
  .tabs button { padding: 7px 4px; font-size: 12px; }
  .scores { gap: 5px; }
  .scores div { padding: 6px 4px; border-radius: 10px; }
  .scores span { font-size: 18px; line-height: 1.15; }
  .scores small { font-size: 10px; }
  .notice { padding: 8px 10px; font-size: 13px; }
  .journey {
    padding: 9px;
    margin-bottom: 4px;
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  }
  .journey h2 { font-size: 14px; }
  .journey-steps { margin-top: 7px; }
  .step { gap: 3px; font-size: 10px; }
  .step-dot { width: 23px; height: 23px; font-size: 11px; }
  .rule { font-size: 12px; line-height: 1.6; margin-bottom: 5px; }
  .group-title { margin: 8px 0 4px; font-size: 12px; }
  .done-count { margin-bottom: 5px; font-size: 12px; }
  .tasks { gap: 6px; }
  .tasks button { padding: 9px 10px; gap: 8px; }
  .tasks .name { font-size: 16px; line-height: 1.45; }
  .tasks .meta { font-size: 11px; }
  .tasks .pts { font-size: 14px; }
  .gift { margin-top: 4px; padding: 11px; font-size: 16px; }
  .reader-active .tabs,
  .reader-active .scores { display: none; }
  .reader-active .card.game { gap: 8px; }
  .reader { gap: 8px; }
  .reader h2 { font-size: 18px; line-height: 1.45; }
  .reader-points { font-size: 14px; }
  .source, .hint, .heard, .privacy { color: color-mix(in srgb, var(--foreground) 68%, var(--muted-foreground)); }
  .source { font-size: 11px; }
  .hint { font-size: 11px; }
  .chunk {
    padding: 10px;
    min-height: 1.65em;
    font-size: calc(26px * var(--reader-scale));
    line-height: 1.65;
    background: color-mix(in srgb, var(--primary) 13%, var(--muted));
    border: 1px solid color-mix(in srgb, var(--primary) 55%, var(--border));
  }
  .text {
    max-height: 27dvh;
    overflow-y: auto;
    padding: 9px 10px;
    border-radius: var(--radius);
    background: var(--muted);
    color: color-mix(in srgb, var(--foreground) 72%, var(--muted-foreground));
    font-size: calc(15px * var(--reader-scale));
    line-height: 1.85;
  }
  .progress {
    height: 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
    border-radius: 6px;
  }
  .counter { font-size: 16px; }
  .mic { width: 100%; min-width: 0; min-height: 48px; padding: 11px 16px; font-size: 16px; }
  /* The mic stays under the thumb however long the text above it is. */
  .mic-dock {
    position: sticky;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 2;
    padding-top: 6px;
    background: linear-gradient(to top, var(--card) 70%, transparent);
  }
  .stats dd { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate-card, .celebrate-mark, .notice.reward { animation: none; }
  .progress .fill, .w { transition: none; }
}

/* "Admin" (admins only) is a link styled like the wide ghost buttons. */
a.admin-link { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
#verify { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
