/* =========================================================================
   Renix – ôn tập tiếng Nhật Unit 13–17 · Liquid glass, monochrome
   Floating sidebar + top bar (frosted glass), flat content panels.
   Dark (default) and light (data-theme="light"); only black / white / grey,
   plus one soft red reserved for wrong answers.
   ========================================================================= */
:root {
  --bg: #0b0b0d;
  --ink: #f5f5f7;
  --ink-2: #c7c7cc;
  --muted: #8e8e93;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .035);
  --surface-solid: rgba(30, 30, 33, .9);
  --surface-2: rgba(255, 255, 255, .05);
  --surface-3: rgba(255, 255, 255, .09);
  --field: rgba(255, 255, 255, .06);
  --hl: rgba(255, 255, 255, .06);
  /* "selected" = raised glass pill; "primary" = solid ink */
  --raised: rgba(255, 255, 255, .13);
  --raised-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 12px -6px rgba(0, 0, 0, .6);
  --primary: #f5f5f7;
  --primary-2: #f5f5f7;
  --primary-ink: #0b0b0d;
  --primary-soft: rgba(255, 255, 255, .09);
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, .12);
  --cyan: #d1d1d6;
  --ok: #f5f5f7; --ok-soft: rgba(255, 255, 255, .11);
  --bad: #ff7b72; --bad-soft: rgba(255, 123, 114, .11);
  --warn: #a1a1a6; --warn-soft: rgba(255, 255, 255, .06);
  --u13: #e5e5ea; --u14: #e5e5ea; --u15: #e5e5ea; --u16: #e5e5ea; --u17: #e5e5ea;
  --t-v: #d1d1d6; --t-n: #d1d1d6; --t-a: #d1d1d6; --t-f: #d1d1d6; --t-g: #f5f5f7;
  /* grey ramp for charts / levels (light → dark on the dark theme) */
  --g0: rgba(255, 255, 255, .09); --g1: #f5f5f7; --g2: #b9b9be; --g3: #7d7d83; --g4: #55555a; --g5: #3a3a3e;
  --kw-ink: #f5f5f7;
  --kw-bg: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015) 70%);
  /* frosted glass for the floating chrome: even frost, hairline edge, soft shadow */
  --glass-bg: linear-gradient(rgba(255, 255, 255, .05), rgba(255, 255, 255, .05));
  --glass-tint: rgba(18, 18, 20, .55);
  --glass-line: rgba(255, 255, 255, .085);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 28px -14px rgba(0, 0, 0, .7);
  --glass-blur: blur(24px) saturate(150%);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 26px 60px -18px rgba(0, 0, 0, .8);
  --blur: blur(22px) saturate(160%);
  --gap: 14px;
  --rail-item: 44px;
  --side-w: calc(var(--rail-item) + 18px);
  --top-h: 56px;
  --topbar-h: calc(var(--top-h) + var(--gap));
  --sticky-top: calc(var(--gap) * 2 + var(--top-h) - 4px);
  --font-ui: "Be Vietnam Pro", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-num: "Be Vietnam Pro", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-jp: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", "Hiragino Sans", sans-serif;
  --font-mincho: "Noto Serif JP", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "MS Mincho", serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ececef;
  --ink: #1c1c1e;
  --ink-2: #3a3a3c;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .07);
  --line-2: rgba(0, 0, 0, .13);
  --surface: rgba(255, 255, 255, .62);
  --surface-solid: rgba(250, 250, 252, .94);
  --surface-2: rgba(0, 0, 0, .035);
  --surface-3: rgba(0, 0, 0, .065);
  --field: rgba(255, 255, 255, .8);
  --hl: rgba(255, 255, 255, .9);
  --raised: #ffffff;
  --raised-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 6px 16px -8px rgba(0, 0, 0, .3);
  --primary: #1c1c1e;
  --primary-2: #1c1c1e;
  --primary-ink: #ffffff;
  --primary-soft: rgba(0, 0, 0, .06);
  --accent: #000000;
  --accent-soft: rgba(0, 0, 0, .07);
  --cyan: #48484a;
  --ok: #1c1c1e; --ok-soft: rgba(0, 0, 0, .07);
  --bad: #d23b32; --bad-soft: rgba(210, 59, 50, .09);
  --warn: #6e6e73; --warn-soft: rgba(0, 0, 0, .04);
  --u13: #2c2c2e; --u14: #2c2c2e; --u15: #2c2c2e; --u16: #2c2c2e; --u17: #2c2c2e;
  --t-v: #3a3a3c; --t-n: #3a3a3c; --t-a: #3a3a3c; --t-f: #3a3a3c; --t-g: #1c1c1e;
  --g0: rgba(0, 0, 0, .07); --g1: #1c1c1e; --g2: #55555a; --g3: #8e8e93; --g4: #b9b9be; --g5: #d8d8dc;
  --kw-ink: #1c1c1e;
  --kw-bg: radial-gradient(circle at 50% 30%, #ffffff, rgba(255, 255, 255, .7) 75%);
  --glass-bg: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .55));
  --glass-tint: rgba(250, 250, 252, .25);
  --glass-line: rgba(0, 0, 0, .06);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 10px 26px -16px rgba(0, 0, 0, .22);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 28px -18px rgba(0, 0, 0, .22);
  --shadow-lg: 0 30px 60px -24px rgba(0, 0, 0, .3);
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
[lang="ja"], .jp { font-family: var(--font-jp); }
a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: .4em 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
kbd { font: 600 11px/1 var(--font-num); color: var(--ink-2); padding: 3px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); }
::selection { background: rgba(255, 255, 255, .24); }
:root[data-theme="light"] ::selection { background: rgba(0, 0, 0, .14); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .28); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, .18); }
::-webkit-scrollbar-track { background: transparent; }
.ic { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.17em; }
select option { background: #1c1c1e; color: #f5f5f7; }
:root[data-theme="light"] select option { background: #fff; color: #1c1c1e; }

/* ruby / furigana */
ruby { ruby-position: over; ruby-align: center; }
rt { font-size: .5em; color: var(--muted); font-weight: 400; letter-spacing: 0; user-select: none; ruby-align: center; }
.furi-off rt { display: none; }
.furi-hover rt { visibility: hidden; }
.furi-hover ruby:hover rt { visibility: visible; }

/* ---------------------------------------------------------------- background */
#bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(1100px 760px at 30% -18%, rgba(255, 255, 255, .06), transparent 62%),
    radial-gradient(820px 640px at 104% 18%, rgba(255, 255, 255, .035), transparent 62%),
    radial-gradient(1100px 780px at 62% 118%, rgba(255, 255, 255, .045), transparent 62%),
    var(--bg);
}
/* fine grain so the glass has something to frost */
#bg::after {
  content: ""; position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="light"] #bg {
  background:
    radial-gradient(1100px 760px at 12% -12%, #ffffff, transparent 62%),
    radial-gradient(820px 640px at 104% 16%, rgba(255, 255, 255, .75), transparent 62%),
    radial-gradient(1000px 760px at 66% 120%, rgba(0, 0, 0, .07), transparent 62%),
    var(--bg);
}
:root[data-theme="light"] #bg::after { opacity: .06; mix-blend-mode: multiply; }

/* ---------------------------------------------------------------- glass */
#sidebar, #topbar, .glass, .toolbar, .player-head, .search-results, .toast, .modal, #nav-tip {
  background: var(--glass-bg), var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  box-shadow: var(--glass-shadow);
}

