/* ଶବ୍ଦ ସଂଯୋଗ — a painted Pattachitra frame around a quiet playing board.
   Every shape carries a bold ink outline and a hard offset shadow, like a
   wood-block print. Pigments: haritala (yellow), hingula (red), indigo, leaf. */
:root {
  color-scheme: light;
  --stone: #e8e3d3;       /* page: Konark stone, cool side */
  --stone-deep: #d9d2bd;  /* a shade darker for pressed states */
  --conch: #fffaf0;       /* tile face */
  --ink: #1a1410;
  --ink-soft: #2a211a;    /* banner fill */
  --muted: #655a4d;
  --line: #c9bfa8;
  --haritala: #e4ad2f;
  --patra: #7d9c44;
  --neela: #2b4a84;
  --sindoor: #b7281b;
  --on-haritala: #1a1410;
  --on-patra: #11190a;
  --on-neela: #fffaf0;
  --on-sindoor: #fffaf0;
  --banner-ink: #fff6e4;  /* text on the banner */
  --banner-edge: #1a1410;
  --shadow: var(--ink);
  --flame: #ffbe3d;
  --flame-core: #fff3c4;
  --title: "Noto Serif Oriya", "Noto Serif Devanagari", "Noto Sans Oriya", serif;
  --body: "Anek Odia", "Anek Devanagari", "Noto Sans Oriya", "Noto Sans Odia", system-ui, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --hard: 3px 3px 0 var(--shadow);
  --hard-sm: 2px 2px 0 var(--shadow);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --stone: #15110d;
  --stone-deep: #0e0b08;
  --conch: #261e16;
  --ink: #f3e9d8;
  --ink-soft: #1d1711;
  --muted: #b5a592;
  --line: #4a3c30;
  --haritala: #e9b43a;
  --patra: #8fb155;
  --neela: #7694d6;
  --sindoor: #e0513f;
  --on-haritala: #1a1410;
  --on-patra: #11190a;
  --on-neela: #0e1222;
  --on-sindoor: #fff6ee;
  --banner-ink: #f3e9d8;
  --banner-edge: #e9b43a;
  --shadow: #000;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --stone: #15110d;
    --stone-deep: #0e0b08;
    --conch: #261e16;
    --ink: #f3e9d8;
    --ink-soft: #1d1711;
    --muted: #b5a592;
    --line: #4a3c30;
    --haritala: #e9b43a;
    --patra: #8fb155;
    --neela: #7694d6;
    --sindoor: #e0513f;
    --on-haritala: #1a1410;
    --on-patra: #11190a;
    --on-neela: #0e1222;
    --on-sindoor: #fff6ee;
    --banner-ink: #f3e9d8;
    --banner-edge: #e9b43a;
    --shadow: #000;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background-color: var(--stone);
  /* a faint woven texture, like handmade paper, that never fights the type */
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.018) 0 1px, transparent 1px 3px);
}

button { border: 0; color: inherit; font: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--neela);
  outline-offset: 3px;
}

.shell {
  width: min(600px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 12px 0 48px;
}

/* ---------- Painted frame: language row, banner, tabs ---------- */
.lang-switch { display: flex; justify-content: flex-end; gap: 2px; margin: 0 4px 10px; font-size: 0.85rem; }
.lang-option {
  display: inline-flex; align-items: center;
  min-height: 30px; padding: 0 10px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.lang-option[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--sindoor); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.lang-soon { margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--haritala); color: var(--on-haritala); font-size: 0.7rem; }

/* The banner is the one loud thing on the page. */
.topbar {
  position: relative;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 18px 16px;
  padding-top: 26px;
  color: var(--banner-ink);
  background: var(--ink-soft);
  border: 3px solid var(--banner-edge);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--sindoor);
  overflow: hidden;
}
/* painted border strip along the top of the frame: chevrons and dots */
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 10px;
  background:
    radial-gradient(circle at 5px 5px, #fffaf0 1.6px, transparent 2.1px) 0 0 / 10px 10px,
    linear-gradient(135deg, var(--sindoor) 25%, transparent 25%) -5px 0 / 10px 10px,
    linear-gradient(225deg, var(--sindoor) 25%, transparent 25%) -5px 0 / 10px 10px,
    var(--haritala);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img {
  width: 54px; height: 54px; flex: 0 0 auto;
  padding: 6px; border-radius: 12px;
  background: var(--conch);
  border: 2px solid var(--haritala);
}
h1, h2, p { margin-top: 0; }
h1 {
  margin: 0;
  font-family: var(--title);
  font-weight: 700;
  font-size: clamp(1.9rem, 7.5vw, 2.6rem);
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--banner-ink);
}
.tagline { margin: 2px 0 0; color: var(--haritala); font-size: 0.95rem; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }

