/* דרישטי — river stone: cool pale stone page, slate ink, one deep-water accent */
:root {
  --paper: #e7e6df;       /* page, pale stone */
  --paper-deep: #d9d8cf;  /* lower page */
  --ink: #1e2529;         /* text, slate */
  --muted: #5b6569;       /* secondary text */
  --line: #c6c7bf;        /* hairlines */
  --accent: #23566b;      /* the sentence, focus, the one accent */
  --accent-dim: #8eaab4;
  --glow: #f7f6f1;        /* light in the background drawing */

  --serif: "Frank Ruhl Libre", "David", serif;
  --sans: "IBM Plex Sans Hebrew", "Assistant", system-ui, sans-serif;
  --gutter: 20px;
  --col: 34rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--paper-deep); }
body {
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--paper) 0, var(--paper) 60vh, var(--paper-deep) 140vh) var(--paper-deep);
  color: var(--ink);
  font: 300 18px/1.75 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- shared bits ---------- */
.eyebrow { font: 400 13px/1.4 var(--sans); letter-spacing: .04em; color: var(--muted); margin: 0; }
.serif { font-family: var(--serif); font-weight: 400; }
.gap { display: inline-block; width: 3.2em; border-bottom: 1px solid var(--muted); transform: translateY(-.25em); margin: 0 .15em; opacity: .7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 52px; padding: 0 26px;
  background: var(--accent); color: var(--paper);
  border: 0; border-radius: 999px; cursor: pointer;
  font: 500 17px/1 var(--sans); text-decoration: none;
  transition: transform .15s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .35; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; font-size: 15px; }

/* the bolt: an accent line that slides across a locked sentence */
.bolted { position: relative; display: inline; }
.bolt {
  display: block; height: 2px; margin-top: 14px; background: var(--accent);
  transform-origin: right center; transform: scaleX(1);
}
.bolt.slide { animation: bolt .8s cubic-bezier(.7, 0, .2, 1) both; }
@keyframes bolt { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lock-tag { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--accent); font: 400 13px/1 var(--sans); letter-spacing: .04em; }
.lock-tag svg { width: 12px; height: 14px; }
.lock-tag.appear { animation: fade .4s .7s ease both; }

/* ---------- home ---------- */
.home { padding-top: calc(28px + env(safe-area-inset-top)); padding-bottom: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 400 15px/1 var(--sans); letter-spacing: .08em; color: var(--muted); }
.brand svg { width: 11px; height: 18px; color: var(--accent); }

.hero { padding: 18vh 0 40px; }
.hero h1 { font: 400 clamp(52px, 15vw, 84px)/1 var(--serif); margin: 0 0 28px; letter-spacing: -.01em; }
.hero p { margin: 0 0 32px; color: var(--ink); max-width: 26em; }
.hero .not { color: var(--muted); font-size: 15px; margin-top: 22px; }

.letter-head { margin: 56px 0 6px; padding-top: 28px; border-top: 1px solid var(--line); }
.letter-head h2 { font: 400 30px/1.2 var(--serif); margin: 6px 0 4px; }
.letter-head p { margin: 0; color: var(--muted); font-size: 15px; }

.rows { list-style: none; margin: 18px 0 0; padding: 0; }
.row a { display: block; padding: 20px 0 22px; border-bottom: 1px solid var(--line); text-decoration: none; }
.row .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row .meta .eyebrow b { font-weight: 500; color: var(--ink); }
.row .go { color: var(--muted); font-size: 14px; }
.row .sentence { font: 400 23px/1.45 var(--serif); margin: 8px 0 0; color: var(--muted); }
.row.done .sentence { color: var(--ink); }
.row.done .bolt { margin-top: 10px; width: 2.5rem; }
.row.next .go { color: var(--accent); }

.privacy { margin-top: 40px; color: var(--muted); font-size: 15px; }
.privacy p { margin: 0 0 10px; }
.foot { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot p { margin: 0; }

/* ---------- player ---------- */
.player { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }
.ambient { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 10px;
  max-width: var(--col); width: 100%; margin: 0 auto;
}
.topbar a { text-decoration: none; color: var(--muted); font-size: 15px; padding: 8px 0; }

.stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  max-width: var(--col); width: 100%; margin: 0 auto; padding: 24px var(--gutter) 32px;
}
.stage > * { animation: rise .6s ease both; }

.say p { margin: 0; font-size: 21px; line-height: 1.75; }
.say p + p { margin-top: 2px; }

.card .text { font: 400 clamp(30px, 8.4vw, 40px)/1.35 var(--serif); margin: 0; }
.card .text + .text { margin-top: 6px; }
.card.list .text { font-size: clamp(26px, 7vw, 32px); color: var(--ink); }
.card.letter .text { font-size: clamp(22px, 6vw, 27px); line-height: 1.5; }
.card.letter .text.missing { color: var(--muted); }
.card .hint { margin: 22px 0 0; color: var(--muted); font-size: 15px; }

