/* הסטודיו של אביה: עיצוב. נייר חם, דיו כהה, טיל עמוק לאנגלית, שזיף לכתיבה, ענבר להישגים. */
:root {
  --paper: #f6f1e8;
  --paper-2: #fffdf9;
  --paper-3: #efe8dc;
  --ink: #1c1a17;
  --ink-2: #3d3934;
  --muted: #6f6961;
  --line: #e3dccf;
  --line-2: #d2c9b8;
  --accent: #0f5f5c;
  --accent-soft: #d9ebe8;
  --amber: #c8891a;
  --amber-soft: #f6e6c6;
  --plum: #6b3a7a;
  --plum-soft: #ece0f0;
  --teal: #0f5f5c;
  --teal-soft: #d9ebe8;
  --ok: #2e7d4f;
  --ok-soft: #d8eedf;
  --danger: #b4432f;
  --danger-soft: #f5dcd6;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px rgba(40, 30, 10, .08);
  --shadow-lg: 0 2px 4px rgba(40, 30, 10, .08), 0 20px 50px rgba(40, 30, 10, .14);
  --radius: 18px;
  --radius-sm: 12px;
  --font-he: "Heebo", "Segoe UI", Arial, sans-serif;
  --font-title: "Frank Ruhl Libre", "David", Georgia, serif;
  --font-en: "Literata", Georgia, "Times New Roman", serif;
  --nav-w: 232px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171a; --paper-2: #1d2024; --paper-3: #23272c;
    --ink: #ece7dd; --ink-2: #cfc8bc; --muted: #9f988d;
    --line: #2c3036; --line-2: #3a3f46;
    --accent: #4fb3ad; --accent-soft: #163a38;
    --amber: #e0a84a; --amber-soft: #3b2c10;
    --plum: #b985c9; --plum-soft: #34203b;
    --teal: #4fb3ad; --teal-soft: #163a38;
    --ok: #5cc48a; --ok-soft: #173424;
    --danger: #e07a68; --danger-soft: #3e1d17;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.5), 0 20px 50px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --paper: #15171a; --paper-2: #1d2024; --paper-3: #23272c;
  --ink: #ece7dd; --ink-2: #cfc8bc; --muted: #9f988d;
  --line: #2c3036; --line-2: #3a3f46;
  --accent: #4fb3ad; --accent-soft: #163a38;
  --amber: #e0a84a; --amber-soft: #3b2c10;
  --plum: #b985c9; --plum-soft: #34203b;
  --teal: #4fb3ad; --teal-soft: #163a38;
  --ok: #5cc48a; --ok-soft: #173424;
  --danger: #e07a68; --danger-soft: #3e1d17;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.5), 0 20px 50px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-he); font-size: 16px; line-height: 1.65;
  direction: rtl; min-height: 100vh;
  background-image: radial-gradient(1200px 600px at 100% -10%, rgba(200,137,26,.08), transparent 60%),
                    radial-gradient(900px 500px at -10% 110%, rgba(15,95,92,.08), transparent 60%);
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 700; line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.en { direction: ltr; text-align: left; font-family: var(--font-en); }
.ltr { direction: ltr; text-align: left; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .78rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Shell ===== */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.main, .hero > *, .grid > *, .card { min-width: 0; }
.nav {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 80%, transparent); backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .mark { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--plum), var(--teal)); display: grid; place-items: center; color: #fff; font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; box-shadow: var(--shadow); }
.brand .name { font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.brand .tag { font-size: .72rem; color: var(--muted); }
.nav a.item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink-2);
  font-weight: 500; transition: background .15s, color .15s, transform .15s;
}
.nav a.item:hover { background: var(--paper-3); transform: translateX(-2px); }
.nav a.item.active { background: var(--ink); color: var(--paper); }
.nav a.item svg { width: 20px; height: 20px; flex: none; }
.nav .spacer { flex: 1; }
.nav .foot { font-size: .75rem; color: var(--muted); padding: 8px 12px; }
.nav .foot button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: .75rem; text-decoration: underline; }
.main { padding: 28px 32px 90px; max-width: 1140px; width: 100%; margin: 0 auto; }
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { display: none; }
  .main { padding: 16px 16px 92px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: color-mix(in srgb, var(--paper-2) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); padding: 4px 0; border-radius: 10px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--accent); }
  h1 { font-size: 1.6rem; }
}

