/* Style 1 · Focus Lane. Tokens match JLPT Master light and dark. */
:root {
  --canvas: #F4F2EB; --surface: #FFFFFF; --ink: #1C2A45; --muted: #5E6781; --doc: #3C4658;
  --line: rgba(20, 25, 40, .08); --line2: rgba(20, 25, 40, .16);
  --accent: #24467E; --accent2: #37589A; --accent-soft: #E9EEF7; --accent-ink: #FFFFFF;
  --success: #2E8B6B; --success-soft: #EAF5F0; --success-ink: #1F6B51;
  --warn: #D89A2E; --warn-soft: #FFF6E7; --warn-ink: #8A6112;
  --danger: #C0473B; --danger-soft: #F9EAE8; --danger-ink: #9B3227;
  --shadow: 0 1px 2px rgba(20, 25, 40, .04), 0 6px 18px rgba(20, 25, 40, .06);
  --shadow-raised: 0 2px 4px rgba(20, 25, 40, .05), 0 14px 32px rgba(20, 25, 40, .12);
  --f-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --f-gothic: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --r-card: 24px; --r-ctl: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #121316; --surface: #1C1D22; --ink: #ECEAE4; --muted: #9C9A93; --doc: #C9C6BE;
    --line: rgba(236, 234, 228, .10); --line2: rgba(236, 234, 228, .20);
    --accent: #8FB0EA; --accent2: #A3BEEE; --accent-soft: #232A38; --accent-ink: #121316;
    --success: #84CDB3; --success-soft: #1A3A32; --success-ink: #A5DCC8;
    --warn: #D9B46A; --warn-soft: #36301F; --warn-ink: #E6C98F;
    --danger: #E4938B; --danger-soft: #3A2422; --danger-ink: #EEB1AA;
    --shadow: none; --shadow-raised: 0 0 0 1px rgba(236, 234, 228, .08);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #121316; --surface: #1C1D22; --ink: #ECEAE4; --muted: #9C9A93; --doc: #C9C6BE;
  --line: rgba(236, 234, 228, .10); --line2: rgba(236, 234, 228, .20);
  --accent: #8FB0EA; --accent2: #A3BEEE; --accent-soft: #232A38; --accent-ink: #121316;
  --success: #84CDB3; --success-soft: #1A3A32; --success-ink: #A5DCC8;
  --warn: #D9B46A; --warn-soft: #36301F; --warn-ink: #E6C98F;
  --danger: #E4938B; --danger-soft: #3A2422; --danger-ink: #EEB1AA;
  --shadow: none; --shadow-raised: 0 0 0 1px rgba(236, 234, 228, .08);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.kana { font-family: var(--f-gothic); font-weight: 500; }
.mincho .kana { font-family: var(--f-mincho); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: var(--surface); color: var(--ink); padding: 12px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 68px; padding: 8px 16px;
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); text-decoration: none; font-size: 17px; white-space: nowrap; }
.brand img { width: 32px; height: 32px; border-radius: 9px; }
.brand-dot { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 4px; }
.theme-btn { width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); display: grid; place-items: center; }
.theme-btn:hover { background: var(--line); }
.theme-btn svg { width: 22px; height: 22px; }
.download { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; text-decoration: none; }
.store-mark { width: 14px; height: 14px; flex: none; display: inline-block; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; -webkit-mask-mode: alpha; mask-mode: alpha; }
.store-android { --icon: url("/assets/mark-android.svg"); }
.store-ios { --icon: url("/assets/mark-apple.svg"); }
.nav-right { gap: 8px; }
.page-foot { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 28px 20px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.page-foot .brand { font-size: 15px; }
.page-foot p { margin: 2px 0 0; font-size: 12px; }
.page-foot nav { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.page-foot a { color: var(--muted); text-decoration: none; font-weight: 650; }
.page-foot a:hover, .page-foot a[aria-current="page"] { color: var(--accent); }
@media (max-width: 420px) {
  .brand { font-size: 15px; gap: 6px; }
  .brand img { width: 28px; height: 28px; }
  .download { padding: 0 12px; font-size: 12px; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 8px 16px 24px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.step { margin-block: 18px 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.step h2 { margin: 0; font-size: 16px; font-weight: 700; }
.step small { color: var(--muted); font-size: 13px; }

.setup { display: flex; flex-direction: column; }
.a-script { order: 1; } .a-rows { order: 2; } .a-font { order: 3; } .setup .go-bar { order: 4; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--line); border-radius: 18px; }
.seg button { border: 0; background: transparent; border-radius: 14px; padding: 10px 8px; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; color: var(--muted); }
.seg button .kana { font-size: 24px; line-height: 1; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.grp { margin-top: 14px; }
.grp-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; }
.grp-head b { font-size: 14px; }
.grp-head b span { color: var(--muted); font-weight: 600; }
.pick-all { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 13px; padding: 6px 4px; }
.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.row-btn {
  position: relative; text-align: left; border: 1.5px solid transparent; background: var(--surface); border-radius: 16px;
  padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; box-shadow: var(--shadow);
}
.row-btn .big { font-size: 26px; line-height: 1; grid-row: span 2; }
.row-btn .rd { font-weight: 700; font-size: 14px; }
.row-btn .all { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .04em; }
.row-btn .tick { position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line2); }
.row-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.row-btn[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); }
.row-btn[aria-pressed="true"] .tick::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.font-btn { border: 1.5px solid var(--line2); background: var(--surface); border-radius: 16px; padding: 10px 12px; display: flex; align-items: center; gap: 12px; text-align: left; }
.font-btn .kana { font-size: 30px; line-height: 1; }
.font-btn small { display: block; color: var(--muted); font-size: 12px; }
.font-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.go-bar {
  position: sticky; bottom: 0; margin: 20px -16px -24px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--canvas) 70%, transparent); display: grid; gap: 6px; z-index: 3;
}
.btn { border: 0; border-radius: var(--r-ctl); padding: 15px 18px; font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -6px var(--accent); }
.btn-primary:disabled { background: var(--line2); color: var(--muted); box-shadow: none; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line2); }
.hint { text-align: center; font-size: 13px; color: var(--muted); margin: 0; }

