﻿/* Word Goblin — css/style.css
 *
 * Paper-and-ink aesthetic: ivory stock, charcoal ink, hairline rules, soft shadows.
 * Korean track is accented taegeuk blue → red; Chinese track cinnabar red → gold.
 * System font stacks only (no CDN, no web fonts) so CJK renders well fully offline.
 * Dark mode: prefers-color-scheme, overridable by [data-theme] on <html>.
 * Sections: tokens · base · chrome · dashboard · unit map · unit page · lesson bodies ·
 *           quiz · flashcards · settings · animation · responsive.
 */

/* ============================================================= 1. tokens == */
:root {
  --paper:      #f6f1e7;
  --paper-deep: #efe8da;
  --card:       #fffdf8;
  --card-2:     #fbf7ee;
  --ink:        #221f1b;
  --ink-2:      #4e483f;
  --ink-3:      #7d7466;
  --rule:       #e5dbc8;
  --rule-2:     #d5c8af;

  --ko-1: #1f4fa3;   --ko-2: #c8102e;
  --zh-1: #c8352a;   --zh-2: #cf9a34;

  --good:   #2f7d55;
  --good-b: #e7f3ea;
  --bad:    #b3352c;
  --bad-b:  #fbeceb;
  --warnc:  #96660d;

  --accent:  #8d6b3a;
  --accent-2:#b0472f;

  --shadow-1: 0 1px 2px rgba(60,45,20,.06);
  --shadow-2: 0 2px 4px rgba(60,45,20,.05), 0 10px 26px -14px rgba(60,45,20,.34);
  --shadow-3: 0 6px 14px rgba(60,45,20,.08), 0 24px 60px -28px rgba(60,45,20,.45);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --t: 180ms cubic-bezier(.22,.61,.36,1);
  --t-slow: 260ms cubic-bezier(.22,.61,.36,1);

  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial,
          "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR",
          "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia,
           "Nanum Myeongjo", "Songti SC", SimSun, Batang, serif;
  --native: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", "Nanum Gothic",
            "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
            "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", "Roboto Mono", Menlo, monospace;

  --maxw: 1120px;
}

.lang-korean  { --accent: var(--ko-1); --accent-2: var(--ko-2); }
.lang-chinese { --accent: var(--zh-1); --accent-2: var(--zh-2); }

/* ---- dark palette (system preference) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #191713;
    --paper-deep: #131110;
    --card:       #221f19;
    --card-2:     #2a271e;
    --ink:        #efe7d6;
    --ink-2:      #c2b8a5;
    --ink-3:      #948b7a;
    --rule:       #38342a;
    --rule-2:     #4a4538;

    --ko-1: #7ba6ea;  --ko-2: #ef7f86;
    --zh-1: #ef8168;  --zh-2: #e5c072;

    --good:   #63c48d;  --good-b: #17281e;
    --bad:    #ef8279;  --bad-b:  #2b1a18;
    --warnc:  #e0b45f;

    --accent:  #c8a86e;
    --accent-2:#e08a6c;

    --shadow-1: 0 1px 2px rgba(0,0,0,.5);
    --shadow-2: 0 2px 6px rgba(0,0,0,.45), 0 12px 30px -16px rgba(0,0,0,.8);
    --shadow-3: 0 8px 18px rgba(0,0,0,.5), 0 28px 64px -30px rgba(0,0,0,.9);
  }
}
/* ---- dark palette (manual toggle) ---- */
:root[data-theme="dark"] {
  --paper:      #191713;
  --paper-deep: #131110;
  --card:       #221f19;
  --card-2:     #2a271e;
  --ink:        #efe7d6;
  --ink-2:      #c2b8a5;
  --ink-3:      #948b7a;
  --rule:       #38342a;
  --rule-2:     #4a4538;

  --ko-1: #7ba6ea;  --ko-2: #ef7f86;
  --zh-1: #ef8168;  --zh-2: #e5c072;

  --good:   #63c48d;  --good-b: #17281e;
  --bad:    #ef8279;  --bad-b:  #2b1a18;
  --warnc:  #e0b45f;

  --accent:  #c8a86e;
  --accent-2:#e08a6c;

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 2px 6px rgba(0,0,0,.45), 0 12px 30px -16px rgba(0,0,0,.8);
  --shadow-3: 0 8px 18px rgba(0,0,0,.5), 0 28px 64px -30px rgba(0,0,0,.9);
}

/* =============================================================== 2. base == */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 700px at 12% -8%, rgba(200,16,46,.045), transparent 62%),
    radial-gradient(900px 600px at 96% 4%, rgba(31,79,163,.05), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(207,154,52,.06), transparent 65%);
  background-attachment: fixed;
  min-height: 100vh;
  opacity: 0;
  transition: opacity var(--t-slow);
}
body.ready { opacity: 1; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.22; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 .85em; }
a { color: inherit; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
code { font-family: var(--mono); font-size: .92em; }
input, textarea, button, select { font: inherit; color: inherit; }

::selection { background: rgba(207,154,52,.32); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--card); color: var(--ink); padding: .7rem 1.1rem;
  border: 1px solid var(--rule-2); border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.6rem 1.25rem 4rem;
}

.view { opacity: 0; transform: translateY(8px); }
.view.entered { animation: viewIn var(--t-slow) forwards; }
@keyframes viewIn { to { opacity: 1; transform: none; } }

.prose { color: var(--ink-2); max-width: 68ch; }
.muted { color: var(--ink-3); }
.mono  { font-family: var(--mono); font-size: .84rem; }

.page-title { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .2rem; }
.page-sub   { color: var(--ink-3); max-width: 60ch; margin-bottom: 2rem; }

.empty-note, .warn-note {
  color: var(--ink-3); font-size: .94rem; font-style: italic;
}
.warn-note {
  font-style: normal; color: var(--warnc);
  background: rgba(207,154,52,.09);
  border-left: 3px solid var(--warnc);
  padding: .7rem .9rem; border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* ---- native script & speakables ---- */
.native { font-family: var(--native); font-feature-settings: "palt" 1; }

.speakable {
  cursor: pointer; position: relative;
  border-radius: 6px;
  transition: color var(--t), background var(--t);
  display: inline-flex; align-items: baseline; gap: .3em;
}
.speakable:hover { color: var(--accent-2); }
.speakable .spk-icon {
  font-size: .58em; opacity: .42; transform: translateY(-.1em);
  transition: opacity var(--t);
  line-height: 1;
}
.speakable:hover .spk-icon, .speakable:focus-visible .spk-icon { opacity: .8; }
.speakable.speaking { animation: speakPulse .65s ease; }
.speakable.speaking .spk-icon { opacity: 1; }
@keyframes speakPulse {
  0%   { background: rgba(207,154,52,0); }
  25%  { background: rgba(207,154,52,.22); }
  100% { background: rgba(207,154,52,0); }
}

/* ---- chips ---- */
.chip {
  display: inline-block; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .18em .6em; border-radius: 999px; border: 1px solid var(--rule-2);
  color: var(--ink-3); background: var(--card-2); white-space: nowrap;
}
.chip-lang   { border-color: var(--accent); color: var(--accent); background: transparent; }
.chip-pos    { text-transform: none; letter-spacing: 0; font-style: italic; }
.chip-origin {
  text-transform: none; letter-spacing: 0; white-space: normal;
  border-color: var(--accent); color: var(--accent); line-height: 1.4;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-size: .93rem; font-weight: 500;
  padding: .62em 1.15em;
  border-radius: 999px;
  border: 1px solid var(--rule-2);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--t), box-shadow var(--t), background var(--t), border-color var(--t), color var(--t);
  box-shadow: var(--shadow-1);
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--accent); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  /* --paper flips with the theme, so the label stays readable on the light-in-dark accents */
  color: var(--paper);
}