/* ---------------------------------------------------------------- shell */
#app { position: relative; z-index: 1; min-height: 100vh; }
/* navigation rail: an icon-only capsule, vertically centred under the top bar and exactly as tall as its items */
#sidebar {
  position: fixed; z-index: 40; left: var(--gap);
  top: calc(50% + (var(--top-h) + var(--gap)) / 2); transform: translateY(-50%);
  width: var(--side-w); max-height: calc(100vh - var(--top-h) - var(--gap) * 3);
  border-radius: calc(var(--side-w) / 2); padding: 8px;
  display: flex; flex-direction: column; overflow: hidden;
}
#sidebar > .brand { display: none; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-text { display: none; }
.brand-text b { display: block; font: 700 24px/1.1 var(--font-ui); letter-spacing: -.03em; }
.brand-text small { color: var(--muted); font-size: 12px; }
#nav { position: relative; display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav a {
  position: relative; z-index: 1; flex: none; width: var(--rail-item); height: var(--rail-item); margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted); transition: color .2s;
}
#nav a .ni { display: grid; place-items: center; }
#nav a .ni .ic { width: 20px; height: 20px; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
#nav a:hover, #nav a:focus-visible { color: var(--ink); text-decoration: none; outline: none; }
#nav a:hover .ni .ic { transform: scale(1.1); }
#nav a:active .ni .ic { transform: scale(.92); }
#nav a.active { color: var(--ink); }
#nav a .nl, #nav a .nj { display: none; }
/* the active pill and the hover pill are single elements that app.js slides from item to item */
#nav .nav-ind, #nav .nav-hov {
  position: absolute; z-index: 0; top: 0; left: 50%; width: var(--rail-item); height: var(--rail-item); margin-left: calc(var(--rail-item) / -2);
  border-radius: 50%; pointer-events: none; opacity: 0;
}
#nav .nav-ind { background: var(--raised); box-shadow: var(--raised-shadow); }
#nav .nav-hov { background: var(--surface-3); }
#nav .nav-ind.on, #nav .nav-hov.on { opacity: 1; }
#nav.glide .nav-ind { transition: transform .5s cubic-bezier(.3, 1.3, .4, 1), height .3s, opacity .2s; }
#nav.glide .nav-hov { transition: transform .32s cubic-bezier(.3, 1.15, .4, 1), height .3s, opacity .2s; }
#nav .nav-hov.jump { transition: opacity .2s !important; }
/* label that slides out next to the hovered icon (one element, glides between items) */
#nav-tip {
  --glass-tint: rgba(24, 24, 27, .82);
  position: fixed; z-index: 60; top: 0; left: calc(var(--gap) + var(--side-w) + 10px);
  display: flex; align-items: center; padding: 8px 15px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translate(-12px, -50%) scale(.9); transform-origin: 0 50%;
  transition: opacity .18s ease, transform .4s cubic-bezier(.2, 1.4, .4, 1), top .34s cubic-bezier(.3, 1.15, .4, 1);
}
:root[data-theme="light"] #nav-tip { --glass-tint: rgba(255, 255, 255, .86); }
#nav-tip.show { opacity: 1; transform: translate(0, -50%) scale(1); }
#nav-tip.jump { transition: opacity .18s ease, transform .4s cubic-bezier(.2, 1.4, .4, 1); }
#nav-tip .tt { display: inline-flex; align-items: baseline; gap: 8px; animation: tipText .3s ease both; }
#nav-tip b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
#nav-tip small { font: 12px var(--font-jp); color: var(--muted); }
@keyframes tipText { from { opacity: 0; transform: translateY(5px); } }
.drawer-extra { display: none; }
.side-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 4px 10px; }
#content { min-width: 0; margin-left: calc(var(--side-w) + var(--gap)); }
/* the top bar floats over the content column only (same width as the page content) */
#topbar {
  position: sticky; z-index: 30; top: var(--gap); height: var(--top-h);
  width: calc(100% - 52px); max-width: calc(1440px - 52px); margin: var(--gap) auto 0;
  border-radius: 20px; display: flex; align-items: center; gap: 12px; padding: 0 8px 0 18px;
}
.top-brand { flex: none; display: flex; align-items: center; gap: 12px; color: var(--ink); }
.top-brand:hover { text-decoration: none; }
.top-brand::after { content: ""; width: 1px; height: 18px; background: var(--line-2); }
.wordmark { font: 700 18px/1 var(--font-ui); letter-spacing: -.03em; color: var(--ink); }
.top-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 0 1 auto; }
.top-title b { font: 600 17px/1.2 var(--font-ui); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { position: relative; flex: 0 1 300px; min-width: 160px; margin-left: auto; }
.search input {
  width: 100%; height: 38px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--ink); padding: 0 16px 0 40px; font: inherit; font-size: 14px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search::before {
  content: ""; position: absolute; left: 14px; top: 10px; width: 18px; height: 18px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.search-kbd { display: none; }
.search input:focus { outline: none; background: var(--field); border-color: var(--line-2); box-shadow: 0 0 0 4px var(--primary-soft); }
/* nested inside the top bar's backdrop root, so it cannot blur the page: keep it near-opaque */
.search-results {
  --glass-tint: rgba(26, 26, 29, .97);
  position: absolute; top: 50px; right: 0; width: max(100%, 480px); max-height: 70vh; overflow: auto;
  border-radius: 22px; padding: 6px;
}
:root[data-theme="light"] .search-results { --glass-tint: rgba(250, 250, 252, .97); }
.sr-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 12px 6px; }
.sr-item { display: flex; gap: 10px; align-items: center; padding: 7px 12px; border-radius: 14px; cursor: pointer; color: var(--ink); }
.sr-item:hover, .sr-item.sel { background: var(--surface-3); text-decoration: none; }
.sr-item .sr-main { font-family: var(--font-jp); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; max-width: 64%; }
.sr-item .sr-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 0; }
.sr-item .tag { margin-left: auto; }
.top-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.top-tools .icon-btn { background: transparent; }
.top-tools .icon-btn:hover { background: var(--surface-3); }
.top-tools .icon-btn.on { background: var(--raised); box-shadow: var(--raised-shadow); color: var(--ink); }
.unit-pills { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); margin-right: 4px; }
.unit-pills.wrap { flex-wrap: wrap; border-radius: 18px; margin: 0; }
.unit-pills button {
  height: 30px; min-width: 34px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font: 600 13px/1 var(--font-num); color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, box-shadow .15s;
}
.unit-pills button:hover { color: var(--ink); }
.unit-pills button.on { color: var(--ink); background: var(--raised); box-shadow: var(--raised-shadow); }
#main { padding: 22px 26px 80px; max-width: 1440px; width: 100%; margin: 0 auto; outline: none; }
.only-mobile, .icon-btn.only-mobile { display: none; }
#scrim { display: none; }

