:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5d6573;
  --line: #dfe3ea;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --rec: #dc2626;
  --warn-bg: #fff7e6;
  --warn: #8a5300;
  --err-bg: #fdecec;
  --err: #a11a1a;
  --ok-bg: #e8f6ef;
  --ok: #17663f;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1b1f25;
    --text: #eef1f5;
    --muted: #9aa3b2;
    --line: #2c323b;
    --brand: #2bb3a5;
    --brand-ink: #071513;
    --warn-bg: #3a2c10;
    --warn: #ffcf7a;
    --err-bg: #3d1717;
    --err: #ff9b9b;
    --ok-bg: #12301f;
    --ok: #7fe0a8;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 "Noto Sans", "Noto Sans Tamil", system-ui, sans-serif;
}
[lang="ta"] { font-family: "Noto Sans Tamil", "Noto Sans", sans-serif; }
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.top nav, .top #menu-btn { margin-left: auto; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
body.wide main { max-width: 980px; }
h1 { font-size: 1.45rem; line-height: 1.3; margin: 8px 0 12px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.4rem; font-weight: 700; margin: 0 0 8px; }
code, kbd { font-size: 0.85em; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.primary kbd, .danger kbd { background: transparent; color: inherit; border-color: currentColor; opacity: 0.8; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.consent p { margin: 0 0 12px; }

button {
  font: inherit; cursor: pointer; border-radius: 12px; border: 1px solid transparent;
  padding: 14px 16px; width: 100%; margin: 8px 0; min-height: 52px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
.danger { background: var(--err-bg); color: var(--err); border-color: transparent; font-weight: 600; }
.link { background: none; color: var(--brand); width: auto; min-height: 0; padding: 8px; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > button.primary, .row > button.secondary, .row > button.danger { flex: 1 1 140px; }
.row > select { flex: 1 1 200px; }

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
input, select {
  font: inherit; width: 100%; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
.choices { border: 0; padding: 0; margin: 14px 0; }
.choices legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choices label, .check {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 6px 0; cursor: pointer;
}
.choices.inline { display: flex; flex-wrap: wrap; gap: 8px; }
.choices.inline legend { width: 100%; }
.choices.inline label { margin: 0; flex: 1 1 120px; }
.choices input, .check input { width: 22px; height: 22px; flex: none; margin: 0; }
.check span .muted { display: block; }

.tips { padding-left: 20px; }
.tips li { margin: 6px 0; }
.tips .muted { display: block; font-size: 0.9rem; }

.meter { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0; }
.meter.small { height: 8px; width: 160px; }
.meter > div { height: 100%; width: 0; background: var(--brand); transition: width 80ms linear; }

.progress-line { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
#upload-state { cursor: pointer; }
#upload-state.error { color: var(--err); }
.progress { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.progress > div { height: 100%; background: var(--brand); width: 0; }

.prompt-card { text-align: center; padding: 20px 16px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.badge { font-size: 0.78rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; color: var(--muted); }
.prompt-text { font-size: 1.75rem; font-weight: 700; line-height: 1.4; margin: 12px 0 4px; overflow-wrap: anywhere; }
.prompt-text.small-prompt { font-size: 1.25rem; text-align: left; }

.rec-row { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 16px 0; }
.rec {
  width: 96px; height: 96px; min-height: 96px; border-radius: 50%; margin: 0;
  background: var(--card); color: var(--rec); border: 3px solid var(--rec);
  font-size: 2.2rem; line-height: 1; padding: 0;
}
.rec.on { background: var(--rec); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0.15); } }
@media (prefers-reduced-motion: reduce) { .rec.on { animation: none; } }
.rec-time { font-size: 1.4rem; font-variant-numeric: tabular-nums; font-weight: 700; }

.checks { min-height: 8px; }
.check-msg { border-radius: 10px; padding: 10px 12px; margin: 6px 0; font-size: 0.95rem; }
.check-msg.block { background: var(--err-bg); color: var(--err); }
.check-msg.warn { background: var(--warn-bg); color: var(--warn); }
.check-msg.ok { background: var(--ok-bg); color: var(--ok); }

audio { width: 100%; margin: 12px 0; }
.rules ol { padding-left: 20px; }
.rules summary { cursor: pointer; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.grid .card { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 16px; margin: 0 auto; max-width: 528px;
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; z-index: 10;
}
.toast.error { background: var(--err); color: #fff; }

/* speaker page: single-language flow */
.big-choice { font-size: 1.3rem; min-height: 64px; }
.check.tall > span { display: flex; flex-direction: column; gap: 2px; }
.check.tall .muted { font-size: 0.9rem; }
.note { background: var(--warn-bg); color: var(--warn); border-color: transparent; font-weight: 600; }
.ok-line { color: var(--ok); font-weight: 600; margin: 4px 0 0; }
.shop-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; flex: 1; }
.shop-line strong { flex: 1 1 100%; }
.badge.need { background: var(--ok-bg); color: var(--ok); border-color: transparent; font-weight: 600; }

/* ---- shop chips (multi-select) ---- */
#shop-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px;
}
.shop-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 999px; cursor: pointer; user-select: none;
  background: var(--card); border: 1.5px solid var(--line);
  font-size: 0.95rem; font-weight: 500; color: var(--text);
  transition: background 120ms, border-color 120ms, color 120ms;
}
.shop-chip--on {
  background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700;
}
.shop-chip--needed .shop-chip__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); flex-shrink: 0;
}
.shop-chip--needed.shop-chip--on .shop-chip__dot { background: var(--brand-ink); opacity: 0.75; }
#shop-list { border: 0; padding: 0; margin: 14px 0; }
#shop-list legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.how { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.how ol { padding-left: 22px; margin: 8px 0 0; }
.how li { margin: 4px 0; }
.how .link { color: var(--ok); text-decoration: underline; }
.rec-block { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 16px 0; }
.rec-label { font-weight: 700; font-size: 1.05rem; text-align: center; }
.rec-label.on { color: var(--rec); }
.rec-meta { display: flex; align-items: center; gap: 12px; }
#how-show { display: block; margin: 0 auto 8px; }

.public-code { text-align: center; margin: 8px 0; }
.public-code code { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.08em; padding: 6px 14px; }
.req-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.req-row .row { margin-left: auto; }