.icon-button, .close-button {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--conch); color: #1a1410;
  border: 2px solid #1a1410;
  font-weight: 700; font-size: 1.1rem; cursor: pointer;
}
.close-button { background: var(--stone); color: var(--ink); border-color: var(--ink); }
.topbar .icon-button { background: var(--haritala); border-color: var(--haritala); color: #1a1410; }
.pill-button {
  min-height: 38px; padding: 0 14px;
  border-radius: 999px;
  border: 2px solid var(--banner-ink);
  background: transparent; color: var(--banner-ink); cursor: pointer; font-weight: 600;
}
.pill-button[aria-pressed="true"] { background: var(--banner-ink); color: #1a1410; }
.account-button {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0;
  border-radius: 50%;
  background: transparent; color: var(--banner-ink);
  border: 2px solid var(--banner-ink);
  font-weight: 700; cursor: pointer; overflow: hidden;
}
.account-button img { width: 100%; height: 100%; object-fit: cover; }
.account-button.is-signed-in { background: var(--patra); border-color: var(--patra); color: var(--on-patra); }
.account-button[hidden] { display: none; }

/* the old band under the banner is now the strip inside the frame */
.patta-band { height: 0; margin: 18px 0 0; border: 0; }

/* Game tabs: a brush-stroke underline marks the open game. Streak and points
   sit beside them like a running tally. */
.game-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 0; border: 0; border-radius: 0; }
.tab {
  position: relative;
  min-height: 40px; padding: 4px 2px; border-radius: 0;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 700;
  font-size: 1.02rem;
}
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px;
  height: 4px; border-radius: 2px 3px 2px 4px;
  background: var(--sindoor); opacity: 0;
  transform: scaleX(0.4); transform-origin: left;
  transition: transform 180ms ease, opacity 180ms ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { opacity: 1; transform: scaleX(1); }
.stats-bar { display: flex; gap: 6px; font-weight: 700; }
.stat {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 34px; padding: 0 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--conch);
  white-space: nowrap; font-size: 0.95rem;
}
.stat b { font-size: 1.1rem; }
.stat.is-bumped { animation: stat-bump 480ms cubic-bezier(.3,1.6,.5,1); }
@keyframes stat-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.14) rotate(-2deg); background: var(--haritala); }
  100% { transform: scale(1); }
}