@media (max-width: 1240px) { .top-title span { display: none; } .search { flex-basis: 220px; } }
@media (min-width: 901px) and (max-height: 640px) { :root { --rail-item: 38px; } #nav { gap: 2px; } }
@media (max-width: 900px), (hover: none) { #nav-tip { display: none; } }
@media (max-width: 900px) {
  :root { --gap: 10px; --top-h: 52px; }
  #content { margin-left: 0; }
  #sidebar {
    top: var(--gap); bottom: var(--gap); max-height: none; width: min(290px, calc(100vw - 2 * var(--gap)));
    border-radius: 26px; padding: 16px 12px; z-index: 50;
    transform: translateX(calc(-100% - 2 * var(--gap))); transition: transform .3s cubic-bezier(.3, .8, .3, 1);
  }
  body.nav-open #sidebar { transform: none; }
  body.nav-open #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 45; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  #sidebar > .brand { display: flex; margin: 0 6px 12px; }
  .brand-text { display: block; }
  .top-brand { display: none; }
  #nav { gap: 2px; flex: 1 1 auto; }
  #nav a { width: auto; height: auto; margin: 0; display: flex; align-items: center; gap: 12px; padding: 9px 12px; font-size: 14.5px; border-radius: 14px; }
  #nav a .nl { display: block; }
  #nav a .nj { display: block; margin-left: auto; font-size: 12px; color: var(--muted); }
  #nav .nav-ind, #nav .nav-hov { left: 0; right: 0; width: auto; margin-left: 0; border-radius: 14px; }
  .drawer-extra { display: block; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
  .only-mobile, .icon-btn.only-mobile { display: inline-grid; }
  #topbar { width: calc(100% - 28px); padding: 0 6px; gap: 6px; border-radius: 18px; }
  .top-title b { font-size: 16px; }
  .search { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 8px); margin: 0; min-width: 0; }
  body.search-open .search { display: block; }
  .search input { height: 46px; background: var(--surface-solid); box-shadow: var(--shadow-lg); }
  .search::before { top: 14px; }
  .search-results { width: 100%; top: 54px; }
  #unit-filter { display: none; }
  .top-tools { margin-left: auto; gap: 2px; }
  #main { padding: 16px 14px 100px; }
  .unit-pills.wrap { display: flex; justify-content: space-between; }
  .unit-pills.wrap button { min-width: 32px; padding: 0 7px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .top-title b { font-size: 15px; }
  .top-tools .icon-btn, .icon-btn.only-mobile { width: 34px; height: 34px; }
}

/* ---------------------------------------------------------------- primitives */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--hl); padding: 18px 20px;
}
:root[data-theme="light"] .card { border-color: rgba(0, 0, 0, .05); box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h3 { display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
.card h3 .ic { color: var(--muted); width: 17px; height: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.sec-label { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 22px 4px 10px; }
.sec-label .more { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.sec-label .more:hover { color: var(--ink); }
.sec-label:first-child { margin-top: 0; }
.page-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.page-bar .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.page-bar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.jp-sub { font-family: var(--font-jp); color: var(--muted); font-size: 14px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 12px; flex-wrap: wrap; }
.section-title h2, .section-title h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.section-title .line { flex: 1; height: 1px; background: var(--line); min-width: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--surface-3); color: var(--ink); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background .15s, box-shadow .15s, filter .15s, transform .06s, opacity .15s;
}
.btn .ic { width: 17px; height: 17px; }
.btn:hover { background: rgba(255, 255, 255, .14); text-decoration: none; }
:root[data-theme="light"] .btn:hover { background: rgba(0, 0, 0, .1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary, .btn.ok { background: var(--primary); color: var(--primary-ink); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 20px -10px rgba(0, 0, 0, .8); }
.btn.primary:hover, .btn.ok:hover { background: var(--primary); filter: brightness(1.08); }
:root[data-theme="light"] .btn.primary, :root[data-theme="light"] .btn.ok { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 18px -10px rgba(0, 0, 0, .55); }
:root[data-theme="light"] .btn.primary:hover, :root[data-theme="light"] .btn.ok:hover { filter: brightness(1.35); }
.btn.accent { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); font-weight: 600; }
.btn.accent:hover { background: var(--surface-3); }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.bad:hover { background: var(--bad-soft); filter: brightness(1.25); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; gap: 6px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { height: 50px; padding: 0 24px; font-size: 15.5px; }
.btn.lg .ic { width: 19px; height: 19px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn kbd { background: rgba(127, 127, 127, .18); color: inherit; border-color: rgba(127, 127, 127, .4); margin-left: 2px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%; flex: none;
  border: 0; background: var(--surface-2); color: var(--ink-2); cursor: pointer; font-size: 15px; font-weight: 600;
  transition: background .15s, color .15s, box-shadow .15s;
}
.icon-btn .ic { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.on { background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.speak {
  border: 0; background: transparent; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; color: var(--muted); line-height: 1; vertical-align: middle; transition: color .15s, background .15s;
}
.speak .ic { width: 16px; height: 16px; }
.speak:hover { color: var(--ink); background: var(--surface-3); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px;
  border: 0; background: var(--surface-3); cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--ink-2);
  user-select: none; transition: background .15s, box-shadow .15s;
}
.chip:hover { background: rgba(127, 127, 127, .2); text-decoration: none; color: var(--ink); }
.chip.on, .chip.u.on { background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip.on .dot { background: var(--ink); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap; border: 0;
}
.tag .ic { width: 12px; height: 12px; }
.tag[class*="u1"] { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); font-variant-numeric: tabular-nums; }
.tag.ok, .tag.acc { background: var(--ink); color: var(--bg); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: transparent; color: var(--ink-2); border: 1px dashed var(--muted); }
.tag.pri { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }

.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-weight: 500; color: var(--muted); font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s, box-shadow .15s;
}
.seg button .ic { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow); }

.input, select.input, textarea.input {
  height: 40px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); color: var(--ink);
  padding: 0 14px; font: inherit; font-size: 14px; min-width: 0; transition: border-color .15s, box-shadow .15s, background .15s;
}
select.input { border-radius: 999px; padding-right: 10px; }
.input::placeholder { color: var(--muted); }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.7; resize: vertical; border-radius: 18px; }
.input:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.ok { border-color: var(--ink); background: var(--ok-soft); }
.input.bad { border-color: var(--bad); background: var(--bad-soft); }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; user-select: none; color: var(--ink-2); }
label.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--g1); border-radius: inherit; transition: width .5s ease; }
.bar.ok > i { background: var(--g1); }
.bar.acc > i { background: var(--g2); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font: 600 30px/1.05 var(--font-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }

.note { border-radius: 16px; padding: 10px 14px; background: var(--surface-2); border: 0; font-size: 14px; color: var(--ink-2); }
.note.info, .note.ok { background: var(--surface-2); }
.note.warn { background: var(--bad-soft); color: var(--ink); }
.note.fix { background: transparent; border: 1px dashed var(--line-2); color: var(--ink); }
.note .ic { color: var(--ink); margin-right: 4px; }
.note b:first-child { margin-right: 4px; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 42px; line-height: 1; margin-bottom: 10px; }
.empty .big .ic { width: 44px; height: 44px; color: var(--muted); }

/* ---------------------------------------------------------------- toast & overlay */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  position: relative; color: var(--ink); padding: 11px 20px; border-radius: 999px; font-weight: 500; font-size: 14px;
  animation: toastIn .25s ease; max-width: 90vw;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fadeIn .18s ease; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
:root[data-theme="light"] .overlay { background: rgba(0, 0, 0, .18); }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  --glass-tint: rgba(24, 24, 27, .78);
  border-radius: 28px; width: min(760px, 100%); max-height: 92vh; overflow: auto; position: relative; animation: popIn .22s ease;
}
:root[data-theme="light"] .modal { --glass-tint: rgba(250, 250, 252, .82); }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px 22px; position: sticky; top: 0; z-index: 2; background: transparent; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 8px 22px 22px; }
.modal.wide { width: min(1100px, 100%); }
.lightbox img { display: block; margin: 0 auto; background: #fff; border-radius: 12px; }
.modal video { display: block; }

/* ---------------------------------------------------------------- formula chips */
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--font-jp); }
.formula + .formula { margin-top: 8px; }
/* the grammar pattern itself is solid; slots (V / N / A) are outlined; verb forms dashed */
.tok {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: 15px;
  background: var(--ink); color: var(--bg); border: 1px solid transparent;
}
.tok.v, .tok.n, .tok.a { background: transparent; color: var(--ink); border-color: var(--line-2); font-weight: 500; }
.tok.f { background: transparent; color: var(--ink); border: 1px dashed var(--muted); font-weight: 500; }
.tok small { font-weight: 400; font-size: 11.5px; opacity: .75; font-family: var(--font-ui); }
.tok-plus { color: var(--muted); font-weight: 600; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: currentColor; }
.legend .lg-solid::before { width: 18px; height: 11px; border-radius: 99px; background: var(--ink); }
.legend .lg-line::before { width: 18px; height: 11px; border-radius: 99px; background: transparent; box-sizing: border-box; border: 1px solid var(--muted); }
.legend .lg-dash::before { width: 18px; height: 11px; border-radius: 99px; background: transparent; box-sizing: border-box; border: 1px dashed var(--muted); }
.legend .sw::before { background: var(--c); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 50%; }