.btn-ghost  { background: transparent; }
.btn-quiet  { background: transparent; border-color: transparent; color: var(--ink-3); box-shadow: none; }
.btn-quiet:hover { color: var(--ink); border-color: var(--rule-2); }
.btn-sm     { font-size: .82rem; padding: .45em .9em; }
.btn-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-danger:hover { background: var(--bad-b); border-color: var(--bad); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; flex: 0 0 auto;
  border-radius: 50%; border: 1px solid var(--rule-2);
  background: var(--card); cursor: pointer;
  transition: transform var(--t), border-color var(--t), background var(--t);
}
.icon-btn:hover { transform: scale(1.08); border-color: var(--accent); }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .4rem; }

/* ---- progress bar & ring ---- */
.pbar { height: 6px; background: var(--rule); border-radius: 999px; overflow: hidden; }
.pbar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--t-slow);
}

.ring { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; }
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--rule); stroke-width: 6; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 600ms cubic-bezier(.22,.61,.36,1);
}
.ring-label {
  position: absolute; font-size: .72rem; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.ring-sm { width: 42px; height: 42px; } .ring-sm .ring-label { font-size: .6rem; }
.ring-md { width: 68px; height: 68px; }
.ring-lg { width: 104px; height: 104px; } .ring-lg .ring-label { font-size: 1.05rem; }

/* ============================================================= 3. chrome == */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
@supports not (backdrop-filter: blur(4px)) { .topbar { background: var(--paper); } }

.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; margin-right: auto; }
.brand-mark {
  font-family: var(--serif); font-size: 1.35rem; line-height: 1;
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  border-radius: 9px; color: var(--paper);
  background: linear-gradient(140deg, var(--ko-1), var(--ko-2) 55%, var(--zh-2));
  box-shadow: var(--shadow-1);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--serif); font-size: 1.05rem; letter-spacing: .01em; }
.brand-sub { font-size: .68rem; color: var(--ink-3); letter-spacing: .1em; text-transform: uppercase; }

.nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.navlink {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .42em .8em; border-radius: 999px;
  font-size: .9rem; text-decoration: none; color: var(--ink-2);
  border: 1px solid transparent;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.navlink:hover { color: var(--ink); background: var(--card-2); }
.navlink.active { color: var(--ink); border-color: var(--rule-2); background: var(--card); box-shadow: var(--shadow-1); }
.navlink-native { font-family: var(--native); font-size: 1.02rem; opacity: .85; }
.theme-btn { font-size: 1rem; }

.sitefoot {
  max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-3); font-size: .78rem; text-align: center;
}

.crumbs { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--ink-3); margin-bottom: 1.2rem; }
.crumbs .crumb { text-decoration: none; }
.crumbs a.crumb:hover { color: var(--accent); text-decoration: underline; }
.crumb.current { color: var(--ink-2); }
.crumb-sep { opacity: .5; }

/* ========================================================== 4. dashboard == */
.hero { text-align: center; padding: 2.2rem 0 2.6rem; }
.hero-kicker {
  font-size: .74rem; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: .8rem;
}
.hero-title { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.hero-native {
  font-family: var(--native); font-size: clamp(2.6rem, 9vw, 5rem); font-weight: 700;
  line-height: 1; letter-spacing: -.02em;
  background-clip: text; -webkit-background-clip: text; color: transparent;
}
.hero-native.ko { background-image: linear-gradient(120deg, var(--ko-1), var(--ko-2)); }
.hero-native.zh { background-image: linear-gradient(120deg, var(--zh-1), var(--zh-2)); }
.hero-amp { color: var(--ink-3); font-size: 2rem; }
.hero-sub { color: var(--ink-2); max-width: 54ch; margin: 0 auto; font-size: 1.02rem; }

.track-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }

.track-card {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 1.5rem 1.5rem 1.3rem;
  box-shadow: var(--shadow-2);
  transition: transform var(--t), box-shadow var(--t);
}
.track-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); }
.track-card.paused { opacity: .84; }
.track-band {
  position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.track-head { display: flex; align-items: flex-start; gap: 1rem; margin-top: .4rem; }
.track-titles { flex: 1 1 auto; min-width: 0; }
.track-native {
  font-family: var(--native); font-size: 2.4rem; line-height: 1.1; font-weight: 700;
  color: var(--accent); margin-bottom: .1rem;
}
.track-name { font-size: 1.25rem; margin: 0 0 .15rem; }
.track-tagline { color: var(--ink-3); font-size: .88rem; margin: 0; }

.paused-badge {
  display: inline-flex; align-items: center; gap: .5em;
  margin-top: 1rem; font-size: .8rem; color: var(--warnc);
  background: rgba(207,154,52,.1); border: 1px solid rgba(207,154,52,.35);
  padding: .3em .8em; border-radius: 999px;
}
.paused-badge .dot { width: .5em; height: .5em; border-radius: 50%; background: currentColor; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .6rem; margin: 1.25rem 0 1.3rem;
  padding: .9rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.stat dt { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stat dd { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .72rem; font-family: var(--sans); font-weight: 400; color: var(--ink-3); margin-left: .15em; }

.track-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

.today-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: .8rem;
  margin-top: 2rem; padding: 1rem 1.2rem;
  border: 1px dashed var(--rule-2); border-radius: var(--r);
  font-size: .88rem; color: var(--ink-2);
}
.today-chip { display: inline-flex; align-items: center; gap: .45em; }
.today-mark { color: var(--ink-3); }
.today-chip.done .today-mark { color: var(--good); }
.today-link { margin-left: auto; color: var(--accent); text-decoration: none; font-weight: 500; }
.today-link:hover { text-decoration: underline; }

/* =========================================================== 5. unit map == */
.map-head { display: flex; align-items: flex-start; gap: 1.2rem; margin-bottom: 1.2rem; }
.map-titles { flex: 1 1 auto; }
.map-title { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: .05rem; }
.map-native { font-family: var(--native); font-size: 1.6rem; color: var(--accent); margin-bottom: .4rem; }
.map-sub { color: var(--ink-3); max-width: 56ch; margin: 0; }
.map-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.8rem; }

.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.1rem; }

