:root {
  /* Neo-brutal: cream paper, black ink, thick black borders with hard offset shadows, and flat yellow / coral / mint blocks.
     Text on a block is always --on-block (black), in light and dark. good/bad colour right and wrong answers. */
  --paper: #fff4e0; --ink: #000000; --soft: #4a4238; --en: #000000; --mark: #000000; --on-mark: #fff4e0;
  --line: #000000; --chip: #ffffff; --mark-soft: #ffd23f; --card: #ffffff;
  --yomi: #b3341a; --yomi-soft: #ff6b4a;
  --good: #1d7a46; --bad: #c62828; --bad-soft: #ff6b4a;
  --yellow: #ffd23f; --coral: #ff6b4a; --mint: #8ee3c8; --on-block: #000000;
  --bd: 3px solid var(--ink); --bd2: 2.5px solid var(--ink); --sh: 5px 5px 0 var(--ink); --sh2: 3px 3px 0 var(--ink);
  --jp: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Noto Sans CJK JP", system-ui, sans-serif;
  --latin: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --tabbar: 90px;
}
/* Neo-brutal dark: near-black paper, cream ink and borders; the colour blocks stay the same.
   Follows the phone unless the theme button picked light or dark (data-theme on <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #141414; --ink: #fff4e0; --soft: #cfc5b4; --en: #fff4e0; --mark: #fff4e0; --on-mark: #141414;
    --line: #fff4e0; --chip: #1f1f1f; --mark-soft: #ffd23f; --card: #1f1f1f;
    --yomi: #ff8a70; --yomi-soft: #ff6b4a;
    --good: #7fe0a3; --bad: #ff8a7a; --bad-soft: #ff6b4a; color-scheme: dark; }
}
:root[data-theme="dark"] { --paper: #141414; --ink: #fff4e0; --soft: #cfc5b4; --en: #fff4e0; --mark: #fff4e0; --on-mark: #141414;
    --line: #fff4e0; --chip: #1f1f1f; --mark-soft: #ffd23f; --card: #1f1f1f;
    --yomi: #ff8a70; --yomi-soft: #ff6b4a;
    --good: #7fe0a3; --bad: #ff8a7a; --bad-soft: #ff6b4a; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
@font-face { font-family: "Space Grotesk"; font-weight: 300 700; font-display: swap; src: url(fonts/space-grotesk-latin.woff2) format("woff2"); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--latin); font-size: 16px; line-height: 1.5;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { accent-color: var(--mark); }
button:focus-visible { outline: 2px solid var(--en); outline-offset: 2px; }
.loading { color: var(--soft); text-align: center; padding: 48px 0; }

/* header, pinned: title, groups, column labels */
.head { position: sticky; top: 0; z-index: 20; background: var(--paper); padding-top: env(safe-area-inset-top); }
.top-row, .subtabs { max-width: 720px; margin: 0 auto; }
.top-row, .subtabs { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.top-row { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; }
.title { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.title span { font-family: var(--jp); font-weight: 900; color: var(--mark); margin-right: 6px; }
.test { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 0; font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; }
.test i { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; display: block; transition: background .15s; }
.test i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.test[aria-pressed="true"] i { background: var(--mark); }
.test[aria-pressed="true"] i::after { transform: translateX(16px); }
.subtabs { display: flex; gap: 6px; overflow-x: auto; padding-top: 4px; padding-bottom: 10px; scrollbar-width: none; }
.subtabs:empty { display: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button { flex: none; border: 0; background: var(--chip); border-radius: 999px; padding: 5px 13px; font-size: .84rem; font-weight: 600; color: var(--soft); }
.subtabs button[aria-selected="true"] { background: var(--mark); color: var(--on-mark); }

/* every list is two columns: Japanese, then English */
.cols, .row, .k, .wd, .gh2, .ex { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 12px; }
.cols { padding: 7px max(16px, env(safe-area-inset-right)) 7px max(16px, env(safe-area-inset-left)); border-block: 1px solid var(--line); font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); max-width: none; }
.cols > * { min-width: 0; }
.cols span:last-child { color: var(--en); }
main { max-width: 720px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.gl { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mark); padding: 18px 0 4px; }

.row { padding: 11px 0; border-bottom: 1px solid var(--line); align-items: start; }
.jp { font-family: var(--jp); font-weight: 700; font-size: 1.12rem; line-height: 1.4; overflow-wrap: anywhere; }
.rd { display: block; font-family: var(--jp); font-weight: 400; font-size: .78rem; color: var(--soft); margin-top: 1px; }
.en { color: var(--en); font-weight: 500; font-size: .95rem; line-height: 1.4; overflow-wrap: anywhere; min-width: 0; }
.en.sm { font-size: .88rem; }
.sub { display: block; color: var(--soft); font-weight: 400; font-size: .76rem; line-height: 1.35; margin-top: 2px; }

/* kanji */
.k { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.k-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.k-top .en { font-size: 1.2rem; font-weight: 700; }
.k-meta { font-family: var(--mono); font-size: .68rem; color: var(--soft); margin-top: 2px; }
.glyph { font-family: var(--jp); font-weight: 900; font-size: 2.9rem; line-height: 1; width: 4.25rem; height: 4.25rem; flex: none; border-radius: 12px; }
button.glyph.glyph { background: var(--chip); color: var(--ink); text-align: center; }
.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.box { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 10px; background: var(--chip); min-width: 0; }
.box.on { background: var(--yomi-soft); }
.box h4 { margin: 0 0 2px; font-family: var(--mono); font-size: .62rem; font-weight: 600; letter-spacing: .08em; color: var(--soft); }
.box.on h4 { color: var(--yomi); }
.yomi { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; font-family: var(--jp); }
.yomi b { font-size: 1.12rem; font-weight: 700; }
.yomi i { font-style: normal; font-size: .76rem; color: var(--soft); }
.rd .hl { font-weight: 700; }
.rd .hl.on { color: var(--yomi); }
.rd .hl.kun { color: var(--ink); }
.wd { padding: 6px 0; border-top: 1px solid var(--line); }
.wd .jp { font-size: .95rem; font-weight: 500; }

.sx { grid-column: 1 / -1; margin-top: 6px; }
.sx summary { cursor: pointer; font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; color: var(--soft); padding: 4px 0; list-style: none; }
.sx summary::-webkit-details-marker { display: none; }
.sx summary::before { content: "+ "; color: var(--mark); font-weight: 700; }
.sx[open] summary::before { content: "- "; }
.jp mark { background: none; color: var(--mark); }

/* grammar */
.g { padding: 16px 0 8px; border-bottom: 1px solid var(--line); }
.gh2 { align-items: baseline; }
.gh2 .jp { font-size: 1.5rem; font-weight: 900; }
.gh2 .en { font-weight: 600; }
.ex { padding: 7px 0; border-top: 1px dashed var(--line); }
.gh2 + .ex { margin-top: 10px; }
.ex .jp { font-weight: 500; font-size: 1rem; }

/* kana */
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding-top: 10px; }
.tiles.k3 { grid-template-columns: repeat(3, 1fr); }
.tile { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 8px 0 6px; display: grid; gap: 2px; justify-items: center; }
.tile b { font-family: var(--jp); font-size: 1.3rem; line-height: 1.15; display: flex; gap: 6px; align-items: baseline; }
.tile b span { color: var(--soft); font-weight: 500; }
.tile small { font-family: var(--mono); font-size: .7rem; color: var(--en); min-width: 2em; text-align: center; }
.tile.gap { visibility: hidden; border: 0; }
.tile.rev { cursor: pointer; }

/* test mode: answers blur until tapped */
.ans { transition: filter .15s; }
.test-on .ans:not(.shown) { filter: blur(7px); cursor: pointer; user-select: none; }

/* bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-top: 1px solid var(--line); background: var(--paper); padding: 6px max(6px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); min-height: var(--tabbar); }
.tabbar button { background: none; border: 0; display: grid; justify-items: center; align-content: center; gap: 0; padding: 3px 0; color: var(--soft); border-radius: 10px; min-width: 0; }
.tabbar b { font-family: var(--jp); font-size: 1.25rem; font-weight: 900; line-height: 1.2; }
.tabbar small { font-size: .56rem; font-weight: 600; letter-spacing: -.01em; }
.tabbar button[aria-selected="true"] { color: var(--ink); background: var(--chip); }
.tabbar button[aria-selected="true"] b { color: var(--mark); }
@media (min-width: 760px) { .tabbar { padding-left: calc((100% - 720px) / 2); padding-right: calc((100% - 720px) / 2); } }
@media (prefers-reduced-motion: reduce) { .ans, .test i, .test i::after { transition: none; } }

/* recall tab: spaced repetition */
body.recall .cols { display: none; }
.rc { padding-top: 14px; display: grid; gap: 14px; }
.rc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rc-stats.one { grid-template-columns: 1fr; }
.rc-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 0 8px; display: grid; justify-items: center; }
.rc-stats b { font-family: var(--mono); font-size: 1.5rem; line-height: 1.1; }
.rc-stats span { font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.rc-go { width: 100%; border: 0; border-radius: 14px; background: var(--mark); color: var(--on-mark); font-weight: 700; padding: 15px 0; font-size: 1rem; box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 4px 12px -6px var(--mark); }
.rc-go:disabled { background: var(--chip); color: var(--soft); cursor: default; box-shadow: none; }
.rc-bar { display: flex; height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.rc-bar span:first-child { background: var(--good); }
.rc-bar span:last-child { background: var(--yomi); }
.rc-note { margin: 0; color: var(--soft); font-size: .8rem; line-height: 1.4; }
.rc-note a { color: var(--en); }
.rc-h { font-family: var(--mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mark); }
.rc-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -6px; }
.rc-pills button { border: 0; background: var(--chip); border-radius: 999px; padding: 5px 13px; font-size: .84rem; font-weight: 600; color: var(--soft); }
.rc-pills button[aria-pressed="true"] { background: var(--mark-soft); color: var(--mark); box-shadow: inset 0 0 0 1.5px var(--mark); }
.rc-npd { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; }
.rc-npd select { font: inherit; background: var(--chip); color: var(--ink); border: 0; border-radius: 8px; padding: 6px 10px; }
.rc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: var(--mono); font-size: .68rem; color: var(--soft); }
.rc-top button { background: none; border: 0; color: var(--mark); font: inherit; padding: 6px 0; }
.rc-face { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 18px; min-height: 240px; display: grid; align-content: center; justify-items: center; text-align: center; gap: 14px; }
.rc-q { font-family: var(--jp); font-weight: 900; line-height: 1.25; overflow-wrap: anywhere; }
.rc-q.s1 { font-size: 4.6rem; } .rc-q.s2 { font-size: 2.6rem; } .rc-q.s3 { font-size: 1.7rem; } .rc-q.s4 { font-size: 1.2rem; font-weight: 700; } .rc-q.after { font-size: 1.6rem; }
.rc-face hr { width: 60%; border: 0; border-top: 1px solid var(--ink); margin: 0; }
.rc-a { color: var(--en); font-weight: 600; font-size: 1.1rem; line-height: 1.5; }
.rc-n { color: var(--soft); font-size: .85rem; line-height: 1.4; }
.rc-hear { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 5px 14px; font-size: .8rem; color: var(--soft); }
.rc-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rc-rate button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 11px 0 9px; font-weight: 700; display: grid; gap: 2px; justify-items: center; }
.rc-rate button.again { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.rc-rate button.good { background: var(--mark); border-color: var(--mark); color: var(--on-mark); }
.rc-rate button.good i { color: var(--on-mark); opacity: .85; }
.rc-rate i { font-style: normal; font-family: var(--mono); font-weight: 500; font-size: .66rem; color: var(--soft); }

/* v2: tools in the header, overlays, stroke order, search, recall extras */
.tools { display: flex; align-items: center; gap: 14px; }
.tool { background: var(--chip); border: 0; border-radius: 999px; height: 34px; padding: 0 13px; font-size: .8rem; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.tool.icon { width: 38px; padding: 0; justify-content: center; color: var(--mark); }
.tool svg { flex: none; }
button.glyph { background: none; border: 0; padding: 0; color: var(--ink); text-align: left; cursor: pointer; }
button.glyph:active { opacity: .8; }
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--paper); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.overlay[hidden] { display: none; }
.ov-top { display: flex; gap: 10px; align-items: center; max-width: 720px; width: 100%; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); }
.ov-top input { flex: 1; min-width: 0; font: inherit; border: 1px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 10px; padding: 10px 12px; }
.ov-title { flex: 1; font-family: var(--jp); font-weight: 900; font-size: 1.6rem; }
.ov-close { border: 0; background: none; color: var(--mark); font-weight: 700; padding: 8px 0; }
.ov-body { flex: 1; overflow-y: auto; max-width: 720px; width: 100%; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.ov-count { font-family: var(--mono); font-size: .66rem; color: var(--soft); letter-spacing: .06em; }
.hit { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 12px; row-gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 0; color: inherit; }
.hit .where { grid-column: 1 / -1; font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mark); }
.stk { display: grid; justify-items: center; align-content: start; gap: 12px; padding-top: 12px; }
.stk-svg { width: min(88vw, 380px); height: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.stk-guide { fill: none; stroke: var(--line); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.stk-live { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.stk-num { font-size: 7px; fill: var(--mark); font-family: var(--mono); font-weight: 700; }
.stk-count { margin: 0; font-family: var(--mono); font-size: .7rem; color: var(--soft); }
.rc-alt { width: 100%; border: 1.5px solid var(--mark); background: none; color: var(--mark); border-radius: 12px; padding: 12px 0; font-weight: 700; }
.stk .rc-alt { width: auto; padding: 10px 28px; }
.rc-weak { display: grid; gap: 0; margin-top: -6px; }
.rc-weak div { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; column-gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rc-weak .jp { font-size: 1rem; font-weight: 700; font-family: var(--jp); overflow-wrap: anywhere; }
.rc-weak .en { font-size: .85rem; color: var(--en); }
.rc-weak i { font-style: normal; font-family: var(--mono); font-size: .66rem; color: var(--bad); }
.rc-tag { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--mark); }
.rc-q.cloze { line-height: 1.6; }
.rc-q.cloze mark { background: none; color: var(--en); border-bottom: 2px solid var(--en); }
.rc-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rc-opts button { border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 16px 0; font-family: var(--jp); font-size: 1.25rem; font-weight: 700; }
.rc-opts button:active { border-color: var(--ink); }
.rc-verdict { text-align: center; font-weight: 700; padding: 4px 0; }
.rc-verdict.good { color: var(--good); }
.rc-verdict.bad { color: var(--bad); }
.rc-type { display: grid; gap: 8px; }
.rc-type input { border: 1px solid var(--ink); background: var(--paper); color: var(--ink); border-radius: 12px; padding: 14px; font-family: var(--jp); font-size: 1.2rem; text-align: center; }
.rc-skip { border: 0; background: none; color: var(--soft); text-decoration: underline; padding: 10px 0; }

/* Neo-brutal layer: borders, hard shadows and colour blocks on top of the layout above */
.title { font-size: 1.3rem; font-weight: 700; letter-spacing: -.03em; text-transform: uppercase; display: flex; align-items: center; }
.title span { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: var(--bd); border-radius: 8px; box-shadow: var(--sh2); background: var(--yellow); color: var(--on-block); font-size: 1rem; margin-right: 9px; }
.tool { background: var(--card); border: var(--bd2); box-shadow: var(--sh2); font-weight: 700; }
.tool.icon { background: var(--mint); color: var(--on-block); }
.tool:active, .subtabs button:active, .rc-go:active, .rc-rate button:active, .rc-opts button:active, .rc-alt:active, .tile.rev:active { transform: translate(2px, 2px); box-shadow: none; }
.test { font-weight: 700; }
.test i { border: var(--bd2); height: 24px; background: var(--card); }
.test i::after { top: 2px; left: 2px; background: var(--ink); box-shadow: none; }
.test[aria-pressed="true"] i { background: var(--yellow); }
.test[aria-pressed="true"] i::after { background: var(--on-block); }
.subtabs { padding-bottom: 12px; padding-top: 8px; }
.subtabs button { background: var(--card); border: var(--bd2); color: var(--ink); font-weight: 700; }
.cols { border-block: var(--bd2); font-weight: 600; }
.gl { display: table; margin-top: 18px; padding: 3px 8px; background: var(--ink); color: var(--paper); font-weight: 600; }

.row { border-bottom: var(--bd2); }
.g { border-bottom: var(--bd2); }

.k { gap: 0; padding: 0; margin: 16px 4px 18px 0; border: var(--bd); border-radius: 10px; box-shadow: var(--sh); overflow: hidden; }
.k-top { gap: 0; align-items: stretch; }
.k-top > div { padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; }
.k-top .en { font-size: 1.35rem; line-height: 1.1; letter-spacing: -.02em; }
.k-meta { font-family: var(--latin); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); margin-top: 6px; }
.glyph { width: 6.5rem; height: 6.5rem; font-size: 4.4rem; border-radius: 0; }
button.glyph.glyph { background: var(--yellow); color: var(--on-block); border-right: var(--bd); }
.boxes { display: flex; gap: 0; border-top: var(--bd); }
.box { flex: 1; border-radius: 0; padding: 9px 12px; background: var(--mint); color: var(--on-block); }
.box + .box { border-left: var(--bd); }
.box.on { flex: 1.3; background: var(--coral); }
.box h4, .box.on h4 { font-family: var(--latin); font-weight: 700; color: var(--on-block); }
.box .yomi b { font-size: 1.3rem; font-weight: 900; }
.box .yomi i { color: var(--on-block); font-weight: 700; }
.wds { border-top: var(--bd); }
.wd { padding: 8px 12px; border-top: var(--bd2); }
.wd:first-child { border-top: 0; }
.wd .jp { font-weight: 900; }
.wd .en { font-weight: 700; }
.rd .hl.on { background: var(--coral); color: var(--on-block); padding: 0 2px; }
.rd .hl.kun { background: var(--mint); color: var(--on-block); padding: 0 2px; }
.k .sx { margin: 0; padding: 6px 12px 8px; border-top: var(--bd2); }
.sx summary { font-family: var(--latin); font-weight: 700; text-transform: uppercase; color: var(--ink); }
.jp mark { background: var(--yellow); color: var(--on-block); }

.tile { border: var(--bd2); background: var(--card); box-shadow: var(--sh2); border-radius: 8px; }
.tile.gap { box-shadow: none; }

.tabbar { border-top: var(--bd); gap: 4px; padding-top: 8px; }
.tabbar button { border: 2px solid transparent; border-radius: 8px; color: var(--ink); }
.tabbar small { font-weight: 700; text-transform: uppercase; font-size: .52rem; }
.tabbar button[aria-selected="true"] { background: var(--yellow); color: var(--on-block); border: var(--bd2); box-shadow: var(--sh2); }
.tabbar button[aria-selected="true"] b { color: var(--on-block); }

.rc-stats div { border: var(--bd2); box-shadow: var(--sh2); background: var(--card); border-radius: 8px; }
.rc-stats span { color: var(--ink); font-weight: 600; }
.rc-go { background: var(--yellow); color: var(--on-block); border: var(--bd); border-radius: 10px; box-shadow: var(--sh); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .02em; }
.rc-go:disabled { border-color: var(--soft); box-shadow: none; }
.rc-bar { height: 14px; border: var(--bd2); border-radius: 4px; background: var(--card); }
.rc-bar span:first-child { background: var(--mint); }
.rc-bar span:last-child { background: var(--yellow); }
.rc-h, .rc-tag { font-family: var(--latin); font-weight: 700; color: var(--ink); }
.rc-pills button { background: var(--card); border: var(--bd2); color: var(--ink); font-weight: 700; }
.rc-pills button[aria-pressed="true"] { background: var(--yellow); color: var(--on-block); box-shadow: var(--sh2); }
.rc-npd select { border: var(--bd2); background: var(--card); font-weight: 700; }
.rc-top button { font-weight: 700; text-decoration: underline; }
.rc-face { border: var(--bd); border-radius: 10px; box-shadow: var(--sh); }
.rc-face hr { border-top: var(--bd); }
.rc-a { color: var(--ink); font-weight: 700; }
.rc-hear { border: var(--bd2); color: var(--ink); font-weight: 700; box-shadow: var(--sh2); }
.rc-rate button { border: var(--bd2); box-shadow: var(--sh2); border-radius: 8px; color: var(--on-block); background: var(--card); }
.rc-rate button i, .rc-rate button.good i { color: inherit; opacity: .75; }
.rc-rate button:nth-child(2) { color: var(--ink); }
.rc-rate button.again { background: var(--coral); border-color: var(--ink); color: var(--on-block); }
.rc-rate button.good { background: var(--yellow); border-color: var(--ink); color: var(--on-block); }
.rc-rate button:nth-child(4) { background: var(--mint); }
.rc-opts button { border: var(--bd2); box-shadow: var(--sh2); background: var(--card); border-radius: 8px; color: var(--ink); }
.rc-type input { border: var(--bd); border-radius: 8px; background: var(--card); }
.rc-alt { border: var(--bd); color: var(--ink); background: var(--card); border-radius: 10px; box-shadow: var(--sh2); }
.rc-weak div { border-bottom: var(--bd2); }
.rc-q.cloze mark { color: var(--ink); background: var(--yellow); color: var(--on-block); border-bottom: 0; padding: 0 4px; }

.ov-top input { border: var(--bd); background: var(--card); border-radius: 8px; }
.ov-close { color: var(--ink); text-decoration: underline; }
.hit { border-bottom: var(--bd2); }
.hit .where { color: var(--ink); font-weight: 700; }
.stk-svg { border: var(--bd); box-shadow: var(--sh); border-radius: 10px; background: var(--card); }
.stk-num { fill: #b3341a; }

/* Closer to the Fresh 1 artboard: big title, square header buttons, 月-style kanji card, boxed bottom nav */
.top-row { padding-top: 14px; padding-bottom: 10px; }
.title { font-size: 1.5rem; }
.title span { width: 34px; height: 34px; font-size: 1.125rem; box-shadow: var(--sh2); }
.tools { gap: 10px; }
.tool { height: 40px; border: var(--bd); border-radius: 10px; }
.tool.icon { width: 40px; background: var(--card); color: var(--ink); }
.tool.icon.search { background: var(--mint); color: var(--on-block); }
.subtabs { gap: 7px; padding-top: 2px; padding-bottom: 14px; }
.subtabs button { border: var(--bd2); padding: 5px 12px; font-size: .8125rem; }
.subtabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
body.sec-kanji .cols { display: none; }

.k { margin: 4px 5px 20px 0; }
.glyph { width: 8.25rem; height: 8.25rem; font-size: 6rem; }
.k-top > .k-txt { padding: 12px; justify-content: space-between; min-width: 0; }
.k-meta { margin: 0; font-size: .75rem; letter-spacing: .06em; }
.k-top .en { font-size: 1.75rem; font-weight: 700; line-height: 1.05; }
.k-stk { align-self: flex-start; background: none; border: 0; padding: 2px 0; font-size: .75rem; font-weight: 700; text-decoration: underline; color: var(--ink); }
.box { padding: 10px 12px; gap: 0; }
.box h4, .box.on h4 { font-size: .6875rem; letter-spacing: 0; margin: 0; }
.box .yomi b { font-size: 1.3125rem; }
.box .yomi i { font-size: .75rem; }
.wds { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 12px; }
.wd { grid-column: 1 / -1; grid-template-columns: 4.75rem 6rem minmax(0, 1fr); grid-template-columns: subgrid; align-items: baseline; padding: 8px 12px; }
.wd b.jp { font-size: 1.0625rem; font-weight: 900; }
.wd .rd { display: inline; margin: 0; font-size: .8125rem; font-weight: 700; color: var(--ink); }
.wd .en { text-align: right; font-size: .9375rem; }

.tabbar { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 688px; margin: 0 auto; padding: 0; gap: 0; min-height: 0; border: var(--bd); border-radius: 10px; box-shadow: var(--sh); background: var(--card); overflow: hidden; }
.tabbar button, .tabbar button[aria-selected="true"] { border: 0; border-left: var(--bd); border-radius: 0; box-shadow: none; padding: 9px 0 7px; }
.tabbar button:first-child { border-left: 0; }
.tabbar b { font-size: 1.125rem; line-height: 1.25; }
.tabbar small { font-size: .5625rem; }

/* Recall v3: dashboard, forecast, heatmap, leeches, writing pad, listening, summary */
.rc-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--yellow); color: var(--on-block); border: var(--bd); border-radius: 10px; box-shadow: var(--sh); padding: 12px 14px; margin-right: 5px; }
.rc-hero b { display: block; font-size: 2.75rem; line-height: 1; letter-spacing: -.03em; }
.rc-hero span { font-weight: 700; font-size: .8rem; }
.rc-start { height: 48px; padding: 0 20px; border: var(--bd); border-radius: 10px; background: #000; color: #fff4e0; font-weight: 700; text-transform: uppercase; box-shadow: 3px 3px 0 #fff4e0; }
.rc-start:disabled { opacity: .5; cursor: default; }
.rc-start:active { transform: translate(2px, 2px); box-shadow: none; }
.rc-stats.three { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rc-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: -6px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.rc-fc { display: flex; align-items: flex-end; gap: 6px; height: 104px; border: var(--bd2); border-radius: 8px; background: var(--card); padding: 8px 8px 4px; }
.rc-fc div { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font-size: .62rem; font-weight: 700; }
.rc-fc b { font-size: .7rem; }
.rc-fc i { display: block; width: 100%; max-height: 56px; min-height: 2px; background: var(--ink); }
.rc-fc .t i { background: var(--coral); outline: 2px solid var(--ink); }
.rc-fc span { text-transform: uppercase; font-size: .55rem; }
.rc-heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; border: var(--bd2); border-radius: 8px; background: var(--card); padding: 6px; }
.rc-heat i { aspect-ratio: 1; border: 1.5px solid var(--ink); border-radius: 2px; background: var(--card); }
.rc-heat .l1 { background: #c9f1e3; } .rc-heat .l2 { background: var(--mint); } .rc-heat .l3 { background: var(--ink); }
.rc-leech div { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; row-gap: 6px; }
.rc-leech i { background: var(--coral); color: var(--on-block); border: 2px solid var(--ink); border-radius: 999px; padding: 0 7px; font-weight: 700; }
.rc-lb { grid-column: 1 / -1; display: flex; gap: 8px; }
.rc-lb button, .rc-tools button, .rc-ctl button { flex: 1; min-height: 44px; border: var(--bd2); border-radius: 8px; background: var(--card); color: var(--ink); box-shadow: var(--sh2); font-weight: 700; font-size: .8rem; }
.rc-lb button:active, .rc-tools button:active, .rc-ctl button:active, .rc-play:active { transform: translate(2px, 2px); box-shadow: none; }
.rc-tools button:disabled { opacity: .45; box-shadow: none; cursor: default; }
.rc-tools button[aria-pressed="true"] { background: var(--coral); color: var(--on-block); }
.rc-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; text-decoration: underline; color: var(--ink); }
.rc-prog { height: 12px; border: var(--bd2); border-radius: 4px; background: var(--card); overflow: hidden; margin-top: -6px; }
.rc-prog i { display: block; height: 100%; background: var(--mint); }
.rc-top { gap: 10px; }
.rc-top button[data-rc="undo"] { margin-left: auto; }
.rc-wq { font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; }
.rc-pad { width: min(100%, 300px); height: auto; aspect-ratio: 1; border: var(--bd); border-radius: 10px; background: var(--card); box-shadow: var(--sh); touch-action: none; }
.rc-grid line { stroke: var(--ink); stroke-width: .6; stroke-dasharray: 2 2; opacity: .3; }
.rc-ink { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.rc-hint { fill: none; stroke: var(--coral); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 3 4; }
.rc-guide { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .12; }
.rc-model { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 1; animation: rc-draw .6s ease-in-out forwards; }
.rc-num { font-size: 7px; font-weight: 700; fill: #b3341a; font-family: var(--latin); opacity: 0; animation: rc-fade .2s forwards; }
@keyframes rc-draw { to { stroke-dashoffset: 0; } }
@keyframes rc-fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rc-model { animation: none; stroke-dashoffset: 0; } .rc-num { animation: none; opacity: 1; } }
.rc-glyph { font-size: 80px; font-family: var(--jp); font-weight: 900; fill: var(--ink); }
.rc-count { border: var(--bd2); border-radius: 999px; background: var(--yellow); color: var(--on-block); font-weight: 700; font-size: .75rem; padding: 2px 10px; }
.rc-tools, .rc-ctl { display: flex; gap: 10px; }
.rc-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.rc-cmp figure { margin: 0; display: grid; justify-items: center; gap: 6px; font-weight: 700; font-size: .75rem; text-transform: uppercase; }
.rc-cmp .rc-pad { box-shadow: var(--sh2); }
.rc-play { width: 112px; height: 112px; border: var(--bd); border-radius: 16px; background: var(--coral); color: var(--on-block); box-shadow: var(--sh); display: flex; align-items: center; justify-content: center; }
.rc-ctl { width: 100%; max-width: 280px; }
.rc-sum { display: grid; grid-template-columns: 1.4fr 1fr 1fr; border: var(--bd); border-radius: 10px; box-shadow: var(--sh); overflow: hidden; background: var(--card); margin-right: 5px; }
.rc-sum div { padding: 10px 12px; border-left: var(--bd); }
.rc-sum div:first-child { border-left: 0; background: var(--mint); color: var(--on-block); }
.rc-sum b { display: block; font-size: 1.6rem; line-height: 1.05; letter-spacing: -.02em; }
.rc-sum span { font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.rc-two { display: flex; flex-wrap: wrap; gap: 10px; }
.rc-two > * { flex: 1 1 30%; width: auto; }

/* stroke order: each stroke draws in turn, its number appears when it ends */
.stk-live { stroke-dasharray: 1 2; stroke-dashoffset: 1; animation: rc-draw .65s ease-in-out forwards; }
.stk-num { opacity: 0; animation: rc-fade .2s forwards; }
@media (prefers-reduced-motion: reduce) { .stk-live { animation: none; stroke-dashoffset: 0; } .stk-num { animation: none; opacity: 1; } }
.stk-guide { stroke: var(--ink); opacity: .12; }   /* --line is solid ink in this theme, which hid the animation */

/* ON / KUN / SPECIAL tag on each kanji example word, and the rule above the cards */
.wds { grid-template-columns: auto minmax(0, max-content) auto minmax(6rem, 1fr); }
.yk { justify-self: start; border: 2px solid var(--ink); border-radius: 999px; padding: 0 6px; font-family: var(--latin); font-size: .625rem; font-weight: 700; letter-spacing: .04em; line-height: 1.5; color: var(--on-block); white-space: nowrap; }
.yk.on { background: var(--coral); }
.yk.kun { background: var(--mint); }
.yk.special { background: var(--yellow); }
.yrule { border: var(--bd); border-radius: 10px; box-shadow: var(--sh); background: var(--card); padding: 8px 12px; margin-bottom: 18px; }
.yrule p { margin: 4px 0; font-size: .8125rem; font-weight: 700; line-height: 1.45; }
.yrule .yk { margin-right: 6px; }
.yrule .jp { font-weight: 900; white-space: nowrap; }
