/* Design "A · Abendmarkt": lavender ground, night purple, saffron. */
:root {
  --bg: #F5F3FA;          /* ground */
  --surface: #FFFFFF;
  --ink: #1A1730;
  --muted: #615C75;       /* 5.9:1 on ground */
  --line: #E7E3F0;
  --accent: #F2A93B;      /* saffron: fills, progress, primary buttons (dark ink on it, 9:1) */
  --accent-ink: #1A1730;
  --accent-text: #8A4B00; /* saffron as text: 6.9:1 on white */
  --accent-soft: rgb(242 169 59 / .25);
  --plum: #2B2350;        /* night purple: hero cards, active elements (white text on it) */
  --plum-ink: #FFFFFF;
  --plum-sub: #D9D4EC;
  --plum-soft: rgb(255 255 255 / .12);
  --user: #2B2350;
  --user-ink: #FFFFFF;
  --chip: #EAE6F8;        /* soft lavender: chips */
  --chip-ink: #2B2350;
  --track: #EEEAF5;       /* progress tracks */
  --word: #FFF4E2;        /* Thai word card */
  --word-ink: #3D2300;
  --rom: #6B3A00;
  --word-line: #E8D3AE;
  --rec: #C8402F;
  --ok: #1E6B3C;
  --ok-bg: #DFF3E6;
  --bad: #9A2B1A;
  --bad-bg: #FCE3DE;
  --shadow: 0 1px 3px rgb(26 23 48 / .08);
  --shadow-lift: 0 6px 20px rgb(43 35 80 / .12);
  --shadow-hero: 0 12px 30px rgb(43 35 80 / .28);
  /* Plus Jakarta Sans (self-hosted) covers Latin only; every other script uses the device's fonts
     (no web-font requests). The script stacks below come first for those UI languages. */
  --sys: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font: "Plus Jakarta Sans", var(--sys);
  --display: "Plus Jakarta Sans", var(--sys);
  --thai: "Noto Sans Thai", "Plus Jakarta Sans", sans-serif;
  --tabbar-h: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121020;
    --surface: #1E1A30;
    --ink: #F1EEF8;
    --muted: #ABA5C2;
    --line: #312B48;
    --accent: #F2A93B;
    --accent-ink: #1A1730;
    --accent-text: #F5B95E;
    --accent-soft: rgb(242 169 59 / .22);
    --plum: #2E2659;
    --plum-sub: #D9D4EC;
    --plum-soft: rgb(255 255 255 / .1);
    --user: #3A3070;
    --chip: #2C2647;
    --chip-ink: #DDD6F7;
    --track: #2C2647;
    --word: #33270F;
    --word-ink: #FFE7C2;
    --rom: #F5C27A;
    --word-line: #5A4520;
    --rec: #FF8A75;
    --ok: #8FDCAA;
    --ok-bg: #18382A;
    --bad: #FFB4A6;
    --bad-bg: #47221C;
    --shadow: 0 1px 3px rgb(0 0 0 / .4);
    --shadow-lift: 0 6px 20px rgb(0 0 0 / .4);
    --shadow-hero: 0 12px 30px rgb(0 0 0 / .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
svg.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Buttons ---------- */
.ghost {
  text-decoration: none; display: inline-block; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600;
}
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0;
  border-radius: 18px; padding: 12px 22px; font-weight: 700; text-decoration: none;
}
.primary:disabled { opacity: .5; }

/* ---------- Old top header (other pages still use .top) ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-th { font-family: var(--thai); font-weight: 700; font-size: 20px; color: var(--accent-text); }
.brand-de { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions .ghost { padding: 6px 12px; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Avatar (teacher initial) ---------- */
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none;
  background: var(--accent); color: #2B2350; display: grid; place-items: center;
  box-shadow: 0 0 0 6px var(--accent-soft);
  font: 800 28px/1 var(--display);
}

/* ---------- Home view ("Heute") ---------- */
.home {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  display: flex; flex-direction: column; gap: 18px;
  width: 100%; max-width: 640px; margin: 0 auto;
}
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-head > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-date { font-size: 14px; color: var(--muted); font-weight: 500; }
.home-hi { margin: 0; font: 800 26px/1.2 var(--display); letter-spacing: -.5px; overflow-wrap: anywhere; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 3px rgb(26 23 48 / .12); display: grid; place-items: center; text-decoration: none;
}
.head-right { display: flex; align-items: center; gap: 8px; flex: none; }
.level-pill { font-size: 13px; font-weight: 700; background: var(--surface); color: var(--chip-ink); padding: 8px 12px;
  border-radius: 999px; box-shadow: 0 1px 3px rgb(26 23 48 / .12); white-space: nowrap; border: 0; min-height: 36px; }

.hero {
  background: var(--plum); color: var(--plum-ink); border-radius: 28px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-hero);
}
.hero-who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hero-who > div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-name { font-size: 20px; font-weight: 700; }
.hero-sub { font-size: 14px; color: var(--plum-sub); overflow-wrap: anywhere; }
.hero-goal { margin: 0; font-size: 17px; line-height: 1.45; color: #ECE9F7; }
.hero-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-chips span { font-size: 12px; font-weight: 700; background: rgb(255 255 255 / .14); padding: 6px 10px; border-radius: 999px; }
.hero-btns { display: flex; gap: 10px; }
.hero-go {
  flex: 1; min-width: 0; min-height: 54px; border: 0; border-radius: 18px; background: var(--accent); color: #1A1730;
  font: 700 17px var(--font); display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; text-align: center;
}
.hero-go svg { width: 20px; height: 20px; stroke-width: 2; }
.hero-hands {
  width: 54px; height: 54px; flex: none; border: 0; border-radius: 18px; background: var(--plum-soft); color: #fff;
  display: grid; place-items: center;
}
.hero-hands[aria-pressed="true"] { background: var(--accent); color: #1A1730; }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: -6px; }
.sec-head h2 { margin: 0; font: 700 18px var(--display); }
.sec-head span { font-size: 14px; color: var(--muted); }
.tiles2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ttile {
  text-decoration: none; color: var(--ink); background: var(--surface); border-radius: 22px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-height: 44px; min-width: 0;
}
.ttile b { font-size: 16px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.ttile small { font-size: 13px; color: var(--muted); line-height: 1.35; }
.ttile .t-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--chip); color: var(--chip-ink); display: grid; place-items: center; }
.ttile .t-ic svg { width: 26px; height: 26px; stroke-width: 2; }
.ttile .t-big { font: 800 28px/1.1 var(--display); color: var(--accent-text); }

.hcard { background: var(--surface); border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); }
.prog-card { display: flex; flex-direction: column; gap: 12px; width: 100%; text-align: start; border: 0; color: var(--ink); }
.pc-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.pc-top b { font-weight: 700; }
.pc-top span { color: var(--muted); }
.hchips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 600; background: var(--chip); color: var(--chip-ink); padding: 6px 10px; border-radius: 999px; }
.skills { display: grid; grid-template-columns: 90px minmax(0, 1fr) 40px; gap: 8px 10px; align-items: center; font-size: 13px; }
.skills > span:nth-child(3n+1) { color: var(--muted); }
.skills > b { font-weight: 700; }
.pc-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.last-lesson { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }

/* "Dein DTZ-Plan" (dtz-plan.js): the primary part of the home screen. */
.dp { display: flex; flex-direction: column; gap: 18px; }
.dp:empty { display: none; }
.dp h2, .dp-h2 { margin: 0; font: 700 18px var(--display); }
.dp-card { background: var(--surface); border-radius: 28px; padding: 20px; box-shadow: var(--shadow-lift); display: flex; flex-direction: column; gap: 14px; }
.dp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dp-head h2 { font-size: 22px; letter-spacing: -.3px; }
.dp-head small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dp-link { color: var(--accent-text); font-weight: 700; font-size: 14px; white-space: nowrap; padding-block: 10px 10px; padding-inline: 8px 0; min-height: 44px; box-sizing: border-box; }
.dp-links { display: flex; flex-direction: column; align-items: flex-end; }
.dp-links .dp-link { padding-block: 6px 6px; padding-inline: 8px 0; min-height: 44px; display: flex; align-items: center; }
/* Time-to-goal estimate (forecast-text.js), on both home views and in "More". */
.fc { display: flex; flex-direction: column; gap: 8px; }
.fc h2 { margin: 0; font: 700 18px var(--display); }
.fc-tag { font: 600 12px var(--font); color: var(--muted); background: var(--chip); border-radius: 999px; padding: 3px 8px; margin-inline-start: 2px; vertical-align: middle; }
.fc-main { margin: 0; font: 700 17px/1.35 var(--display); }
.fc p { margin: 0; font-size: 15px; line-height: 1.45; }
.fc-exam.tight, .fc-exam.later { background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; }
.fc small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.dp-count { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.dp-num { font: 800 52px/1 var(--display); color: var(--accent-text); letter-spacing: -1px; }
.dp-unit { font: 700 20px var(--display); }
.dp-until { flex-basis: 100%; color: var(--muted); font-size: 15px; }
.dp-msg { margin: 0; font-size: 16px; line-height: 1.45; }
.dp-reg { margin: 0; font-size: 14px; line-height: 1.45; background: var(--accent-soft); border-radius: 14px; padding: 10px 12px; }
.dp-plan { border-top: 1px solid var(--line); padding-top: 12px; }
.dp-plan h3 { margin: 0 0 6px; font: 700 15px var(--display); }
.dp-plan ul { margin: 0 0 8px; padding-inline-start: 20px; line-height: 1.5; font-size: 15px; }
.dp-plan small, .dp-note { color: var(--muted); font-size: 13px; line-height: 1.4; }
.dp-today { background: var(--chip); color: var(--chip-ink); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.dp-today h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .6px; }
.dp-t-title { margin: 0; font: 700 19px/1.3 var(--display); color: var(--ink); }
.dp-t-sub { margin: 0 0 8px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.dp-go { align-self: stretch; min-height: 52px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink);
  font: 700 17px var(--font); display: flex; align-items: center; justify-content: center; text-decoration: none; padding: 0 16px; text-align: center; }
.dp-ready { display: flex; flex-direction: column; gap: 10px; }
.dp-ready p.dp-note { margin: 0; }
.dp-aim .dp-link { display: inline-flex; align-items: center; padding-inline: 0; white-space: normal; }
.dp-examday { margin: 6px 0 0; font-size: 14px; }
.dp-examday a { color: var(--accent-text); font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.dp-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dp-row:last-child { border-bottom: 0; }
.dp-part b { display: block; font-size: 15px; }
.dp-part small { color: var(--muted); font-size: 13px; }
.dp-est { font-weight: 800; font-size: 15px; color: var(--ok); }
.dp-est.none { font-weight: 600; font-size: 14px; color: var(--muted); }
.dp-row.low .dp-est { color: var(--bad); }
.dp-detail { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.dp-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.dp-q { background: var(--surface); color: var(--ink); border: 0; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); text-align: start;
  text-decoration: none; display: flex; flex-direction: column; gap: 2px; min-height: 64px; font: inherit; min-width: 0; }
.dp-q b { font-size: 15px; overflow-wrap: anywhere; }
.dp-q small { color: var(--muted); font-size: 13px; }
.dp-q:last-child:nth-child(odd) { grid-column: 1 / -1; }
.dp-facts summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.dp-facts ul { margin: 10px 0 8px; padding-inline-start: 20px; line-height: 1.5; font-size: 14px; }
.dp-facts p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dp-facts a { color: var(--accent-text); display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
}
/* Wide screens: the bar is as wide as the content column (640px), centred, not the whole window. */
@media (min-width: 700px) {
  .tabbar { inset-inline: 0; margin-inline: auto; max-width: 640px; border-inline: 1px solid var(--line); border-start-start-radius: 20px; border-start-end-radius: 20px; }
}
.tb {
  background: none; border: 0; color: var(--muted); min-height: 56px; min-width: 0; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: 600; font-family: var(--font);
}
.tb svg { width: 24px; height: 24px; }
.tb[aria-current="page"] { color: var(--accent-text); font-weight: 700; }
.tb[aria-current="page"] svg { stroke-width: 2; }
.tab-talk {
  justify-self: center; width: 62px; height: 62px; margin-top: -26px; border-radius: 50%; border: 0;
  background: var(--plum); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgb(43 35 80 / .35);
}
.tab-talk svg { width: 26px; height: 26px; stroke-width: 2; }
body.in-lesson .tabbar { display: none; }

/* ---------- Conversation view ---------- */
.lesson { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; }
.lesson-top {
  background: var(--plum); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 14px 16px;
  border-radius: 0 0 28px 28px; display: flex; flex-direction: column; gap: 10px; flex: none;
}
.lt-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.lt-icon { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--plum-soft); color: #fff; display: grid; place-items: center; }
.lt-icon svg { width: 20px; height: 20px; stroke-width: 2.2; }
.lt-title { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; gap: 4px; }
.lt-title #lessonLabel { font-size: 15px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.lt-end { min-height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: var(--plum-soft); color: #fff; font: 600 14px var(--font); }
.lt-spacer { width: 44px; }
.lt-teacher { display: flex; align-items: center; gap: 14px; padding: 0 4px; min-width: 0; }
.lt-teacher .avatar { width: 52px; height: 52px; font-size: 24px; box-shadow: 0 0 0 5px var(--accent-soft); transition: box-shadow .3s ease; }
body.speaking .lt-teacher .avatar { box-shadow: 0 0 0 6px rgb(242 169 59 / .3), 0 0 0 13px rgb(242 169 59 / .12); }
.lt-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lt-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lt-state { font-size: 12px; color: var(--plum-sub); min-height: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eq { display: none; align-items: center; gap: 3px; height: 22px; }
.eq i { width: 4px; height: 8px; border-radius: 2px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .15s; } .eq i:nth-child(3) { animation-delay: .3s; } .eq i:nth-child(4) { animation-delay: .45s; } .eq i:nth-child(5) { animation-delay: .6s; }
body.speaking .eq { display: inline-flex; }
@keyframes eq { 0%, 100% { height: 6px; } 50% { height: 22px; } }

.agenda {
  display: inline-block; font: 600 13px/1.3 var(--font); background: var(--plum-soft); color: var(--plum-sub);
  border: 0; border-radius: 14px; padding: 5px 10px; min-height: 30px; cursor: pointer; max-width: 100%;
}
.agenda::after { content: '\00a0›'; }
.rp-badge { display: inline-block; font-size: 12px; font-weight: 700; background: var(--accent); color: #1A1730; border-radius: 999px; padding: 2px 10px; }

.chat {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.msg { max-width: 88%; padding: 12px 16px; border-radius: 20px; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; max-width: 80%; background: var(--user); color: var(--user-ink); border-end-end-radius: 6px; }
.msg.teacher { align-self: flex-start; max-width: 94%; background: var(--surface); border-end-start-radius: 6px; box-shadow: var(--shadow); padding: 14px; }
.msg.error { align-self: center; color: var(--rec); font-size: 14px; background: none; padding: 4px 8px; }
.msg .punct { margin-inline-start: -4px; }

/* Thai word card inside a bubble: big Thai, romanization, play / slow / meaning */
.thw {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%;
  vertical-align: middle; margin-block: 4px 4px; margin-inline: 0 4px; padding: 6px; background: var(--word); border-radius: 16px;
}
.thw-acts { display: inline-flex; gap: 6px; align-items: center; }
.th {
  display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%;
  background: none; color: var(--word-ink); border: 0; border-radius: 12px; padding-block: 4px 4px; padding-inline: 8px 4px;
  text-align: start; position: relative; min-height: 44px;
}
.th-text { display: flex; flex-direction: column; min-width: 0; }
.th-script { font-family: var(--thai); font-size: 26px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.th-play { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--accent); color: #1A1730; display: grid; place-items: center; }
.th-play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.th.playing .th-play { box-shadow: 0 0 0 5px var(--accent-soft); }
.th.playing { outline: 2px solid var(--accent); outline-offset: -2px; }
.slow {
  font: 600 13px var(--font); color: var(--rom); background: var(--surface); border: 1px solid var(--word-line);
  border-radius: 22px; padding: 0 14px; margin: 0; vertical-align: middle; min-height: 44px; min-width: 44px;
}
.slow.info { width: 44px; padding: 0; font-weight: 800; font-size: 16px; border-radius: 50%; }
.th-mean { font-size: 14px; font-weight: 500; color: var(--muted); line-height: 1.3; font-family: var(--font); }
.thw.saved { box-shadow: inset 0 0 0 2px var(--accent); }
.msg.saved-note {
  align-self: flex-start; max-width: 94%; font-size: 14px; padding: 8px 12px; border-radius: 14px;
  background: var(--accent-soft); color: var(--ink); font-family: var(--font), var(--thai);
}
.msg.saved-note b { font-weight: 700; }

/* Teacher is thinking */
.msg.thinking { display: inline-flex; align-items: center; gap: 5px; padding: 14px 16px; }
.msg.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.msg.thinking i:nth-child(2) { animation-delay: .2s; }
.msg.thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.msg.thinking .cancel-btn { margin-inline-start: 10px; min-height: 44px; font-size: 14px; }
.msg.user.cancelled { opacity: .55; }
.msg.user.cancelled::after { content: ' · ' attr(data-tag); font-size: 12px; }

/* Notice pill in the chat (e.g. saved word) and the monthly-limit card */
.notice { align-self: center; display: inline-flex; align-items: center; gap: 8px; background: var(--chip); color: var(--chip-ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; max-width: 100%; }
.limit-card { align-self: stretch; display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border-radius: 22px;
  padding: 16px; box-shadow: var(--shadow); border: 2px solid var(--accent); }
.limit-card .lc-ic { width: 44px; height: 44px; flex: none; border-radius: 14px; background: var(--word); color: var(--rom); display: grid; place-items: center; }
.limit-card b { display: block; font-size: 16px; margin-bottom: 2px; }
.limit-card p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.45; }

/* ---------- Dock ---------- */
.dock {
  flex: none; border-top: 1px solid var(--line); background: var(--surface);
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px);
}
.status { text-align: center; margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); min-height: 21px; }
.dock-row { display: flex; align-items: center; justify-content: center; gap: 20px; }
.round {
  width: 50px; height: 50px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  display: grid; place-items: center;
}
.round svg { width: 22px; height: 22px; }
.round.hands.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: 0;
  background: var(--accent); color: #1A1730;
  display: grid; place-items: center;
  box-shadow: 0 0 0 10px rgb(242 169 59 / .18);
  transition: transform .15s ease, background .2s ease;
}
.mic svg { width: 34px; height: 34px; }
.mic .ic-send { display: none; }
.mic:active { transform: scale(.96); }
.mic.recording { background: #C8402F; color: #fff; box-shadow: 0 0 0 0 rgb(200 64 47 / .5); animation: pulse 1.4s infinite; display: grid; align-content: center; gap: 0; }
.mic.recording .ic-mic { display: none; }
.mic.recording .ic-send { display: block; }
.mic:disabled { opacity: .5; }
.mic.listening { --lvl: 0; background: var(--plum); color: #fff; box-shadow: 0 0 0 calc(4px + var(--lvl) * 18px) rgb(242 169 59 / .35); transition: box-shadow .08s linear; }
.mic.hearing { background: #C8402F; color: #fff; }
@keyframes pulse { 70% { box-shadow: 0 0 0 18px rgb(200 64 47 / 0); } 100% { box-shadow: 0 0 0 0 rgb(200 64 47 / 0); } }
.mic-label { display: none; font-size: 12px; font-weight: 700; margin-top: -2px; }
.mic.recording .mic-label { display: block; }
.dock-extra { display: flex; justify-content: center; margin-top: 10px; }
/* Hands-free "Sending… ✕" (public/hf-undo.js): a big tap target with a bar that runs down. */
.hf-undo { position: relative; overflow: hidden; display: block; margin: 0 auto 8px; min-height: 44px; padding: 0 22px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; }
.hf-undo[hidden] { display: none; }
.hf-undo::after { content: ''; position: absolute; inset-inline-start: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .5; transform-origin: left; }
[dir="rtl"] .hf-undo::after { transform-origin: right; }
.hf-undo.run::after { animation: hf-undo var(--undo-ms, 1500ms) linear forwards; }
@keyframes hf-undo { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .hf-undo.run::after { animation: none; } }
.dock-extra .ghost { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.type-form { display: flex; gap: 8px; margin-top: 12px; }
.type-form input {
  flex: 1; min-width: 0; font: inherit; padding: 10px 16px; border-radius: 16px; min-height: 48px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.type-form .primary { min-height: 48px; padding: 0 18px; border-radius: 16px; }

/* ---------- Sheets ---------- */
.sheet {
  width: min(640px, 100vw); max-width: 100vw; max-height: 88vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 28px 28px 0 0; background: var(--bg); color: var(--ink);
  box-shadow: 0 -10px 40px rgb(26 23 48 / .2);
}
.sheet::backdrop { background: rgb(18 14 36 / .5); }
.sheet-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 22px 20px 12px; position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.sheet-head::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
.sheet-head h2 { margin: 0; font: 800 24px/1.2 var(--display); letter-spacing: -.4px; min-width: 0; overflow-wrap: anywhere; }
.sheet-head .ghost { min-height: 44px; display: inline-flex; align-items: center; }
.notes { padding: 8px 20px 32px; font-family: var(--font), var(--thai); }
.notes h3 { font: 700 16px var(--display); margin: 18px 0 6px; }
.notes ul { padding-inline-start: 20px; margin: 0; }
.notes p { margin: 6px 0; }

/* Progress sheet */
.progress { padding: 4px 20px 32px; }
.progress h3 { font: 700 18px var(--display); margin: 24px 0 10px; color: var(--ink); }
.bar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.course-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.now { margin: 12px 0 0; padding: 16px; border-radius: 24px; background: var(--surface); color: var(--ink); border: 2px solid var(--accent); box-shadow: var(--shadow-lift); }
.now strong { display: block; font-size: 17px; }
.now ul { margin: 8px 0 0; padding-inline-start: 18px; font-size: 14px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 0; border-radius: 18px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); font: inherit; color: var(--ink); min-height: 64px; }
.tile b { display: block; font: 800 24px/1.2 var(--display); }
.tile span { font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.25; display: block; }
.tile.shaky b { color: var(--rec); }
.tile.solid b { color: var(--ok); }
.tile.practice b { color: var(--ink); }
.tile.due b { color: var(--accent-text); }
button.tile { cursor: pointer; }
.tile.on { background: var(--plum); box-shadow: none; }
.tile.on b { color: var(--accent); }
.tile.on span { color: var(--plum-sub); }
.units { display: grid; gap: 6px; }
.unit { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.unit-name { flex: 1; min-width: 0; }
.dots { display: flex; gap: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.dot.done { background: var(--accent); border-color: var(--accent); }
.dot.cur { border-color: var(--accent); }
.dot.quiz { border-radius: 3px; }
.words { display: grid; gap: 10px; }
.word { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; background: var(--surface); color: var(--ink);
  border: 0; border-radius: 20px; padding: 12px 14px; min-height: 56px; box-shadow: var(--shadow); }
.word .w-th { font-family: var(--thai); font-size: 24px; font-weight: 500; }
.word .w-meta { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); line-height: 1.35; }
.word .r-play { flex: none; }
.r-play { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--word); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; }
.word.playing .r-play, .g-part.playing .r-play, .recap-item.playing .r-play { background: var(--accent); color: #1A1730; }
.w-main { flex: 1; min-width: 0; display: grid; gap: 0; }
.w-main .w-th { line-height: 1.35; overflow-wrap: anywhere; }
.w-main .w-meta { overflow-wrap: anywhere; }
.badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 9px; background: var(--chip); color: var(--chip-ink); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px; flex: none; }
.badge.wackelig { background: var(--bad-bg); color: var(--bad); }
.badge.sicher { background: var(--ok-bg); color: var(--ok); }
.badge.lernt { background: var(--word); color: var(--rom); }
.badge.none { background: none; border: 1px dashed var(--line); color: var(--muted); }
.dot-s { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.filter { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.filter button { font-size: 13px; }
.filter button.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.facts, .history { padding-inline-start: 18px; margin: 0; font-size: 14px; }
.facts li, .history li { margin: 4px 0; }
.empty { color: var(--muted); font-size: 14px; }

/* Practice menu */
.rp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rp { display: flex; align-items: center; gap: 10px; text-align: start; background: var(--surface); color: var(--ink); min-height: 56px; min-width: 0;
  border: 0; border-radius: 18px; padding: 10px 12px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.rp small { font-weight: 500; color: var(--muted); }
.rp-icon { width: 36px; height: 36px; flex: none; border-radius: 12px; background: var(--chip); color: var(--chip-ink); display: grid; place-items: center; }
.rp-icon svg { width: 20px; height: 20px; }
.menu { display: grid; gap: 10px; }
.menu a { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--surface); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); min-height: 56px; }
.menu a b { grid-column: 1; font-weight: 700; }
.menu a span { grid-column: 1; font-size: 13px; color: var(--muted); }
.menu a::after { content: '›'; grid-column: 2; grid-row: 1 / span 2; color: var(--muted); font-size: 22px; }

/* German profile (Lena) */
.brand-name { font-family: var(--display); }
.th.word-de .th-script { font-family: var(--font); font-size: 20px; font-weight: 700; }
.msg .help { color: var(--muted); font-style: italic; margin-inline-end: .25em; }
.msg .help:lang(th) { font-style: normal; font-family: var(--thai); }
/* Explanation shown as text only (no voice for the language): upright, a little larger, own line. */
.msg .help.text-only { display: block; font-style: normal; font-size: 1.05em; color: var(--ink); margin: .3em 0; padding-inline-start: .6em; border-inline-start: 3px solid var(--line); }
.w-de { font-family: var(--font) !important; font-size: 17px !important; font-weight: 700; }
.settings { display: grid; gap: 12px; margin: 12px 0 4px; padding: 14px 16px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; font-size: 15px; flex-wrap: wrap; }
.set-row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--plum); flex: none; }
.seg-pick { display: inline-flex; gap: 4px; padding: 4px; background: var(--chip); border-radius: 16px; max-width: 100%; }
.seg-pick button { border: 0; background: none; color: var(--chip-ink); padding: 6px 12px; font-size: 14px; font-weight: 600; border-radius: 12px; min-height: 40px; }
.seg-pick button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgb(26 23 48 / .12); }
.muted { color: var(--muted); }
.topics summary { cursor: pointer; font-size: 14px; color: var(--muted); margin-top: 8px; }
.topics h4 { margin: 10px 0 4px; font-size: 14px; }
.topics ul { margin: 0; padding-inline-start: 18px; font-size: 14px; }
.topics li.done { color: var(--ok); }

/* Teacher personas */
.personas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.persona { display: grid; gap: 2px; text-align: start; background: var(--surface); color: var(--ink); border: 2px solid transparent; border-radius: 18px; padding: 10px 12px; box-shadow: var(--shadow); min-width: 0; }
.persona.on { border-color: var(--accent); }
.persona b { font-size: 15px; }
.persona span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.voice-pick { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.voice-pick select { font: inherit; font-size: 14px; padding: 6px 8px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.voice-pick .ghost { min-height: 44px; }
.teacher-entry { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; margin: 4px 0 10px;
  background: var(--plum); color: #fff; border: 0; border-radius: 22px; padding: 12px 14px; min-height: 56px; box-shadow: var(--shadow-hero); }
.teacher-entry .avatar { width: 44px; height: 44px; font-size: 20px; box-shadow: 0 0 0 4px var(--accent-soft); }
.teacher-entry .te-txt { flex: 1; min-width: 0; display: grid; }
.teacher-entry .te-txt span { font-size: 12px; color: var(--plum-sub); }
.teacher-entry b { font-size: 16px; font-family: var(--font), var(--thai); }
.teacher-entry .te-change { font-size: 14px; font-weight: 600; color: var(--accent); }
.barge-row { margin: 4px 0 8px; padding: 12px 16px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.barge-row small { font-size: 13px; }

/* Costs */
.costs { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.costs th, .costs td { padding: 5px 6px; text-align: end; border-bottom: 1px solid var(--line); }
.costs th:first-child, .costs td:first-child { text-align: start; }
.costs th { color: var(--muted); font-weight: 600; font-size: 12px; }
.costs tr.sum td { font-weight: 700; border-bottom: 0; }
.cost-sub { margin: 12px 0 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.bal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bal { display: grid; gap: 2px; align-content: start; background: var(--surface); border-radius: 18px; padding: 12px; font-size: 12px; color: var(--ink); box-shadow: var(--shadow); min-width: 0; }
.bal b { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.bal-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.bal-edit { margin-top: 8px; }
.bal-edit summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent-text); min-height: 44px; display: flex; align-items: center; }
.bal-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.bal-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.bal-form input { font: inherit; font-size: 15px; padding: 8px 10px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 0; }
.bal-form button { grid-column: 1 / -1; min-height: 48px; }
@media (max-width: 360px) { .bal-cards, .bal-form { grid-template-columns: 1fr; } }
.cost-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; font-size: 15px; }
.costs-details summary { cursor: pointer; color: var(--accent-text); font-weight: 600; font-size: 14px; margin-top: 6px; min-height: 44px; display: flex; align-items: center; }

/* Level estimate */
.level-card { display: flex; gap: 14px; align-items: center; background: var(--plum); color: #fff; border-radius: 22px; padding: 14px 16px; }
.level-big { font: 800 40px/1 var(--display); display: grid; justify-items: center; gap: 4px; min-width: 72px; color: var(--accent); }
.level-big span { font: 600 12px var(--font); color: var(--plum-sub); }
.level-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; font-size: 13px; flex: 1; color: var(--plum-sub); }
.level-skills span { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; column-gap: 5px; min-width: 0; }
.level-skills b { font-size: 16px; color: #fff; min-width: 0; }
.level-line { margin: 8px 0 0; font-size: 14px; }

/* End-of-lesson summary card */
.recap { background: var(--surface); border-radius: 24px; padding: 16px; box-shadow: var(--shadow-lift); }
.recap-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.recap-head h2 { margin: 0; font: 800 22px var(--display); }
.recap-head span { color: var(--muted); font-size: 14px; }
.recap h3 { font: 700 15px var(--display); margin: 14px 0 6px; }
.recap-sum { margin: 8px 0 0; font-size: 15px; }
.recap-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; margin-bottom: 8px; min-height: 52px;
  background: var(--word); color: var(--word-ink); border: 0; border-radius: 16px; padding-block: 8px 8px; padding-inline: 12px 8px; }
.recap-item .r-th { font-family: var(--thai); font-size: 22px; font-weight: 500; }
.recap-item .r-th.r-de { font-family: var(--font); font-size: 16px; font-weight: 700; }
.recap-item .r-meta { flex: 1; min-width: 0; font-size: 14px; color: var(--rom); line-height: 1.35; }
.recap-item .r-play { background: var(--accent); color: #1A1730; }
.recap-level { margin: 12px 0 0; font-size: 15px; }
.recap-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.recap-actions .primary { display: inline-flex; align-items: center; min-height: 48px; }
.recap-actions .ghost { min-height: 48px; display: inline-flex; align-items: center; }

/* Word meaning on tap */
.g-part { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; margin-bottom: 8px; min-height: 56px;
  background: var(--surface); color: var(--ink); border: 0; border-radius: 18px; padding-block: 8px 8px; padding-inline: 14px 8px; box-shadow: var(--shadow); }
.g-part > span:not(.r-play) { flex: 1; min-width: 0; font-size: 15px; color: var(--muted); }
.g-part .g-de { font-size: 17px; }
.g-literal { margin: 12px 0 0; font-size: 15px; }

/* ---------- Lernstand: tabs, today card, course list, words, more ---------- */
.sheet-top { position: sticky; top: 0; z-index: 3; background: var(--bg); }
.sheet-top .sheet-head { position: relative; padding-bottom: 10px; }
.ptabs { display: flex; margin: 0 20px 10px; }
.ptabs button { flex: 1; min-width: 0; min-height: 40px; padding: 6px 4px; font-size: 14px; }
.ptab > :first-child { margin-top: 8px; }
.anchor, #readBox, #adminBox, #freunde { scroll-margin-top: 150px; }

.today-card { background: var(--plum); color: #fff; border-radius: 24px; padding: 18px; margin-top: 8px; display: grid; gap: 10px; box-shadow: var(--shadow-hero); }
.today-k { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.today-msg { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.35; }
.today-sub { margin: 0; font-size: 15px; color: var(--plum-sub); }
.primary.big { display: flex; align-items: center; justify-content: center; min-height: 54px; font-size: 17px; text-decoration: none; text-align: center; width: 100%; margin-top: 4px; }
.linkish { background: none; border: 0; padding: 8px 0; min-height: 44px; color: inherit; font: inherit; font-size: 15px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-align: start; display: inline-flex; align-items: center; }
.today-card .linkish { justify-self: start; color: #fff; }
.progress .linkish { color: var(--accent-text); }
.progress .today-card .linkish { color: #fff; }
.why summary { cursor: pointer; font-size: 15px; min-height: 44px; display: flex; align-items: center; gap: 6px; list-style: none; color: var(--plum-sub); }
.why summary::-webkit-details-marker { display: none; }
.why p { margin: 0 0 6px; font-size: 15px; line-height: 1.45; color: var(--plum-sub); }

.path { display: grid; gap: 0; border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.path-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 14px; text-align: start;
  background: none; border: 0; color: var(--ink); font-size: 15px; }
.path-row + .path-row { border-top: 1px solid var(--line); }
.pr-k { width: 62px; flex: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.path-row .bar { flex: 1; min-width: 40px; height: 8px; }
.pr-fill { flex: 1; }
.pr-v { flex: none; font-weight: 700; text-align: end; }
.path-row .bar + .pr-v { min-width: 0; }
.chev { color: var(--muted); font-size: 18px; flex: none; }
.last-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin-top: 12px; padding: 12px 14px; text-align: start;
  background: var(--surface); border: 0; border-radius: 20px; color: var(--ink); font-size: 15px; min-height: 48px; box-shadow: var(--shadow); }
.chev-t { color: var(--accent-text); font-size: 14px; font-weight: 700; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.now .row-btns, .focus-box .row-btns { margin-top: 12px; }
.now .primary { margin-top: 12px; min-height: 46px; }
.now .row-btns .primary { margin-top: 0; }
.now-k { display: block; font-size: 12px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent-text); }
.now-sub { display: block; font-size: 14px; color: var(--muted); }
.now-also { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.recall { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-btns .primary, .row-btns .ghost { min-height: 46px; font-size: 15px; border-radius: 16px; }
.btn44 { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; padding: 8px 16px; }
.focus-box { margin-top: 8px; padding: 14px 16px; border-radius: 20px; border: 2px solid var(--accent); background: var(--surface); }
.focus-box p { margin: 0; font-size: 15px; }
.focus-box p + p { margin-top: 4px; }
.focus-box.flash { animation: flash 1.2s ease-out 1; }
@keyframes flash { from { box-shadow: 0 0 0 6px rgb(242 169 59 / .45); } to { box-shadow: 0 0 0 0 rgb(242 169 59 / 0); } }

/* Course path: circles per lesson */
.units-list { display: grid; gap: 16px; }
.unit-box { display: grid; gap: 6px; }
.unit-h { margin: 4px 0 2px; font-size: 14px; font-weight: 700; color: var(--chip-ink); background: var(--chip); border-radius: 16px; padding: 10px 14px; }
.unit-box details summary.unit-h { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.unit-box details[open] summary { margin-bottom: 6px; }
.unit-box details { display: grid; gap: 6px; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding-block: 6px 6px; padding-inline: 8px 12px; text-align: start;
  background: var(--surface); color: var(--ink); border: 0; border-radius: 20px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); }
.lrow[aria-expanded="true"] { border-end-start-radius: 6px; border-end-end-radius: 6px; box-shadow: 0 0 0 2px var(--accent); }
.lrow[aria-expanded="true"] .chev { transform: rotate(90deg); }
.l-ic { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--surface); color: var(--muted); border: 2px dashed var(--line); }
.l-ic svg { width: 18px; height: 18px; stroke-width: 2.4; }
.lrow.s-done .l-ic { background: var(--accent); color: #1A1730; border: 0; }
.lrow.s-current { box-shadow: 0 0 0 2px var(--accent), var(--shadow-lift); }
.lrow.s-current .l-ic { background: var(--plum); color: #fff; border: 0; box-shadow: 0 0 0 4px rgb(43 35 80 / .12); }
.l-t { flex: 1; min-width: 0; }
.l-t small { font-size: 12px; color: var(--accent-text); font-weight: 700; margin-inline-start: 4px; }
.l-t .l-sub { display: block; margin: 0; color: var(--muted); font-weight: 500; font-size: 13px; }
.l-tag { flex: none; font-size: 12px; font-weight: 700; color: var(--accent-text); letter-spacing: .4px; text-transform: uppercase; }
.lprev { border-radius: 6px 6px 20px 20px; padding: 12px 14px 14px; margin: -2px 0 6px; background: var(--surface); display: grid; gap: 10px; box-shadow: 0 0 0 2px var(--accent); }
.lp-note { margin: 0; font-size: 15px; }
.lp-err { margin: 0; color: var(--rec); font-size: 14px; }
.unit-box.later .linkish { justify-self: start; }
.rule { margin-top: 18px; }
.rule summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent-text); font-weight: 700; font-size: 15px; }
.rule p { margin: 0 0 8px; font-size: 15px; }

.tiles.tiles3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
.w-search { margin-top: 12px; position: relative; }
.w-search svg { position: absolute; inset-inline-start: 14px; top: 50%; margin-top: -10px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.w-search input { width: 100%; font: 500 16px var(--font); min-height: 48px; padding-block: 8px; padding-inline: 44px 14px; border-radius: 16px;
  border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.w-count { margin: 10px 0 8px; font-size: 13px; color: var(--muted); }
.legend { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

.facts-x { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.facts-x li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding-block: 4px 4px; padding-inline: 14px 4px; border-radius: 18px; background: var(--surface); font-size: 15px; box-shadow: var(--shadow); }
.facts-x li > span:first-child { flex: 1; min-width: 0; }
.fx { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 16px; border-radius: 50%; }
.fx-confirm { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; justify-content: flex-end; padding-block: 0 4px; padding-inline: 0 4px; font-size: 14px; }
.fx-confirm .sm { min-height: 44px; padding: 6px 12px; font-size: 14px; }
.hist { display: grid; gap: 8px; }
.sess { display: grid; gap: 2px; width: 100%; text-align: start; padding: 10px 14px; min-height: 48px; background: var(--surface); color: var(--ink);
  border: 0; border-radius: 18px; font-size: 15px; box-shadow: var(--shadow); }
.sess b { font-size: 13px; color: var(--muted); }
.sess.open .clamp2 { -webkit-line-clamp: unset; display: block; }
.progress .settings { margin-top: 4px; }
.progress > .ptab > .settings:last-child { margin-top: 18px; }

/* ---------- Admin: invites, profiles, limits ---------- */
.admin { display: grid; gap: 10px; }
.admin-card { background: var(--surface); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 10px; min-width: 0; }
.admin-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.ad-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; }
.ad-head b { font-size: 16px; overflow-wrap: anywhere; }
.ad-head .chip { font-size: 12px; padding: 4px 9px; }
.ad-use { font-size: 14px; color: var(--muted); }
.ad-use b { color: var(--ink); }
.ad-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-row label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.ad-row input { font: 600 16px var(--font); width: 96px; min-height: 44px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.ad-row input.ad-name { width: auto; flex: 1; min-width: 0; }
.ad-row .ghost, .ad-row .primary { min-height: 44px; display: inline-flex; align-items: center; border-radius: 14px; }
.ad-link { display: grid; gap: 8px; background: var(--word); border-radius: 16px; padding: 10px 12px; }
.ad-link code { font: 600 13px/1.4 ui-monospace, monospace; color: var(--word-ink); overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.ad-ok { font-size: 13px; font-weight: 700; color: var(--ok); }
.ad-err { font-size: 13px; color: var(--rec); }
.ad-mail { font-weight: 500; color: var(--muted); font-size: 13px; }
.ad-pend { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.ad-pend .linkish { min-height: 36px; }
.ad-out:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.r-play svg { width: 16px; height: 16px; fill: currentColor; }
.barge-row { flex-wrap: nowrap; }
.barge-row > span:first-child { flex: 1; min-width: 0; }
@media (prefers-color-scheme: dark) {
  .tab-talk { background: #3F347A; box-shadow: 0 8px 20px rgb(0 0 0 / .5), 0 0 0 1px rgb(255 255 255 / .08); }
  .hero, .today-card, .level-card, .teacher-entry { box-shadow: 0 0 0 1px rgb(255 255 255 / .06), var(--shadow-hero); }
}

/* App tour (first start) */
dialog.tour {
  width: min(400px, calc(100vw - 32px)); box-sizing: border-box; border: 0; border-radius: 28px; padding: 28px 22px 20px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); text-align: center; font-family: var(--font);
}
dialog.tour::backdrop { background: rgb(18 16 32 / .55); }
.tour-ic { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 24px; background: var(--accent); color: #1A1730; display: grid; place-items: center; }
.tour-ic svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
dialog.tour h2 { font: 700 22px var(--display, var(--font)); margin: 0 0 8px; }
dialog.tour p { margin: 0 0 18px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--track); }
.tour-dots i.on { width: 22px; border-radius: 999px; background: var(--accent); }
.tour-btns { display: flex; gap: 10px; }
.tour-btns button { flex: 1; min-height: 48px; }

/* Listening quiz card: hidden until "Auflösen" */

.retry-btn { min-height: 44px; margin-inline-start: 6px; }

button.ttile { border: 0; font: inherit; text-align: start; cursor: pointer; }

/* Small phones: give the conversation more room (compact header) */
@media (max-height: 760px), (max-width: 380px) {
  .lesson-top { padding-bottom: 10px; gap: 6px; border-radius: 0 0 22px 22px; }
  .lt-title #lessonLabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
  .lt-teacher .avatar { width: 36px; height: 36px; font-size: 17px; box-shadow: 0 0 0 3px var(--accent-soft); }
  .lt-name { font-size: 15px; }
}

/* Level plan after the course */

.recap-rate { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; padding: 12px 14px; border-radius: 16px; background: var(--bg); }
.recap-rate p { flex: 1; margin: 0; font-size: 15px; }
.recap-rate small { color: var(--muted); font-size: 13px; }
.recap-rate button { min-width: 52px; min-height: 48px; font-size: 22px; }

/* App tour spotlight: full-screen transparent dialog, dim layer with cut-outs, card in the free space */
dialog.tour.tour-spot {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  background: transparent; border-radius: 0; box-shadow: none; overflow: hidden;
}
dialog.tour.tour-spot::backdrop { background: transparent; }
.tour-dim { position: absolute; inset: 0; width: 100%; height: 100%; }
.tour-shade { fill: rgb(18 16 32 / .62); }
.tour-ring { fill: none; stroke: var(--accent); stroke-width: 3; }
@media (prefers-reduced-motion: no-preference) {
  .tour-ring { animation: tour-pulse 1.6s ease-in-out infinite; }
}
@keyframes tour-pulse { 50% { stroke-width: 6; stroke-opacity: .55; } }
.tour-card {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 28px); overflow-y: auto; box-sizing: border-box;
  border-radius: 28px; padding: 24px 20px 18px; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-hero); text-align: center;
}
.tour-card.centred { top: 50%; transform: translate(-50%, -50%); }
.tour-card .tour-ic { width: 60px; height: 60px; border-radius: 20px; margin-bottom: 12px; }
.tour-card .tour-ic svg { width: 30px; height: 30px; }
.tour-card .tour-btns button { min-height: 48px; }
.tour-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-color-scheme: dark) {
  .tour-card { box-shadow: 0 0 0 1px rgb(255 255 255 / .08), var(--shadow-hero); }
  .tour-shade { fill: rgb(6 5 14 / .7); }
}

/* Practice page opened in the wrong kind of profile (inline guard in tones/lesen/aussprache.html) */
.tour-card.compact { padding-top: 18px; }
.tour-card.compact .tour-ic { display: none; }

.msg.placed-card { align-self: stretch; display: grid; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); color: var(--ink); }
.msg.placed-card small { color: var(--muted); font-size: 13px; }

/* Compact conversation header: one row (back · avatar, teacher, lesson · end), a slim second line only when needed */
.lesson-top { padding: calc(env(safe-area-inset-top) + 8px) 12px 10px; gap: 6px; border-radius: 0 0 22px 22px; }
.lt-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
.lt-row .lt-teacher { padding: 0; gap: 10px; min-width: 0; }
.lt-row .lt-teacher .avatar { width: 40px; height: 40px; font-size: 18px; flex: none; box-shadow: 0 0 0 3px var(--accent-soft); }
body.speaking .lt-row .lt-teacher .avatar { box-shadow: 0 0 0 4px rgb(242 169 59 / .35), 0 0 0 9px rgb(242 169 59 / .12); }
.lt-row .lt-name { font-size: 16px; line-height: 1.2; flex-wrap: nowrap; }
.lt-row .lt-title { display: block; text-align: start; min-width: 0; }
.lt-row .lt-title #lessonLabel { display: block; font-size: 13px; font-weight: 600; color: var(--plum-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 0; }
.lt-sub:not(:has(#ltState:not(:empty), #rpBadge:not([hidden]), #agenda:not([hidden]))) { display: none; }
.lt-sub .agenda { margin-inline-start: auto; }
body.recap-shown .dock .dock-row, body.recap-shown .dock .type-form { display: none; }

/* Simulation history in the progress sheet (dtz-history.js). Colours from the tokens: light and dark. */
.sim-hist { margin-top: 8px; }
.sh-disc { background: var(--chip); color: var(--chip-ink); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0 0 10px; }
.sh-disc small { display: block; margin-top: 2px; }
.sh-trend { margin: 10px 0; font-size: 16px; }
.sh-trend small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.sh-h4 { font-size: 14px; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
.sh-fig { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px 6px; }
.sh-fig figcaption { margin: 4px 6px 2px; font-size: 13px; }
.sh-chart { display: block; width: 100%; height: auto; max-height: 260px; overflow: visible; font-family: var(--font); }
.sh-grid { stroke: var(--line); stroke-width: 1; }
.sh-thr { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.sh-thr-t, .sh-ax { fill: var(--muted); font-size: 11px; }
.sh-thr-t { font-weight: 700; }
.sh-line { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sh-pt circle { fill: var(--accent-text); stroke: var(--surface); stroke-width: 2; }
.sh-val { fill: var(--ink); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.sh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sh-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-height: 52px; padding: 10px 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.sh-row .chev { grid-column: 2; grid-row: 1 / span 2; }
.sh-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.sh-date { font-size: 13px; color: var(--muted); font-weight: 700; }
.sh-mode { font-weight: 600; }
.sh-meta { font-size: 14px; color: var(--muted); }
.sh-meta b { color: var(--ink); }
.sh-proj { font-size: 13px; }
.sh-start { margin-top: 12px; text-decoration: none; justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Error card in the conversation (app.js addErrorCard): icon + text + what to do; not only red. */
.msg.error.err-card { align-self: stretch; display: flex; gap: 10px; align-items: flex-start; color: var(--ink); background: var(--bad-bg);
  border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; font-size: 15px; line-height: 1.4; max-width: none; }
.err-card .err-ic { flex: none; color: var(--bad); display: inline-flex; }
.err-card .err-ic .ic { width: 22px; height: 22px; }
.err-card .err-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.err-card .err-body b { font-weight: 700; }
.err-card .err-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.err-card .err-acts:empty { display: none; }
.err-card .retry-btn { margin-inline-start: 0; min-height: 44px; padding: 0 16px; }

/* Microphone help sheet (mic-help.js) */
.mic-help .mh-sec { margin: 16px 0; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.mic-help h3 { margin: 0 0 8px; font: 700 16px var(--display); }
.mic-help ol { margin: 8px 0; padding-inline-start: 22px; }
.mic-help li { margin: 4px 0; }
.mh-pic { display: block; width: 100%; max-width: 280px; height: auto; margin: 6px 0; }
.mh-bar { fill: var(--track); stroke: var(--line); }
.mh-url, .mh-allow { fill: var(--muted); font: 600 13px var(--font); }
.mh-aa { fill: var(--ink); font: 700 14px var(--font); }
.mh-ic { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.mh-dot { fill: var(--track); stroke: var(--ink); stroke-width: 2; }
.mh-ring { fill: none; stroke: var(--accent-text); stroke-width: 2.5; }
.mh-on { fill: var(--ok); }
.mh-knob { fill: #fff; }
.mh-note { font-size: 14px; color: var(--muted); }
.mh-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.mh-acts button { min-height: 48px; padding: 0 18px; }

/* "Save Calimo on your home screen" (install-card.js) */
.home-card { display: block; padding: 16px 18px; margin: 0 0 16px; }
.home-card h2 { margin: 0 0 4px; font: 700 18px var(--display); }
.home-card .hc-sub { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.home-card ol { margin: 8px 0; padding-inline-start: 22px; line-height: 1.5; }
.home-card li { margin: 6px 0; }
.home-card .hc-ic { width: 20px; height: 20px; vertical-align: -4px; display: inline-block; }
.home-card .hc-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.home-card .hc-acts button, .home-card #hcInstall, .home-card .hc-code-btn { min-height: 44px; padding: 0 18px; }
.home-card .hc-code { margin: 8px 0 0; }
.dev-code { font: 700 18px ui-monospace, monospace; letter-spacing: 2px; user-select: all; white-space: nowrap; }
/* "Stop audio" only while the teacher is speaking (otherwise it reads like "mute my mic").
   visibility keeps the dock layout still. */
body:not(.speaking) #stopBtn { visibility: hidden; }

/* ---------- RTL groundwork (full localisation later) ----------
   Arrows and chevrons come from CSS, not from the strings, so they can be mirrored. */
.arr-back::before { content: "\2190\00a0"; }
.arr-next::after { content: "\00a0\203a"; }
[dir="rtl"] .arr-back::before { content: "\2192\00a0"; }
[dir="rtl"] .arr-next::after { content: "\00a0\2039"; }
[dir="rtl"] .chev, [dir="rtl"] .flip-rtl { display: inline-block; transform: scaleX(-1); }

/* ---------- Confirm dialog (ask.js) ---------- */
.ask { border: 0; padding: 0; background: transparent; max-width: min(420px, calc(100vw - 32px)); width: 100%; }
.ask::backdrop { background: rgb(18 14 36 / .55); }
.ask-box { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 20px 18px 16px; box-shadow: var(--shadow-lift); display: grid; gap: 12px; }
.ask-box h2 { margin: 0; font: 700 20px/1.3 var(--display); }
.ask-box p { margin: 0; color: var(--muted); line-height: 1.5; }
.ask-btns { display: grid; gap: 8px; margin-top: 4px; }
.ask-btns button { min-height: 48px; font-size: 16px; border-radius: 16px; width: 100%; }
.ask-btns .danger-btn { background: var(--bad); color: var(--surface); border: 0; font-weight: 700; }
/* My area: jump links to Settings / History / Account at the top. */
.jump { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }
.jump .ghost { display: inline-flex; align-items: center; }
/* Admin: the login-link form stacked (full-width inputs on phones), the QR code of a new link. */
.ad-stack { display: grid; gap: 10px; }
.ad-stack label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.ad-stack input { font: 500 16px var(--font); width: 100%; box-sizing: border-box; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.ad-stack .primary { min-height: 48px; }
.ad-qr { width: min(220px, 100%); margin-inline: auto; aspect-ratio: 1; background: #fff; border-radius: 12px; overflow: hidden; justify-self: center; }
.ad-qr svg { display: block; width: 100%; height: 100%; }

/* Can-do checklist, grammar progress, core words (EX-22/23/24) */
.cur-box { display: grid; gap: 6px; }
.cur-box summary.unit-h { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cur-bar { flex: 1 1 80px; min-width: 80px; }
.cd-list, .gr-list, .core-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cd-row, .gr-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.cd-row .l-t, .gr-row .l-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cd-row.s-done .l-ic { background: var(--accent); color: var(--accent-ink); border: 0; }
.core-list li { padding: 6px 2px; color: var(--muted); }
.core-list b { color: var(--ink); margin-inline-end: 6px; }
.w-src { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--chip-ink); background: var(--chip); border-radius: 999px; padding: 1px 6px; }
.cd-row .l-ic { width: 28px; height: 28px; }
/* "Your week" (public/weekly.js): ring, days, streak, improvements, rhythm rows */
.wk { display: flex; flex-direction: column; gap: 10px; }
.wk h2 { margin: 0; font: 700 18px var(--display); }
.wk-top { display: flex; align-items: center; gap: 14px; }
.wk-ring { flex: none; }
.wk-num { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wk-num b { font: 700 20px var(--display); }
.wk-num small, .wk-note, .wk-imp small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.wk-ok { color: var(--ok); font-weight: 700; font-size: 14px; }
.wk-orient, .wk-streak, .wk-miss { margin: 0; font-size: 14px; line-height: 1.45; }
.wk-miss { color: var(--muted); }
.wk-days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wk-day span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--track); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.wk-day.on span { background: var(--accent); }
.wk-day.today span { outline: 2px solid var(--plum); outline-offset: 1px; }
.wk-day.future span { opacity: .55; }
.wk-day small { font-size: 11px; color: var(--muted); }
.wk-h3 { margin: 4px 0 4px; font: 700 15px var(--display); }
.wk-imp ul { margin: 0 0 4px; padding-inline-start: 20px; font-size: 15px; line-height: 1.5; }
.wk-rhythm, .dp-plan .wk-rhythm { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.4; }
.wk-rhythm li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.wk-r-text { display: flex; flex-direction: column; min-width: 0; }
.wk-r-text small { color: var(--muted); font-size: 13px; }
.wk-r-done { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.wk-rhythm li.met .wk-r-done { color: var(--ok); font-weight: 700; }

/* ---------- UI languages (public/i18n.js sets <html lang dir>) ---------- */
/* The body stays hidden until the dictionary is applied (at most 3 s, see i18n.js). */
html.i18n-wait body { visibility: hidden; }
/* Arabic script (ar, fa, prs, ckb, ps): Latin from Plus Jakarta, the rest from an Arabic-script font. */
:root:lang(ar), :root:lang(fa), :root:lang(ckb), :root:lang(ps) {
  --arabic: "Noto Sans Arabic", "Vazirmatn", "Noto Naskh Arabic", "Segoe UI", Tahoma, "Geeza Pro", "Arial", sans-serif;
  --font: "Plus Jakarta Sans", var(--arabic);
  --display: "Plus Jakarta Sans", var(--arabic);
}
:root:lang(ar) body, :root:lang(fa) body, :root:lang(ckb) body, :root:lang(ps) body { line-height: 1.7; }
/* Tigrinya (Ethiopic script). */
:root:lang(ti) {
  --font: "Plus Jakarta Sans", "Noto Sans Ethiopic", "Abyssinica SIL", "Nyala", "Ebrima", "Kefa", var(--sys);
  --display: var(--font);
}
/* Cyrillic and Vietnamese: Plus Jakarta Sans lacks the glyphs (Vietnamese would mix two fonts in one word). */
:root:lang(ru), :root:lang(uk), :root:lang(bg), :root:lang(vi) { --font: var(--sys); --display: var(--sys); }
/* Language picker (login, confirm, onboarding, settings). */
.lang-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0 8px; }
.lang-grid button {
  min-height: 56px; padding: 8px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 18px; font-weight: 600; text-align: start; display: flex; flex-direction: column; justify-content: center;
}
.lang-grid button small { font-size: 13px; font-weight: 500; color: var(--muted); }
.lang-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.lang-grid :lang(ar), .lang-grid :lang(fa), .lang-grid :lang(ckb), .lang-grid :lang(ps) { font-family: var(--arabic, "Noto Sans Arabic", "Vazirmatn", Tahoma, sans-serif); }
.lang-grid :lang(ti) { font-family: "Noto Sans Ethiopic", "Abyssinica SIL", "Nyala", "Ebrima", var(--sys); }
.lang-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 600 15px var(--font); }
.read-aloud { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; margin: 4px 0 8px;
  border-radius: 22px; border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent-text); font: 600 15px var(--font); }
.read-aloud[aria-pressed="true"] { background: var(--accent); color: #fff; }
.app-lang { display: grid; gap: 8px; margin: 0 0 14px; }
.app-lang select { font: inherit; font-size: 17px; min-height: 48px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.onb-top .brand { flex: none; flex-direction: row; white-space: nowrap; }
/* Picker groups and the "AI translation" label (dictionaries without native review). */
.lang-group { font: 700 15px var(--display); color: var(--muted); margin: 18px 0 0; }
.lang-groups .lang-grid { margin-top: 8px; }
.ai-tag { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.3; padding: 1px 6px; border-radius: 8px; background: var(--line); color: var(--muted); white-space: nowrap; }
.pick-note { font-size: 13px; color: var(--muted); margin-top: 14px; }
/* More scripts (system fonts only; no web-font requests). */
:root:lang(he) { --font: "Plus Jakarta Sans", "Noto Sans Hebrew", "Arial Hebrew", "Segoe UI", Arial, var(--sys); --display: var(--font); }
:root:lang(ur) {
  --arabic: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font: "Plus Jakarta Sans", var(--arabic); --display: var(--font);
}
:root:lang(ur) body { line-height: 2; }
:root:lang(am) { --font: "Plus Jakarta Sans", "Noto Sans Ethiopic", "Abyssinica SIL", "Nyala", "Ebrima", "Kefa", var(--sys); --display: var(--font); }
:root:lang(th) { --font: "Plus Jakarta Sans", "Noto Sans Thai", "Thonburi", "Leelawadee UI", var(--sys); --display: var(--font); }
:root:lang(hi), :root:lang(mr) { --font: "Plus Jakarta Sans", "Noto Sans Devanagari", "Kohinoor Devanagari", "Nirmala UI", "Mangal", var(--sys); --display: var(--font); }
:root:lang(bn) { --font: "Plus Jakarta Sans", "Noto Sans Bengali", "Kohinoor Bangla", "Nirmala UI", "Vrinda", var(--sys); --display: var(--font); }
:root:lang(ta) { --font: "Plus Jakarta Sans", "Noto Sans Tamil", "Tamil Sangam MN", "Nirmala UI", "Latha", var(--sys); --display: var(--font); }
:root:lang(te) { --font: "Plus Jakarta Sans", "Noto Sans Telugu", "Telugu Sangam MN", "Nirmala UI", "Gautami", var(--sys); --display: var(--font); }
:root:lang(kn) { --font: "Plus Jakarta Sans", "Noto Sans Kannada", "Kannada Sangam MN", "Nirmala UI", "Tunga", var(--sys); --display: var(--font); }
:root:lang(ml) { --font: "Plus Jakarta Sans", "Noto Sans Malayalam", "Malayalam Sangam MN", "Nirmala UI", "Kartika", var(--sys); --display: var(--font); }
:root:lang(gu) { --font: "Plus Jakarta Sans", "Noto Sans Gujarati", "Gujarati Sangam MN", "Nirmala UI", "Shruti", var(--sys); --display: var(--font); }
:root:lang(pa) { --font: "Plus Jakarta Sans", "Noto Sans Gurmukhi", "Gurmukhi Sangam MN", "Nirmala UI", "Raavi", var(--sys); --display: var(--font); }
:root:lang(ja) { --font: "Plus Jakarta Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", "Meiryo", var(--sys); --display: var(--font); }
:root:lang(zh-CN) { --font: "Plus Jakarta Sans", "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--sys); --display: var(--font); }
:root:lang(zh-HK) { --font: "Plus Jakarta Sans", "PingFang HK", "Noto Sans HK", "Noto Sans CJK HK", "Noto Sans CJK TC", "Microsoft JhengHei", var(--sys); --display: var(--font); }
:root:lang(ko) { --font: "Plus Jakarta Sans", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", var(--sys); --display: var(--font); }
/* Greek and Serbian Cyrillic: Plus Jakarta Sans has no glyphs. */
:root:lang(el), :root:lang(sr) { --font: var(--sys); --display: var(--sys); }
/* CJK, Thai and Indic scripts don't use italics or tight letter-spacing well. */
:root:lang(ja) *, :root:lang(zh-CN) *, :root:lang(zh-HK) *, :root:lang(ko) *, :root:lang(th) * { letter-spacing: normal !important; }

/* First-start tips in the first conversation and on home (app.js showFirstTip, UX-05). */
.first-tip { align-self: stretch; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 4px 0 12px; border-radius: 16px; background: var(--accent-soft); color: var(--ink); }
.first-tip .ft-ic { flex: none; width: 40px; height: 40px; border-radius: 14px; background: var(--accent); color: #1A1730; display: grid; place-items: center; }
.first-tip .ft-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.first-tip h3 { margin: 0 0 4px; font: 700 16px var(--display, var(--font)); }
.first-tip p { margin: 0 0 8px; font-size: 15px; line-height: 1.45; }
.mic.tip-glow { box-shadow: 0 0 0 4px var(--accent); }