.ucard {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.1rem 1.15rem 1rem;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  position: relative; overflow: hidden;
}
.ucard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .0; transition: opacity var(--t);
}
.ucard:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--rule-2); }
.ucard:hover::before { opacity: 1; }
.ucard.done { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.ucard.done::before { opacity: 1; background: var(--good); }

.ucard-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .55rem; }
.ucard-num {
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--accent);
  line-height: 1; font-variant-numeric: tabular-nums;
}
.ucard-title { font-size: 1.08rem; margin: 0 0 .12rem; }
.ucard-native { font-family: var(--native); font-size: 1rem; color: var(--ink-2); margin-bottom: .35rem; }
.ucard-sub { font-size: .85rem; color: var(--ink-3); margin: 0 0 .8rem; }
.ucard-foot { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; padding-top: .5rem; }
.mini-chip {
  font-size: .64rem; letter-spacing: .05em; text-transform: uppercase;
  padding: .16em .5em; border-radius: 5px;
  background: var(--card-2); color: var(--ink-3); border: 1px solid var(--rule);
}
.mini-practice { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.ucard-status {
  margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--rule);
  font-size: .78rem; color: var(--ink-3);
}
.ucard.done .ucard-status { color: var(--good); }
.ucard-check { font-weight: 700; }

.empty-box {
  border: 1px dashed var(--rule-2); border-radius: var(--r);
  padding: 2rem; text-align: center; color: var(--ink-2);
  background: var(--card-2);
}
.empty-box h2 { font-size: 1.2rem; }
.empty-box .prose { margin: 0 auto 1.2rem; }