input.blank {
  font: inherit; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--accent); border-radius: 0;
  padding: 0 .1em; margin: 0 .04em; width: 5ch; min-width: 3.5ch; max-width: 100%;
  text-align: center;
}
input.blank:focus { outline: none; border-bottom-width: 2px; }
.filled { color: var(--accent); }

.picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.pick {
  min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink); font-size: 16px;
}
.pick[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.actions { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; }

.breath { height: 1px; background: var(--line); max-width: var(--col); width: calc(100% - 2 * var(--gutter)); margin: 0 auto; overflow: hidden; }
.breath i { display: block; height: 100%; background: var(--accent-dim); transform-origin: right; transform: scaleX(0); }
.breath i.run { animation: breath linear both; }
@keyframes breath { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.controls {
  max-width: var(--col); width: 100%; margin: 0 auto;
  padding: 12px var(--gutter) calc(18px + env(safe-area-inset-bottom));
}
.progress { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.progress i { display: block; height: 100%; width: 0; background: var(--muted); transition: width .4s ease; margin-right: 0; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 52px; height: 52px; display: grid; place-items: center;
  background: none; border: 0; color: var(--ink); cursor: pointer; border-radius: 50%;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.main { border: 1px solid var(--line); }
.icon-btn.main svg { width: 20px; height: 20px; }

.intro h1 { font: 400 clamp(56px, 16vw, 88px)/1 var(--serif); margin: 10px 0 18px; }
.intro p { color: var(--muted); margin: 0 0 30px; }

.finish h2 { font: 400 22px/1.3 var(--sans); color: var(--muted); margin: 8px 0 22px; }
.finish .text { font: 400 clamp(28px, 8vw, 38px)/1.35 var(--serif); margin: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
}

[hidden] { display: none !important; }
.wipe-confirm { margin-top: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.wipe-confirm p { margin: 0; color: var(--ink); }
.wipe-confirm .actions { margin-top: 14px; }

/* ---------- module menu ---------- */
.menu-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); font-size: 14px; cursor: pointer;
}
.menu-btn svg { width: 12px; height: 12px; color: var(--muted); }
.menu {
  width: min(30rem, calc(100% - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 18px 20px 22px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 16px;
}
.menu::backdrop { background: rgba(30, 37, 41, .35); }
.menu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.menu-list { list-style: none; margin: 0 0 18px; padding: 0; }
.menu-item {
  display: grid; grid-template-columns: 1.6em 1fr auto; align-items: baseline; gap: 10px;
  padding: 13px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.menu-item .num { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.menu-item .name { font: 400 21px/1.3 var(--serif); min-width: 0; }
.menu-item .state { color: var(--muted); font-size: 13px; white-space: nowrap; }
.menu-item.current .name, .menu-item.current .state { color: var(--accent); }

/* ---------- דרישטי: the track ---------- */
.hero .tagline { font: 300 clamp(22px, 6vw, 28px)/1.4 var(--serif); color: var(--accent); margin: 0 0 22px; }
.row.fork a { cursor: default; }
.row.fork .sentence { font-size: 19px; }
.track-line { margin: 18px 0 0; color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.track-line b { color: var(--ink); font-weight: 500; }
.menu .track-line { margin: 0 0 16px; }
.brand svg { width: 14px; height: 20px; }

/* ---------- the task: on the finish screen and on the home page ---------- */
.finish-task { margin-top: 30px; padding: 16px 18px; border-inline-start: 2px solid var(--accent); background: rgba(247, 246, 241, .6); }
.finish-task p { margin: 0; }
.finish-task p + p { margin-top: 4px; font-size: 19px; color: var(--ink); }

.task-panel { margin-top: 8px; padding: 22px 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--glow); }
.task-panel h2 { font: 400 26px/1.25 var(--serif); margin: 6px 0 10px; }
.task-text { font: 400 22px/1.45 var(--serif); margin: 0; color: var(--accent); }
.task-note { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.task-panel .actions { margin-top: 20px; }
.task-done { margin: 18px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.task-done .lock-tag { margin-top: 0; }

/* ---------- the big sound switch ---------- */
.sound-switch {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 22rem;
  margin-top: 18px; padding: 14px 18px; min-height: 64px; text-align: start;
  background: transparent; color: var(--ink); cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px;
}
.sound-switch[aria-pressed="true"] { border-color: var(--accent); background: var(--glow); }
.sound-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--paper-deep); color: var(--muted); }
.sound-switch[aria-pressed="true"] .sound-icon { background: var(--accent); color: var(--glow); }
.sound-icon svg { width: 22px; height: 22px; }
.sound-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sound-label b { font-weight: 500; font-size: 17px; line-height: 1.3; }
.sound-label small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.player-sound { max-width: var(--col); width: 100%; margin: 0 auto; padding: 0 var(--gutter); }
.player-sound .sound-switch { margin-top: 4px; }

/* ---------- key line and listening advice on the home page ---------- */
.hero .key-line { font: 500 19px/1.5 var(--sans); color: var(--ink); margin: 0 0 22px; padding-inline-start: 14px; border-inline-start: 2px solid var(--accent); }
.hero .setting { color: var(--muted); font-size: 15px; margin: 14px 0 0; max-width: 22rem; }
