/* Teacher Romulo brand, clean style: white and warm grey, the logo's burgundy (#741C21) softened to a
   pastel (#E2A4A9) for buttons and highlights, the logo's cream (#F0D4B0) for notes and corrections.
   Inter Tight for titles, Inter for everything else. Buttons have a dark outline. */
/* The fonts (SIL Open Font License) are kept in /fonts: the server's security policy only lets the page
   load files from the platform itself, and they then also work without internet. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url(fonts/inter-tight-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/cinzel-700-latin.woff2) format("woff2");
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f1ef;
  --ink: #1f1718;
  --muted: #6b5f60;
  --line: #e6dedc;
  --brand: #741c21;
  --primary: #741c21;
  --primary-strong: #741c21;
  --on-primary: #ffffff;
  --primary-soft: #fcf2e4;
  --rose: #741c21;
  --rose-hover: #5f161b;
  --rose-soft: #f0d4b0;
  --rose-line: #741c21;
  --on-rose: #ffffff;
  --btn-border: #1f1718;
  --accent: #a8702f;
  --accent-soft: #fcf2e4;
  --cream: #f0d4b0;
  --cream-line: #ecd6b6;
  --good: #2f7d55;
  --good-soft: #e0f3e8;
  --bad: #c2453a;
  --bad-soft: #fde6e2;
  --bar: #ffffff;
  --sketch: #1f1718;
  --sketch-shadow: #1f1718;
  --shadow-pop: 0 6px 16px rgb(31 23 24 / 6%);
  --radius: 8px;
  --topbar-h: 65px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* The serif capitals of the Teacher Romulo seal, for the "After Class" name. */
  --font-brand: "Cinzel", "Trajan Pro", Georgia, serif;
  color-scheme: light;
}

/* Dark colours: on a dark device unless the person chose Light, or whenever they chose Dark
   (the sun/moon button, which sets data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171213;
    --surface: #1f191a;
    --surface-2: #2a2223;
    --ink: #f4ebe7;
    --muted: #b3a5a2;
    --line: #3a3031;
    --brand: #f0d4b0;
    --primary: #f0d4b0;
    --primary-strong: #f0d4b0;
    --on-primary: #1f1718;
    --primary-soft: #33281c;
    --rose: #9c3a41;
    --rose-hover: #b04c53;
    --rose-soft: #4a3a25;
    --rose-line: #f0d4b0;
    --on-rose: #ffffff;
    --btn-border: #f0d4b0;
    --accent: #e3b071;
    --accent-soft: #33281c;
    --cream-line: #4a3b28;
    --good: #6fcf97;
    --good-soft: #183326;
    --bad: #f08a7c;
    --bad-soft: #3d2320;
    --bar: #171213;
    --sketch-shadow: rgb(0 0 0 / 55%);
    --shadow-pop: 0 6px 16px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #171213;
  --surface: #1f191a;
  --surface-2: #2a2223;
  --ink: #f4ebe7;
  --muted: #b3a5a2;
  --line: #3a3031;
  --brand: #f0d4b0;
  --primary: #f0d4b0;
  --primary-strong: #f0d4b0;
  --on-primary: #1f1718;
  --primary-soft: #33281c;
  --rose: #9c3a41;
  --rose-hover: #b04c53;
  --rose-soft: #4a3a25;
  --rose-line: #f0d4b0;
  --on-rose: #ffffff;
  --btn-border: #f0d4b0;
  --accent: #e3b071;
  --accent-soft: #33281c;
  --cream-line: #4a3b28;
  --good: #6fcf97;
  --good-soft: #183326;
  --bad: #f08a7c;
  --bad-soft: #3d2320;
  --bar: #171213;
  --sketch-shadow: rgb(0 0 0 / 55%);
  --shadow-pop: 0 6px 16px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.75rem, 1.45rem + 1.2vw, 2.25rem); letter-spacing: -0.035em; line-height: 1.12; }
h2 { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stack.tight { gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

/* ---------- frame ---------- */

.topbar { position: sticky; top: 0; z-index: 20; background: var(--bar); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 0 16px; min-height: 64px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; text-decoration: none; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 8px; }
/* Menu items sit on the bar's bottom edge, the open one underlined in the pastel burgundy. */
.topbar nav { display: flex; gap: 4px; margin-left: auto; align-self: stretch; align-items: stretch; }
.navlink {
  display: flex; align-items: center; gap: 4px; white-space: nowrap; background: none; border: 0; border-bottom: 3px solid transparent;
  padding: 3px 12px 0; cursor: pointer; color: var(--ink); font-weight: 500; font-size: 0.95rem;
}
.navlink:hover { color: var(--primary); }
.navlink.on { border-bottom-color: var(--rose-line); }

