/* ---------- Tokens ---------- */
:root {
  --page: #f6f5f1;
  --surface: #fcfcfb;
  --card: #ffffff;
  --sunken: #f1f0eb;
  --ink: #151513;
  --ink-2: #52514e;
  --muted: #6f6e69;
  --line: #e6e4dc;
  --line-strong: #cfcdc4;
  --accent: #1c5cab;
  --accent-hover: #184f95;
  --accent-soft: #e8f0fb;
  --accent-ink: #ffffff;
  --good: #0c6b0c;
  --good-soft: #e4f3e4;
  --good-line: #3f9f3f;
  --bad: #b3302f;
  --bad-soft: #fbe9e8;
  --bad-line: #d65a59;
  --bar: #2a78d6;           /* single-series charts */
  --warn: #7a5000; --warn-soft: #fdf3dc; --warn-line: #e0a526;
  /* Strength scale: diverging red (weak) <-> blue (strong), neutral midpoint. */
  --h1: #c23b3a; --h1-ink: #ffffff;
  --h2: #ee9b9a; --h2-ink: #151513;
  --h3: #e4e3dd; --h3-ink: #151513;
  --h4: #86b6ef; --h4-ink: #151513;
  --h5: #1c5cab; --h5-ink: #ffffff;
  --h0-ring: #dcdad1; --h0-ink: #6f6e69;
  --shadow-sm: 0 1px 2px rgba(24, 22, 16, 0.05), 0 1px 1px rgba(24, 22, 16, 0.03);
  --shadow-md: 0 8px 24px rgba(24, 22, 16, 0.08), 0 2px 6px rgba(24, 22, 16, 0.05);
  --shadow-lg: 0 24px 60px rgba(24, 22, 16, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --greek: "Gentium Book Plus", "GFS Didot", "Noto Serif", serif;
  --ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0f0f0e; --surface: #1a1a19; --card: #1c1c1b; --sunken: #232321;
    --ink: #f4f3ef; --ink-2: #c3c2b7; --muted: #9a9890; --line: #2c2c2a; --line-strong: #43423e;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: #16273d; --accent-ink: #0b0b0b;
    --good: #5ccf5c; --good-soft: #142a17; --good-line: #2f8f2f;
    --bad: #f08a89; --bad-soft: #341716; --bad-line: #b84747;
    --bar: #3987e5;
    --warn: #f5c451; --warn-soft: #33280f; --warn-line: #8a6a1c;
    --h1: #ec7a7a; --h1-ink: #0b0b0b; --h2: #9a2e2e; --h2-ink: #ffffff; --h3: #383835; --h3-ink: #f4f3ef;
    --h4: #184f95; --h4-ink: #ffffff; --h5: #6da7ec; --h5-ink: #0b0b0b;
    --h0-ring: #3a3a37; --h0-ink: #9a9890;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink); font-family: var(--ui);
  font-size: 16px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
[lang="grc"], .greek {
  font-family: var(--greek);
  font-synthesis: none;            /* never fake bold/italic: it smears breathings and accents */
  font-variant-ligatures: none;
  letter-spacing: 0;
}
a { color: var(--accent); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1040px) / 2));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-family: var(--greek); font-size: 1.25rem; line-height: 1;
}
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 0.75rem; letter-spacing: 0; }
.tabs { display: flex; gap: 4px; align-items: center; }
.tabs a {
  text-decoration: none; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; font-weight: 550; font-size: 0.95rem;
}
.tabs a:hover { background: var(--sunken); color: var(--ink); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 0.85rem;
  background: var(--sunken); color: var(--ink-2); border: 1px solid var(--line);
}
.link { background: none; border: 0; color: var(--ink-2); cursor: pointer; padding: 4px; font-size: 0.9rem; }
.link:hover { color: var(--ink); text-decoration: underline; }
body.focus .tabs, body.focus .user { display: none; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .brand small { display: none; }
  .tabs { order: 3; width: 100%; justify-content: space-between; gap: 2px; }
  .tabs a { flex: 1 1 auto; text-align: center; padding: 7px 6px; font-size: 0.9rem; }
}

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 16px 56px; }
.foot { text-align: center; color: var(--muted); font-size: 0.78rem; padding: 18px 16px 24px; }