.quiz { display: grid; gap: 14px; padding-top: 4px; }
.qtop { display: flex; align-items: center; gap: 12px; }
.ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--success) calc(var(--p) * 1%), var(--line) 0); }
.ring::before { content: ""; grid-area: 1/1; width: 36px; height: 36px; border-radius: 50%; background: var(--canvas); }
.ring span { grid-area: 1/1; font-size: 11px; font-weight: 800; }
.qtop .lbl { flex: 1; min-width: 0; }
.qtop .lbl b { display: block; font-size: 15px; }
.qtop .lbl small { color: var(--muted); font-size: 13px; }
.finish { border: 0; background: var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; }
.lane { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.lane::-webkit-scrollbar { display: none; }
.cell { flex: none; min-width: 40px; padding: 0 5px; white-space: nowrap; height: 46px; border-radius: 11px; border: 0; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 18px; position: relative; scroll-snap-align: center; color: var(--ink); }
.cell.wide { font-size: 15px; }
.cell.solved { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); cursor: default; }
.cell.solved::after { content: ""; position: absolute; bottom: 4px; width: 14px; height: 3px; border-radius: 2px; background: var(--success); }
.cell.solved.fx::after { background: var(--warn); }
.cell.miss::before { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.cell.cur { outline: 2.5px solid var(--accent); outline-offset: 1px; color: var(--accent); }
.stage { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-raised); padding: 26px 18px 18px; display: grid; justify-items: center; gap: 14px; }
.stage .glyph { font-size: clamp(104px, 34vw, 168px); line-height: 1; margin: 6px 0 4px; }
.stage.wrong .glyph { animation: nudge .32s ease; }
@keyframes nudge { 25% { transform: translateX(-7px); } 60% { transform: translateX(5px); } }
.tries { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 28px; }
.tries span { padding: 4px 10px; border-radius: 999px; background: var(--danger-soft); color: var(--danger-ink); font-weight: 700; font-size: 13px; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.answer { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.answer input { width: 100%; min-width: 0; height: 56px; border-radius: 16px; border: 2px solid var(--line2); background: var(--canvas); padding: 0 16px; font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.answer input:focus { outline: none; border-color: var(--accent); }
.stage.wrong .answer input { border-color: var(--danger); }
.answer button { width: 56px; height: 56px; border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.answer button svg { width: 24px; height: 24px; }
.fb { min-height: 20px; margin: 0; font-size: 14px; font-weight: 600; text-align: center; }
.fb.bad { color: var(--danger-ink); }
.fb.good { color: var(--success-ink); }
.qacts { display: flex; justify-content: center; gap: 4px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 10px; }
.link:hover { background: var(--accent-soft); }
.reveal { font-weight: 800; color: var(--ink); }

.res { display: grid; gap: 16px; padding-top: 6px; }
.hero { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-raised); padding: 22px 18px; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.big-ring { --p: 0; width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--success) calc(var(--p) * 1%), var(--line) 0); }
.big-ring::before { content: ""; grid-area: 1/1; width: 88px; height: 88px; border-radius: 50%; background: var(--surface); }
.big-ring b { grid-area: 1/1; font-size: 26px; font-weight: 800; }
.hero h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.2; text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 20px; }
.stat small { color: var(--muted); font-size: 12px; line-height: 1.25; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart { display: grid; gap: 8px; }
.rrow { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; }
.rrow > b { font-size: 13px; color: var(--muted); }
.rrow > b .kana { display: block; font-size: 18px; color: var(--ink); }
.marks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mk { border-radius: 12px; padding: 6px 2px 5px; display: grid; justify-items: center; gap: 1px; }
.mk .kana { font-size: 19px; line-height: 1.1; }
.mk small { font-size: 11px; font-weight: 700; }
.mk.first { background: var(--success-soft); color: var(--success-ink); }
.mk.fixed { background: var(--warn-soft); color: var(--warn-ink); }
.mk.wrong { background: var(--danger-soft); color: var(--danger-ink); }
.mk.untried { border: 1.5px dashed var(--line2); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 4px; }
.racts { display: grid; gap: 8px; }

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 24, .45); display: grid; place-items: end center; padding: 16px; }
.sheet { width: min(420px, 100%); background: var(--surface); border-radius: 20px; padding: 22px; box-shadow: var(--shadow-raised); }
.sheet h2 { margin: 0 0 6px; font-size: 19px; }
.sheet p { margin: 0 0 18px; color: var(--muted); }
.sheet .acts { display: grid; gap: 10px; }