/* ===== Components ===== */
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.accent { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--paper-2)), var(--paper-2)); }
.card.plum { border-color: color-mix(in srgb, var(--plum) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--plum-soft) 55%, var(--paper-2)), var(--paper-2)); }
.card.amber { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--amber-soft) 60%, var(--paper-2)), var(--paper-2)); }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.split { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 1000px) { .grid.split { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } .grid.c4.keep2, .grid.c2.keep2, .grid.c3.keep2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; } .mb { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: .95rem; cursor: pointer; transition: transform .12s, box-shadow .12s, background .15s, opacity .15s;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.plum { background: var(--plum); color: #fff; }
.btn.amber { background: var(--amber); color: #1c1a17; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--paper-3); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.lg { padding: 14px 26px; font-size: 1.05rem; }
.btn svg { width: 18px; height: 18px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--paper-3); color: var(--ink-2); border: 1px solid var(--line); }
.chip.plum { background: var(--plum-soft); color: var(--plum); border-color: transparent; }
.chip.teal { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.chip.amber { background: var(--amber-soft); color: #7a4f08; border-color: transparent; }
:root[data-theme="dark"] .chip.amber { color: var(--amber); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.amber { color: var(--amber); } }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.kicker.plum { color: var(--plum); } .kicker.teal { color: var(--teal); } .kicker.amber { color: var(--amber); }

/* Progress ring */
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--accent); transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring.plum .fg { stroke: var(--plum); } .ring.amber .fg { stroke: var(--amber); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; font-family: var(--font-title); }
.ring.lg { width: 120px; height: 120px; } .ring.lg .val { font-size: 1.5rem; }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar.plum > i { background: var(--plum); } .bar.amber > i { background: var(--amber); }

/* Hero / dashboard */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: stretch; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.greeting h1 { font-size: 2.2rem; margin-bottom: 4px; }
.greeting .sub { color: var(--muted); font-size: 1.05rem; }
.streak { display: flex; align-items: center; gap: 14px; }
.streak .flame { width: 54px; height: 54px; border-radius: 16px; background: linear-gradient(160deg, var(--amber), #e8b04a); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow); }
.streak .flame.cold { background: var(--paper-3); color: var(--muted); box-shadow: none; }
.streak .n { font-family: var(--font-title); font-size: 1.9rem; font-weight: 700; line-height: 1; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.week .d { text-align: center; font-size: .72rem; color: var(--muted); }
.week .d i { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; background: var(--paper-3); border: 1px solid var(--line); margin-bottom: 4px; }
.week .d.done i { background: var(--amber); border-color: transparent; }
.week .d.half i { background: linear-gradient(135deg, var(--amber) 50%, var(--paper-3) 50%); }
.week .d.today i { outline: 2px solid var(--ink); outline-offset: 1px; }
.week .d.goal:not(.done):not(.half) i { border-style: dashed; border-color: var(--amber); }

.task { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.task:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.task .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.task .ico.plum { background: var(--plum-soft); color: var(--plum); } .task .ico.teal { background: var(--teal-soft); color: var(--teal); } .task .ico.amber { background: var(--amber-soft); color: var(--amber); }
.task .ico svg { width: 22px; height: 22px; }
.task.done { opacity: .6; } .task.done .t { text-decoration: line-through; }
.task .t { font-weight: 700; } .task .s { color: var(--muted); font-size: .88rem; }

.mentor-say { display: flex; gap: 12px; align-items: flex-start; }
.mentor-say .av { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--plum)); flex: none; display: grid; place-items: center; color: #fff; font-family: var(--font-title); font-weight: 700; }
.mentor-say .bubble { background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 12px 16px; font-size: .98rem; }

/* Units list */
.unit-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.unit-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.unit-row .num { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; background: var(--paper-3); }
.unit-row.plum .num { background: var(--plum-soft); color: var(--plum); } .unit-row.teal .num { background: var(--teal-soft); color: var(--teal); }
.unit-row.done .num { background: var(--ok-soft); color: var(--ok); }
.unit-row.locked { opacity: .55; }
.unit-row .t { font-weight: 700; } .unit-row .s { color: var(--muted); font-size: .85rem; }
.unit-row .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.steps { display: flex; gap: 4px; }
.steps i { width: 10px; height: 10px; border-radius: 3px; background: var(--line-2); }
.steps i.on { background: var(--ok); }

/* Lesson page */
.lesson-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; margin-bottom: 20px; }
@media (max-width: 860px) { .lesson-head { grid-template-columns: 1fr; } }
.lesson-body p { font-size: 1.06rem; line-height: 1.85; max-width: 72ch; }
.lesson-body .en p { font-size: 1.04rem; line-height: 1.8; }
.callout { border-right: 4px solid var(--amber); background: var(--amber-soft); padding: 12px 16px; border-radius: 10px; }
.callout.plum { border-color: var(--plum); background: var(--plum-soft); }
.callout.teal { border-color: var(--teal); background: var(--teal-soft); }
.callout.danger { border-color: var(--danger); background: var(--danger-soft); }
.callout .k { font-weight: 700; margin-bottom: 4px; }
ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px dashed var(--line); }
ul.clean li:last-child { border-bottom: 0; }
ul.clean li::before { content: ""; position: absolute; right: 2px; top: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
ul.clean.plum li::before { background: var(--plum); }
.tabs { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-size: .95rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; flex: none; }
@media (max-width: 860px) { .tabs { margin-left: -16px; margin-right: -16px; padding: 0 16px; } }

/* Keyboard focus */
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 8px; }
.btn:focus-visible, .opt:focus-visible, .nav a.item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: middle; }

/* Exercise editor */
.editor textarea {
  width: 100%; min-height: 260px; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink);
  font-family: var(--font-title); font-size: 1.12rem; line-height: 1.9; resize: vertical; outline: none; transition: border-color .15s, box-shadow .15s;
}
.editor textarea.en { font-family: var(--font-en); }
.editor textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.editor .status { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; gap: 8px; }
.wc { font-weight: 700; } .wc.ok { color: var(--ok); }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.checklist input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.feedback { white-space: pre-wrap; background: var(--paper-3); border-radius: 12px; padding: 14px 16px; line-height: 1.8; border: 1px solid var(--line); }

/* Quiz */
.q { padding: 16px 0; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: 0; }
.q .qt { font-weight: 700; margin-bottom: 10px; font-size: 1.02rem; }
.q .opts { display: grid; gap: 8px; }
.q .opt { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; transition: background .12s, border-color .12s; text-align: right; font-size: .98rem; width: 100%; color: var(--ink); }
.q .opt:hover { background: var(--paper-3); }
.q .opt.sel { border-color: var(--ink); background: var(--paper-3); }
.q .opt.right { border-color: var(--ok); background: var(--ok-soft); }
.q .opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.q .opt .l { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.q input.fill { width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink); font-size: 1rem; outline: none; }
.q input.fill:focus { border-color: var(--accent); }
.q .why { margin-top: 8px; font-size: .88rem; color: var(--muted); }
.score { text-align: center; padding: 24px; }
.score .big { font-family: var(--font-title); font-size: 3rem; font-weight: 700; line-height: 1; }

/* Reading */
.passage { font-family: var(--font-en); direction: ltr; text-align: left; font-size: 1.12rem; line-height: 1.95; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; }
.passage h3 { font-family: var(--font-en); font-style: italic; font-weight: 400; margin-bottom: 12px; }
.passage::first-letter { font-size: 2.6em; float: left; line-height: .9; padding: 6px 8px 0 0; font-weight: 700; color: var(--teal); }

/* Vocab cards */
.flash { perspective: 1200px; }
.flash .inner { position: relative; min-height: 260px; transition: transform .5s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.flash.flipped .inner { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; border: 1px solid var(--line); background: var(--paper-2); box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.flash .face.back { transform: rotateY(180deg); background: linear-gradient(180deg, var(--teal-soft), var(--paper-2)); }
.flash .word { font-family: var(--font-en); font-size: 2.2rem; font-weight: 700; direction: ltr; }
.flash .pos { color: var(--muted); font-size: .85rem; direction: ltr; }
.flash .he { font-size: 1.3rem; font-weight: 700; }
.flash .ex { font-family: var(--font-en); direction: ltr; font-style: italic; color: var(--ink-2); margin-top: 8px; }
.flash .col { font-size: .85rem; color: var(--muted); direction: ltr; margin-top: 4px; }
.rate { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.boxes .b { text-align: center; background: var(--paper-3); border-radius: 10px; padding: 8px 4px; font-size: .78rem; }
.boxes .b b { display: block; font-size: 1.1rem; font-family: var(--font-title); }

/* Speaking practice */
.dlg { display: flex; flex-direction: column; gap: 10px; }
.turn { padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); opacity: .55; transition: opacity .2s, transform .2s; }
.turn .who { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.turn .en { font-size: 1.12rem; line-height: 1.7; }
.turn .he { font-size: .9rem; color: var(--muted); direction: rtl; text-align: right; }
.turn.mine { border-color: color-mix(in srgb, var(--teal) 50%, var(--line)); }
.turn.cur { opacity: 1; transform: scale(1.01); box-shadow: var(--shadow); border-color: var(--teal); }
.turn.done { opacity: .8; }
.word { padding: 0 2px; border-radius: 4px; }
.word.ok { background: var(--ok-soft); color: var(--ok); }
.word.miss { background: var(--danger-soft); color: var(--danger); text-decoration: underline dotted; }
.mic-btn { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--teal); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); transition: transform .15s; }
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.listening { animation: pulse 1s infinite; background: var(--danger); }
.mic-btn svg { width: 30px; height: 30px; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 40%, transparent) } 50% { box-shadow: 0 0 0 14px transparent } }

/* Inbox */
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #1c1a17; font-size: .72rem; font-weight: 700; margin-right: auto; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread .msg { max-width: 92%; }
.inbox-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.inbox-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.inbox-item.new { border-color: var(--amber); background: linear-gradient(90deg, var(--amber-soft), var(--paper-2)); }
.inbox-item .t { font-weight: 700; } .inbox-item .x { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 460px; }
.chat .log { flex: 1; overflow-y: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; line-height: 1.75; white-space: pre-wrap; font-size: .98rem; }
.msg.me { align-self: flex-start; background: var(--ink); color: var(--paper); border-radius: 16px 4px 16px 16px; }
.msg.ai { align-self: flex-end; background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: .82rem; }
.msg .typing { display: inline-flex; gap: 4px; } .msg .typing i { width: 7px; height: 7px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; } .msg .typing i:nth-child(2) { animation-delay: .2s } .msg .typing i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.composer textarea { flex: 1; min-height: 48px; max-height: 180px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink); font-family: inherit; font-size: 1rem; resize: none; outline: none; }
.composer textarea:focus { border-color: var(--accent); }
.modes { display: flex; gap: 6px; flex-wrap: wrap; }
.modes button { border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; font-size: .85rem; cursor: pointer; font-weight: 600; }
.modes button.active { background: var(--accent); color: #fff; border-color: transparent; }

/* Badges & levels */
.badge { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); }
.badge .ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); flex: none; }
.badge.locked { opacity: .45; filter: grayscale(1); }
.badge .t { font-weight: 700; } .badge .s { font-size: .82rem; color: var(--muted); }
.level { display: flex; align-items: center; gap: 12px; }
.level .lv { width: 46px; height: 46px; border-radius: 14px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-family: var(--font-title); font-weight: 700; font-size: 1.2rem; }