/* ---------- Type & layout ---------- */
h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); line-height: 1.2; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0; letter-spacing: -0.01em; font-weight: 650; }
.eyebrow { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.sub { color: var(--ink-2); margin: 6px 0 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section { margin-top: 28px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }
.error { color: var(--bad); min-height: 1.4em; margin: 0; font-size: 0.92rem; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; text-decoration: none; font-size: 0.97rem;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--sunken); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.lg { padding: 14px 22px; font-size: 1.02rem; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.kbd {
  font: 600 0.72rem/1 var(--ui); padding: 3px 6px; border-radius: 5px; border: 1px solid currentColor; opacity: 0.7;
}
label.field { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="search"], input[type="email"], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Segmented control */
.seg { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; padding: 0; }
.seg .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.seg.joined .opts { display: inline-flex; gap: 0; padding: 3px; background: var(--sunken); border-radius: 12px; flex-wrap: nowrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  margin: 0; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 550; font-size: 0.92rem;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); transition: all 0.15s;
}
.seg label:hover { color: var(--ink); border-color: var(--ink-2); }
.seg input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--page); }
.seg.joined label { border: 0; background: transparent; border-radius: 9px; min-width: 52px; text-align: center; padding: 8px 14px; }
.seg.joined input:checked + label { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.stack > * + * { margin-top: 20px; }

/* ---------- Login ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; max-width: 880px; margin: 3vh auto 0; padding: 0; overflow: hidden; }
.auth-art {
  background: linear-gradient(160deg, #1c5cab, #123c72); color: #fff; padding: 40px 36px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px; min-height: 420px;
}
.auth-art .quote { font-family: var(--greek); font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.2; }
.auth-art .tr { opacity: 0.8; margin-top: 8px; }
.auth-art .meta { font-size: 0.85rem; opacity: 0.75; }
.auth-form { padding: 40px 36px; }
@media (max-width: 720px) { .auth { grid-template-columns: 1fr; } .auth-art { min-height: 0; padding: 28px; } .auth-form { padding: 28px; } }

/* ---------- Dashboard ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; gap: 16px; } }
.hero-num { font-size: clamp(2.8rem, 7vw, 3.6rem); font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.hero-num small { font-size: 1.1rem; color: var(--muted); font-weight: 600; letter-spacing: 0; margin-left: 4px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.tile .v { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; }
.tile .l { color: var(--muted); font-size: 0.85rem; font-weight: 550; }
.focus-list { list-style: none; margin: 0 0 18px; padding: 0; }
.focus-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.focus-list li:last-child { border-bottom: 0; }
.focus-list .greek { font-size: 1.12rem; }
.focus-list .en { color: var(--ink-2); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 3px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }

/* Distribution bar (stacked, 2px surface gaps) */
.dist { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--card); }
.dist span { display: block; height: 100%; min-width: 3px; transition: flex-grow 0.4s ease; }
.dist .h0 { background: var(--sunken); box-shadow: inset 0 0 0 1px var(--h0-ring); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 0.85rem; color: var(--ink-2); }
.legend .k { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend b { color: var(--ink); font-weight: 650; }
.sw.h0 { background: transparent; box-shadow: inset 0 0 0 1.5px var(--h0-ring); }
.h1 { background: var(--h1); color: var(--h1-ink); } .h2 { background: var(--h2); color: var(--h2-ink); }
.h3 { background: var(--h3); color: var(--h3-ink); } .h4 { background: var(--h4); color: var(--h4-ink); }
.h5 { background: var(--h5); color: var(--h5-ink); }

/* Score column chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 500 11px var(--ui); }
.chart .bar { fill: var(--bar); transition: opacity 0.15s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar { opacity: 0.75; }

/* ---------- Quiz ---------- */
.quiz { max-width: 720px; margin: 0 auto; }
.quiz-top { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-bottom: 18px; }
.meter { height: 8px; background: var(--sunken); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.35s ease; }
.quiz-count { font-weight: 650; font-size: 0.92rem; color: var(--ink-2); white-space: nowrap; }
.quiz-count .ok { color: var(--good); margin-left: 8px; }
.prompt-card { text-align: center; padding: 30px 22px 34px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 650;
  letter-spacing: 0.04em; text-transform: uppercase; background: var(--sunken); color: var(--ink-2);
}
.prompt-q { color: var(--muted); font-size: 0.95rem; margin: 14px 0 6px; }
.prompt-greek { font-size: clamp(2rem, 6.5vw, 3rem); line-height: 1.3; overflow-wrap: anywhere; margin: 0; font-weight: 400; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
@media (max-width: 640px) { .options { grid-template-columns: 1fr; } }
.option {
  position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) 22px; gap: 12px; align-items: center;
  text-align: left; padding: 15px 16px; min-height: 64px; border-radius: 14px; border: 1.5px solid var(--line-strong);
  background: var(--card); cursor: pointer; font-size: 1.02rem; line-height: 1.35; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.option:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.option:active:not(:disabled) { transform: translateY(0); }
.option:disabled { cursor: default; }
.option .key {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
  background: var(--sunken); color: var(--ink-2); transition: all 0.15s;
}
.option .icon { font-weight: 800; text-align: center; }
.option.dim { opacity: 0.5; }
.option.correct { border-color: var(--good-line); background: var(--good-soft); }
.option.correct .key { background: var(--good-line); color: #fff; }
.option.correct .icon { color: var(--good); }
.option.wrong { border-color: var(--bad-line); background: var(--bad-soft); }
.option.wrong .key { background: var(--bad-line); color: #fff; }
.option.wrong .icon { color: var(--bad); }
.feedback {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid transparent; min-height: 70px;
}
.feedback.ok { background: var(--good-soft); border-color: var(--good-line); }
.feedback.no { background: var(--bad-soft); border-color: var(--bad-line); }
.feedback .title { font-weight: 700; }
.feedback.ok .title { color: var(--good); }
.feedback.no .title { color: var(--bad); }
.feedback .detail-line { font-size: 0.92rem; color: var(--ink-2); }
.feedback.placeholder { justify-content: center; color: var(--muted); font-size: 0.85rem; border: 1px solid var(--line); background: transparent; }

.type-badge { background: var(--accent-soft); color: var(--accent); }
.typed { display: flex; gap: 10px; margin-top: 16px; }
.answer-input {
  flex: 1; min-width: 0; padding: 16px 18px; font-size: 1.15rem; border-radius: 14px; border: 1.5px solid var(--line-strong);
  background: var(--card); color: var(--ink); font-family: var(--ui); box-shadow: var(--shadow-sm);
}
.answer-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.answer-input.correct { border-color: var(--good-line); background: var(--good-soft); }
.answer-input.wrong { border-color: var(--bad-line); background: var(--bad-soft); }
.answer-input:disabled { color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
@media (max-width: 480px) { .typed { flex-direction: column; } .typed .btn { width: 100%; } }
.tag-typed, .tag-self { display: inline-block; padding: 0 7px; border-radius: 999px; font: 600 0.72rem/1.6 var(--ui); vertical-align: 1px; }
.tag-typed { background: var(--accent-soft); color: var(--accent); }
.tag-self { background: var(--warn-soft); color: var(--warn); }
.review .mine.neutral { color: var(--ink-2); }

/* ---------- Results ---------- */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
@media (max-width: 560px) { .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--sunken); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(.2,.8,.2,1); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.9rem; font-weight: 750; letter-spacing: -0.02em; }
.review { list-style: none; margin: 0; padding: 0; }
.review li { display: grid; grid-template-columns: 28px minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.review li:last-child { border-bottom: 0; }
.review .greek { font-size: 1.15rem; line-height: 1.35; }
.review .mine { color: var(--bad); font-size: 0.88rem; margin-top: 2px; }
.mark-ok, .mark-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.8rem; }
.mark-ok { background: var(--good-soft); color: var(--good); }
.mark-no { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 560px) { .review li { grid-template-columns: 28px minmax(0, 1fr); } .review li > :last-child { grid-column: 2; } }

/* ---------- Heatmap ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 220px; max-width: 320px; }
.overview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.overview-head .big { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; }
.letters { display: grid; gap: 18px; }
.letter-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .letter-row { grid-template-columns: 1fr; gap: 6px; } }
.letter-label { padding-top: 6px; }
.letter-label .g { font-family: var(--greek); font-size: 1.35rem; line-height: 1; }
.letter-label .c { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .letter-label { display: flex; align-items: baseline; gap: 8px; padding: 0; } .letter-label .c { margin: 0; } }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 2px; }
.cell {
  font-family: var(--greek); font-size: 0.98rem; line-height: 1.2; height: 38px; padding: 0 8px; border: 0; border-radius: 5px;
  cursor: pointer; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.15s;
}
.cell.h0 { background: transparent; color: var(--h0-ink); box-shadow: inset 0 0 0 1px var(--h0-ring); }
.cell:hover, .cell:focus-visible { transform: translateY(-1px); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); outline: none; z-index: 1; position: relative; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px; padding: 10px 12px; border-radius: 10px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow-md);
  font-size: 0.85rem; opacity: 0; transform: translateY(4px); transition: opacity 0.1s, transform 0.1s;
}
.tip.show { opacity: 1; transform: none; }
.tip .v { font-weight: 700; display: flex; align-items: center; gap: 7px; }
.tip .v i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .g { font-family: var(--greek); font-size: 1.05rem; margin-top: 4px; }
.tip .e { color: var(--ink-2); }

/* Table view */
.table-wrap { overflow-x: auto; max-height: 70vh; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 650; background: var(--surface); position: sticky; top: 0; z-index: 1; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--accent); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .greek { font-size: 1.08rem; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.pill .sw { width: 10px; height: 10px; border-radius: 3px; }
.pill.none { color: var(--muted); font-weight: 500; }

/* Word dialog */
dialog.sheet {
  border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(460px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg);
  max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(10, 10, 8, 0.45); backdrop-filter: blur(2px); }
.sheet-body { padding: 24px; }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sheet .greek-lg { font-size: 1.6rem; line-height: 1.3; margin: 10px 0 4px; }
.sheet .en { color: var(--ink-2); font-size: 1.02rem; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.stats-row div { background: var(--sunken); border-radius: 12px; padding: 10px 12px; }
.stats-row b { display: block; font-size: 1.15rem; }
.stats-row b.pill { display: flex; font-size: 1.05rem; }
.stats-row span { font-size: 0.78rem; color: var(--muted); }
.recent { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; color: var(--muted); flex-wrap: wrap; }
.recent i { width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-style: normal; font-size: 0.7rem; font-weight: 800; }
.recent .y { background: var(--good-soft); color: var(--good); }
.recent .n { background: var(--bad-soft); color: var(--bad); }
.close-x { background: var(--sunken); border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--ink-2); flex: none; }

/* ---------- Teacher ---------- */
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 600; font-size: 0.92rem; }
.back:hover { text-decoration: underline; }
.tile .of { font-size: 0.95rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.note-card { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 14px 18px; margin-bottom: 16px; background: var(--accent-soft); border-color: transparent; }
.note-card a { font-weight: 600; text-decoration: none; }
.who { display: flex; align-items: center; gap: 12px; }
.who .avatar { width: 36px; height: 36px; flex: none; }
.dist.mini { height: 10px; border-radius: 5px; }
.mini-cap { font-size: 0.78rem; color: var(--muted); margin-top: 5px; }
table.students td { padding-top: 13px; padding-bottom: 13px; }
.focus-list.cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; margin: 0; }
@media (max-width: 720px) { .focus-list.cols { grid-template-columns: 1fr; } }
.focus-list.cols li:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
.right-stat { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 0.85rem; }
.right-stat .muted { font-size: 0.75rem; white-space: nowrap; }
.chart .hit.link { cursor: pointer; }
.btn.sm { padding: 6px 12px; font-size: 0.88rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-soft); }
.tag-edited { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font: 600 0.7rem var(--ui); background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
dialog.sheet.wide { width: min(720px, calc(100vw - 32px)); }
input[type="text"].greek-input { font-family: var(--greek); font-size: 1.3rem; padding: 10px 13px; font-synthesis: none; }
select { appearance: auto; }
.preview { background: var(--sunken); border-radius: 14px; padding: 16px 18px; min-height: 64px; }
.preview-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; font-size: 0.82rem; }
.preview-head .eyebrow { margin: 0; }
.preview .greek-lg { font-size: 1.55rem; line-height: 1.3; margin: 8px 0 2px; }
.preview .en { color: var(--ink-2); }
.check { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; border: 1px solid transparent; }
.check.ok { background: var(--good-soft); color: var(--good); border-color: var(--good-line); }
.check.err { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-line); }
.check.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.check.info { background: var(--accent-soft); color: var(--accent); }
.confirm { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 0.92rem; }
.confirm input { width: 18px; height: 18px; }
.history summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.edits { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.edits li { padding: 8px 0; border-top: 1px solid var(--line); }

.pills-card { padding: 18px 20px; }
.pills-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 0.92rem;
  transition: all 0.15s; user-select: none;
}
.pill-toggle .avatar { width: 26px; height: 26px; font-size: 0.75rem; }
.pill-toggle .n { font-size: 0.75rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill-toggle:hover { border-color: var(--ink-2); color: var(--ink); }
.pill-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.pill-toggle[aria-pressed="true"] .avatar { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.per-student { margin-top: 4px; font-size: 0.9rem; }
.per-student th { position: static; background: transparent; }
.per-student td, .per-student th { padding: 9px 8px; }

/* ---------- Classes ---------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.class-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 18px; min-height: 196px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  color: var(--ink); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
a.class-card:hover, a.class-card:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.cc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cc-head h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.cc-head .muted { font-size: 0.88rem; white-space: nowrap; }
.cc-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cc-big .big { font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1; }
.cc-big .muted { font-size: 0.88rem; }
.cc-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.85rem; color: var(--ink-2); }
.cc-stats b { color: var(--ink); }
.cc-empty { margin: 0; flex: 1; }
.cc-go { margin-top: auto; font-weight: 650; font-size: 0.9rem; color: var(--accent); }
.class-card.add {
  align-items: center; justify-content: center; cursor: pointer; font: inherit; font-weight: 650; color: var(--ink-2);
  background: transparent; border: 1.5px dashed var(--line-strong); box-shadow: none;
}
@media (max-width: 640px) { .class-card.add { min-height: 88px; flex-direction: row; } }
.class-card.add:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.class-card.add .plus { font-size: 2rem; line-height: 1; font-weight: 400; }
.privacy { color: var(--muted); font-size: 0.85rem; margin: 18px 0 0; }
.onboard { max-width: 640px; }
.onboard h2 { font-size: 1.25rem; }
.onboard .btn { margin-top: 20px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; }
.steps li::before {
  content: counter(step); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 750;
}
.steps span { color: var(--ink-2); font-size: 0.93rem; }
.nudge { padding: 18px 20px; }
.nudge .pill-toggle { text-decoration: none; }
td.row-act { text-align: right; width: 1%; white-space: nowrap; }
.btn.remove { color: var(--muted); }
.btn.remove:hover { color: var(--bad); background: var(--bad-soft); }
.danger-zone { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.danger-zone .btn { color: var(--bad); }
.danger-zone .btn:hover { background: var(--bad-soft); color: var(--bad); }
.sheet-title { font-size: 1.3rem; }
.btn.danger-solid { background: var(--bad); color: #fff; }
.btn.danger-solid:hover { background: var(--bad); filter: brightness(0.92); }
.close-x.sm { width: 28px; height: 28px; font-size: 0.8rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.95em; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-foot { color: var(--ink-2); font-size: 0.92rem; padding-top: 16px; border-top: 1px solid var(--line); }
.logins-wrap { max-height: 50vh; border: 1px solid var(--line); border-radius: 12px; }
.logins { margin: 0; }
.logins th { position: sticky; background: var(--surface); }
.logins.edit td { padding: 6px 4px; }
.logins.edit td:first-child { padding-left: 8px; }
.logins.edit input { padding: 8px 10px; min-width: 110px; }
.logins tr.has-err input { border-color: var(--bad-line); }
.logins .row-err td { color: var(--bad); font-size: 0.85rem; padding-top: 0; border-bottom-color: var(--line); }
.logins tr.has-err td { border-bottom: 0; }
.original { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.original .greek { font-size: 1.1rem; }
.original .btn { margin-left: auto; }

/* ---------- Word lists, copying, account, admin ---------- */
a.avatar { text-decoration: none; }
a.avatar[href]:hover { border-color: var(--accent); color: var(--accent); }
.cc-list { margin-top: -8px; font-size: 0.82rem; color: var(--muted); }
.list-tag { margin: 6px 0 0; font-size: 0.88rem; color: var(--muted); }
.list-tag b { color: var(--ink-2); font-weight: 600; }
.list-select { width: auto; max-width: 100%; margin-top: 10px; padding: 7px 10px; font-weight: 600; }
.pick { border: 0; padding: 0; min-width: 0; }
.pick legend { padding: 0; margin-bottom: 8px; }
.pick legend .link { font-size: 0.85rem; color: var(--accent); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 16px; max-height: 240px; overflow-y: auto; }
.pick .confirm { font-weight: 500; }
.narrow { max-width: 560px; }
.subtabs { display: flex; gap: 4px; margin: -8px 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subtabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs a:hover { color: var(--ink); }
.subtabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 18px; margin-bottom: 16px; font-size: 0.93rem; }
.notice.new { background: var(--accent-soft); border-color: var(--accent); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.filter-chip { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-weight: 600; font-size: 0.92rem; }
.filter-chip .link { color: var(--accent); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 0.75rem/1.7 var(--ui); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.chip.err { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.info { background: var(--accent-soft); color: var(--accent); }
.chip.new { background: var(--sunken); color: var(--ink-2); }
.chip.muted-chip { background: var(--sunken); color: var(--muted); }
tr.dimmed td { opacity: 0.55; }
.freq { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .freq { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.freq-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); font: inherit; color: var(--ink);
  border-top: 4px solid var(--line-strong); transition: border-color 0.15s, background 0.15s;
}
.freq-card.most { border-top-color: var(--h5); }
.freq-card.weekly { border-top-color: var(--h4); }
.freq-card.some { border-top-color: var(--h2); }
.freq-card .n { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.freq-card .t { font-weight: 650; }
.freq-card .h { font-size: 0.8rem; color: var(--muted); }
.freq-card:hover { border-color: var(--ink-2); }
.freq-card[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.strip { display: inline-flex; gap: 1px; vertical-align: middle; }
.strip i { width: 4px; height: 14px; border-radius: 1px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--h0-ring); }
.strip i.on, .strip i.l3 { background: var(--accent); box-shadow: none; }
.strip.weeks i { width: 12px; }
.strip i.l1 { background: color-mix(in srgb, var(--accent) 35%, var(--sunken)); box-shadow: none; }
.strip i.l2 { background: color-mix(in srgb, var(--accent) 65%, var(--sunken)); box-shadow: none; }
table.usage td:nth-child(3), table.usage td.num { white-space: nowrap; }
table.usage td, table.usage th { padding-left: 10px; padding-right: 10px; }
.usage-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: -6px 0 16px; }

/* Login slips: only these print. */
#print-area { display: none; }
@media print {
  @page { margin: 12mm; }
  body { display: block; background: #fff; min-height: 0; }
  body > :not(#print-area) { display: none !important; }
  #print-area { display: grid !important; grid-template-columns: 1fr 1fr; gap: 0; color: #000; }
  .slip { break-inside: avoid; border: 1px dashed #888; padding: 14px 16px; font-size: 11pt; }
  .slip-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12pt; }
  .slip .mark { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; border: 1.5px solid #000; font-family: var(--greek); }
  .slip p { margin: 8px 0; }
  .slip dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
  .slip dt { color: #444; }
  .slip dd { margin: 0; font-weight: 700; }
}

/* ---------- Motion ---------- */
.fade-in { animation: fadeIn 0.25s ease backwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.shake { animation: shake 0.35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.pop { animation: pop 0.3s ease; }
@keyframes pop { 50% { transform: scale(1.025); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  main { padding-top: 20px; }
  .card { padding: 18px; }
  .toolbar .row { justify-content: stretch; flex-wrap: nowrap; }
  .toolbar .search { max-width: none; min-width: 0; }
  .cells { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .cell { font-size: 0.92rem; height: 36px; padding: 0 6px; }
  .page-head .btn.lg { width: 100%; }
  .prompt-card { padding: 22px 16px 26px; }
  .quiz-top { gap: 10px; }
}

/* ---------- Own accounts, join codes, account page ---------- */
.ok-msg { color: var(--good); background: var(--good-soft); border: 1px solid var(--good-line); border-radius: 10px; padding: 10px 12px; margin: 0; }
.acct { margin-top: 16px; }
.acct h2 { font-size: 1.1rem; }
.acct > p { margin: 0; color: var(--ink-2); }
.join .row input { max-width: 180px; }
.code-input { text-transform: uppercase; letter-spacing: 0.08em; font-size: 1.1rem; }
.join-confirm { margin-top: 14px; padding: 16px; border-radius: 12px; background: var(--accent-soft); }
.join-confirm p { margin: 0 0 10px; color: var(--ink); }
.danger-card { border-color: var(--bad-line); }
.join-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; padding: 16px 20px; }
.join-card > div:first-child { flex: 1 1 360px; }
.join-card .eyebrow { margin-bottom: 4px; }
.join-code { font-size: 1.7rem; font-weight: 750; letter-spacing: 0.12em; margin: 0 0 6px; color: var(--accent); }
.center { text-align: center; }
.email-result { margin: 6vh auto 0; padding: 40px 28px; }
.big-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; font-size: 1.8rem; font-weight: 800; }
.big-mark.ok { background: var(--good-soft); color: var(--good); }
.big-mark.no { background: var(--warn-soft); color: var(--warn); }
.small-email { font-size: 0.82rem; }
.ok-tick { color: var(--good); font-weight: 800; }