/* ========================================================== 6. unit page == */
.unit-head { margin-bottom: 1.8rem; }
.unit-kicker { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.unit-num { font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.unit-title { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .1rem; }
.unit-title-native {
  font-family: var(--native); font-size: clamp(1.3rem, 3vw, 1.8rem);
  color: var(--accent); margin-bottom: .5rem;
}
.unit-subtitle { color: var(--ink-2); font-size: 1.02rem; max-width: 62ch; }

.basis {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  margin: 1rem 0; padding: .7rem .95rem;
  border-left: 3px solid var(--accent); background: var(--card-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.basis-label { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.basis-list { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem; color: var(--ink-2); font-style: italic; }
.basis-list li::before { content: "§ "; color: var(--accent); font-style: normal; }
.overview { margin-top: 1rem; }
.overview .prose { font-size: 1.02rem; }

/* ---- tabs ---- */
.tabs-wrap {
  position: sticky; top: 3.4rem; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  margin: 0 -1.25rem 1.6rem; padding: 0 1.25rem;
}
@supports not (backdrop-filter: blur(4px)) { .tabs-wrap { background: var(--paper); } }
.tabs { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: thin; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: .4em;
  padding: .75rem .95rem; white-space: nowrap;
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: .92rem;
  border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab.done .tab-check { color: var(--good); font-weight: 700; }
.tab-check { font-size: .8em; }

.panel { animation: none; }
.panel.fade-in { animation: fadeUp var(--t-slow) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.panel-title { font-size: 1.45rem; margin: 0; }

.complete-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .8rem;
  margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
}
.btn-complete { border-color: var(--accent); color: var(--accent); }
.btn-complete.is-done { background: var(--good-b); border-color: var(--good); color: var(--good); }
.complete-note { font-size: .8rem; color: var(--ink-3); }

.unit-footer { margin-top: 2.6rem; }
.unit-progress { margin-bottom: 1.2rem; }
.unit-progress-label { font-size: .8rem; color: var(--ink-3); display: block; margin-bottom: .4rem; }
.unit-nav { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; }

/* ---- one-step-at-a-time footer: every section ends with the NEXT section ---- */
.step-nav { margin-top: 1.1rem; }
.step-next {
  display: flex; width: 100%; text-align: left;
  border: 1px solid var(--rule-2); border-radius: var(--r);
  background: var(--card-2); color: var(--ink); cursor: pointer;
  padding: .95rem 1.15rem; text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.step-next:hover { border-color: var(--accent); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.step-inner { display: flex; align-items: center; gap: 1rem; width: 100%; }
.step-text { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.step-kicker { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.step-label { font-weight: 600; font-size: 1.05rem; color: var(--accent); }
.step-sub { font-size: .85rem; color: var(--ink-2); }
.step-arrow { margin-left: auto; font-size: 1.4rem; color: var(--accent); flex: 0 0 auto; }

/* ====================================================== 7. lesson bodies == */
/* dialogue */
.scene {
  font-style: italic; color: var(--ink-3);
  border-left: 2px solid var(--rule-2); padding-left: .9rem; margin-bottom: 1.2rem;
}
.dialogue { margin-top: 1.1rem; display: flex; flex-direction: column; gap: .5rem; }
.dline {
  display: grid; grid-template-columns: minmax(60px, 92px) 1fr; gap: 1rem;
  padding: .85rem 1rem; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--rule);
  transition: border-color var(--t), transform var(--t);
}
.dline:hover { border-color: var(--rule-2); }
.dline.alt { background: var(--card-2); }
.dspeaker { font-size: .9rem; color: var(--accent); font-weight: 600; }
.dspeaker-name { font-family: var(--native); }
.dtext { font-family: var(--native); font-size: 1.32rem; line-height: 1.5; margin-bottom: .15rem; }
.droman { font-size: .86rem; color: var(--ink-3); font-style: italic; }
.dgloss { font-size: .95rem; color: var(--ink-2); margin-top: .2rem; }

/* vocab */
.vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.vcard {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex; flex-direction: column;
}
.vcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--rule-2); }
.vcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.vcard-termwrap { min-width: 0; }
.vcard-term {
  font-family: var(--native); font-size: 2.05rem; line-height: 1.25; font-weight: 600;
  letter-spacing: -.01em;
}
.vcard-trad { font-family: var(--native); font-size: .82rem; color: var(--ink-3); }
.vcard-roman { font-style: italic; color: var(--accent); font-size: 1rem; margin-top: .1rem; }
.vcard-glossrow { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .35rem; }
.vcard-gloss { font-size: 1.02rem; }
.vcard-example {
  margin-top: .9rem; padding: .75rem .85rem;
  background: var(--card-2); border-radius: var(--r-sm); border: 1px solid var(--rule);
}
.vex-text { font-family: var(--native); font-size: 1.12rem; line-height: 1.5; }
.vex-roman { font-size: .8rem; color: var(--ink-3); font-style: italic; }
.vex-gloss { font-size: .88rem; color: var(--ink-2); margin-top: .15rem; }

.mastery { display: flex; gap: 3px; align-items: center; padding-top: .5rem; }
.mdot { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-2); display: block; }
.mdot.on { background: var(--good); }

/* linguistics reveal */
.ling { margin-top: .95rem; border-top: 1px solid var(--rule); }
.ling-summary {
  display: flex; align-items: center; gap: .35rem .55rem; flex-wrap: wrap;
  list-style: none; cursor: pointer; padding: .7rem 0 .1rem;
  font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  transition: color var(--t);
}
.ling-summary::-webkit-details-marker { display: none; }
.ling-summary:hover { color: var(--accent); }
.ling-title { font-weight: 600; }
.ling-caret { margin-left: auto; transition: transform var(--t); }
.ling[open] .ling-caret { transform: rotate(180deg); }
.ling-body { padding: .5rem 0 .2rem; animation: fadeUp var(--t-slow) both; }
.ling-block { margin-bottom: .9rem; }
.ling-h {
  display: flex; align-items: center; gap: .4em;
  font-family: var(--sans); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .3em;
}
.ling-icon { font-size: .9em; opacity: .8; }
.ling-p { font-size: .88rem; line-height: 1.62; color: var(--ink-2); margin-bottom: .5em; }

/* grammar */
.gpoint {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.3rem 1.4rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-1);
}
.gpoint-head { display: flex; align-items: baseline; gap: .7rem; }
.gpoint-num {
  font-family: var(--serif); font-size: .8rem; color: var(--paper);
  background: var(--accent); width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
}
.gpoint-name { font-size: 1.2rem; margin: 0 0 .5rem; }
.gpattern { display: flex; align-items: center; gap: .7rem; margin: .2rem 0 .9rem; flex-wrap: wrap; }
.gpattern-label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.gpattern-code {
  font-family: var(--native); font-size: 1rem; padding: .3em .7em;
  background: var(--card-2); border: 1px dashed var(--rule-2); border-radius: var(--r-sm);
  color: var(--accent-2);
}
.gexamples { margin-top: 1rem; display: grid; gap: .6rem; }
.gex {
  padding: .7rem .9rem; border-left: 3px solid var(--accent);
  background: var(--card-2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.gex-text { font-family: var(--native); font-size: 1.2rem; line-height: 1.5; }
.gex-roman { font-size: .8rem; font-style: italic; color: var(--ink-3); }
.gex-gloss { font-size: .9rem; color: var(--ink-2); }

/* notes */
.notes {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.5rem 1.7rem; box-shadow: var(--shadow-1);
  position: relative;
}
.notes::before {
  content: "❦"; position: absolute; top: .9rem; right: 1.2rem;
  color: var(--accent); opacity: .35; font-size: 1.3rem;
}
.notes .prose { font-size: 1.02rem; line-height: 1.75; max-width: 70ch; }

/* =============================================================== 8. quiz == */
.prev-score { font-size: .84rem; color: var(--ink-3); margin-bottom: .8rem; }

.quiz { max-width: 780px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; color: var(--ink-3); margin-bottom: .4rem; }
.quiz-score { font-variant-numeric: tabular-nums; }
.quiz-bar { height: 5px; background: var(--rule); border-radius: 999px; overflow: hidden; margin-bottom: 1.3rem; }
.quiz-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width var(--t-slow); }

.qcard {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 1.6rem 1.6rem 1.4rem; box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(10px);
}
.qcard.in { animation: fadeUp var(--t-slow) forwards; }
.qtype {
  display: inline-block; font-size: .64rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .7rem;
}
.qprompt { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: 1.3rem; }
.qprompt-text { font-family: var(--serif); font-size: 1.35rem; line-height: 1.35; flex: 1 1 auto; }

.choices { display: grid; gap: .55rem; }
.choice {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
  padding: .85rem 1rem; border-radius: var(--r);
  border: 1px solid var(--rule); background: var(--card-2); cursor: pointer;
  transition: transform var(--t), border-color var(--t), background var(--t);
  font-size: 1.02rem;
}
.choice:hover:not(.locked) { transform: translateX(3px); border-color: var(--accent); }
.choice-key {
  flex: 0 0 auto; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 600; color: var(--ink-3);
  border: 1px solid var(--rule-2); background: var(--card);
}
.choice-text { font-family: var(--native); }
.choice.locked { cursor: default; opacity: .72; }
.choice.is-correct {
  border-color: var(--good); background: var(--good-b); opacity: 1;
  animation: popIn 320ms cubic-bezier(.2,.9,.3,1.3);
}
.choice.is-correct .choice-key { border-color: var(--good); color: var(--good); }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-b); opacity: 1; }
.choice.is-wrong .choice-key { border-color: var(--bad); color: var(--bad); }
.choice.reveal { box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 35%, transparent); }
@keyframes popIn { 0% { transform: scale(.98); } 60% { transform: scale(1.015); } 100% { transform: scale(1); } }

.play-big {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  margin: 0 auto 1.4rem; padding: 1.4rem 2.2rem;
  border-radius: var(--r-lg); border: 1px dashed var(--rule-2);
  background: var(--card-2); cursor: pointer;
  transition: transform var(--t), border-color var(--t), background var(--t);
}
.play-big:hover { transform: scale(1.03); border-color: var(--accent); }
.play-glyph { font-size: 2.2rem; line-height: 1; }
.play-label { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

.typing { display: flex; gap: .6rem; flex-wrap: wrap; }
.typing-input {
  flex: 1 1 240px; min-width: 0;
  font-family: var(--native); font-size: 1.3rem;
  padding: .7rem .95rem; border-radius: var(--r);
  border: 1px solid var(--rule-2); background: var(--card-2); color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
}
.typing-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.typing-input.is-correct { border-color: var(--good); background: var(--good-b); }
.typing-input.is-wrong { border-color: var(--bad); background: var(--bad-b); }
.hint-wrap { margin-top: .7rem; }
.hint { font-size: .86rem; color: var(--ink-3); font-style: italic; margin: .4rem 0 0; }

.reveal-answer { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.reveal-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.reveal-value { font-family: var(--native); font-size: 1.3rem; color: var(--good); }
.reveal-alt { font-size: .78rem; color: var(--ink-3); }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.match-col { display: grid; gap: .5rem; align-content: start; }
.match-tile {
  padding: .8rem .9rem; border-radius: var(--r-sm);
  border: 1px solid var(--rule); background: var(--card-2); cursor: pointer;
  text-align: left; display: flex; align-items: center; gap: .5rem; justify-content: space-between;
  transition: transform var(--t), border-color var(--t), background var(--t), opacity var(--t);
}
.match-tile:hover:not([disabled]) { border-color: var(--accent); transform: translateY(-1px); }
.match-tile.side-a .match-text { font-family: var(--native); font-size: 1.2rem; }
.match-tile .spk-icon { font-size: .72rem; opacity: .35; }
.match-tile.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card-2)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.match-tile.done { border-color: var(--good); background: var(--good-b); opacity: .62; cursor: default; }
.match-tile.bad { border-color: var(--bad); background: var(--bad-b); animation: shake 380ms; }
.match-status { margin-top: .9rem; font-size: .84rem; color: var(--ink-3); }
.match-summary { font-size: .88rem; color: var(--ink-2); margin-top: .4rem; }

.order-line {
  min-height: 4rem; display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  padding: .85rem; border-radius: var(--r);
  border: 1px dashed var(--rule-2); background: var(--card-2); margin-bottom: 1rem;
  transition: border-color var(--t), background var(--t);
}
.order-line.is-correct { border-color: var(--good); border-style: solid; background: var(--good-b); }
.order-line.is-wrong { border-color: var(--bad); border-style: solid; background: var(--bad-b); }
.order-placeholder { color: var(--ink-3); font-size: .88rem; font-style: italic; }
.order-pool { display: flex; flex-wrap: wrap; gap: .45rem; }
.token {
  font-family: var(--native); font-size: 1.15rem;
  padding: .45em .85em; border-radius: 999px;
  border: 1px solid var(--rule-2); background: var(--card); cursor: pointer;
  transition: transform var(--t), border-color var(--t), background var(--t);
  box-shadow: var(--shadow-1);
}
.token:hover:not([disabled]) { transform: translateY(-2px); border-color: var(--accent); }
.token-picked { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--card)), var(--card)); border-color: var(--accent); }
.order-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }

.qfeedback { max-height: 0; overflow: hidden; opacity: 0; transition: max-height var(--t-slow), opacity var(--t-slow); }
.qfeedback.shown { max-height: 60rem; opacity: 1; margin-top: 1.2rem; }
.verdict { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-size: 1.15rem; }
.verdict-mark {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
  font-size: .95rem; color: var(--paper);
}
.verdict.ok  .verdict-mark { background: var(--good); }
.verdict.no  .verdict-mark { background: var(--bad); }
.verdict.ok  .verdict-text { color: var(--good); }
.verdict.no  .verdict-text { color: var(--bad); }
.explain { font-size: .93rem; color: var(--ink-2); margin-top: .6rem; padding-left: 2.3rem; }

.qfooter { display: flex; justify-content: flex-end; margin-top: 1.2rem; }

.summary-card { text-align: center; }
.summary-card .ring { margin: 0 auto 1rem; }
.summary-title { font-size: 1.7rem; margin-bottom: .2rem; }
.summary-line { color: var(--ink-2); }
.summary-list { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1.2rem 0; }
.summary-item {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; padding: .25em .6em; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--card-2); color: var(--ink-3);
}
.summary-item.ok { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); color: var(--good); }
.summary-item.no { border-color: color-mix(in srgb, var(--bad) 45%, var(--rule)); color: var(--bad); }
.summary-num { font-variant-numeric: tabular-nums; opacity: .7; }
.summary-type { text-transform: capitalize; }
.summary-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; }

/* ========================================================= 9. flashcards == */
.review-head { margin-bottom: 1.4rem; }
.review-title { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: .1rem; }
.review-sub { color: var(--ink-3); max-width: 58ch; }

.flash-stage { max-width: 620px; margin: 0 auto; }
.flash-meter { display: flex; justify-content: space-between; font-size: .78rem; color: var(--ink-3); margin-bottom: .4rem; }
.flash-stage .pbar { margin-bottom: 1.4rem; }

.flash-scene { perspective: 1400px; position: relative; }
.flash-card {
  position: relative; width: 100%; min-height: 300px;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(.3,.8,.3,1);
  cursor: pointer;
}
.flash-card.in { animation: fadeUp var(--t-slow) both; }
.flash-card.flipped { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem; text-align: center; padding: 2rem 1.6rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.flash-front { background-image: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--card)), var(--card) 60%); }
.flash-back { transform: rotateY(180deg); }
.flash-term { font-family: var(--native); font-size: clamp(2.6rem, 11vw, 4.2rem); line-height: 1.15; font-weight: 600; }
.flash-trad { font-family: var(--native); font-size: 1.1rem; color: var(--ink-3); }
.flash-hint { position: absolute; bottom: 1.1rem; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.flash-roman { font-style: italic; font-size: 1.3rem; color: var(--accent); }
.flash-gloss { font-family: var(--serif); font-size: 1.6rem; }
.flash-example { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--rule); width: 100%; }
.flash-ex-text { font-family: var(--native); font-size: 1.2rem; }
.flash-ex-gloss { font-size: .88rem; color: var(--ink-3); }
.flash-tools { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }
.flash-grade { display: flex; gap: .8rem; justify-content: center; margin-top: 1rem; }
.btn-again { border-color: var(--bad); color: var(--bad); min-width: 8rem; }
.btn-again:hover { background: var(--bad-b); }
.btn-good { border-color: var(--good); color: var(--good); min-width: 8rem; }
.btn-good:hover { background: var(--good-b); }
.flash-keys { text-align: center; font-size: .74rem; color: var(--ink-3); margin-top: 1rem; }

/* =========================================================== 10. settings == */
.spanel {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.5rem 1.6rem; margin-bottom: 1.3rem; box-shadow: var(--shadow-1);
}
.spanel-title { font-size: 1.25rem; margin-bottom: .2rem; }
.spanel-sub { color: var(--ink-3); font-size: .88rem; max-width: 62ch; margin-bottom: 1.1rem; }

.segmented { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 999px; overflow: hidden; }
.seg {
  padding: .5em 1.1em; border: none; background: transparent; cursor: pointer;
  font-size: .88rem; color: var(--ink-3);
  transition: background var(--t), color var(--t);
}
.seg:hover { color: var(--ink); }
.seg.on { background: var(--accent); color: var(--paper); }

.voice-list { display: grid; gap: .8rem; }
.voice-row {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1rem; border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--card-2);
}
.voice-info { flex: 1 1 260px; min-width: 0; }
.voice-lang { font-weight: 600; font-size: .95rem; }
.voice-status { font-size: .84rem; color: var(--ink-3); }
.voice-status.ok { color: var(--good); }
.voice-status.warn { color: var(--warnc); }
.voice-status.bad { color: var(--bad); }

.field { margin-bottom: 1.1rem; }
.field-label { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .35rem; }
.field-hint { font-size: .78rem; color: var(--ink-3); margin: .35rem 0 0; }
.input, .code-area {
  width: 100%; padding: .65rem .85rem;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--card-2); color: var(--ink);
  transition: border-color var(--t), box-shadow var(--t);
}
.input:focus, .code-area:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.code-area { font-family: var(--mono); font-size: .78rem; line-height: 1.5; resize: vertical; }
.file-input { padding: .5rem; }

