/* חום וגבול — a notebook, not a dashboard.
   One sheet of paper with a margin line, pen-ink type, a highlighter for the lines you
   read aloud, and a string of seven beads for the principles. Mobile first, RTL. */
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/heebo-hebrew.woff2') format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/heebo-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Heebo'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/heebo-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Miriam Libre'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/fonts/miriam-libre-hebrew.woff2') format('woff2'); }

:root {
  --paper: #F8F7F3;
  --sheet: #FFFFFF;
  --ink: #1E2230;
  --pencil: #5F6572;
  --rule: #DADCE1;
  --rule-soft: #ECEDF0;
  --pen: #2B4A8B;
  --pen-soft: #E7EDF8;
  --marker: #F8E57A;
  --marker-ink: #1E2230;
  --red: #C8372D;
  --red-soft: #FBE9E6;
  --green: #2F7A4D;
  --display: 'Miriam Libre', 'Heebo', sans-serif;
  --body: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 20px;
  --margin: 26px;
  --tab-h: 58px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17191E; --sheet: #1F2229; --ink: #ECEBE6; --pencil: #9A9EA8; --rule: #30343C; --rule-soft: #262A31;
    --pen: #8FB0F0; --pen-soft: #243049; --marker: #C9B74A; --marker-ink: #17191E; --red: #F07A70; --red-soft: #3A2624; --green: #7CC48C;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--pen); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: var(--display); font-weight: 700; font-size: 30px; }
h2 { font-family: var(--display); font-weight: 700; font-size: 22px; }
h3 { font-weight: 700; font-size: 17px; }
p { margin: 0; }
.muted { color: var(--pencil); }
.small { font-size: 14px; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 3px; }

.app { max-width: 600px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.boot { flex: 1; display: grid; place-items: center; }
.boot-mark { width: 14px; height: 14px; border-radius: 50%; background: var(--pen); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.6); opacity: .4; } 50% { transform: scale(1); opacity: 1; } }

/* --- shell: the page is one sheet with a margin line on the start side --- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 6px; }
.brand { display: flex; align-items: baseline; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 19px; color: var(--pen); }
.brand small { font-family: var(--body); font-weight: 500; font-size: 13px; color: var(--pencil); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--pencil); border-radius: 8px; transition: color .15s ease, background .15s ease; }
.icon-btn:active { background: var(--rule-soft); }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

main.view { flex: 1; position: relative; padding: 4px var(--gutter) calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); padding-inline-start: calc(var(--gutter) + var(--margin)); display: flex; flex-direction: column; animation: fade-in .22s ease both; }
main.view::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: calc(var(--gutter) + 6px); width: 1px; background: var(--pen); opacity: .35; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.tabbar { position: fixed; bottom: 0; inset-inline: 0; margin: 0 auto; max-width: 600px; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding: 0 var(--gutter) env(safe-area-inset-bottom); background: var(--paper); border-top: 1px solid var(--rule); display: flex; gap: 4px; z-index: 20; }
.tab { flex: 1; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--pencil); position: relative; transition: color .15s ease; }
.tab svg { display: none; }
.tab[aria-current="page"] { color: var(--pen); font-weight: 700; }
.tab[aria-current="page"]::after { content: ''; position: absolute; top: -1px; inset-inline: 22%; height: 2px; background: var(--pen); }

/* --- sheets: sections divided by rules, no boxes --- */
.card { padding: 18px 0 22px; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 12px; }
.card:last-child { border-bottom: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--pencil); position: relative; }
/* the margin bead: every labelled part hangs off the margin line */
.eyebrow::before { content: ''; position: absolute; inset-inline-start: calc(-1 * var(--margin) + 2px); top: .55em; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--pen); }

.btn { min-height: 48px; padding: 0 18px; border-radius: 10px; border: 1.5px solid var(--ink); background: transparent; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, background .15s ease, opacity .15s ease; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--pen); color: #fff; border-color: var(--pen); font-size: 18px; min-height: 56px; }
.btn-ghost { border-color: transparent; color: var(--pen); padding-inline: 8px; }
.btn-warm { border-color: var(--red); color: var(--red); }
.btn-block { width: 100%; }
.btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