@media (min-width: 600px) { .scrim { place-items: center; } }
@media (min-width: 900px) {
  .wrap { padding: 36px 32px 48px; }
  .setup { display: grid; grid-template-columns: 340px 1fr; grid-template-areas: "script rows" "font rows" "go rows"; grid-template-rows: auto auto 1fr; column-gap: 48px; align-items: start; }
  .a-script { grid-area: script; } .a-font { grid-area: font; } .a-rows { grid-area: rows; }
  .a-rows > .step:first-child { margin-top: 0; }
  .setup .go-bar { grid-area: go; position: static; margin: 22px 0 0; padding: 0; background: none; }
  .rows { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grp:first-child { margin-top: 0; }
  .quiz { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "top top" "stage lane"; gap: 24px 32px; align-items: start; }
  .qtop { grid-area: top; }
  .stage { grid-area: stage; padding: 48px 48px 32px; }
  .stage .answer { max-width: 440px; }
  .lane { grid-area: lane; flex-wrap: wrap; overflow: visible; background: var(--surface); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); align-content: start; }
  .lane::before { content: "Queue · tap any open character"; flex-basis: 100%; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-bottom: 4px; }
  .cell { min-width: 46px; height: 50px; }
  .res { grid-template-columns: 380px 1fr; gap: 24px 32px; align-items: start; }
  .res .left { display: grid; gap: 16px; position: sticky; top: 96px; }
  .hero { grid-template-columns: 1fr; justify-items: start; }
}