.checks { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .95rem; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

/* mini-lesson queue status */
.sync-box {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  margin-top: 1.1rem; padding: .75rem .95rem;
  border: 1px dashed var(--rule-2); border-radius: var(--r-sm);
  background: var(--card-2);
}
.sync-line {
  flex: 1 1 260px; margin: 0;
  font-size: .82rem; color: var(--ink-3);
}
.sync-line.on { color: var(--ink-2); }
.key-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.key-input {
  flex: 1 1 15rem; min-width: 0;
  font-family: var(--mono); font-size: 1.02rem;
  letter-spacing: .14em; text-transform: uppercase;
}
.sync-line.on::before {
  content: ""; display: inline-block; width: .5em; height: .5em; margin-right: .5em;
  border-radius: 50%; background: var(--good); vertical-align: middle;
}

.form-status { font-size: .85rem; color: var(--ink-3); min-height: 1.3em; margin: .5rem 0 0; }
.form-status.ok { color: var(--good); }
.form-status.bad { color: var(--bad); }
.form-status.warn { color: var(--warnc); }

.diag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1rem; }
.diag-cell h3 { font-size: 1rem; margin-bottom: .2rem; }
.diag-cell > p { font-size: .84rem; color: var(--ink-3); }
.diag-units { font-size: .82rem; color: var(--ink-2); display: grid; gap: .15rem; margin-top: .4rem; }
.diag-units li::before { content: "· "; color: var(--ink-3); }
.diag-units li.bad { color: var(--bad); }