textarea, input[type="text"], input[type="number"], input[type="password"] { width: 100%; min-height: 48px; padding: 12px 0; border: 0; border-bottom: 1.5px solid var(--rule); background: transparent; font-size: 17px; line-height: 1.5; resize: none; border-radius: 0; transition: border-color .15s ease; }
textarea:focus, input:focus { border-color: var(--pen); outline: none; }
textarea::placeholder, input::placeholder { color: var(--pencil); opacity: .8; }
textarea.situation { min-height: 120px; font-size: 19px; line-height: 1.5; }
label.field { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 14px; color: var(--pencil); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1.5px solid var(--rule); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.chip[aria-pressed="true"] { background: var(--pen); color: #fff; border-color: var(--pen); }
.chip.add { border-style: dashed; color: var(--pencil); }

.segmented { display: flex; gap: 18px; border-bottom: 1.5px solid var(--rule); }
.segmented button { min-height: 44px; font-weight: 600; color: var(--pencil); position: relative; padding: 0 2px; transition: color .15s ease; }
.segmented button[aria-pressed="true"] { color: var(--ink); }
.segmented button[aria-pressed="true"]::after { content: ''; position: absolute; bottom: -1.5px; inset-inline: 0; height: 2.5px; background: var(--pen); }
.segmented button[data-v="boiling"][aria-pressed="true"] { color: var(--red); }
.segmented button[data-v="boiling"][aria-pressed="true"]::after { background: var(--red); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.switch { position: relative; width: 46px; height: 28px; border-radius: 999px; border: 1.5px solid var(--pencil); flex: none; transition: background .2s ease, border-color .2s ease; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--pencil); transition: transform .2s ease, background .2s ease; }
.switch[aria-checked="true"] { background: var(--pen); border-color: var(--pen); }
.switch[aria-checked="true"]::after { background: #fff; transform: translateX(-18px); }

/* --- the seven beads --- */
.strip { display: flex; justify-content: space-between; gap: 4px; padding: 6px 0 0; }
.bead { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.bead i { display: block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--pen); background: transparent; transition: transform .3s ease, background .3s ease; }
.bead b { font-size: 11px; font-weight: 500; color: var(--pencil); white-space: nowrap; }
.bead.on i { background: var(--pen); transform: scale(1.5); }
.bead.on b { color: var(--pen); font-weight: 700; }
.strip.meter .bead i { width: calc(8px + var(--n, 0) * 20px); height: calc(8px + var(--n, 0) * 20px); background: var(--pen); opacity: calc(.25 + var(--n, 0) * .75); transform: none; }
.strip.meter .bead { justify-content: flex-end; }
.strip.meter .bead small { font-size: 12px; color: var(--pencil); font-variant-numeric: tabular-nums; }

/* --- the answer --- */
.answer { display: flex; flex-direction: column; }
.sec { padding: 14px 0 16px; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 6px; animation: rise .25s ease both; }
.sec:last-child { border-bottom: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sec .eyebrow { display: flex; align-items: center; gap: 6px; }
.sec .eyebrow svg { display: none; }
.sec-say { padding-block: 18px 20px; }
.sec-say .eyebrow { color: var(--pen); }
.sec-say .eyebrow::before { background: var(--pen); }
.say-line { font-size: 22px; font-weight: 600; line-height: 1.7; }
.say-line mark { background: linear-gradient(transparent 10%, var(--marker) 10%, var(--marker) 88%, transparent 88%); color: var(--marker-ink); padding: 0 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sec-me { background: var(--pen-soft); margin-inline: calc(-1 * (var(--gutter) + var(--margin))) calc(-1 * var(--gutter)); padding-inline: calc(var(--gutter) + var(--margin)) var(--gutter); border-bottom: 0; border-radius: 0; }
.sec-me .eyebrow { color: var(--pen); }
.sec-me .eyebrow::before { background: var(--pen); border-color: var(--pen-soft); }
.sec-feedback { border-inline-start: 0; }
.sec-feedback .eyebrow { color: var(--red); }
.sec-feedback .eyebrow::before { border-color: var(--red); background: var(--red); }
.sec-question .eyebrow { color: var(--pen); }
.sec-reinforce .eyebrow { color: var(--green); }
.sec-reinforce .eyebrow::before { border-color: var(--green); background: var(--green); }
.sec-code { padding-block: 22px 8px; gap: 10px; }
.code-word { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; color: var(--pen); }
.code-why { color: var(--pencil); font-size: 15px; max-width: 36ch; }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--pen); vertical-align: text-bottom; margin-inline-start: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.pending { display: flex; align-items: center; gap: 10px; color: var(--pencil); padding: 18px 0; }
.breath { display: flex; align-items: center; gap: 14px; padding: 18px 0; }
.breath-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--pen); animation: breathe 4s ease-in-out infinite; flex: none; }
@keyframes breathe { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.4); opacity: 1; } }