/* ---------------------------------------------------------------- dashboard (home) */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dash-col > .sec-label { margin: 8px 4px -4px; }
@media (max-width: 1240px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-center { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 760px) { .dash { grid-template-columns: 1fr; } }
.cd-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.cd-nums { display: flex; align-items: baseline; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.cd-nums b { font: 600 clamp(28px, 2.4vw, 38px)/1 var(--font-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.cd-nums span { font-size: 13px; color: var(--muted); margin-right: 8px; }
.cd-card .cd-sub { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.cd-icon {
  margin-left: auto; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 0; cursor: pointer;
  background: var(--raised); color: var(--ink); box-shadow: var(--raised-shadow);
}
.cd-icon .ic { width: 20px; height: 20px; }
.today { padding: 6px; }
.today a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px; color: var(--ink); }
.today a:hover { background: var(--surface-2); text-decoration: none; }
.today .ti { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--ink); background: var(--surface-3); }
.today .ti .ic { width: 17px; height: 17px; }
.today .tl { font-size: 14px; font-weight: 500; min-width: 0; flex: 1; }
.today .tl small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today .tl .bar { margin-top: 7px; height: 4px; }
.today .tn { margin-left: auto; font: 600 20px/1 var(--font-num); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.today .tn small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 4px; }
.today .go { color: var(--muted); width: 16px; height: 16px; }
.stage { position: relative; padding: 0; display: flex; flex-direction: column; align-items: center; overflow-x: clip; }
.stage-halo { position: absolute; left: 50%; top: 36%; width: 110%; aspect-ratio: 1; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(255, 255, 255, .09), transparent 58%); pointer-events: none; }
:root[data-theme="light"] .stage-halo { background: radial-gradient(circle, rgba(255, 255, 255, .95), transparent 60%); }
.kotd-pad { position: relative; width: min(290px, 76%); aspect-ratio: 1; z-index: 2; cursor: pointer; }
.kotd-pad .kw { max-width: none; }
.kotd-pad .kw svg { background: transparent; border: 0; box-shadow: none; }
.kotd-pad .kw .grid { display: none; }
.kotd-pad .kw .outline path { stroke: rgba(255, 255, 255, .07); }
:root[data-theme="light"] .kotd-pad .kw .outline path { stroke: rgba(0, 0, 0, .07); }
.platform { position: relative; width: min(360px, 92%); height: 70px; margin-top: -44px; z-index: 1; pointer-events: none; }
.platform i { position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); }
.platform .p1 { width: 100%; height: 100%; background: radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, .1), transparent 68%); }
.platform .p2 { width: 76%; height: 54%; border: 1px solid rgba(255, 255, 255, .35); box-shadow: 0 0 24px rgba(255, 255, 255, .12), inset 0 0 18px rgba(255, 255, 255, .08); }
.platform .p3, .platform .p4 { display: none; }
:root[data-theme="light"] .platform .p1 { background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, .1), transparent 68%); }
:root[data-theme="light"] .platform .p2 { border-color: rgba(0, 0, 0, .18); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .25); }
.kotd-info { text-align: center; margin-top: 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kotd-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.kotd-hv { font: 700 30px/1.1 var(--font-ui); letter-spacing: .04em; color: var(--ink); }
.kotd-mean { font-size: 15px; color: var(--ink-2); }
.kotd-reads { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.kotd-reads .rd { font-size: 14px; }
.ready { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 16px; align-items: center; }
.ready .gauge { width: 116px; }
.status-rows { display: flex; flex-direction: column; }
.status-row { display: flex; align-items: center; gap: 9px; padding: 9px 2px; font-size: 13.5px; white-space: nowrap; color: var(--ink-2); }
.status-row + .status-row { border-top: 1px solid var(--line); }
.status-row .ic { width: 16px; height: 16px; color: var(--muted); }
.status-row b { margin-left: auto; font-weight: 600; font-size: 12px; height: 22px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; }
.status-row b.ok { background: var(--ink); color: var(--bg); }
.status-row b.warn { background: var(--surface-3); color: var(--ink); }
.status-row b.bad { background: transparent; color: var(--ink-2); border: 1px dashed var(--muted); }
.donut-wrap { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; }
.donut-wrap .donut { width: 120px; }
.legend-rows { display: flex; flex-direction: column; gap: 9px; }
.legend-rows div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.legend-rows i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.legend-rows b { margin-left: auto; font: 600 13.5px/1 var(--font-num); color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-rows small { width: 34px; text-align: right; font: 500 12px/1 var(--font-num); color: var(--muted); }
.unit-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1240px) { .unit-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .unit-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .unit-row { grid-template-columns: 1fr; } }
.unit-tile { cursor: pointer; padding: 16px 16px 14px; overflow: hidden; transition: transform .2s, background .2s, border-color .2s; }
.unit-tile:hover { transform: translateY(-2px); background: var(--surface-2); border-color: var(--line-2); }
.unit-tile .un { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.unit-tile .ut { font: 600 19px/1.55 var(--font-jp); margin: 6px 0 0; padding-right: 50px; min-height: 2.4em; }
.unit-tile .uv { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-tile .ring { position: absolute; right: 14px; top: 14px; }
.unit-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.unit-mini div { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.unit-mini div b { color: var(--ink); font-size: 12.5px; }
.unit-mini .bar { height: 3px; }
.ring { --p: 0; --c: var(--ink); position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ink) calc(var(--p) * 1%), var(--surface-3) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
}
.ring::after { content: attr(data-v); position: relative; font: 600 11px/1 var(--font-num); color: var(--ink); font-variant-numeric: tabular-nums; }

/* charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid line { stroke: var(--line); stroke-width: 1; }
.ch-axis text, .ch-lbl { fill: var(--muted); font: 500 10.5px var(--font-num); }
.ch-val { fill: var(--ink); font: 600 10.5px var(--font-num); }
.ch-legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ch-empty { display: grid; place-items: center; text-align: center; min-height: 120px; color: var(--muted); font-size: 13px; gap: 10px; }
.gauge { position: relative; width: 132px; aspect-ratio: 1; }
.gauge svg { width: 100%; height: 100%; display: block; }
.gauge .gv { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .gv b { font: 600 32px/1 var(--font-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.gauge .gv span { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.donut { position: relative; width: 136px; aspect-ratio: 1; }
.donut svg { width: 100%; height: 100%; display: block; transform: rotate(-90deg); }
.donut .dv { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .dv b { font: 600 26px/1 var(--font-num); letter-spacing: -.02em; }
.donut .dv span { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ---------------------------------------------------------------- master text */
.unit-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.text-hero { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
.text-title { font: 700 32px/1.65 var(--font-jp); margin: 0; letter-spacing: .02em; }
.text-sub { color: var(--muted); font-size: 14px; }
.text-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.text-main { min-width: 0; }
.text-side { position: sticky; top: calc(var(--sticky-top) + 64px); display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - var(--sticky-top) - 80px); overflow-y: auto; scrollbar-width: thin; padding-bottom: 4px; }
@media (max-width: 1180px) { .text-layout { grid-template-columns: 1fr; } .text-side { position: static; max-height: none; overflow: visible; } }
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px; margin: 14px 0 6px; border-radius: 999px;
  position: sticky; top: var(--sticky-top); z-index: 6;
}
.toolbar .sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 2px; }
@media (max-width: 900px) { .toolbar { position: static; border-radius: 24px; } .text-title { font-size: 26px; } }
.toolbar select.input { height: 32px; font-size: 13px; padding: 0 8px 0 12px; }
.speaker { display: flex; gap: 12px; align-items: center; margin: 24px 0 6px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 700 16px/1 var(--font-jp); flex: none; }
.avatar.li { background: #f5f5f7; color: #0b0b0d; }
.avatar.akio { background: #6e6e73; color: #fff; }
.avatar.nishiyama { background: #2c2c2e; color: #f5f5f7; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
:root[data-theme="light"] .avatar.li { background: #1c1c1e; color: #fff; }
:root[data-theme="light"] .avatar.akio { background: #8e8e93; color: #fff; }
:root[data-theme="light"] .avatar.nishiyama { background: #fff; color: #1c1c1e; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.speaker b { font-family: var(--font-jp); font-size: 16px; }
.speaker small { display: block; color: var(--muted); font-size: 12px; }
.para { font: 400 19.5px/2.4 var(--font-jp); margin: 0 0 8px; padding: 4px 0; color: var(--ink); }
.furi-off .para { line-height: 2; }
.sent { cursor: pointer; border-radius: 8px; padding: 2px 1px; transition: background .15s, box-shadow .15s; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sent:hover { background: var(--surface-3); }
.sent.active { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 1px rgba(255, 255, 255, .28); }
:root[data-theme="light"] .sent.active { background: rgba(0, 0, 0, .08); box-shadow: 0 0 0 1px rgba(0, 0, 0, .22); }
.sent.sh { text-decoration: underline dotted var(--muted); text-underline-offset: 7px; text-decoration-thickness: 2px; }
.only-shadow .sent:not(.sh) { opacity: .28; }
.para-vi { font-size: 14.5px; color: var(--ink-2); border-left: 2px solid var(--line-2); padding: 2px 0 2px 14px; margin: -2px 0 16px; }
.para-vi span { cursor: pointer; }
.para-vi span.active { background: var(--surface-3); border-radius: 4px; color: var(--ink); }
.heading-jp { font: 700 18px/1.8 var(--font-jp); margin: 28px 0 0; color: var(--ink); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.heading-jp .hv { font: 400 13px var(--font-ui); color: var(--muted); }
.dock { padding: 16px 18px; }
.dock .dock-pos { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-variant-numeric: tabular-nums; }
.dock-jp { font: 500 21px/2.1 var(--font-jp); margin-top: 6px; }
.dock-jp .kj { cursor: pointer; border-bottom: 2px solid transparent; }
.dock-jp .kj:hover { border-bottom-color: var(--ink); }
.dock-vi { color: var(--ink-2); font-size: 14px; }
.dock-empty { color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.dock-empty .ic { width: 20px; height: 20px; color: var(--muted); }
@media (max-width: 1180px) {
  .dock.live {
    position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 25; max-width: 760px; margin: 0 auto; border-radius: 26px;
    background: var(--glass-bg), var(--surface-solid); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  }
  .dock:not(.live) { display: none; }
}
.res-list { display: flex; flex-direction: column; gap: 2px; }
.res-list button, .res-list a {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 14px; border: 0;
  background: transparent; color: var(--ink); cursor: pointer; font-size: 13.5px; text-align: left; transition: background .15s;
}
.res-list button:hover, .res-list a:hover { background: var(--surface-3); text-decoration: none; }
.res-list .ic { width: 17px; height: 17px; color: var(--muted); }
.res-list .tag { margin-left: auto; }
.res-list .ic.muted { margin-left: auto; width: 14px; height: 14px; }
.cast { display: flex; flex-direction: column; gap: 10px; }
.cast > div { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.cast b { display: block; font: 600 14px var(--font-jp); color: var(--ink); }
.cast .avatar { width: 32px; height: 32px; font-size: 14px; }
.steps { counter-reset: st; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: st; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.steps li::before { content: counter(st); flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11.5px/1 var(--font-num); color: var(--ink); background: var(--surface-3); }
.steps b { color: var(--ink); font-weight: 600; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.guide-grid img { border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; aspect-ratio: 0.77; object-fit: cover; object-position: top; width: 100%; }
video { width: 100%; max-height: 72vh; border-radius: 16px; background: #000; }
details.box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 0; margin: 12px 0; }
details.box > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; gap: 10px; align-items: center; }
details.box > summary .ic { color: var(--muted); }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; flex: none; }
details.box[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.box > .box-body { padding: 0 16px 16px; }

/* ---------------------------------------------------------------- vocab */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.filters .input[type="search"], .filters input.input { flex: 1; min-width: 200px; border-radius: 999px; }
.vcard { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 10px; transition: background .2s, border-color .2s, transform .2s; }
.vcard:hover { background: var(--surface-2); border-color: var(--line-2); }
.vcard .vw { font: 500 22px/1.9 var(--font-jp); }
.vcard .vk { font: 13.5px var(--font-jp); color: var(--muted); }
.vcard .vm { font-size: 14.5px; color: var(--ink-2); }
.vcard .vf { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
.boxes { display: inline-flex; gap: 3px; }
.boxes i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.boxes i.f { background: var(--ink); }
.star { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0; width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; }
.star .ic { width: 17px; height: 17px; }
.star:hover { background: var(--surface-3); color: var(--ink); }
.star.on { color: var(--ink); }
.star.on .ic { fill: currentColor; }
.vtable { width: 100%; border-collapse: collapse; }
.vtable th, .vtable td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.vtable th { font-size: 12px; font-weight: 600; color: var(--muted); }
.vtable tr:last-child td { border-bottom: 0; }
.vtable tr:hover td { background: var(--surface-2); }
.vtable td.jp { font-size: 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }

/* flashcard */
.flash-wrap { max-width: 580px; margin: 0 auto; }
.flash { perspective: 1400px; height: 340px; cursor: pointer; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .55s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 30px;
  background: radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, .1), transparent 55%), linear-gradient(180deg, #232326, #161618);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 8px;
}
.flash-back { transform: rotateY(180deg); background: radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, .12), transparent 55%), linear-gradient(180deg, #2a2a2e, #1b1b1e); }
:root[data-theme="light"] .flash-face { background: radial-gradient(120% 80% at 0% 0%, #fff, transparent 60%), linear-gradient(180deg, #fbfbfc, #f2f2f4); box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(0, 0, 0, .05), var(--shadow-lg); }
:root[data-theme="light"] .flash-back { background: linear-gradient(180deg, #ffffff, #f4f4f6); }
.flash-face > .tag { position: absolute; top: 18px; left: 20px; }
.flash-face .big { font: 500 50px/1.6 var(--font-jp); }
.flash-face .mid { font-size: 23px; font-weight: 600; }
.flash-face .hint { position: absolute; bottom: 16px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.flash-actions .btn.bad { background: var(--surface-3); color: var(--ink); }
.flash-actions .btn.bad:hover { background: rgba(127, 127, 127, .24); filter: none; }
.kbd-hint { font-size: 12px; color: var(--muted); display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.kbd-hint span { display: inline-flex; gap: 5px; align-items: center; }

/* quiz (generic) */
.qbox { max-width: 780px; margin: 0 auto; }
.q-prog { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.q-prog .bar { flex: 1; }
.q-prog .score { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; font-size: 13px; }
.q-prog .score .ic { width: 15px; height: 15px; }
.q-prompt { font: 500 32px/1.8 var(--font-jp); text-align: center; padding: 14px 10px 6px; }
.q-prompt.vi { font-family: var(--font-ui); font-size: 24px; }
.q-prompt .big-ic { width: 60px; height: 60px; color: var(--ink); }
.q-sub { text-align: center; color: var(--muted); margin-bottom: 16px; font-size: 14px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .opts { grid-template-columns: 1fr; } }
.opt {
  text-align: left; padding: 13px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  cursor: pointer; font-size: 16px; line-height: 1.6; display: flex; gap: 12px; align-items: flex-start; transition: border-color .15s, background .15s, box-shadow .15s;
}
.opt:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-2); }
.opt .ok-key { flex: none; width: 25px; height: 25px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font: 600 12px/1 var(--font-num); color: var(--muted); margin-top: 2px; }
.opt.sel { border-color: var(--ink); background: var(--surface-3); }
.opt.sel .ok-key { background: var(--ink); color: var(--bg); }
.opt.correct { border-color: var(--ink); background: var(--ok-soft); box-shadow: 0 0 0 1px var(--ink); }
.opt.correct .ok-key { background: var(--ink); color: var(--bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .ok-key { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; color: var(--ink); }
.opt.dim { opacity: .45; }
.opt.jp { font-family: var(--font-jp); font-size: 18px; }
.opt p { margin: 0; }
.qinst { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 4px; }
.qinst p { margin: 0; }
.feedback { margin-top: 14px; border-radius: 18px; padding: 12px 16px; border: 0; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback .fb-t { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.feedback.ok .fb-t { color: var(--ink); } .feedback.bad .fb-t { color: var(--bad); }
.result-big { font: 600 68px/1 var(--font-num); letter-spacing: -.03em; }
.result-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 20px; }
.result-card .gauge { width: 160px; margin-bottom: 4px; }

/* matching game */
.match-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.match-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .match-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { min-height: 86px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; padding: 8px; text-align: center; cursor: pointer; font-size: 15px; transition: transform .12s, opacity .3s, border-color .15s, box-shadow .15s, background .15s; }
.tile.jp { font: 500 20px/1.7 var(--font-jp); }
.tile:hover { border-color: var(--line-2); background: var(--surface-3); }
.tile.sel { border-color: var(--ink); background: var(--surface-3); box-shadow: 0 0 0 1px var(--ink); }
.tile.done { opacity: 0; pointer-events: none; transform: scale(.9); }
.tile.err { animation: shake .35s; border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------------------------------------------------------------- grammar */
.gcard { padding: 0; overflow: hidden; transition: border-color .15s, background .15s; }
.gcard.open { border-color: var(--line-2); }
.gcard-head { display: flex; gap: 14px; padding: 16px 18px; cursor: pointer; align-items: flex-start; }
.gcard-head:hover { background: var(--surface-2); }
.gnum { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 600 13.5px/1 var(--font-num); background: var(--surface-3); color: var(--ink); }
.gcard.open .gnum { background: var(--ink); color: var(--bg); }
.gtitle { font: 700 19px/1.5 var(--font-jp); }
.gtitle small { font-weight: 500; color: var(--muted); font-size: 14px; }
.gmean { color: var(--ink-2); font-size: 14.5px; }
.gcard-head .chev { margin-left: auto; color: var(--muted); transition: transform .2s; flex: none; margin-top: 10px; }
.gcard-head .chev .ic { width: 18px; height: 18px; }
.gcard.open .chev { transform: rotate(180deg); }
.gbody { display: none; padding: 0 22px 22px 72px; }
.gcard.open .gbody { display: block; }
@media (max-width: 700px) { .gbody { padding-left: 18px; } }
.glabel { font-size: 12px; font-weight: 600; color: var(--muted); margin: 20px 0 8px; }
.usage { margin: 0; padding-left: 18px; color: var(--ink-2); }
.usage li { margin: 3px 0; }
.usage li::marker { color: var(--muted); }
.ex { display: flex; gap: 8px; align-items: flex-start; padding: 8px 4px; border-bottom: 1px solid var(--line); margin: 0; }
.ex:last-of-type { border-bottom: 0; }
.ex .exj { font: 17px/2.1 var(--font-jp); }
.ex .exv { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.ex .src { display: inline-flex; vertical-align: 1px; margin-left: 6px; height: 18px; padding: 0 7px; border-radius: 99px; align-items: center; font-size: 10.5px; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); font-weight: 600; }
.ex .fixnote { font-size: 12px; color: var(--ink-2); display: flex; gap: 5px; align-items: center; margin-top: 2px; }
.ex .fixnote .ic { width: 13px; height: 13px; }
.extra { border-left: 2px solid var(--ink); padding: 4px 0 4px 14px; margin: 8px 0; font-size: 14.5px; }
.extra-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.gnote { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; margin-top: 8px; color: var(--ink-2); }
.gnote .ic { color: var(--ink); width: 15px; height: 15px; margin-top: 4px; }
.ctable { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14.5px; }
.ctable th, .ctable td { padding: 9px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ctable tr:last-child td { border-bottom: 0; }
.ctable th { font: 600 12px/1.3 var(--font-ui); color: var(--muted); }
.ctable td.jp { font-family: var(--font-jp); font-size: 16px; white-space: nowrap; }
.ctable tbody tr:hover td, .ctable tr:hover td { background: var(--surface-2); }
.end, .ctable .end { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.ctable .grp { font: 600 14px var(--font-num); color: var(--ink); }
.give { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .give { grid-template-columns: 1fr; } }
.give-box { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: var(--surface-2); position: relative; }
.give-box.focus { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.give-box h4 { font: 700 18px/1.5 var(--font-jp); margin: 0 0 4px; }
.give-flow { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 16px 0 10px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); }
.person .p { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font: 700 12.5px/1 var(--font-jp); color: var(--ink); background: var(--surface-3); white-space: nowrap; letter-spacing: -.5px; }
.person .p.me { background: var(--ink); color: var(--bg); }
.arrow { flex: 1; height: 2px; position: relative; margin: 0 4px; background: var(--muted); }
.arrow::after { content: ""; position: absolute; right: -2px; top: -6px; border: 7px solid transparent; border-left: 10px solid var(--muted); border-right: 0; }
.arrow.rev::after { right: auto; left: -2px; border-left: 0; border-right: 10px solid var(--muted); }
.arrow .gift { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); color: var(--ink); }
.arrow .gift .ic { width: 18px; height: 18px; }
.give-box .sent-ex { font: 15px/1.9 var(--font-jp); }
.give-box .honor { font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding: 8px 0 0; margin-top: 8px; }
.mod-demo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 18px/1.9 var(--font-jp); }
.mod-clause { border: 1.5px dashed var(--muted); border-radius: 14px; padding: 4px 12px; }
.mod-noun { border: 1.5px solid var(--ink); border-radius: 14px; padding: 4px 12px; font-weight: 700; }
.mod-arrow { color: var(--muted); font-size: 22px; }

/* ---------------------------------------------------------------- kanji */
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.ktile {
  position: relative; border: 1px solid var(--line); border-radius: 22px; padding: 14px 6px 11px; text-align: center; cursor: pointer;
  background: var(--surface); box-shadow: inset 0 1px 0 var(--hl);
  transition: transform .2s, background .2s, border-color .2s;
}
:root[data-theme="light"] .ktile { border-color: rgba(0, 0, 0, .05); box-shadow: var(--shadow); }
.ktile:hover { transform: translateY(-2px); background: var(--surface-2); border-color: var(--line-2); }
.ktile .kc { font: 600 48px/1.15 var(--font-mincho); }
.ktile .kh { font-size: 12.5px; font-weight: 700; color: var(--ink); letter-spacing: .04em; margin-top: 4px; }
.ktile .km { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.ktile .kbadge { position: absolute; top: 8px; right: 8px; height: 18px; padding: 0 6px; font-size: 10px; }
.ktile .kdone { position: absolute; top: 9px; left: 10px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); }
.ktile .kdone .ic { width: 11px; height: 11px; }
.ktile .kdone.part { background: var(--surface-3); color: var(--ink); }
.kdetail { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 26px; }
@media (max-width: 800px) { .kdetail { grid-template-columns: 1fr; } }
.kbig-hv { font: 800 28px/1.15 var(--font-ui); letter-spacing: .04em; color: var(--ink); }
.kread { display: grid; grid-template-columns: 56px 1fr; gap: 8px 10px; align-items: baseline; margin: 0; }
.kread dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.kread dd { margin: 0; font: 17px/1.7 var(--font-jp); }
.rd { display: inline-block; margin: 0 6px 4px 0; padding: 0 10px; border-radius: 999px; background: var(--surface-3); }
.rd.rare { opacity: .6; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.rd .ok { color: var(--muted); }
.kex { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.kex:last-of-type { border-bottom: 0; }
.kex .w { font: 19px/1.9 var(--font-jp); }
.kex .r { color: var(--muted); font-family: var(--font-jp); }
.filmstrip { display: flex; flex-wrap: wrap; gap: 5px; }
.filmstrip svg { width: 50px; height: 50px; border-radius: 12px; background: var(--surface-2); }
.rd-hv-rare { opacity: .5; font-weight: 600; }

/* kanji writer */
.kw { position: relative; width: 100%; max-width: 380px; aspect-ratio: 1; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.kw svg { width: 100%; height: 100%; display: block; border-radius: 26px; background: var(--kw-bg); box-shadow: inset 0 1px 0 var(--hl), inset 0 0 0 1px var(--line); }
.kw .grid line { stroke: var(--line-2); stroke-width: .5; stroke-dasharray: 2 2; }
.kw .grid rect { fill: none; stroke: none; }
.kw .outline path { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .kw .outline path { stroke: rgba(0, 0, 0, .09); }
.kw .done path { fill: none; stroke: var(--kw-ink); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.kw .done path.flash { stroke: #ffffff; }
.kw .done.all-ok path { stroke: var(--kw-ink); transition: stroke .4s; }
.kw .anim path { fill: none; stroke: var(--muted); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.kw .anim path.cur { stroke: var(--kw-ink); }
.kw .hint path { fill: none; stroke: var(--muted); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 5 4; opacity: .9; }
.kw .user path { fill: none; stroke: var(--kw-ink); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.kw .user path.bad { stroke: var(--bad); transition: opacity .6s; opacity: 0; }
.kw .free path { fill: none; stroke: var(--kw-ink); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.kw .nums text { font: 600 7px var(--font-num); fill: var(--muted); }
.kw .startdot { fill: var(--kw-ink); opacity: .85; }
:root[data-theme="light"] .kw g { filter: none; }
:root[data-theme="light"] .kw .done path.flash { stroke: #000; }
.kw-msg { min-height: 26px; text-align: center; font-weight: 500; margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.kw-msg.ok { color: var(--ink); } .kw-msg.bad { color: var(--bad); }
.kw-ctrls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.write-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .write-layout { grid-template-columns: 1fr; } }
.write-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.write-top select.input { height: 34px; font-size: 13px; }
.kstrip { display: flex; gap: 7px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; margin-bottom: 6px; }
.kstrip button {
  flex: none; width: 48px; height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  cursor: pointer; font: 600 24px/1 var(--font-mincho); position: relative; transition: border-color .15s, box-shadow .15s, background .15s;
}
.kstrip button:hover { border-color: var(--line-2); background: var(--surface-3); }
.kstrip button.on { border-color: var(--ink); background: var(--raised); box-shadow: var(--raised-shadow), 0 0 0 1px var(--ink); }
.kstrip button .d { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.kstrip button .d.p { background: var(--muted); } .kstrip button .d.m { background: var(--ink); }
.kinfo-head { display: flex; gap: 14px; align-items: center; }
.kinfo-head .kc { font: 700 64px/1.1 var(--font-mincho); }

/* ---------------------------------------------------------------- conjugation */
.conj-q { font: 600 36px/1.9 var(--font-jp); text-align: center; }
.conj-target { text-align: center; font-size: 16px; margin: 4px 0 16px; color: var(--ink-2); }
.conj-target b { color: var(--ink); font-family: var(--font-jp); font-size: 19px; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.answer-input { font: 500 24px/1.4 var(--font-jp) !important; height: 56px !important; text-align: center; width: 100%; max-width: 420px; border-radius: 999px !important; }
.rulebox { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.rulebox .ic { color: var(--ink); margin-top: 3px; }
.g1, .g2, .g3 { color: var(--ink); font-weight: 600; }
.conj-settings { display: flex; flex-direction: column; gap: 12px; }
.form-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.form-chips label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--surface-3); cursor: pointer; font: 500 14px var(--font-jp); color: var(--muted); transition: all .15s; }
.form-chips label input { display: none; }
.form-chips label.on { color: var(--ink); background: var(--raised); box-shadow: var(--raised-shadow); }
.streak { display: inline-flex; align-items: center; gap: 6px; font: 600 13px var(--font-num); color: var(--muted); }
.streak .ic { color: var(--ink); width: 16px; height: 16px; }

/* ---------------------------------------------------------------- question bank */
.bank-legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; font-size: 12.5px; color: var(--muted); }
.bank-unit { margin-bottom: 18px; padding: 6px; }
.bank-unit-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px 8px; }
.bank-unit-head .un { font-size: 14px; font-weight: 700; color: var(--ink); }
.bank-row { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 16px; transition: background .15s; }
.bank-row:hover { background: var(--surface-2); }
.bank-row .bn { font: 600 15px var(--font-jp); }
.bank-row .bs { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bank-row .bs .ic { width: 13px; height: 13px; }
.bank-kind { width: 52px; height: 24px; border-radius: 999px; display: grid; place-items: center; font: 600 11.5px/1 var(--font-jp); flex: none; }
.bank-kind.test { color: var(--bg); background: var(--ink); }
.bank-kind.drill { color: var(--ink-2); background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.best { font: 600 14px var(--font-num); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.best.ok { color: var(--ink); } .best.warn { color: var(--muted); } .best.bad { color: var(--bad); }
.qcard { padding: 18px 20px; margin-bottom: 14px; }
.qhead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.qn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center; font: 600 13px/1 var(--font-num); background: var(--surface-3); color: var(--ink); }
.qprompt { font: 17px/2 var(--font-jp); overflow-x: auto; }
.qprompt p { margin: .2em 0; }
.qprompt img { display: block; max-height: 360px; width: auto; margin: 8px 0; border-radius: 12px; background: #fff; border: 1px solid var(--line); cursor: zoom-in; }
.qprompt audio { display: block; width: 100%; max-width: 440px; height: 40px; margin: 8px 0; }
.qprompt table { border-collapse: collapse; margin: 8px 0; }
.qprompt td, .qprompt th { border: 1px solid var(--line-2); padding: 4px 8px; }
.qprompt hr.qsep { border: 0; border-top: 1px dashed var(--line-2); margin: 8px 0; }
.qprompt .slot { display: inline-block; vertical-align: middle; margin: 2px 4px; }
.qprompt .slot input, .qprompt .slot select { height: 36px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--field); color: var(--ink); font: 16px var(--font-jp); padding: 0 10px; min-width: 120px; }
.qprompt .slot input:focus, .qprompt .slot select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--primary-soft); }
.qprompt .slot input.ok, .qprompt .slot select.ok { border-color: var(--ink); background: var(--ok-soft); }
.qprompt .slot input.bad, .qprompt .slot select.bad { border-color: var(--bad); background: var(--bad-soft); }
.qprompt .slot .exp { display: block; font-size: 12.5px; color: var(--ink); line-height: 1.3; }
.qopts { display: grid; gap: 8px; margin-top: 10px; }
.chips-pool, .chips-ans { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 8px; border-radius: 18px; }
.chips-pool { background: var(--surface-2); border: 1px dashed var(--line-2); }
.chips-ans { border: 1px solid var(--line-2); background: var(--field); }
.wchip { height: 38px; padding: 0 15px; border-radius: 999px; border: 0; background: var(--surface-3); color: var(--ink); cursor: pointer; font: 16px var(--font-jp); transition: background .15s, box-shadow .15s; }
.wchip:hover { background: rgba(127, 127, 127, .24); }
.wchip.used { opacity: .25; pointer-events: none; }
.wchip.reuse { box-shadow: inset 0 0 0 1px var(--muted); }
.chips-ans .wchip { background: var(--raised); box-shadow: var(--raised-shadow); }
.chips-ans.ok { border-color: var(--ink); background: var(--ok-soft); }
.chips-ans.bad { border-color: var(--bad); background: var(--bad-soft); }
.explain { margin-top: 12px; padding: 4px 0 4px 14px; font-size: 14.5px; border-left: 2px solid var(--line-2); color: var(--ink-2); }
.explain b { color: var(--ink); }
.explain.ok { border-left-color: var(--ink); }
.explain.bad { border-left-color: var(--bad); }
.explain .ex-t { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.explain.ok .ex-t { color: var(--ink); } .explain.bad .ex-t { color: var(--bad); }
.conf { font-size: 11px; }
.qnav { display: flex; flex-wrap: wrap; gap: 5px; }
.qnav button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--ink-2); cursor: pointer; font: 600 12px/1 var(--font-num); transition: all .15s; }
.qnav button:hover { background: rgba(127, 127, 127, .24); }
.qnav button.ok { background: var(--ink); color: var(--bg); }
.qnav button.bad { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.qnav button.ans { background: var(--raised); box-shadow: var(--raised-shadow); color: var(--ink); }
.qnav button.cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.player-head { position: sticky; top: var(--sticky-top); z-index: 6; border-radius: 24px; padding: 10px 16px; margin-bottom: 14px; }
.player-title { font: 700 22px/1.4 var(--font-jp); margin: 0 0 12px; }
.score-line { font: 600 13px var(--font-num); color: var(--ink-2); display: inline-flex; gap: 10px; align-items: center; }
.score-line b { color: var(--ink); font-size: 15px; }
.timer { font: 600 22px/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 6px; }
.timer .ic { width: 18px; height: 18px; color: var(--muted); }
.timer.low { color: var(--bad); animation: pulse 1s infinite; }
.timer.low .ic { color: var(--bad); }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------------------------------------------------------------- exam */
.sec-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--surface-3); cursor: pointer; font-size: 13.5px; color: var(--muted); transition: all .15s; user-select: none; }
.sec-chip .ic { width: 17px; height: 17px; }
.sec-chip input { display: none; }
.sec-chip.on { color: var(--ink); background: var(--raised); box-shadow: var(--raised-shadow); }
.exam-cfg { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .exam-cfg { grid-template-columns: 1fr; } }
.cfg-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.cfg-row .lbl { font-size: 13px; color: var(--muted); min-width: 64px; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.pool { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.pool .pi { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--ink); background: var(--surface-3); }
.pool .pi .ic { width: 19px; height: 19px; }
.pool b { display: block; font: 600 24px/1.1 var(--font-num); letter-spacing: -.02em; }
.pool span { font-size: 12px; color: var(--muted); }
.sec-score { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sec-score .row { gap: 8px; }
.sec-score .ic { width: 15px; height: 15px; color: var(--muted); }

/* ---------------------------------------------------------------- essay */
.essay-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .essay-layout { grid-template-columns: 1fr; } }
.essay-area { width: 100%; min-height: 280px; font: 17px/2 var(--font-jp) !important; }
.check-item { display: flex; gap: 9px; align-items: center; padding: 5px 0; font-family: var(--font-jp); color: var(--muted); transition: color .15s; }
.check-item .box { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; flex: none; }
.check-item .box .ic { width: 12px; height: 12px; }
.check-item.on { color: var(--ink); }
.check-item.on .box { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.model p { font: 17px/2.2 var(--font-jp); }
.essay-count { font: 600 13px var(--font-num); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- progress */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1000px) { .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px 18px 15px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kpi-l { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi-l .ic { width: 15px; height: 15px; color: var(--muted); }
.kpi-v { display: flex; align-items: baseline; gap: 4px; }
.kpi-v b { font: 600 32px/1 var(--font-num); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-v small { font: 500 14px/1 var(--font-num); color: var(--muted); }
.kpi-f { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; }
.kpi-f .bar { flex: 1; }
.kpi .spark { height: 30px; margin-top: auto; }
.u-bars { display: flex; flex-direction: column; gap: 11px; }
.u-bar { display: grid; grid-template-columns: 46px minmax(0, 1fr) 84px; gap: 10px; align-items: center; }
.u-bar .stack { display: flex; height: 10px; border-radius: 7px; overflow: hidden; background: var(--surface-3); gap: 1px; }
.u-bar .stack i { display: block; height: 100%; }
.u-bar .v { font: 500 12.5px/1 var(--font-num); color: var(--muted); text-align: right; }
.u-bar .v b { color: var(--ink); }
.weak-list { display: flex; gap: 6px; flex-wrap: wrap; }
.weak-list a { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px; border-radius: 999px; background: var(--surface-3); color: var(--ink); font-size: 12.5px; }
.weak-list a b { font: 600 20px/1 var(--font-mincho); }
.weak-list a:hover { background: var(--bad-soft); text-decoration: none; }
.weak-list a span { color: var(--bad); font-family: var(--font-num); }

/* ---------------------------------------------------------------- misc */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.badge-n4 { background: transparent !important; color: var(--ink) !important; box-shadow: inset 0 0 0 1px var(--line-2) !important; }
.pill-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--ink); color: var(--bg); font: 600 12px/1 var(--font-num); }
.mono { font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.fade-in { animation: fadeIn .25s ease; }
.history-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0; }
.history-chart .hb { flex: 1; max-width: 34px; background: var(--ink); border-radius: 6px 6px 2px 2px; position: relative; min-height: 4px; }
.history-chart .hb span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.scroll-x { overflow-x: auto; }
.info-tip { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--muted); cursor: help; }
.info-tip .ic { width: 15px; height: 15px; }
.info-tip:hover { color: var(--ink); }
.foot-note { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media print { #sidebar, #topbar, .toolbar, .dock, #bg { display: none !important; } #content { margin: 0; } #main { padding-top: 0; } body { background: #fff; color: #000; } }