/* ========================================================== 11. animation == */
.anim-correct { animation: goodPulse 640ms cubic-bezier(.2,.9,.3,1.2); }
@keyframes goodPulse {
  0%   { box-shadow: var(--shadow-2), 0 0 0 0 color-mix(in srgb, var(--good) 55%, transparent); }
  40%  { box-shadow: var(--shadow-2), 0 0 0 10px color-mix(in srgb, var(--good) 0%, transparent); transform: scale(1.008); }
  100% { box-shadow: var(--shadow-2); transform: scale(1); }
}
.anim-wrong { animation: shake 460ms cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fleck {
  position: absolute; top: -12px; width: 7px; height: 12px; border-radius: 1px;
  animation: fall 1.2s cubic-bezier(.3,.6,.5,1) forwards;
}
@keyframes fall {
  0%   { opacity: 0; transform: translateY(-10px) rotate(0deg); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(340px) rotate(520deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .view { opacity: 1; transform: none; }
  .qcard { opacity: 1; transform: none; }
}

/* ========================================================= 12. responsive == */
@media (max-width: 900px) {
  .track-grid { grid-template-columns: 1fr; }
  .diag-grid  { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app { padding: 1.1rem .9rem 3rem; }
  .topbar-inner { padding: .55rem .9rem; gap: .4rem; flex-wrap: nowrap; }
  .nav { flex-wrap: nowrap; }
  .brand-sub { display: none; }
  /* keep text-only links (Home, Settings) labelled; the two language links go glyph-only */
  .navlink-native ~ .navlink-label { display: none; }
  .navlink-native { font-size: 1.15rem; }
  .navlink { padding: .42em .6em; font-size: .84rem; }
  .nav { gap: .1rem; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: .8rem .4rem; }
  .dline { grid-template-columns: 1fr; gap: .25rem; }
  .match-grid { grid-template-columns: 1fr; }
  .match-col:last-child { margin-top: .3rem; }
  .tabs-wrap { top: 3rem; margin-left: -.9rem; margin-right: -.9rem; padding: 0 .9rem; }
  .vocab-grid { grid-template-columns: 1fr; }
  .qcard { padding: 1.2rem 1.1rem; border-radius: var(--r); }
  .spanel { padding: 1.2rem 1.1rem; }
  .flash-card { min-height: 250px; }
  .unit-nav { justify-content: stretch; }
  .unit-nav .btn { flex: 1 1 auto; }
}

@media (max-width: 470px) {
  /* the mark alone carries the brand once the bar gets tight */
  .brand-text { display: none; }
  .today-link { margin-left: 0; }
}

@media (min-width: 1200px) {
  :root { --maxw: 1180px; }
}

/* ================================================= 13. story mode (mobile) ==
   The phone lesson experience: a full-screen deck of story cards over the whole
   app (z 50 — above the topbar at 40, below the tutor goblin at 59/60 so the
   tutor stays one tap away mid-lesson). */

body.story-open { overflow: hidden; }

/* The story is fixed-position inside the animated .view; the view's entrance
   transform would hijack the fixed positioning, so this view variant sits still. */
.view.unitview-story { animation: none !important; opacity: 1; transform: none !important; }

.story {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 700px at 12% -8%, rgba(200,16,46,.045), transparent 62%),
    radial-gradient(900px 600px at 96% 4%, rgba(31,79,163,.05), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(207,154,52,.06), transparent 65%);
  color: var(--ink);
  outline: none;
  overscroll-behavior: contain;
}

.story-top { padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 6px; flex: 0 0 auto; }
.story-segs { display: flex; gap: 4px; margin-bottom: 9px; }
.story-seg {
  flex: 1 1 0; height: 3px; border-radius: 999px;
  background: var(--rule); overflow: hidden;
}
.story-seg i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--t);
}
.story-head { display: flex; align-items: center; gap: .6rem; min-height: 2.1rem; }
.story-head-label {
  font-size: .82rem; font-weight: 600; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.story-head-count { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); flex: 0 0 auto; }
.story-close {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 1px solid var(--rule-2); background: var(--card);
  color: var(--ink-2); text-decoration: none; font-size: .95rem; line-height: 1;
}

.story-stage { flex: 1 1 auto; min-height: 0; position: relative; }
.story-card {
  position: absolute; inset: 0;
  overflow: hidden;                 /* pages are measured to FIT — no scrolling mid-lesson */
  font-size: 1.05rem; line-height: 1.62;
  padding: 1.1rem 1.15rem calc(4.8rem + env(safe-area-inset-bottom, 0px));
}
.story-card.story-scroll {          /* practice quiz + rare unsplittable block only */
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.story-meas { visibility: hidden; pointer-events: none; z-index: -1; }

/* entrance: a soft slide plus the text fading in left → right */
.story-card.in, .story-card.in-back {
  -webkit-mask-image: linear-gradient(to right, #000 46%, transparent 64%);
  mask-image: linear-gradient(to right, #000 46%, transparent 64%);
  -webkit-mask-size: 240% 100%; mask-size: 240% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.story-card.in      { animation: storyIn 240ms cubic-bezier(.22,.61,.36,1) both, storyWipe 520ms ease-out both; }
.story-card.in-back { animation: storyBack 240ms cubic-bezier(.22,.61,.36,1) both, storyWipe 520ms ease-out both; }
@keyframes storyIn   { from { opacity: 0; transform: translateX(18px); }  to { opacity: 1; transform: none; } }
@keyframes storyBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes storyWipe {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: 0% 0;   mask-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .story-card.in, .story-card.in-back {
    animation: none;
    -webkit-mask-image: none; mask-image: none;
  }
}

.story-sec-kicker {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .9rem;
  font-family: var(--sans);         /* native-script kickers (word · linguistics) stay tidy */
}
.story-sec-title { font-size: 1.45rem; margin-bottom: .7rem; }
.story-unit-title { font-size: clamp(2rem, 8.5vw, 2.6rem); margin: .35rem 0 .15rem; }
.story-intro .unit-subtitle { margin-bottom: .9rem; font-size: 1.08rem; }

/* story typography runs a notch larger than the desktop panels */
.story .vcard-term { font-size: 2.35rem; }
.story .vcard-roman { font-size: 1.05rem; }
.story .vcard-gloss { font-size: 1.08rem; }
.story .vex-text { font-size: 1.25rem; }
.story .gex-text { font-size: 1.25rem; }
.story .ling-p { font-size: 1rem; }
.story-ling-origin { margin-bottom: .9rem; }

/* practice fits the page better compacted; it may still scroll as a fallback */
.story .qcard { padding: 1.05rem .95rem; }
.story .match-grid { grid-template-columns: 1fr 1fr; }
.story .match-col:last-child { margin-top: 0; }

.story-tapnote {
  margin-top: 1.6rem; color: var(--ink-3); font-size: .85rem; text-align: center;
  animation: tapPulse 1.8s ease-in-out infinite;
}
@keyframes tapPulse { 50% { opacity: .45; } }

/* dialogue line cards: one big centred line per card */
.story-line { display: flex; flex-direction: column; }
.story-line-mid { margin: auto 0; text-align: center; padding: 1rem 0 1.5rem; }
.story-term-long { font-size: clamp(1.5rem, 6.5vw, 2.05rem); }
.story-speaker { color: var(--ink-3); font-size: .95rem; margin-bottom: 1.1rem; justify-content: center; }
.story-term {
  font-size: clamp(2rem, 9vw, 2.9rem); line-height: 1.4;
  margin-bottom: 1rem; justify-content: center; flex-wrap: wrap;
}
.story-roman { color: var(--accent); font-size: 1.1rem; margin-bottom: .5rem; }
.story-gloss { color: var(--ink-2); font-size: 1.12rem; }

.story-vocab .vcard { border-radius: var(--r); }

/* floating prev/next — centred so the tutor goblin keeps its corner */
.story-nav {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 10px; z-index: 2;
}
.story-nav-btn {
  width: 2.7rem; height: 2.7rem; border-radius: 50%;
  border: 1px solid var(--rule-2);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 1.35rem; line-height: 1; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-2);
  padding: 0 0 .15em;
}
@supports not (backdrop-filter: blur(4px)) { .story-nav-btn { background: var(--card); } }
.story-nav-btn[disabled] { opacity: .3; cursor: default; }
.story-nav-next { border-color: var(--accent); color: var(--accent); }

/* section end cards */
.story-end { display: flex; flex-direction: column; }
.story-end-mid { margin: auto 0; text-align: center; padding-bottom: 1.5rem; }
.story-end-mark {
  width: 4.2rem; height: 4.2rem; margin: 0 auto 1.1rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--paper);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-2);
}
.story-end-mark.todo {
  background: var(--card-2); color: var(--ink-3);
  border: 1px dashed var(--rule-2); box-shadow: none;
}
.story-end-title { font-size: 1.4rem; margin-bottom: .4rem; }
.story-end-note { color: var(--ink-3); font-size: .9rem; margin: 0 auto 1.1rem; max-width: 34ch; }
.story-end .step-nav { flex: 0 0 auto; }
.story-end-links { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.story-end-links .btn { width: 100%; }

/* short viewports (old/small phones): step the story type down a notch so the
 * unpaginated cards — dialogue lines especially — still fit without scrolling */
@media (max-height: 700px) {
  .story-card { font-size: 1rem; line-height: 1.55; padding-bottom: calc(4.2rem + env(safe-area-inset-bottom, 0px)); }
  .story-sec-kicker { margin-bottom: .6rem; }
  .story-sec-title { font-size: 1.3rem; }
  .story-unit-title { font-size: clamp(1.7rem, 7.5vw, 2.2rem); }
  .story-term { font-size: clamp(1.7rem, 8vw, 2.3rem); }
  .story-term-long { font-size: clamp(1.35rem, 6vw, 1.8rem); }
  .story-speaker { margin-bottom: .7rem; }
  .story-line-mid { padding: .6rem 0 1rem; }
  .story-roman { font-size: 1rem; }
  .story-gloss { font-size: 1.02rem; }
  .story .vcard-term { font-size: 2rem; }
  .story .vex-text, .story .gex-text { font-size: 1.15rem; }
}

/* very short viewports (iPhone-5 class): one more step down */
@media (max-height: 600px) {
  .story-card { padding-bottom: calc(3.9rem + env(safe-area-inset-bottom, 0px)); }
  .story-term { font-size: clamp(1.5rem, 7vw, 2rem); }
  .story-term-long { font-size: clamp(1.15rem, 5.4vw, 1.5rem); }
  .story-roman { font-size: .92rem; }
  .story-gloss { font-size: .95rem; }
  .story .basis { padding: .55rem .7rem; }
  .story .basis-list { font-size: .78rem; }
}

/* short viewports: tighten the end card so it never scrolls */
@media (max-height: 760px) {
  .story-end-mark { width: 3.2rem; height: 3.2rem; font-size: 1.5rem; margin-bottom: .7rem; }
  .story-end-mid { padding-bottom: .6rem; }
  .story-end-note { margin-bottom: .7rem; }
  .story-end-links { margin-top: .6rem; gap: .45rem; }
}

/* Print: fall back to plain paper. */
@media print {
  .topbar, .tabs-wrap, .complete-bar, .unit-footer, .sitefoot, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .panel[hidden] { display: block !important; }
}

/* ================================================================ AI tutor ==
   The floating 🧌 bubble + chat panel (js/tutor.js). Uses the same paper-and-ink
   tokens as the rest of the app; on small screens the panel becomes a bottom sheet. */

.tutor-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  font-size: 26px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  transition: transform var(--t), box-shadow var(--t);
}
.tutor-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.tutor-fab.open { transform: scale(.92); }

.tutor-panel {
  position: fixed; right: 18px; bottom: 84px; z-index: 59;
  width: min(400px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 120px));
  height: min(560px, calc(100dvh - 120px));   /* dvh: honest height under mobile URL bars */
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: 0 18px 48px rgba(0,0,0,.25);
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98);
  transition: opacity var(--t), transform var(--t), visibility var(--t);
}
.tutor-panel.open { opacity: 1; visibility: visible; transform: none; }

