/* Design system for the speech practice app. Hebrew RTL, mobile first, light and dark. */
:root {
  --bg: #f4f1ea; --surface: #ffffff; --surface-2: #ebe6da; --ink: #1c1a17; --muted: #6a645a; --line: #ddd6c8;
  --accent: #0d6b63; --accent-ink: #ffffff; --accent-soft: #d9efec;
  --hl: #c2410c; --good: #177a3c; --bad: #b3261e; --warn: #a16207;
  --radius: 18px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .06);
  --font: "Heebo", system-ui, "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131210; --surface: #1d1b18; --surface-2: #29261f; --ink: #f2eee6; --muted: #a59e90; --line: #36322a;
    --accent: #3fd0c1; --accent-ink: #06231f; --accent-soft: #12332f;
    --hl: #fb923c; --good: #4ade80; --bad: #f87171; --warn: #facc15;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--font); }
main { max-width: 680px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 4px; font-weight: 800; }
h2 { font-size: 19px; margin: 26px 0 10px; font-weight: 700; }
p { margin: 6px 0; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 15px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; min-height: 36px; }
.back { text-decoration: none; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.center { justify-content: center; } .row.between { justify-content: space-between; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 15px; border-radius: 999px;
  font: inherit; cursor: pointer; min-height: 42px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.chip small { opacity: .75; margin-inline-start: 6px; }
.btn { font: inherit; font-weight: 700; padding: 15px 18px; border-radius: 14px; border: 0; cursor: pointer; min-height: 54px;
  background: var(--surface-2); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--good); color: #fff; } .btn.no { background: var(--bad); color: #fff; }
.btn.wide { width: 100%; }
.btn:disabled, .tool:disabled { opacity: .35; cursor: default; }
@media (prefers-color-scheme: dark) { .btn.ok, .btn.no { color: #111; } }

/* practice card */
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 22px 16px 16px; text-align: center; box-shadow: var(--shadow); }
.word { font-size: clamp(36px, 10vw, 64px); font-weight: 800; line-height: 1.3; min-height: 2.6em; display: grid; place-items: center; }
.word.long { font-size: clamp(22px, 5.8vw, 34px); font-weight: 600; }
.word span { white-space: pre-wrap; }
.word b { color: var(--hl); font-weight: inherit; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 7px; }
.sub { color: var(--muted); font-size: 15px; min-height: 1.5em; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.tool { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 14px; padding: 10px 4px; cursor: pointer; display: grid; justify-items: center; gap: 2px; min-height: 64px; }
.tool svg { width: 26px; height: 26px; fill: currentColor; }
.tool.rec { border-color: var(--bad); color: var(--bad); }
.tool.rec.on { background: var(--bad); color: #fff; animation: pulse 1.1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgb(179 38 30 / .18); } }
@media (prefers-reduced-motion: reduce) { .tool.rec.on { animation: none; } }
.msg { color: var(--warn); font-size: 14px; min-height: 1.4em; }
.marks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

/* cue box */
.cue { background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; font-size: 15px; margin: 10px 0; }
.cue b { color: var(--accent); }

/* home */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.ring { width: 112px; height: 112px; }
.ring circle { fill: none; stroke-width: 10; }
.ring .t { stroke: var(--surface-2); } .ring .v { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s; }
.ring text { font: 800 26px var(--font); fill: var(--ink); text-anchor: middle; }
.ring .s { font: 500 11px var(--font); fill: var(--muted); }
.week { display: flex; gap: 6px; margin-top: 10px; }
.week div { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.week i { display: block; height: 30px; border-radius: 8px; background: var(--surface-2); margin-bottom: 3px; }
.week i.part { background: color-mix(in srgb, var(--accent) 40%, var(--surface-2)); } .week i.full { background: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tile { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: transform .12s; }
.tile:hover { transform: translateY(-2px); }
.tile b { display: block; font-size: 18px; color: var(--accent); margin-bottom: 2px; }
.tile.main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); grid-column: 1 / -1; }
.tile.main b { color: inherit; font-size: 22px; }
.tile .muted { font-size: 14px; } .tile.main .muted { color: inherit; opacity: .85; }
.ladder { display: grid; gap: 6px; }
.rung { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.rung .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rung .bar i { display: block; height: 100%; background: var(--accent); }
.rung.ready { border-color: var(--good); } .rung .tag { font-size: 13px; color: var(--muted); }
.rung.ready .tag { color: var(--good); font-weight: 700; }
.soundpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.soundpick button { font: inherit; border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 14px 8px; cursor: pointer; }
.soundpick button b { display: block; font-size: 44px; line-height: 1.1; }
.soundpick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* session */
.stages { display: flex; gap: 4px; margin: 6px 0 10px; }
.stages span { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); }
.stages span.done { background: var(--good); } .stages span.now { background: var(--accent); }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 20px; }
.banner { margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px dashed var(--accent); }
table { width: 100%; border-collapse: collapse; } td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; }

/* ear training */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.choice { font: 800 clamp(30px, 8vw, 46px) var(--font); padding: 26px 8px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--surface)); }

/* memory */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.mcard { aspect-ratio: 3 / 4; border-radius: 14px; border: 1px solid var(--line); background: var(--accent); color: transparent; font: 700 clamp(15px, 4.2vw, 22px) var(--font);
  cursor: pointer; padding: 4px; display: grid; place-items: center; text-align: center; transition: background .15s; }
.mcard.up { background: var(--surface); color: var(--ink); }
.mcard.done { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); cursor: default; }

/* recordings */
.rec-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rec-item button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 16px; }
footer { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); }

.mcard.up b, .mcard.done b { color: var(--hl); font-weight: inherit; }
.mcard b { font-weight: inherit; }