/* ---------- Status line ---------- */
.status {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.status p { margin-bottom: 2px; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.status strong { display: block; font-size: clamp(1.05rem, 4.4vw, 1.25rem); font-weight: 700; line-height: 1.4; }
.difficulty-badge[hidden] { display: none; }

.mistakes { flex: 0 0 auto; text-align: right; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.dots { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
/* each remaining mistake is a lit diya flame */
.dot {
  position: relative;
  width: 12px; height: 16px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 72%, var(--flame-core) 0 28%, var(--flame) 60%, #e8711a 100%);
  box-shadow: 0 0 10px rgba(255, 170, 40, 0.65);
  transform-origin: 50% 100%;
  animation: flicker 1.8s ease-in-out infinite;
  transition: background 300ms ease, box-shadow 300ms ease;
}
.dot:nth-child(2) { animation-delay: -0.6s; }
.dot:nth-child(3) { animation-delay: -1.1s; }
.dot:nth-child(4) { animation-delay: -0.3s; }
.dot.is-out { background: var(--line); box-shadow: none; animation: none; transform: scaleY(0.75); }
.dot.is-relit { animation: relight 700ms ease-out, flicker 1.8s ease-in-out 700ms infinite; }
@keyframes flicker {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  30% { transform: scaleY(1.08) scaleX(0.94); }
  60% { transform: scaleY(0.95) scaleX(1.05); }
}
@keyframes relight {
  0% { transform: scale(0.2); box-shadow: 0 0 0 rgba(255, 170, 40, 0); }
  60% { transform: scale(1.5); box-shadow: 0 0 22px rgba(255, 170, 40, 0.9); }
  100% { transform: scale(1); }
}

/* ---------- Board ---------- */
.solved-groups { display: grid; gap: 10px; margin-bottom: 10px; }
.solved-card {
  position: relative;
  padding: 14px 12px 14px;
  border-radius: var(--radius);
  text-align: center;
  border: 2px solid var(--ink);
  box-shadow: var(--hard);
}
.solved-card.is-new { animation: stamp 360ms cubic-bezier(.2,1.4,.4,1); }
.solved-card header { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 4px; }
.solved-card strong { font-size: 1.15rem; font-weight: 700; }
.solved-card span { display: block; font-size: 1rem; font-weight: 600; }
.level-label {
  position: absolute; top: 6px; left: 10px;
  font-size: 0.72rem; font-weight: 700; opacity: 0.8;
}
.category-like {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: rgba(255, 250, 240, 0.7); color: #1a1410; cursor: pointer;
}
.category-like.is-liked { background: #1a1410; color: #fffaf0; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 2px; }
.tile {
  min-height: 76px;
  padding: 8px 4px;
  border-radius: var(--radius);
  background: var(--conch);
  border: 2px solid var(--ink);
  box-shadow: var(--hard);
  cursor: pointer;
  font-size: clamp(0.95rem, 3.6vw, 1.15rem);
  font-weight: 600;
  line-height: 1.3; /* room for vowel signs and conjuncts */
  overflow-wrap: anywhere;
  transition: transform 110ms ease, background 110ms ease, box-shadow 110ms ease;
}
/* hand-placed: each tile sits a hair off true */
.tile:nth-child(3n+1) { transform: rotate(-0.5deg); }
.tile:nth-child(3n+2) { transform: rotate(0.35deg); }
.tile:nth-child(5n) { transform: rotate(0.6deg); }
.tile:hover { background: var(--stone); }
.tile:active, .tile[aria-pressed="true"] { transform: translate(2px, 2px) rotate(0deg); box-shadow: 1px 1px 0 var(--shadow); }
.tile[aria-pressed="true"] { background: var(--haritala); color: var(--on-haritala); }
.tile.is-wrong { animation: tile-shake 420ms ease; }

@keyframes tile-shake {
  0%, 100% { transform: translate(2px, 2px); }
  20% { transform: translate(-5px, 2px); }
  40% { transform: translate(9px, 2px); }
  60% { transform: translate(-2px, 2px); }
  80% { transform: translate(6px, 2px); }
}
@keyframes stamp {
  from { transform: scale(0.9) rotate(-1.5deg); opacity: 0.3; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes card-in {
  from { transform: scale(0.94); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

/* Group colours = difficulty, easiest to hardest */
.group-0 { background: var(--haritala); color: var(--on-haritala); }
.group-1 { background: var(--patra); color: var(--on-patra); }
.group-2 { background: var(--neela); color: var(--on-neela); }
.group-3 { background: var(--sindoor); color: var(--on-sindoor); }

/* ---------- Buttons ---------- */
.controls { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; margin-top: 18px; padding: 2px; }
.controls button, .result button, .dialog-start, .riddle-next, .riddle-share, .riddle-again, .dev-send, .revive-actions button, .auth-actions button {
  min-height: 48px; padding: 0 16px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--conch);
  box-shadow: var(--hard);
  cursor: pointer; font-weight: 700;
  transition: transform 90ms ease, box-shadow 90ms ease, opacity 120ms ease;
}
.controls button:not(:disabled):active, .result button:active, .dialog-start:active, .riddle-next:active,
.riddle-share:active, .riddle-again:active, .dev-send:not(:disabled):active, .revive-actions button:active, .auth-actions button:active {
  transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow);
}
.controls button.primary, .result button.primary, .dialog-start, .riddle-next, .riddle-share, .dev-send, .revive-actions .primary {
  background: var(--sindoor); color: var(--on-sindoor);
}
.controls button:disabled { cursor: default; opacity: 0.4; box-shadow: var(--hard-sm); }
.riddle-hint {
  margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--stone); color: var(--ink); font-weight: 600; line-height: 1.5;
}

.result {
  margin-top: 20px; padding: 20px 18px;
  text-align: center;
  background: var(--conch);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--hard);
}
.result h2 { margin-bottom: 6px; font-family: var(--title); font-size: 1.5rem; }
.result p { color: var(--muted); line-height: 1.6; }
.result .note { display: block; margin-bottom: 8px; color: var(--ink); font-weight: 600; }
.result button { margin: 4px; }

/* Revive: all four diyas are out; spend points to relight one */
.revive {
  margin-top: 18px; padding: 16px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--conch); box-shadow: var(--hard);
  text-align: center;
  animation: card-in 240ms ease-out;
}
.revive[hidden] { display: none; }
.revive-flame { font-size: 2rem; line-height: 1; display: block; margin-bottom: 6px; }
.revive h2 { margin: 0 0 4px; font-size: 1.2rem; }
.revive p { margin: 0 0 12px; color: var(--muted); font-weight: 600; line-height: 1.5; }
.revive-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.revive-actions button { padding-inline: 10px; }
.revive-actions .primary:disabled { opacity: 0.45; cursor: default; box-shadow: var(--hard-sm); }
.revive-actions small { display: block; font-weight: 600; font-size: 0.78rem; opacity: 0.9; }

/* Archive + feedback sit quietly below the game */
.game-picker, .feedback {
  margin-top: 26px; padding-top: 18px;
  border-top: 2px dashed var(--line);
}
.game-picker summary { cursor: pointer; font-weight: 700; }
.game-picker-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 10px; }
.game-picker label { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.game-picker select, .trail-picker select, .preview-riddle-picker select {
  width: 100%; min-height: 44px; padding: 0 12px;
  border: 2px solid var(--ink); border-radius: var(--radius-sm);
  background: var(--conch); color: var(--ink);
  font: inherit; font-weight: 600;
}

.feedback h2 { margin-bottom: 4px; font-size: 1.1rem; }
.feedback p { margin-bottom: 10px; color: var(--muted); font-weight: 600; }
.feedback-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.feedback-button {
  min-height: 42px; border-radius: var(--radius-sm);
  background: var(--conch); border: 2px solid var(--line);
  cursor: pointer; font-weight: 600;
}
.feedback-button.is-selected { background: var(--ink); color: var(--stone); border-color: var(--ink); }
.dev-label { display: block; margin: 18px 0 6px; font-weight: 700; }
.dev-message {
  width: 100%; padding: 10px 12px; resize: vertical;
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--conch); color: var(--ink);
  font: inherit; line-height: 1.5;
}
.dev-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.dev-status { color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.dev-send { flex: 0 0 auto; min-height: 44px; padding: 0 22px; }
.dev-send:disabled { opacity: 0.5; cursor: default; }
.form-link { display: inline-block; margin-top: 12px; color: var(--neela); font-weight: 700; }
.form-link.is-disabled { cursor: not-allowed; opacity: 0.5; }

/* ---------- ଦୁଇ ଅର୍ଥ ---------- */
.riddle-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.riddle-progress { display: flex; gap: 6px; }
.step { width: 26px; height: 8px; border-radius: 4px; background: var(--line); border: 1.5px solid var(--ink); }
.step.is-current { background: var(--haritala); }
.step.is-right { background: var(--patra); }
.step.is-wrong { background: var(--sindoor); }
.riddle-score { font-weight: 700; }
.riddle-card:empty { display: none; }
.riddle-card {
  padding: 16px; margin-bottom: 14px;
  background: var(--conch);
  border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--hard);
}
.riddle-count { margin-bottom: 10px; color: var(--muted); font-weight: 600; }
.clue { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; }
.clue + .clue { border-top: 2px dashed var(--line); }
.clue p { margin: 0; font-size: clamp(1.1rem, 4.6vw, 1.3rem); font-weight: 600; line-height: 1.45; }
.clue-tag {
  flex: 0 0 auto; padding: 2px 8px; border-radius: 999px;
  background: var(--haritala); color: var(--on-haritala); font-size: 0.8rem; font-weight: 700;
}
.clue + .clue .clue-tag { background: var(--neela); color: var(--on-neela); }
.clue-wait { margin: 0; font-weight: 600; }
.riddle-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 2px; }
.riddle-option { font-size: clamp(1.1rem, 4.6vw, 1.3rem); }
.riddle-option:disabled { cursor: default; }
.riddle-option.is-answer { background: var(--patra); border-color: var(--ink); color: var(--on-patra); }
.riddle-option.is-chosen-wrong { background: var(--sindoor); color: var(--on-sindoor); }
.riddle-option:disabled:not(.is-answer):not(.is-chosen-wrong) { opacity: 0.5; }
.riddle-feedback { min-height: 1.6em; margin: 14px 0 8px; font-weight: 600; line-height: 1.5; }
.riddle-feedback.good strong { color: var(--patra); filter: brightness(0.8); }
.riddle-feedback.bad strong { color: var(--sindoor); }
.riddle-next, .riddle-share, .riddle-again { min-height: 48px; padding: 0 22px; }
.riddle-next { width: 100%; }
.riddle-recap { margin: 12px 0 14px; padding: 0; list-style: none; text-align: left; line-height: 1.5; }
.riddle-recap li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.riddle-recap strong { white-space: nowrap; }
.reward { display: block; margin-bottom: 8px; color: var(--sindoor); font-size: 1.05rem; }

/* Quick rating inside the result panel */
.quick-rate { margin: 12px 0 4px; }
.quick-rate-status { margin: 0 0 8px; color: var(--ink); font-weight: 700; }
.quick-rate-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.result .quick-rate-button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 70px; margin: 0; padding: 6px 2px; border-radius: var(--radius-sm);
  border: 2px solid var(--line); background: var(--stone); box-shadow: none;
  font-size: 0.78rem; font-weight: 600; line-height: 1.25;
}
.result .quick-rate-button.is-selected { background: var(--ink); color: var(--stone); border-color: var(--ink); }
.quick-rate-button span { font-size: 1.5rem; line-height: 1; }

/* Today's score card */
.day-card {
  margin: 12px 0 14px; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: var(--stone); text-align: left;
}
.day-title { margin: 0 0 6px; font-weight: 700; color: var(--ink); }
.day-card ul { margin: 0; padding: 0; list-style: none; }
.day-card li { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; color: var(--muted); font-weight: 600; }
.day-card li.is-current { color: var(--ink); }
.day-card li b { font-size: 1.15rem; color: var(--ink); }
.day-card li small { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.day-card .pending { font-size: 0.9rem; color: var(--muted); }
.day-card .day-total { margin-top: 4px; border-top: 2px dashed var(--line); padding-top: 8px; color: var(--ink); }
.day-card .day-total b { font-size: 1.35rem; color: var(--sindoor); }
.day-card .next-game {
  width: 100%; min-height: 48px; margin: 10px 0 0; border-radius: 999px;
  background: var(--sindoor); border: 2px solid var(--ink); color: var(--on-sindoor);
  box-shadow: var(--hard); cursor: pointer; font-weight: 700;
}
.day-done { margin: 10px 0 0; color: var(--ink); font-weight: 600; text-align: center; }

/* ---------- Dialogs: help and account ---------- */
dialog { max-width: min(440px, calc(100vw - 24px)); padding: 0; border: 0; background: transparent; color: var(--ink); }
dialog::backdrop { background: rgba(20, 14, 10, 0.6); }
.dialog-body {
  position: relative; padding: 22px;
  background: var(--conch);
  border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--sindoor);
  line-height: 1.6;
  max-height: 88vh; overflow-y: auto;
}
.dialog-body h2 { font-family: var(--title); padding-right: 44px; font-size: 1.6rem; }
.dialog-body h3 { margin: 16px 0 4px; font-size: 1.05rem; }
.close-button { position: absolute; top: 12px; right: 12px; }
.level-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; padding: 0; list-style: none; font-weight: 600; }
.level-legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 2px solid var(--ink); }
.dialog-start { width: 100%; margin-top: 8px; }