.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { padding: 10px 0; white-space: pre-wrap; }
.bubble.user { color: var(--pencil); border-inline-start: 2px solid var(--rule); padding-inline-start: 12px; }
.bubble.coach { }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 48px; max-height: 140px; }
.composer .btn { flex: none; width: 48px; min-height: 48px; padding: 0; border-radius: 50%; }

.outcome { display: flex; gap: 8px; }
.outcome .btn { flex: 1; min-height: 48px; font-size: 15px; border-color: var(--rule); }
.outcome .btn[aria-pressed="true"] { background: var(--pen); color: #fff; border-color: var(--pen); }
.outcome .btn[data-v="didnt"][aria-pressed="true"] { background: var(--red); border-color: var(--red); }

/* --- lists --- */
.list { display: flex; flex-direction: column; }
.item { padding: 14px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 4px; text-align: start; width: 100%; }
.item .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--pencil); flex-wrap: wrap; }
.item .meta .tag { font-weight: 700; color: var(--pen); }
.item .meta .ok { color: var(--green); }
.item .meta .warm { color: var(--red); }
.item .text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.day-head { font-family: var(--display); font-size: 15px; color: var(--pencil); padding: 18px 0 4px; }

.empty { padding: 36px 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; color: var(--pencil); }
.empty svg { display: none; }
.empty h3 { color: var(--ink); font-family: var(--display); font-size: 22px; }

.error { color: var(--red); display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1.5px solid var(--red); }

/* --- learn --- */
.principle { padding: 4px 0; border-bottom: 1px solid var(--rule-soft); }
.principle summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 700; font-size: 18px; }
.principle summary::-webkit-details-marker { display: none; }
.principle .num { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--pen); color: transparent; font-size: 0; flex: none; }
.principle[open] .num { background: var(--pen); }
.principle .body { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 14px 0; padding-inline-start: 24px; }
.kv { display: flex; gap: 8px; }
.kv b { flex: none; color: var(--pen); }
.kv.trap b { color: var(--red); }
.quote { font-family: var(--display); font-size: 22px; line-height: 1.35; }
.today { padding-block: 22px; }
.today .word { font-family: var(--display); font-size: 34px; color: var(--pen); line-height: 1; }

/* --- login --- */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 24px var(--gutter); }
.login .mark { display: none; }
.login h1 { font-size: 40px; color: var(--pen); }

.install { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (min-width: 640px) {
  :root { --gutter: 28px; }
  h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- round 2: rhythm, hints, practice --- */
.hint { color: var(--pen); font-weight: 500; padding: 4px 0 0; }
.scene { font-size: 19px; line-height: 1.6; }
.today { padding-block: 30px 26px; gap: 8px; }
.today .word { font-size: 40px; }
.today p:first-of-type { font-size: 18px; font-weight: 600; }
.card.today + .card { border-top: 0; }
.btn:active { opacity: .85; }
.chip:active, .tab:active, .item:active { opacity: .7; }
textarea.situation { padding-top: 10px; }
.sec-say .eyebrow::before { transform: scale(1.3); }
.sec-code .eyebrow::before { background: var(--pen); }
.bubble.user { font-size: 17px; }
@media (max-height: 700px) { textarea.situation { min-height: 96px; } }
