
:root {
  /* layout: list of days on the left, the lesson sheet on the right; stacks to one column on phones */
  --bg: #eef0f3;
  --surface: #ffffff;
  --ink: #1a2130;
  --muted: #5b6475;
  --line: #d9dde5;
  --accent: #23457d;
  --accent-soft: #e4eaf5;
  --good: #1d7448;
  --good-soft: #e2f2e9;
  --bad: #b02a20;
  --bad-soft: #fbe6e3;
  --font-ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-jp: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --font-display: "Zen Kaku Gothic New", "Noto Sans JP", "Hiragino Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c;
    --surface: #19202a;
    --ink: #e6e9ef;
    --muted: #9aa3b2;
    --line: #2c3542;
    --accent: #8fb1ec;
    --accent-soft: #23314a;
    --good: #6fcf9a;
    --good-soft: #193427;
    --bad: #f08d83;
    --bad-soft: #3d1f1c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c;
  --surface: #19202a;
  --ink: #e6e9ef;
  --muted: #9aa3b2;
  --line: #2c3542;
  --accent: #8fb1ec;
  --accent-soft: #23314a;
  --good: #6fcf9a;
  --good-soft: #193427;
  --bad: #f08d83;
  --bad-soft: #3d1f1c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}
[lang="ja"], .ja, .kana { font-family: var(--font-jp); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }

/* top bar */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; min-width: 0; flex: 1 1 260px; }
.brand h1 { font-size: 16px; font-weight: 700; }
.brand .meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); user-select: none;
}
.pill input { margin: 0; accent-color: var(--accent); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 6px 12px; font-size: 13.5px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.file-label { display: inline-flex; }
.file-label input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.banner[hidden] { display: none; }

/* main layout */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.filters { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.filters input, .filters select, .vfilters input, .vfilters select {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
.filters .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.progress { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.bar { flex: 1; height: 6px; background: var(--accent-soft); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.daylist { overflow-y: auto; flex: 1; padding: 4px 0 16px; }
.group-h {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  padding: 10px 14px 6px; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line);
}
.dayitem {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 10px; align-items: start;
  width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 14px;
  border-left: 3px solid transparent;
}
.dayitem:hover { background: var(--bg); }
.dayitem[aria-current="true"] { background: var(--accent-soft); border-left-color: var(--accent); }
.dayitem .num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); font-size: 14px; padding-top: 1px; }
.dayitem .t { font-size: 14px; font-weight: 500; line-height: 1.35; }
.dayitem .s { grid-column: 2; font-size: 12px; color: var(--muted); font-family: var(--font-jp); }
.dayitem .done { grid-row: 1; grid-column: 3; color: var(--good); font-size: 13px; font-weight: 700; }
.empty-list { padding: 16px; color: var(--muted); font-size: 14px; }

.main { overflow-y: auto; min-height: 0; padding: 20px 16px 48px; }
.sheet { max-width: 860px; margin: 0 auto; display: grid; gap: 18px; }

/* lesson header */
.lhead { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.chip.plain { background: var(--bg); color: var(--muted); }
.chip.ok { background: var(--good-soft); color: var(--good); }
.lhead h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1.3; }
.lhead .sub { font-size: 16px; color: var(--muted); }
.lhead ul { margin: 0; padding-left: 20px; }
.acts { display: flex; gap: 3px; height: 8px; border-radius: 4px; overflow: hidden; }
.acts span { background: var(--accent); opacity: .35; }
.acts span:nth-child(2n) { opacity: .6; }
.actlegend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lnav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }

/* sections */
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; display: grid; gap: 12px; }
.sec > h3 { font-size: 15px; font-weight: 700; display: flex; align-items: baseline; gap: 10px; }
.sec > h3 .n { font-size: 12px; color: var(--muted); font-weight: 500; }
.note { font-size: 14px; color: var(--muted); }

.jp-block { display: grid; gap: 1px; }
.jp-block .ja { font-size: 17px; font-weight: 500; }
.jp-block .kana { font-size: 13.5px; color: var(--muted); }
.jp-block .vi { font-size: 14px; }
.jp-block .ja, .jp-block .kana, .jp-block .vi { white-space: pre-line; }
body.hide-kana .jp-block:not(.reveal) .kana,
body.hide-kana .vocab:not(.reveal) .kana { visibility: hidden; }
body.hide-vi .jp-block:not(.reveal) .vi,
body.hide-vi .vocab:not(.reveal) .vi { visibility: hidden; }
body.hide-kana .jp-block, body.hide-vi .jp-block,
body.hide-kana .vocab, body.hide-vi .vocab { cursor: pointer; }

.say { border: 1px solid var(--line); background: transparent; border-radius: 6px; font-size: 11.5px; padding: 0 6px; margin-left: 6px; vertical-align: 2px; color: var(--muted); font-family: var(--font-ui); }
.say:hover { color: var(--accent); border-color: var(--accent); }
body.no-tts .say { display: none; }