.tutor-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--rule);
}
.tutor-head-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tutor-title { font-family: var(--serif); font-size: 1.05rem; }
.tutor-model-tag { font-family: var(--mono); font-size: .7rem; opacity: .55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tutor-head-tools { display: flex; gap: 4px; }

.tutor-scroll {
  flex: 1; min-height: 0;                     /* let flexbox actually shrink the scroller */
  overflow-y: auto; padding: 14px 14px 18px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;               /* don't drag the page behind the sheet */
  -webkit-overflow-scrolling: touch;
}

.tutor-hello { text-align: center; padding: 8px 4px 2px; }
.tutor-hello-mark { font-size: 40px; }
.tutor-hello-p { font-size: .9rem; opacity: .8; margin: 8px 0 12px; }
.tutor-chips { display: flex; flex-direction: column; gap: 8px; }
.tutor-chip {
  border: 1px dashed var(--rule); border-radius: var(--r);
  background: var(--paper); color: var(--ink);
  padding: 8px 12px; font-size: .84rem; text-align: left; cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.tutor-chip:hover { background: var(--paper-deep); border-color: var(--accent); }

.tutor-setup { padding: 4px 2px; }
.tutor-setup-title { font-family: var(--serif); font-size: 1rem; margin-bottom: 6px; }
.tutor-setup-p { font-size: .84rem; line-height: 1.5; opacity: .85; }
.tutor-link { display: inline-block; margin: 8px 0; font-size: .84rem; color: var(--accent); text-decoration: underline; }
.tutor-keyrow { display: flex; gap: 8px; margin-top: 6px; }
.tutor-keyrow .input { flex: 1; min-width: 0; }

.tutor-msgs { display: flex; flex-direction: column; gap: 10px; }
.tutor-msg { display: flex; }
.tutor-user { justify-content: flex-end; }
.tutor-bubble {
  max-width: 86%; min-width: 0; padding: 9px 12px; border-radius: var(--r);
  font-size: .92rem; line-height: 1.55;
  overflow-wrap: anywhere; word-break: break-word;   /* URLs, romanization runs, pinyin */
}
.tutor-user .tutor-bubble {
  background: var(--accent); color: var(--paper);
  border-bottom-right-radius: var(--r-sm); white-space: pre-wrap;
}
.tutor-model .tutor-bubble {
  background: var(--paper); border: 1px solid var(--rule);
  border-bottom-left-radius: var(--r-sm);
}
.tutor-p { margin: 0 0 .5em; }
.tutor-p:last-child { margin-bottom: 0; }
.tutor-list { margin: 0 0 .5em 1.1em; padding: 0; }
.tutor-list:last-child { margin-bottom: 0; }
.tutor-bubble code {
  font-family: var(--mono); font-size: .85em;
  background: var(--paper-deep); border-radius: 4px; padding: 1px 4px;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.tutor-bubble .spk-icon { opacity: .5; }
.tutor-say { cursor: pointer; border-bottom: 1px dotted var(--accent); font-family: var(--native); }
.tutor-say:hover { color: var(--accent); }
.tutor-dots { letter-spacing: 3px; opacity: .5; animation: tutorPulse 1.1s ease-in-out infinite; }
@keyframes tutorPulse { 0%,100% { opacity: .25; } 50% { opacity: .8; } }
.tutor-error { color: var(--bad); font-size: .84rem; margin-top: .4em; }

.tutor-form {
  display: flex; align-items: flex-end; gap: 8px; flex: 0 0 auto;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));  /* clear the home bar */
  border-top: 1px solid var(--rule);
  background: var(--card);
}
.tutor-input {
  flex: 1; resize: none; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: .92rem; line-height: 1.4;
  padding: 9px 12px; max-height: 120px;
}
.tutor-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tutor-send {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 50%;
  border: none; background: var(--accent); color: var(--paper);
  font-size: 15px; cursor: pointer; transition: transform var(--t);
}
.tutor-send:hover { transform: scale(1.06); }

@media (max-width: 560px) {
  .tutor-panel {
    right: 0; left: 0; bottom: 0; width: 100%;
    height: min(78vh, 640px);
    height: min(82dvh, 640px);                /* dvh: the sheet never hides its own input */
    max-height: 100dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-left: none; border-right: none; border-bottom: none;
    transform: translateY(24px);
  }
  .tutor-panel.open { transform: none; }
  .tutor-bubble { max-width: 92%; font-size: .95rem; }
  .tutor-input { font-size: 16px; }           /* <16px makes iOS zoom the whole page on focus */
  .tutor-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .tutor-fab.open { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tutor-fab, .tutor-panel, .tutor-send { transition: none; }
  .tutor-dots { animation: none; }
}

/* =========================================================== landing gate ==
   Full-screen sign-in cover shown until this device has signed in with Google.
   Same paper-and-ink world as the app; the red name-seal mark is the signature. */

.landing {
  position: fixed; inset: 0; z-index: 80;
  overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.25rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 700px at 12% -8%, rgba(200,16,46,.045), transparent 62%),
    radial-gradient(900px 600px at 96% 4%, rgba(31,79,163,.05), transparent 60%),
    radial-gradient(700px 500px at 60% 110%, rgba(207,154,52,.06), transparent 65%);
  transition: opacity 320ms ease;
}
.landing.leaving { opacity: 0; pointer-events: none; }

.landing-inner { width: 100%; max-width: 30rem; text-align: center; }

.landing-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; margin-bottom: 1rem;
  font-family: var(--serif); font-size: 46px; line-height: 1;
  color: #fdf6ec; background: linear-gradient(150deg, #c8352a, #a02218);
  border-radius: 20px; transform: rotate(-3deg);
  box-shadow: var(--shadow-2);
}
.landing-title { font-size: clamp(2rem, 6vw, 2.6rem); margin-bottom: .15em; }
.landing-native {
  font-family: var(--native); font-size: 1.05rem; color: var(--ink-2);
  letter-spacing: .04em; margin-bottom: .9rem;
}
.landing-dot { margin: 0 .55em; color: var(--ink-3); }
.landing-sub { color: var(--ink-2); max-width: 36ch; margin: 0 auto 0; }

.landing-card {
  margin-top: 1.7rem; padding: 1.4rem 1.4rem 1.2rem; text-align: left;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
}
.landing-signin { display: flex; justify-content: center; margin-bottom: .6rem; }
.landing-signin:not(:empty) { min-height: 44px; }
.landing-google {
  display: block;
  margin: .4rem auto .9rem;
  padding: .7rem 1.6rem;
  font-size: 1.02rem;
}
.landing-note { text-align: center; margin-bottom: .4rem; }
.landing-hero { animation: landingIn 480ms cubic-bezier(.22,.61,.36,1) both; }
.landing-card { animation: landingIn 480ms 90ms cubic-bezier(.22,.61,.36,1) both; }
@keyframes landingIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .landing, .landing-hero, .landing-card { animation: none; transition: none; }
}

.signed-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-bottom: 10px;
  padding: 8px 12px; border: 1px dashed var(--rule-2); border-radius: var(--r);
}
.signed-as { font-size: .88rem; color: var(--ink-2); }
