/* Identity: the squared school notebook. Blue grid paper, red margin line on the
   right (Hebrew notebooks), ballpoint-blue ink, and one yellow highlighter reserved
   for the identity sentence. Handwriting (Playpen Sans Hebrew) for headings, Rubik for text. */
:root {
  --bg: #fbfcfe; --surface: #ffffff; --fg: #2a2f3b; --muted: #5e6677;
  --line: #b8c3d6; --border: #dce5f3; --grid: #e6edf8;
  --accent: #1d3faf; --accent-ink: #ffffff; --accent-soft: #e6ecfb;
  --t-fill: #ffffff; --t-stroke: #1d3faf; --t-text: #1d3faf;
  --p-fill: #ffe14d; --p-stroke: #c9a800; --p-text: #2a2f3b;
  --margin: #d8344b; --hl: #ffe14d; --hl-ink: #1e1b10;
  --warn-bg: #fff4c7; --warn-fg: #6b5300;
  --danger: #b3261e;
  --shadow: none;
  --font: 'Rubik', 'Arial Hebrew', Arial, sans-serif;
  --font-hand: 'Playpen Sans Hebrew', 'Rubik', 'Arial Hebrew', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a30; --surface: #16233f; --fg: #e7ecf7; --muted: #a3aec6;
    --line: #3a4a6e; --border: #22325a; --grid: #172642;
    --accent: #9db6ff; --accent-ink: #0f1a30; --accent-soft: #1e2f57;
    --t-fill: #16233f; --t-stroke: #9db6ff; --t-text: #cfdbff;
    --p-fill: #ffe14d; --p-stroke: #e8c200; --p-text: #1e1b10;
    --margin: #e0566a; --hl: #ffe14d; --hl-ink: #1e1b10;
    --warn-bg: #3a2f0c; --warn-fg: #ffe9a3;
    --danger: #ff9a8f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a30; --surface: #16233f; --fg: #e7ecf7; --muted: #a3aec6;
  --line: #3a4a6e; --border: #22325a; --grid: #172642;
  --accent: #9db6ff; --accent-ink: #0f1a30; --accent-soft: #1e2f57;
  --t-fill: #16233f; --t-stroke: #9db6ff; --t-text: #cfdbff;
  --p-fill: #ffe14d; --p-stroke: #e8c200; --p-text: #1e1b10;
  --margin: #e0566a; --hl: #ffe14d; --hl-ink: #1e1b10;
  --warn-bg: #3a2f0c; --warn-fg: #ffe9a3;
  --danger: #ff9a8f; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; inset-inline-start: 8px; top: -40px; background: var(--accent); color: var(--accent-ink); padding: 6px 12px; border-radius: 6px; z-index: 20; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--p-stroke); outline-offset: 2px; }

.wrap {
  max-width: 720px; margin: 0 auto;
  padding-inline: max(16px, env(safe-area-inset-left, 0px));
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-in { max-width: 720px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; fill: var(--t-fill); stroke: var(--t-stroke); stroke-width: 1.3; }
.brand .b-c { fill: var(--p-fill); stroke: var(--p-stroke); }
nav { display: flex; gap: 2px; margin-inline-start: auto; overflow-x: auto; scrollbar-width: none; }
nav a { text-decoration: none; font-size: 14px; color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
nav a:hover { color: var(--fg); background: var(--surface); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
@media (max-width: 560px) { .brand span { display: none; } }

main.wrap { display: flex; flex-direction: column; gap: 20px; padding-block: 28px 32px; }

/* Hero */
.hero { padding-top: 8px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; font-weight: 800; margin: 0 0 10px; text-wrap: balance; }
.sub { margin: 0; color: var(--muted); max-width: 56ch; font-size: 17px; }
h2 { font-size: 20px; margin: 0; font-weight: 700; }
h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.muted { color: var(--muted); margin: 2px 0 0; }

/* Form */
label, legend { display: block; font-weight: 500; margin: 0 0 6px; padding: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
textarea, input[type="text"], .tr-add input {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { resize: vertical; min-height: 96px; }
textarea:focus, .tr-add input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  font: inherit; font-size: 14px; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.field { margin-top: 16px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.seg label { margin: 0; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 7px 4px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); outline: 1px solid var(--border); }
.seg input:focus-visible + span { outline: 3px solid var(--p-stroke); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.btn {
  font: inherit; font-weight: 500; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn.done { background: var(--accent-soft); border-color: var(--accent); color: var(--t-text); }
#status { min-height: 1.4em; margin: 10px 0 0; font-size: 15px; color: var(--muted); }
#status.err { color: var(--danger); }
.note { font-size: 13px; color: var(--muted); margin: 10px 0 0; }

/* Result */
.result-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { display: inline-block; font-size: 13px; font-weight: 500; color: var(--p-text); background: var(--p-fill); border-radius: 6px; padding: 2px 10px; }
.domains { font-size: 13px; color: var(--muted); }
.identity { font-size: 21px; font-weight: 500; line-height: 1.4; margin: 10px 0 4px; text-wrap: balance; }
.map-wrap { margin: 4px auto 0; max-width: 460px; }
#map { width: 100%; height: auto; display: block; overflow: visible; }
#map .center circle { fill: var(--p-fill); stroke: var(--p-stroke); stroke-width: 1; }
#map .center text { fill: var(--p-text); }
#map .bubble { cursor: pointer; outline: none; }
#map .bubble circle { fill: var(--t-fill); stroke: var(--t-stroke); stroke-width: 1; transition: stroke-width .15s ease; }
#map .bubble:hover circle { stroke-width: 2; }
#map .bubble.sel circle { stroke-width: 3; }
#map .bubble:focus-visible circle { stroke: var(--p-stroke); stroke-width: 3; }
#map .bubble text { fill: var(--t-text); }
#map .bubble .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
#map text { font-family: var(--font); font-size: 13.5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
#map line { stroke: var(--line); stroke-width: .8; stroke-dasharray: 3 2; }
#map .pop { animation: pop .35s ease both; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
#map .pop { transform-box: fill-box; transform-origin: center; }

.detail { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 14px; }
.detail h2 { color: var(--t-text); }
.dhow { margin: 2px 0 0; }
.k { font-size: 13px; color: var(--muted); margin: 14px 0 4px; font-weight: 500; }
.stack { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 4px 14px 12px; margin-top: 12px; }
.stack .k { margin-top: 8px; }
.stack-line { margin: 0 0 10px; font-weight: 500; }
.stack-line b { color: var(--p-text); font-weight: 700; }
.habits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.habits li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.habits li .lvl { font-size: 12px; color: var(--p-text); background: var(--p-fill); border-radius: 5px; padding: 0 6px; margin-inline-start: 6px; white-space: nowrap; }
.add { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.add.done { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.two { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .two { grid-template-columns: 1fr 1fr; } }
.two .panel p { margin: 0; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
#copybox { min-height: 140px; }

/* Tracker */
.tr-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.votes { text-align: center; background: var(--accent-soft); border-radius: 12px; padding: 6px 14px; color: var(--t-text); }
.votes strong { display: block; font-size: 26px; line-height: 1.1; font-weight: 800; font-variant-numeric: tabular-nums; }
.votes span { font-size: 12px; }
.warn { background: var(--warn-bg); color: var(--warn-fg); border-radius: 10px; padding: 8px 12px; margin: 14px 0 0; font-size: 14px; }

.tr-days, .tr-row { display: grid; grid-template-columns: 1fr repeat(7, 30px) 44px; gap: 4px; align-items: center; }
.tr-days { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; }
.tr-days span:first-child { text-align: start; }
.tr-days .today { color: var(--accent); font-weight: 700; }
.tr-list { list-style: none; margin: 4px 0 0; padding: 0; }
.tr-row { padding: 8px 0; border-top: 1px solid var(--border); }
.tr-name { min-width: 0; font-size: 15px; line-height: 1.35; display: flex; gap: 6px; align-items: center; }
.tr-name span { overflow-wrap: anywhere; }
.tr-del { flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 0 4px; opacity: .6; }
.tr-del:hover { opacity: 1; color: var(--danger); }
.day {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line);
  background: transparent; cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--accent-ink);
}
.day.on { background: var(--accent); border-color: var(--accent); }
.day.on::after { content: ''; width: 9px; height: 5px; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.day.today { border-color: var(--accent); border-width: 2px; }
.streak { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.streak.hot { color: var(--accent); }
.empty { color: var(--muted); padding: 18px 0 6px; border-top: 1px solid var(--border); margin-top: 8px; text-align: center; }
.tr-add { display: flex; gap: 8px; margin-top: 14px; }
.tr-add input { flex: 1; }
@media (max-width: 480px) {
  .tr-days, .tr-row { grid-template-columns: 1fr repeat(7, 24px) 34px; gap: 3px; }
  .day { width: 24px; height: 24px; }
}

/* Laws */
.laws h2 { margin-bottom: 12px; }
.law-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .law-grid { grid-template-columns: 1fr 1fr; } }
.law-grid li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; gap: 12px; }
.law-grid .n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--p-fill); color: var(--p-text); display: grid; place-items: center; font-weight: 800; }
.law-grid p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.foot { font-size: 13px; color: var(--muted); padding-block: 0 calc(32px + env(safe-area-inset-bottom, 0px)); }

.toast {
  position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px);
  background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 10px; font-size: 14px; z-index: 30;
  animation: pop .2s ease both;
}



/* AI mode */
.mode { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: -4px 0 12px; flex-wrap: wrap; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.mode-dot.on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.link { font: inherit; background: none; border: 0; padding: 0; color: var(--p-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; margin-inline-start: auto; }
.source { font-size: 12px; color: var(--t-text); background: var(--t-fill); border-radius: 6px; padding: 1px 8px; margin-inline-start: auto; }
.result.busy { opacity: .55; pointer-events: none; transition: opacity .2s; }
.btn:disabled { opacity: .55; cursor: default; }

dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--fg); padding: 20px; width: min(480px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 14, 22, .45); }
dialog h2 { margin-bottom: 4px; }
dialog input[type="password"], dialog input[type="url"] { width: 100%; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; margin: 0; font-weight: 400; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { margin-top: 5px; accent-color: var(--accent); }
.opt b { display: block; font-weight: 700; }
.opt small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.err-line { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 10px 0 0; }
.captcha:empty { display: none; }
.captcha { margin-top: 14px; }
.tr-del.armed { opacity: 1; color: var(--danger); font-size: 12px; font-weight: 700; white-space: nowrap; }
.suggest { border-style: dashed; }
.suggest .actions { margin-top: 10px; }

/* Todoist */
.todoist { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin-top: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.td-icon { flex: none; width: 28px; height: 28px; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.td-icon path { fill: none; }
.td-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.td-text .muted { font-size: 14px; margin: 0; }
.td-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Steps */
.step { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.plan h2, .finish h2 { margin-bottom: 4px; }

/* Plan */
.plan-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-row { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.pr-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.pr-text { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.pr-sched { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.pr-sched select, .pr-time input { font: inherit; font-size: 14px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }
.pr-time { margin: 0; font-weight: 400; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day-chip { font: inherit; font-size: 13px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; padding: 0; }
.day-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.pr-due { margin: 0; font-size: 13px; color: var(--t-text); }
.plan .empty { list-style: none; color: var(--muted); padding: 18px 0 6px; text-align: center; border: 1px dashed var(--border); border-radius: 12px; }

/* Finish */
.finish-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
@media (min-width: 620px) { .finish-grid { grid-template-columns: 1fr 1fr; } }
.finish-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.finish-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; }
.finish-card .muted { font-size: 14px; margin: 0; }
.finish-card .note { margin: 0; }
.finish .row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.finish .todoist { margin: 0; }

/* Print summary (Save as PDF) */
.print-summary { display: none; }
@media print {
  @page { margin: 16mm; }
  body { background: #fff; color: #1d2230; }
  body > *:not(.print-summary) { display: none !important; }
  .print-summary { display: block; direction: rtl; font-family: var(--font); color: #1d2230; font-size: 12pt; line-height: 1.5; }
  .ps-head { border-bottom: 2px solid #0f6e56; padding-bottom: 10px; margin-bottom: 14px; }
  .ps-eyebrow { margin: 0; color: #0f6e56; font-weight: 700; font-size: 10pt; }
  .print-summary h1 { font-size: 20pt; line-height: 1.25; margin: 6px 0; }
  .ps-goal { margin: 0; color: #5b6372; }
  .print-summary h2 { font-size: 13pt; margin: 16px 0 6px; color: #0f6e56; }
  .ps-traits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ps-trait { border: 1px solid #dde1e8; border-radius: 8px; padding: 8px 10px; break-inside: avoid; }
  .ps-trait h3 { margin: 0 0 2px; font-size: 12pt; }
  .ps-trait p { margin: 0; font-size: 10.5pt; }
  .ps-stack { color: #3c3489; margin-top: 4px !important; }
  .ps-plan { list-style: none; margin: 0; padding: 0; }
  .ps-plan li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eceef3; break-inside: avoid; }
  .ps-box { width: 12px; height: 12px; border: 1.5px solid #1d2230; border-radius: 3px; flex: none; }
  .ps-habit { flex: 1; }
  .ps-when { color: #5b6372; font-size: 10.5pt; white-space: nowrap; }
  .ps-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .ps-two p { margin: 0; }
  .ps-laws { margin: 0; padding-inline-start: 18px; font-size: 10.5pt; }
  .ps-foot { margin-top: 18px; color: #5b6372; font-size: 9pt; }
}
.td-direct { display: flex; flex-direction: column; gap: 4px; }
.td-direct label { margin: 0; font-size: 14px; }
.td-direct input { width: 100%; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.td-direct .note { margin: 0; }
.td-direct a { color: var(--p-text); }
.td-steps { margin: 2px 0 0; padding-inline-start: 18px; font-size: 13px; color: var(--muted); }
.td-steps li { margin: 2px 0; }
.td-steps a { color: var(--p-text); }
.ver { opacity: .6; }

/* Ideas */
.ideas { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ideas-q { margin: 0; font-size: 14px; color: var(--muted); }
.ideas .row { margin-top: 0; }
.ideas .link { margin-inline-start: 0; font-size: 14px; }

/* Widget guide */
.guide h2 { margin-bottom: 4px; }
.guide > .muted { max-width: 62ch; }
.guide a { color: var(--p-text); }
.guide-steps { margin: 12px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.guide-tabs { display: inline-grid; grid-template-columns: 1fr 1fr; margin-top: 14px; min-width: 220px; }
.guide-tabs button { font: inherit; font-size: 14px; border: 0; background: none; color: var(--muted); padding: 7px 12px; border-radius: 7px; cursor: pointer; }
.guide-tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); outline: 1px solid var(--border); }
.guide-cards { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.guide-cards li { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; }
.guide-cards p { margin: 0; font-size: 14px; line-height: 1.5; }
.ill { width: 100%; max-width: 140px; height: auto; margin: 0 auto; display: block; }
.ill-phone { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.ill-app rect, .ill-app circle { fill: var(--p-fill); stroke: var(--p-stroke); stroke-width: .8; }
.ill-pill, .ill-search, .ill-menu { fill: var(--bg); stroke: var(--border); stroke-width: 1; }
.ill-widget { fill: var(--bg); stroke: var(--border); stroke-width: 1.2; }
.ill-row { fill: transparent; }
.hl { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
.ill-btn { fill: var(--accent); }
.ill-lines circle { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.ill-lines rect { fill: var(--line); }
.ill-lines circle.done { fill: var(--accent); stroke: var(--accent); }
.ill-lines rect.done { opacity: .4; }
.ill-dots circle { fill: var(--line); } .ill-dots circle.on { fill: var(--fg); }
.ill-touch { fill: var(--accent); opacity: .25; } .ill-touch-c { fill: var(--accent); }
.ill-arrow { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ill-t { font-family: var(--font); font-size: 6px; text-anchor: middle; fill: var(--fg); font-weight: 500; }
.ill-t.big { font-size: 7.5px; } .ill-t.dim { fill: var(--muted); } .ill-t.light { fill: var(--accent-ink); font-weight: 700; } .ill-t.acc { fill: var(--accent); font-weight: 700; }
@media (prefers-reduced-motion: no-preference) {
  .wiggle rect { animation: wig 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .wiggle rect:nth-child(even) { animation-delay: -.6s; }
}
@keyframes wig { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }


/* ================= Notebook identity ================= */
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center top;
}
h1, h2, h3, .detail h2, .brand span, .finish-card h3 { font-family: var(--font-hand); font-weight: 600; letter-spacing: 0; }
h1, h2, .detail h2 { color: var(--accent); }

/* The page: one sheet with a red margin line on the right (inline-start in RTL) */
main.wrap { position: relative; padding-inline-start: max(56px, env(safe-area-inset-right, 0px)); gap: 8px; }
main.wrap::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  inset-inline-start: 38px; width: 2px; background: var(--margin); opacity: .55;
}
@media (max-width: 560px) {
  main.wrap { padding-inline-start: 44px; }
  main.wrap::before { inset-inline-start: 28px; }
}

/* Sections sit on the paper, not in cards */
.panel, .law-grid li { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 22px 0; }
main.wrap > section + section, main.wrap > form + section, main.wrap > section + form, main.wrap > div + section {
  border-top: 1.5px dashed var(--line);
}
.panel.suggest { border: 1.5px dashed var(--margin); border-radius: 10px; padding: 14px 16px; }
.two { gap: 20px; }
.two .panel { padding: 0; }
.two .panel h3 { color: var(--accent); }

/* Step numbers handwritten in the margin, like a teacher's red pen */
.mnum {
  position: absolute; inset-inline-start: -50px; top: 18px; width: 30px; text-align: center;
  font-family: var(--font-hand); font-weight: 700; font-size: 28px; line-height: 1; color: var(--margin);
}
@media (max-width: 560px) { .mnum { inset-inline-start: -40px; font-size: 22px; } }
#build, #plan, #finish, #result { position: relative; }

/* Hero: the thesis, written in ink */
.hero { padding-top: 18px; padding-bottom: 6px; }
.hero h1 { font-size: clamp(30px, 6.5vw, 46px); line-height: 1.22; font-weight: 700; max-width: 18ch; margin-bottom: 12px; }
.hero .sub { color: var(--fg); max-width: 52ch; }

/* The one bold element: the identity sentence, highlighted */
.identity {
  font-family: var(--font-hand); font-weight: 600; font-size: clamp(22px, 4.6vw, 28px); line-height: 1.5;
  color: var(--hl-ink); margin: 14px 0 6px;
}
.identity span {
  background: var(--hl); padding: 0 .25em; border-radius: .3em .1em .35em .15em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.identity { color: var(--fg); }
.identity span { color: var(--hl-ink); }

/* Inputs and buttons: pen on paper */
textarea, .tr-add input, .td-direct input, .pr-sched select, .pr-time input { background: var(--surface); border: 1.5px solid var(--line); }
textarea:focus, .tr-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn { border-radius: 8px; border-width: 1.5px; }
.btn.primary { box-shadow: 2px 2px 0 var(--fg); }
.btn.primary:active { box-shadow: none; transform: translate(2px, 2px); }
.chip { background: var(--surface); border: 1.5px solid var(--line); color: var(--fg); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.seg { background: transparent; border: 1.5px solid var(--line); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); outline: 0; box-shadow: none; }

/* Result: the map drawn in ink, centre marked with the highlighter */
.tag { background: transparent; color: var(--margin); padding: 0; font-family: var(--font-hand); font-size: 15px; }
.source, .domains { background: transparent; padding: 0; color: var(--muted); }
#map .bubble circle { stroke-width: 1.6; }
#map .bubble.sel circle { stroke-width: 3.2; }
#map .center circle { fill: var(--hl); stroke: none; }
#map .center text { fill: var(--hl-ink); }
#map text { font-family: var(--font-hand); font-weight: 600; }
#map line { stroke: var(--accent); opacity: .45; stroke-dasharray: 2 4; stroke-linecap: round; }
.detail { border-top: 1.5px dashed var(--line); }
.stack { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.stack-line b { color: var(--accent); }
.habits li { background: var(--surface); border: 1.5px solid var(--border); }
.habits li .lvl { background: var(--hl); color: var(--hl-ink); }

/* Plan rows, finish cards, guide: light paper slips */
.plan-row, .finish-card, .guide-cards li { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; }
.day-chip { background: var(--surface); }
.pr-due { color: var(--accent); font-family: var(--font-hand); font-size: 14px; }
.law-grid .n { background: transparent; color: var(--margin); font-family: var(--font-hand); font-size: 26px; width: auto; height: auto; }
.law-grid li { border-top: 1.5px dashed var(--line); padding: 14px 0; gap: 14px; }
.law-grid p { color: var(--fg); }
.step { display: none; }
.top { background: color-mix(in srgb, var(--bg) 90%, transparent); }
.badge { background: var(--margin); color: #fff; }
.foot { padding-inline-start: max(56px, env(safe-area-inset-right, 0px)); }
.pr-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }

/* Questionnaire */
.q { border: 0; margin: 18px 0 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.q:first-of-type { margin-top: 6px; }
.q legend, .q > label { font-weight: 500; margin: 0 0 8px; padding: 0; }
.q-hint { font-weight: 400; font-size: 13px; color: var(--muted); margin-inline-start: 6px; }
.q input[type="text"], .q input:not([type]) { width: 100%; font: inherit; color: var(--fg); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.q input:not([type]):focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.q .row { margin-top: 0; }
.q .link { align-self: flex-start; margin: 0; font-size: 14px; }
.chip.area[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 420px) { .seg4 span { font-size: 13px; padding-inline: 2px; } }
.free { margin-top: 18px; }
.free summary { cursor: pointer; color: var(--accent); font-weight: 500; width: max-content; max-width: 100%; }
.free[open] summary { margin-bottom: 10px; }
.free textarea { min-height: 80px; }

/* Start small */
.start-here { display: inline-block; margin: -4px 0 10px; font-family: var(--font-hand); font-weight: 600; color: var(--hl-ink); background: var(--hl); border-radius: .3em .1em .35em .15em; padding: 0 .4em; }
.plan-limit { margin: 12px 0 0; font-size: 14px; color: var(--accent); font-family: var(--font-hand); }

/* Opening animation */
html.intro-on, html.intro-on body { overflow: hidden; }
.intro {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 56px 20px 24px;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px; overflow: auto;
}
.intro-skip { position: absolute; top: 14px; inset-inline-end: 14px; font: inherit; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.intro-scene { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.intro-q { font-family: var(--font-hand); font-size: clamp(28px, 7vw, 40px); line-height: 1.25; color: var(--accent); margin: 0 0 8px; }
.intro-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.intro-list li {
  text-align: start; font-size: 17px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 10px 14px; display: flex; gap: 10px; align-items: center; opacity: 0; transform: translateY(8px);
  transition: opacity .65s, transform .65s, border-color .4s, background .4s;
}
.intro-list li::before { content: ''; flex: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 800; line-height: 1; transition: background .3s; }
.intro-list li.in { opacity: 1; transform: none; }
.intro-list li.on { border-color: var(--margin); }
.intro-list li.on::before { content: '✓'; background: var(--margin); border-color: var(--margin); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .intro-list li.on::before { animation: tick .5s cubic-bezier(.3,1.6,.5,1); } }
@keyframes tick { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
.intro-punch { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: clamp(26px, 6.5vw, 36px); line-height: 1.25; }
@media (prefers-reduced-motion: no-preference) {
  .intro.b .intro-punch { animation: rise .5s ease-out; }
  .intro.b .phone { animation: rise .6s .25s ease-out both; }
  .intro.b mark { background-size: 0 100%; animation: sweep .6s .5s ease-out forwards; }
}
/* a highlighter mark: the whole word sits inside the yellow, with room on every side */
mark { display: inline-block; background: linear-gradient(var(--hl), var(--hl)) no-repeat right center / 100% 100%; color: var(--hl-ink); padding: .02em .32em .1em; border-radius: .28em; line-height: 1.15; transform: rotate(-1.5deg); white-space: nowrap; }
.intro:focus { outline: none; }
@keyframes sweep { to { background-size: 100% 100%; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.intro-cap { margin: 0; font-weight: 700; font-family: var(--font-hand); font-size: 18px; min-height: 1.5em; }
.intro-go { min-width: 200px; }
.foot .replay { font-size: 13px; color: var(--accent); }

/* Home screen demo */
.phone {
  position: relative; width: min(210px, 24vh); aspect-ratio: 9 / 19; flex: none; border-radius: 34px; padding: 12px;
  background: #1c2233; box-shadow: 0 0 0 2px var(--line);
}
.ph-notch { position: absolute; top: 18px; left: 50%; width: 30%; height: 16px; border-radius: 9px; background: #1c2233; transform: translateX(-50%); z-index: 3; }
.ph-stage {
  position: relative; width: 100%; height: 100%; border-radius: 24px; overflow: hidden; container-type: inline-size;
  background: linear-gradient(160deg, #cfdcff, #ffe9b8);
}
.ph-stage::before { content: ''; position: absolute; inset: 0; padding-top: 14%; }
.ph-app {
  position: absolute; width: 17.5%; aspect-ratio: 1; border-radius: 24%; display: grid; place-items: center;
  font-size: 9cqw; line-height: 1; margin-top: 9%; will-change: transform, top;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.ph-app.c1 { background: #ffd2d2; } .ph-app.c2 { background: #d6e4ff; } .ph-app.c3 { background: #ffe7a8; } .ph-app.c4 { background: #cdeedd; }
.ph-app.c5 { background: #e6d8ff; } .ph-app.c6 { background: #ffdcc2; } .ph-app.c7 { background: #d3f0f7; } .ph-app.c8 { background: #f4f4f4; }
.ph-badge {
  position: absolute; top: -12%; inset-inline-end: -12%; min-width: 42%; height: 42%; border-radius: 99px; padding: 0 2px;
  background: #e5243b; color: #fff; font: 700 5cqw/1 var(--font); display: grid; place-items: center;
}
.ph-widget {
  position: absolute; top: 9%; inset-inline: 6%; height: 31%; margin-top: 4%; border-radius: 10cqw; padding: 6cqw;
  background: rgba(255,255,255,.92); color: #1e2433; display: flex; flex-direction: column; gap: 3.5cqw; box-shadow: 0 2px 8px rgba(0,0,0,.12);
  opacity: 0;
}
.ph-w-h { font: 700 6.5cqw/1.2 var(--font); color: #d8344b; display: flex; justify-content: space-between; }
.ph-w-h span { color: #8a92a6; font-weight: 500; }
.ph-w-row { display: grid; grid-template-columns: auto 1fr; gap: 0 3cqw; align-items: start; font: 500 5.4cqw/1.3 var(--font); border-bottom: 1px solid #e3e7ef; padding-bottom: 3cqw; }
.ph-w-row i { width: 5.5cqw; height: 5.5cqw; border-radius: 50%; border: 1.5px solid #8a92a6; margin-top: .6cqw; grid-row: span 2; }
.ph-w-row span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ph-w-row small { font-size: 4.4cqw; color: #2a8a5a; }
.ph-lib { position: absolute; bottom: 25%; inset-inline: 0; text-align: center; font: 500 4.8cqw/1 var(--font); color: #3a4257; opacity: 0; }
.ph-dots { position: absolute; bottom: 21%; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; z-index: 2; pointer-events: none; }
.ph-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(30,36,51,.35); }
.ph-dots i.on { background: rgba(30,36,51,.85); }
.ph-stage::after { content: ''; position: absolute; inset-inline: 4%; bottom: 3%; height: 15%; border-radius: 9cqw; background: rgba(255,255,255,.4); }
.ph-app { z-index: 1; }
.screen-h { margin-top: 20px; font-size: 17px; }
.screen-steps { gap: 8px; }

/* Wizard: one step per screen */
[data-step]:not(.cur) { display: none !important; }
.stepper { list-style: none; display: flex; gap: 2px; margin: 0 auto; padding: 0; align-items: center; }
.stepper li { display: flex; align-items: center; }
.stepper li + li::before { content: ''; width: 10px; height: 2px; background: var(--border); margin-inline: 2px; }
.stepper button {
  font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 5px; padding: 4px 4px; border-radius: 8px; white-space: nowrap;
}
.stepper .n {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  border: 1.5px solid var(--line); background: var(--surface);
}
.stepper button.done .n { background: var(--accent-soft); border-color: var(--accent); color: var(--t-text); }
.stepper button[aria-current="step"] { color: var(--fg); font-weight: 700; }
.stepper button[aria-current="step"] .n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 520px) { .stepper button:not([aria-current]) .l { display: none; } .stepper li + li::before { width: 8px; } }
.stepper .badge { display: none !important; }
/* in the flow at the end of each step: nothing floats over the content */
.step-nav { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0 0; }
.step-nav .btn.primary { margin-inline-start: auto; }
.link.inline { margin: 0; font-size: inherit; }
details.more { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--accent); }
details.more[open] summary { margin-bottom: 8px; }
.phone-steps { gap: 8px; }
#resultNote:empty { display: none; }

/* Step 1: one question per screen */
#build [data-q]:not(.qcur) { display: none !important; }
#build .q.qcur > label, #build .q.qcur > legend { font-size: 19px; font-weight: 700; font-family: var(--font-hand); }
.q-nav { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.q-count { font-size: 13px; color: var(--muted); }
.q-dots { display: flex; gap: 4px; }
.q-dots i { width: 12px; height: 4px; border-radius: 2px; background: var(--border); }
.q-dots i.on { background: var(--accent); }
.q-nav #qNext { min-width: 96px; }
.q-nav #qBack { margin-inline-start: auto; }
.q-nav #qBack[hidden] + #qNext { margin-inline-start: auto; }
.q-count { white-space: nowrap; }
.q-nav #qBack { order: 3; }
.q-nav #qNext { order: 4; }
.ps-next { margin: 6px 0 0; font-size: 13px; }

/* Privacy page */
.privacy { display: flex; flex-direction: column; gap: 14px; padding-block: 28px 32px; max-width: 760px; }
.privacy .panel h2 { margin-bottom: 6px; }
.privacy .panel p { margin: 6px 0 0; }
.privacy ul { margin: 6px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.privacy a { color: var(--accent); }
.back-home { margin-inline-start: auto; text-decoration: none; }
.foot a { color: var(--accent); }

/* Buy me a coffee */
.tip { margin-top: 16px; padding: 14px; border: 1.5px dashed var(--p-stroke); border-radius: 12px; background: color-mix(in srgb, var(--hl) 14%, transparent); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tip p { margin: 0; flex: 1 1 220px; font-size: 15px; }
.tip .btn { text-decoration: none; color: var(--fg); background: var(--surface); border-color: var(--line); }

/* "לפנות אליך ב: אתה / את" */
.gender { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.gender label { cursor: pointer; }
.gender input { position: absolute; opacity: 0; pointer-events: none; }
.gender label span { display: inline-block; padding: 3px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--fg); }
.gender input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.gender input:focus-visible + span { outline: 3px solid var(--p-stroke); outline-offset: 2px; }

/* ready-made plans */
.presets { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.presets-q { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.chip.preset { border-style: dashed; }