.vocab { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.vocab:first-of-type { border-top: 0; }
.vocab .w { font-family: var(--font-jp); font-size: 19px; font-weight: 500; line-height: 1.3; }
.vocab .kana { font-size: 13px; color: var(--muted); }
.vocab .vi { font-weight: 500; }
.vocab .pos { font-size: 12px; color: var(--muted); }
.vocab .ex { grid-column: 2; padding: 6px 10px; background: var(--bg); border-radius: 8px; }
.vocab .ex .ja { font-size: 15px; }

.pattern { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
.pattern:first-of-type { border-top: 0; padding-top: 0; }
.kanji .kj { display: flex; align-items: baseline; gap: 12px; }
.kanji .big { font-family: var(--font-display); font-size: 40px; line-height: 1.1; color: var(--accent); }
.kanji .hv { font-weight: 700; font-size: 16px; text-transform: uppercase; letter-spacing: .04em; }
.kanji .pos { font-size: 12px; color: var(--muted); }
.pitch { font-size: 12.5px; color: var(--muted); font-family: var(--font-jp); }
.pattern .p { font-family: var(--font-jp); font-size: 18px; font-weight: 700; color: var(--accent); }
.pattern .f { font-size: 13.5px; }
.pattern .f b { font-weight: 600; color: var(--muted); }
.pattern .exs { padding: 8px 12px; background: var(--bg); border-radius: 8px; display: grid; gap: 8px; }

.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.tips li { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 12px; }
.tips .tg { font-family: var(--font-jp); font-weight: 700; }

.dlg { display: grid; gap: 10px; }
.dlg-meta { font-size: 14px; color: var(--muted); }
.line { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 8px 10px; border-radius: 8px; }
.line.B { background: var(--bg); }
.line .who { font-size: 13px; font-weight: 600; color: var(--accent); }
.line .who small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; line-height: 1.3; }

.ex-item { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.ex-item:first-of-type { border-top: 0; padding-top: 0; }
.ex-item .kind { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ex-item .q { font-weight: 500; }
details { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; }
details summary { cursor: pointer; font-size: 13.5px; color: var(--accent); }
details[open] summary { margin-bottom: 6px; }
.choices { display: grid; gap: 6px; }
.choice { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 12px; font-family: var(--font-jp); }
.choice:hover { border-color: var(--accent); }
.choice.radio { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.choice.radio input { accent-color: var(--accent); margin: 0; }
fieldset.ex-item { border: 0; margin: 0; padding: 12px 0; min-width: 0; }
fieldset.ex-item legend { padding: 0; margin-bottom: 4px; }
.choice.right { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.choice.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.warn { font-size: 13.5px; padding: 6px 10px; border-left: 3px solid var(--bad); background: var(--bad-soft); border-radius: 0 6px 6px 0; }
.warn b { color: var(--bad); font-weight: 600; }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.req, .check { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.check { list-style: none; padding-left: 0; }
.check li { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; accent-color: var(--good); }
.check input:checked + label { color: var(--muted); text-decoration: line-through; }
.draft { width: 100%; font: inherit; font-family: var(--font-jp); font-size: 15px; line-height: 1.7; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); resize: vertical; }
.sample { display: grid; gap: 10px; }
.explain { font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--bg); }
.explain[hidden] { display: none; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }

/* vocabulary view */
.vfilters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .w { font-family: var(--font-jp); font-size: 16px; }
td.kana { color: var(--muted); }
body.hide-kana td.kana, body.hide-vi td.vi { color: transparent; }

.emptystate { max-width: 560px; margin: 40px auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.emptystate h2 { font-size: 20px; }

.drop {
  position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent); border: 3px dashed var(--accent);
  font-size: 18px; font-weight: 600; color: var(--accent);
}
.drop.on { display: flex; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 42vh; }
  body { height: auto; }
  html, body { height: auto; }
  .main { overflow: visible; }
  .vocab { grid-template-columns: 1fr; }
  .vocab .ex { grid-column: 1; }
  .line { grid-template-columns: 1fr; gap: 2px; }
  .tips li { grid-template-columns: 1fr; gap: 2px; }
  .vfilters { grid-template-columns: 1fr; }
  .lhead h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
:root{--accent:#4f46e5;--accent-soft:#eef2ff;--bg:#f5f7fb;--line:#e1e5ef} :root[data-theme=dark]{--accent:#a5b4fc;--accent-soft:#292d50;--bg:#11151c;--line:#364152}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--accent:#a5b4fc;--accent-soft:#292d50;--bg:#11151c;--line:#364152}} .topbar{padding:14px 22px;gap:12px}.brand h1{font-size:19px}.seg{flex-wrap:wrap;border:0;gap:4px}.seg button{border-radius:8px;min-height:42px}.sheet{max-width:1000px}.sec,.lhead,.metric{border-radius:16px}.btn{min-height:42px}.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:16px}.metric{background:var(--surface);border:1px solid var(--line);padding:18px;display:grid;gap:8px}.metric small{color:var(--muted)}.metric strong{font-size:26px;color:var(--accent)}.stepnav{display:flex;gap:6px;flex-wrap:wrap;margin:12px 0}.flash{text-align:center;padding:32px 16px!important;display:grid;gap:16px}.flash h2{font-size:36px}.ratings{display:flex;justify-content:center;gap:8px;flex-wrap:wrap}.settings{display:grid;gap:16px}.settings label{display:grid;gap:8px}.sec select{max-width:100%} [hidden]{display:none!important} @media(max-width:700px){.metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar{padding:8px}.seg button{font-size:12px;padding:5px 8px}.sidebar{max-height:23vh!important}.flash h2{font-size:28px}.metric{padding:12px}.controls{gap:4px}}