/* Sun/moon button that switches between light and dark. */
.theme-toggle {
  display: grid; place-items: center; align-self: center; flex: none; width: 40px; height: 40px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle.floating { position: fixed; top: 16px; right: 16px; z-index: 30; background: var(--surface); border: 1px solid var(--line); }

/* The button that switches the student area between English and Portuguese. */
.lang-toggle {
  flex: none; align-self: center; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.lang-toggle:hover { border-color: var(--ink); }
.show-narrow { display: none; }
.lang-toggle.floating { position: fixed; top: 16px; right: 64px; z-index: 30; }

/* "After Class by (seal)" */
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.wordmark { white-space: nowrap; font-family: var(--font-brand); font-weight: 700; letter-spacing: 0.04em; line-height: 1; color: var(--brand); }
.lockup.bar .wordmark { font-size: 1.4rem; }
.lockup .by { display: inline-flex; align-items: center; gap: 6px; }
.lockup .by-word { font-size: 0.85rem; color: var(--muted); }
.seal { display: block; border-radius: 50%; object-fit: cover; }
.lockup.bar .seal { width: 40px; height: 40px; }

.eyebrow { font-size: 0.95rem; font-weight: 500; color: var(--muted); }

/* Header, page and footer fill the screen, so the footer sits at the bottom even on short pages. */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.page { flex: 1 0 auto; width: 100%; max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
.page.narrow { max-width: 720px; }

/* The slogan closes every page; it clears the bottom bar on pages that have one. */
.site-footer { border-top: 1px solid var(--line); padding: 28px 16px 40px; text-align: center; color: var(--muted); font-size: 0.9rem; }
body:has(.actionbar) .site-footer { padding-bottom: 120px; }
.slogan span, .login .hero .tagline span { display: inline-block; }

.banner { padding: 10px 16px; font-size: 0.88rem; text-align: center; background: var(--accent-soft); color: var(--ink); border-bottom: 1px solid var(--line); }
.banner button { margin-left: 8px; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 2px solid var(--rose);
  background: var(--rose); color: var(--on-rose); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--rose-hover); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.soft { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn.soft:hover { background: var(--rose-soft); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 0.9rem; }
.btn.big { min-height: 52px; padding: 12px 24px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: grid; gap: 6px; }
.field label, .label { font-weight: 600; font-size: 0.9rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--ink); outline: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.soft { background: var(--surface-2); border-color: transparent; }

.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 6px; background: var(--surface-2); font-size: 0.8rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.chip.primary { background: var(--rose-soft); color: var(--primary-strong); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- login ---------- */

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; background: var(--surface-2); }
.login { width: 100%; max-width: 400px; display: grid; gap: 24px; }
.login .hero { text-align: center; display: grid; gap: 6px; justify-items: center; }
.login .hero .seal { width: 104px; height: 104px; margin-bottom: 12px; border: 2px solid var(--sketch); box-shadow: 5px 5px 0 var(--sketch-shadow); }
.login .hero .wordmark { font-size: clamp(2.3rem, 1.9rem + 2.2vw, 2.9rem); }
.login .hero .tagline { margin-top: 8px; }
.login .card { padding: 24px; }

/* ---------- steps ---------- */

.steps { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.steps .step { display: inline-flex; align-items: center; gap: 6px; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 0.75rem; }
.steps .step.on { color: var(--ink); }
.steps .step.on .dot, .steps .step.done .dot { background: var(--rose); color: var(--on-rose); }
.steps .step.on .dot { box-shadow: inset 0 0 0 2px var(--btn-border); }
.steps .sep { width: 18px; height: 2px; background: var(--line); border-radius: 2px; }

.tabs { display: inline-flex; justify-self: start; padding: 4px; background: var(--surface-2); border-radius: 10px; gap: 4px; }
.tab { border: 0; background: transparent; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--muted); min-height: 40px; }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.tab .count { margin-left: 6px; font-size: 0.75rem; background: var(--rose); color: var(--on-rose); border-radius: 999px; padding: 1px 7px; }

.pick-list { display: grid; gap: 10px; }
.pick {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; text-align: left; width: 100%;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 14px 16px; cursor: pointer;
}
.pick:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.pick.on { border-color: var(--ink); background: var(--rose-soft); }
/* A practice with a Remove button: the box is drawn around both, the clickable part has no box of its own. */
.pick-box { background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 10px; }
.pick-box:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
.pick.pick-inner { border: 0; padding: 0; background: none; border-radius: 0; }
.pick .box { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 2px; background: var(--surface); color: transparent; font-weight: 800; font-size: 0.85rem; }
.pick.on .box { background: var(--rose); border-color: var(--btn-border); color: var(--on-rose); }
.pick .date { font-weight: 700; }
.pick .title { font-weight: 650; }
.pick .sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.pick .chips { margin-top: 8px; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.actionbar-inner { max-width: 960px; margin: 0 auto; display: flex; gap: 12px; align-items: center; justify-content: space-between; }

.kinds { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.kind {
  text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer;
  display: grid; gap: 8px; align-content: start; transition: border-color 0.15s ease;
}
.kind:hover { border-color: var(--ink); }
.kind .icon { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); transition: background 0.15s ease; }
.kind .icon svg { width: 24px; height: 24px; }
.kind .name { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.kind:hover .icon { background: var(--rose); color: var(--on-rose); }
.kind[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ---------- loading ---------- */

.loading { display: grid; justify-items: center; gap: 18px; padding: 64px 16px; text-align: center; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
.spinner.small { width: 18px; height: 18px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

/* ---------- exercises ---------- */

/* The exercise title sits in a panel with a small notepad drawing on the right. */
.exercise-head { background: var(--surface-2); border-radius: 8px; padding: 30px 170px 30px 28px; position: relative; overflow: hidden; min-height: 150px; align-content: center; }
.exercise-head > .muted { color: var(--ink); font-size: 0.95rem; }
.exercise-head::after {
  content: ""; position: absolute; right: 36px; top: 50%; width: 92px; height: 108px; margin-top: -50px; transform: rotate(-8deg);
  background:
    linear-gradient(var(--rose), var(--rose)) 30px 24px / 44px 11px no-repeat,
    linear-gradient(#a8d8bb, #a8d8bb) 30px 48px / 38px 11px no-repeat,
    linear-gradient(var(--cream), var(--cream)) 30px 72px / 44px 11px no-repeat,
    linear-gradient(var(--sketch), var(--sketch)) 12px 24px / 11px 11px no-repeat,
    linear-gradient(var(--sketch), var(--sketch)) 12px 48px / 11px 11px no-repeat,
    linear-gradient(#fff, #fff) 14px 74px / 7px 7px no-repeat,
    linear-gradient(var(--sketch), var(--sketch)) 12px 72px / 11px 11px no-repeat,
    #fffaf3;
  border: 2px solid var(--sketch); border-radius: 8px; box-shadow: 5px 5px 0 var(--sketch-shadow);
}

.blank-item { display: grid; gap: 6px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.blank-item:last-child { border-bottom: 0; }
.blank-line { font-size: 1.08rem; line-height: 2.2; }
.blank-line .n {
  display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: 10px; vertical-align: 1px; line-height: 1;
  border-radius: 6px; background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 0.85rem;
}
.blank-input {
  display: inline-block; width: 9.5em; max-width: 60vw; min-height: 40px; padding: 4px 10px; margin: 0 4px; text-align: center;
  border: 2px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600;
}
.blank-input:focus { outline: none; border-color: var(--ink); }
.blank-input.correct { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.blank-input.almost { background: var(--accent-soft); border-color: var(--accent); }
.blank-input.wrong, .blank-input.blank { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.wordbank { display: flex; flex-wrap: wrap; gap: 8px; }
/* The words stay in reach while the student scrolls down the sentences. */
.card.bank-card { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 5; background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-pop); max-height: 40dvh; overflow: auto; }
.bank-card .label { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
.word { border: 2px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.word:hover { border-color: var(--ink); }
.word.used { opacity: 0.4; text-decoration: line-through; }

.result-line { font-size: 0.92rem; display: grid; gap: 2px; }
.said { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.better { color: var(--good); font-weight: 650; }

.score { display: flex; align-items: center; gap: 24px; }
.card.score { background: var(--rose-soft); border-color: transparent; padding: 28px; }
.score h2 { font-size: 2.1rem; letter-spacing: -0.035em; }
.score .muted { color: var(--ink); }
.ring { --value: 0; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--ink);
  background: conic-gradient(var(--primary-strong) calc(var(--value) * 1%), var(--surface) 0); }
.ring span {
  width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: var(--rose-soft); border: 2px solid var(--ink);
  font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.03em;
}

.feedback { border-left: 4px solid var(--rose-line); }
.feedback.great { border-left-color: var(--good); }
.feedback.needs_work { border-left-color: var(--accent); }
.feedback dl { margin: 0; display: grid; gap: 14px; }
.feedback dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.feedback dd { margin: 0; }
.fix { display: grid; gap: 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.fix + .fix { margin-top: 8px; }

.dots { display: flex; gap: 6px; }
.dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.done { background: var(--primary); }
.dots i.now { background: var(--accent); }

.picture { width: 100%; max-height: 56vh; object-fit: contain; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: block; }
.credit { font-size: 0.75rem; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }

/* ---------- chat ---------- */

.chat { display: grid; gap: 12px; }
.msg { max-width: min(82%, 560px); padding: 12px 16px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* The tutor speaks with Teacher Romulo's avatar beside each message. */
.msg.tutor { background: var(--surface-2); border-bottom-left-radius: 4px; justify-self: start; position: relative; margin-left: 44px; }
.msg.tutor::before {
  content: ""; position: absolute; left: -44px; bottom: 0; width: 34px; height: 34px; border-radius: 50%;
  background: url(brand/teacher-romulo-avatar.jpg) center / cover; border: 2px solid var(--sketch);
}
.msg.me { background: var(--rose-soft); color: var(--ink); border-bottom-right-radius: 4px; justify-self: end; }
.msg.blurred { filter: blur(6px); cursor: pointer; user-select: none; }
/* A word of the tutor's speech: pointing or tapping it shows its translation in a small box. */
.gloss-word { cursor: help; border-bottom: 1px dotted var(--muted); }
.gloss-word:hover, .gloss-word:focus-visible { color: var(--brand); border-bottom-color: var(--brand); outline: none; }
.gloss {
  position: fixed; transform: translate(-50%, -100%); z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 4px 10px; border-radius: 6px; font-size: 0.85rem; white-space: nowrap;
}
.correction { justify-self: end; max-width: min(82%, 560px); font-size: 0.9rem; background: var(--accent-soft); border: 1px solid var(--cream-line); border-radius: 8px; padding: 10px 14px; display: grid; gap: 2px; }
.correction b { font-weight: 700; color: var(--good); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 160px; resize: none; }
.speaker { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 6px; margin-left: 6px; border-radius: 6px; vertical-align: middle; }
.speaker:hover { color: var(--primary-strong); background: var(--rose-soft); }
.speaker svg { width: 18px; height: 18px; vertical-align: -3px; }

.mic-wrap { display: grid; justify-items: center; gap: 10px; }
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--btn-border); cursor: pointer; background: var(--rose); color: var(--on-rose);
  display: grid; place-items: center;
}
.mic svg { width: 36px; height: 36px; }
.mic.live { background: var(--bad); border-color: var(--bad); color: #fff; animation: pulse 1.4s ease-out infinite; }
.mic[disabled] { opacity: 0.45; cursor: not-allowed; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.heard { min-height: 1.5em; font-style: italic; color: var(--muted); text-align: center; }

/* ---------- teacher ---------- */

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
.num { font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid-2 > * { min-width: 0; }
.file-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px dashed var(--line); font-size: 0.9rem; }
.file-row .name { overflow-wrap: anywhere; }
.drop { border: 2px dashed var(--line); border-radius: 8px; padding: 18px; text-align: center; background: var(--surface-2); }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.secret { font: 600 1.2rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 12px 16px; text-align: center; letter-spacing: 0.04em; user-select: all; }

.modal-back { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 460px; box-shadow: 0 20px 50px rgb(0 0 0 / 20%); max-height: 90dvh; overflow: auto; }

#toasts { position: fixed; left: 0; right: 0; bottom: 92px; display: grid; justify-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-pop); max-width: 520px; font-size: 0.92rem; }
.toast.error { background: var(--bad); color: #fff; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }

/* ---------- phones ---------- */

@media (max-width: 560px) {
  :root { --topbar-h: 89px; }
  .page { padding: 16px 12px 40px; }
  .card { padding: 16px; }
  .topbar .hide-narrow { display: none; }
  .topbar .show-narrow { display: inline; }
  /* Brand on its own row, the menu below it, scrolling sideways if it has to. */
  .topbar-inner { flex-wrap: wrap; row-gap: 4px; padding: 10px 12px 0; min-height: 0; }
  .topbar nav { order: 3; margin-left: 0; width: 100%; align-self: auto; overflow-x: auto; scrollbar-width: none; }
  .topbar .theme-toggle { margin-left: auto; }
  .topbar .lang-toggle { margin-left: auto; }
  .topbar .lang-toggle + .theme-toggle { margin-left: 0; }
  .navlink { padding: 9px 8px 8px; font-size: 0.9rem; }
  .lockup.bar .wordmark { font-size: 1.2rem; }
  .lockup.bar .seal { width: 32px; height: 32px; }
  .msg, .correction { max-width: 92%; }
  .msg.tutor { margin-left: 36px; max-width: calc(92% - 36px); }
  .msg.tutor::before { left: -36px; width: 28px; height: 28px; }
  .exercise-head { padding: 22px 96px 22px 20px; min-height: 0; }
  .exercise-head::after { top: 16px; right: 12px; margin-top: 0; transform: rotate(-8deg) scale(0.58); transform-origin: top right; }
  .card.score { padding: 20px; gap: 16px; }
  .score h2 { font-size: 1.5rem; }
  .ring { width: 84px; height: 84px; }
  .ring span { width: 62px; height: 62px; font-size: 1.2rem; }
}

/* ---------- student area ---------- */

.class-time { margin: 0; font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.fee { margin: 0; font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.2; }
.pix-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pix-key { font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.pix-numbers { gap: 12px 40px; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumb { background: none; border: 0; padding: 4px 2px; cursor: pointer; color: var(--primary-strong); font: inherit; font-weight: 500; text-align: left; overflow-wrap: anywhere; }
.crumb:hover { text-decoration: underline; }
.page.wide { max-width: 1200px; }
.drive-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.drive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.drive-card {
  display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; min-width: 0;
}
.drive-card:hover { background: var(--surface-2); box-shadow: var(--shadow-pop); }
.drive-card.folder { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
.drive-card.folder svg { width: 28px; height: 28px; flex: none; }
.drive-cover { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.drive-cover.empty-cover { display: grid; place-items: center; }
.drive-cover.empty-cover svg { width: 48px; height: 48px; opacity: 0.6; }
.drive-text { min-width: 0; }
@media (max-width: 560px) { .drive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .drive-folders { grid-template-columns: 1fr; } .drive-card { padding: 8px; } .drive-name { font-size: 0.9rem; } }
.drive-name { display: block; font-weight: 500; overflow-wrap: anywhere; }
.drive-meta { display: block; }

/* ---------- calendar ---------- */

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-cell {
  aspect-ratio: 1; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; padding: 4px 0 6px; cursor: pointer;
}
.cal-cell.empty { border: 0; background: none; cursor: default; }
.cal-cell[disabled] { opacity: 0.35; cursor: default; }
.cal-cell.done { background: var(--rose-soft); border-color: transparent; }
.cal-cell.today .cal-num { color: var(--primary-strong); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.cal-cell.on { outline: 2px solid var(--ink); outline-offset: -1px; }
.cal-num { font-weight: 650; font-size: 0.95rem; }
.cal-dots { display: flex; gap: 3px; min-height: 8px; }
.cal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cal-dot.platform { background: var(--primary); }
.cal-dot.outside { background: var(--accent); }
.cal-dot.planned { background: transparent; border: 2px solid var(--accent); width: 9px; height: 9px; box-sizing: border-box; }
.planned-card { border-style: dashed; }

/* On/off switch, with a hint above it on hover. */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; justify-self: start; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--primary-strong); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary-strong); outline-offset: 2px; }
.switch[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 300px; text-align: left; line-height: 1.4; padding: 8px 12px; border-radius: 8px; background: var(--ink); color: var(--surface); font-size: 0.85rem; font-weight: 500; z-index: 20; }

/* Practise: classes grouped by month with a calendar tile, materials with a cover. */
.month-group { display: grid; gap: 10px; }
.month-group + .month-group { margin-top: 14px; }
.month-title { font-size: 1rem; font-weight: 750; color: var(--muted); margin: 6px 0 0; text-transform: capitalize; }
.pick-row { display: flex; gap: 14px; align-items: flex-start; }
.pick-text { min-width: 0; flex: 1; }
.cal-tile { flex: none; width: 54px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); text-align: center; display: grid; }
.cal-tile .cal-month { background: var(--rose); color: var(--on-rose); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 0; }
.cal-tile .cal-day { font-size: 1.4rem; font-weight: 800; line-height: 1.3; padding: 2px 0 4px; }
.pick.on .cal-tile { border-color: var(--btn-border); }
.mat-cover { flex: none; width: 96px; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: block; }
.mat-cover.empty-cover { display: grid; place-items: center; }
.mat-cover.empty-cover svg { width: 28px; height: 28px; opacity: 0.55; }
.practised { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 700; vertical-align: 1px; }
@media (max-width: 520px) { .mat-cover { width: 72px; } }

/* The A1 guide shown while a practice is being prepared. */
.guide-kind .guide-q { font-weight: 650; color: var(--primary-strong); margin: 0; }
.guide-kind p { margin: 0; }
.guide-examples { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 2px; }
.guide-status { align-self: center; }