/* Notebook */
.note { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.note:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note .t { font-weight: 700; font-family: var(--font-title); font-size: 1.1rem; }
.note .x { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Tables */
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
table.t th { color: var(--muted); font-weight: 600; font-size: .8rem; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); opacity: 0; transition: all .3s; z-index: 100; font-weight: 600; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 860px) { .toast { bottom: 84px; } }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 16, 10, .45); display: grid; place-items: center; z-index: 90; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: var(--paper-2); border-radius: 20px; padding: 24px; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto; }

/* Settings */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink); font-size: 1rem; font-family: inherit; }
.daypick { display: flex; gap: 6px; }
.daypick button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-2); font-weight: 700; cursor: pointer; }
.daypick button.on { background: var(--ink); color: var(--paper); border-color: transparent; }

/* Program timeline */
.timeline { display: grid; gap: 10px; }
.tl { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper-2); }
.tl .wk { font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; }
.tl.now { border-color: var(--amber); background: linear-gradient(90deg, var(--amber-soft), var(--paper-2)); }
.tl.past { opacity: .7; }

/* Confetti-ish celebration */
.celebrate { animation: pop .5s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { 0% { transform: scale(.94); opacity: .5 } 100% { transform: scale(1); opacity: 1 } }
.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: .55; transform: translateY(5px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { .fade-in, .celebrate { animation: none; } }

/* Print */
@media print { .nav, .bottom-nav, .btn, .composer { display: none !important; } .main { padding: 0; } .card { box-shadow: none; } }