.auth-dialog .dialog-body { text-align: center; }
.auth-dialog h2 { padding-right: 0; }
.auth-dialog p { color: var(--muted); font-weight: 600; }
.auth-lead { font-size: 2.2rem; line-height: 1; margin: 4px 0 10px; }
.auth-actions { display: grid; gap: 10px; margin-top: 14px; }
.auth-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.auth-actions .google { background: var(--conch); }
.auth-actions .google svg { width: 20px; height: 20px; flex: 0 0 auto; }
.auth-actions .quiet { background: transparent; border-color: var(--line); box-shadow: none; }
.auth-who { margin: 6px 0 0; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.auth-status { min-height: 1.4em; margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
.auth-status.is-error { color: var(--sindoor); }
.auth-list { margin: 10px 0 0; padding: 0; list-style: none; text-align: left; font-weight: 600; }
.auth-list li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }

/* A small nudge in result panels for players who are not signed in */
.save-nudge {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 10px 0 4px; padding: 10px 12px;
  border: 2px dashed var(--ink); border-radius: var(--radius-sm);
  background: var(--stone); text-align: left; font-weight: 600; font-size: 0.9rem; color: var(--ink);
}
.save-nudge button {
  flex: 0 0 auto; margin: 0; min-height: 36px; padding: 0 12px; font-size: 0.85rem;
  background: var(--patra); color: var(--on-patra); border: 2px solid var(--ink); box-shadow: var(--hard-sm);
}

@media (max-width: 520px) {
  .shell { width: calc(100vw - 16px); padding-top: 8px; }
  .topbar { padding: 22px 12px 12px; gap: 8px; }
  .brand { gap: 10px; }
  .brand img { width: 42px; height: 42px; padding: 5px; }
  h1 { font-size: clamp(1.5rem, 6.2vw, 2rem); }
  .tagline { font-size: 0.82rem; }
  .topbar-actions { gap: 6px; }
  .pill-button { min-height: 32px; padding: 0 8px; font-size: 0.82rem; }
  .topbar .icon-button, .account-button { width: 34px; height: 34px; font-size: 1rem; }
  .grid, .riddle-options { gap: 8px; }
  .tile { min-height: 70px; font-size: 0.95rem; }
  .tab { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-wrong { animation: none; outline: 3px solid var(--sindoor); outline-offset: -3px; }
  .solved-card.is-new, .stat.is-bumped, .revive, .dot, .dot.is-relit { animation: none; }
  .tile, .dot, .tab::after { transition: none; }
}

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; margin-left: 6px; padding: 0;
  border-radius: 50%; background: var(--conch); border: 2px solid var(--ink);
  font-size: 0.9rem; cursor: pointer;
}
