/* TryEnglish — site styles. No inline styles anywhere (CSP: style-src 'self'). */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --ink: #1c2536;
  --muted: #5d6779;
  --line: #e4dfd5;
  --red: #dc3b3b;
  --red-ink: #b42323;
  --red-soft: #fdeceb;
  --marker: #ffe566;
  --ok: #1f8f5f;
  --ok-soft: #e4f5ec;
  --focus: #2b7de0;
  --g5: #2f9e6e;
  --g4: #1a97a6;
  --g3: #2b7de0;
  --gj2: #5a5ad6;
  --gj2p: #7352ce;
  --g2: #8e4ec6;
  --gj1: #cf3f96;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 37, 54, .06), 0 8px 24px rgba(28, 37, 54, .06);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Noto Sans JP", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-en: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161f;
    --surface: #1a202c;
    --surface-2: #202838;
    --ink: #e9edf4;
    --muted: #9da8ba;
    --line: #2c3547;
    --red: #f26a6a;
    --red-ink: #ff9c9c;
    --red-soft: #3a2024;
    --marker: #6b5a12;
    --ok: #4cc38a;
    --ok-soft: #173326;
    --focus: #6aa9ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

[lang="en"] { font-family: var(--font-en); }

a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--red-ink); }

h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; letter-spacing: .01em; }
h1 { font-size: clamp(1.6rem, 4.6vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3.4vw, 1.6rem); margin-top: 2.2em; }
h3 { font-size: 1.08rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
small, .small { font-size: .85rem; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(780px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-en); font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand:hover { color: inherit; }
.brand-stamp {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .02em;
  transform: rotate(-6deg);
}
.brand-name b { color: var(--red); font-weight: 800; }
.nav-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .9rem; cursor: pointer;
}
.site-nav { display: none; width: 100%; padding: 4px 0 14px; }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.site-nav a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--surface); color: var(--red-ink); }
.header-inner { flex-wrap: wrap; }

@media (min-width: 1000px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; width: auto; margin-left: auto; padding: 0; }
  .site-nav ul { display: flex; gap: 2px; }
  .site-nav a { padding: 8px 12px; }
}

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--surface); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-ink); border-color: var(--red-ink); color: #fff; }
.btn.small { min-height: 36px; padding: 5px 14px; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--muted);
}
.grade-badge {
  display: inline-grid; place-items: center; min-width: 56px; padding: 2px 10px; border-radius: 8px;
  background: var(--gc, var(--ink)); color: #fff; font-weight: 800; font-size: .9rem; letter-spacing: .04em;
}
.g-5kyu { --gc: var(--g5); } .g-4kyu { --gc: var(--g4); } .g-3kyu { --gc: var(--g3); }
.g-jun2kyu { --gc: var(--gj2); } .g-jun2kyuplus { --gc: var(--gj2p); } .g-2kyu { --gc: var(--g2); } .g-jun1kyu { --gc: var(--gj1); }

/* ---------- Hero ---------- */
.hero { padding: 44px 0 28px; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.3rem); line-height: 1.25; margin-bottom: .45em; letter-spacing: .02em; word-break: keep-all; }
.hero h1 .mark { background: linear-gradient(transparent 62%, var(--marker) 62%); padding: 0 .08em; }
.hero-lead { font-size: 1.05rem; color: var(--muted); max-width: 34em; }
.hero-points { list-style: none; padding: 0; margin: 18px 0 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-points li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: .88rem; font-weight: 700; }
@media (min-width: 900px) {
  .hero { padding: 72px 0 44px; }
  .hero-grid { grid-template-columns: 1.15fr .85fr; gap: 48px; }
}

/* Today's word card */
.today {
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 20px;
  box-shadow: 9px 9px 0 var(--red); padding: 22px; transform: rotate(1.2deg); margin: 0 10px 10px 0;
}
.today-label { font-size: .8rem; font-weight: 800; color: var(--red-ink); letter-spacing: .12em; }
.today-word { font-family: var(--font-en); font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 800; line-height: 1.2; margin: 6px 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.today-ex { margin: 12px 0 4px; font-size: 1rem; }
.today-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Sections & cards ---------- */
.section { padding: 28px 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: .92rem; }
.kicker { font-size: .78rem; font-weight: 800; letter-spacing: .14em; color: var(--red-ink); text-transform: uppercase; margin: 0 0 4px; }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); list-style: none; padding: 0; margin: 0; }
.card {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
a.card:hover { transform: translateY(-2px); border-color: var(--ink); color: inherit; }
.card h3 { margin: 0; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.card .more { margin-top: auto; padding-top: 8px; font-weight: 700; font-size: .88rem; color: var(--red-ink); }

.grade-card { border-top: 5px solid var(--gc, var(--ink)); }
.grade-card .grade-name { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.grade-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; list-style: none; padding: 0; }
.grade-links a {
  display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: .84rem; font-weight: 700; text-decoration: none;
}
.grade-links a:hover { border-color: var(--gc, var(--ink)); }

.callout {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--red);
  border-radius: var(--radius); padding: 14px 18px; margin: 1.2em 0;
}
.callout.ok { border-left-color: var(--ok); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 800; margin-bottom: .3em; }

/* ---------- Page header / breadcrumbs ---------- */
.crumbs { font-size: .82rem; color: var(--muted); padding: 14px 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 0; margin: 0; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--line); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { padding: 18px 0 8px; }
.page-head h1 { margin-bottom: .35em; }
.page-head .lead { color: var(--muted); max-width: 46em; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }

/* ---------- Prose ---------- */
.prose { max-width: 780px; }
.prose h2 { padding-bottom: .3em; border-bottom: 2px solid var(--line); }
.prose li { margin-bottom: .35em; }
.prose strong { background: linear-gradient(transparent 68%, var(--marker) 68%); }

.feedback-form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(16px, 4vw, 28px); margin-bottom: 1em;
}
.feedback-fields { display: grid; gap: 16px; border: 0; padding: 0; margin: 0; min-width: 0; }
.feedback-field { display: grid; gap: 4px; }
.feedback-field label { font-weight: 700; }
.feedback-tag { margin-left: 4px; color: var(--muted); font-size: .8rem; font-weight: 400; }
.feedback-field :is(input, select, textarea) {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--muted) 55%, var(--line));
  background: var(--surface-2); color: var(--ink); font: inherit;
}
.feedback-field select { width: min(100%, 24em); }
.feedback-field textarea { resize: vertical; }
.feedback-field p { margin: 0; }
.feedback-source { display: flex; gap: 8px; align-items: start; cursor: pointer; }
.feedback-source input { margin: .45em 0 0; width: 18px; height: 18px; flex-shrink: 0; }
.feedback-source .small { display: block; }
.feedback-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.feedback-status { margin: 0; scroll-margin-top: 76px; }
.feedback-status[data-state] { margin-top: 12px; padding: 8px 12px; border-radius: 8px; }
.feedback-status[data-state="pending"] { background: var(--surface-2); }
.feedback-status[data-state="success"] { background: var(--ok-soft); }
.feedback-status[data-state="error"] { background: var(--red-soft); }
.feedback-email a { display: inline-block; }

.table-scroll { overflow-x: auto; margin: 1em 0 1.4em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: normal; min-width: 4.6em; }
thead th { background: var(--surface-2); font-size: .82rem; color: var(--muted); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 1em 0 1.6em; }
.toc ol { margin: 0; }
.toc-title { font-weight: 800; margin-bottom: .3em; }

/* ---------- Sound button ---------- */
.say {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer;
  vertical-align: middle;
}
.say::before {
  content: ""; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url(/assets/img/sound.svg) center / contain no-repeat;
  mask: url(/assets/img/sound.svg) center / contain no-repeat;
}
.say:hover { border-color: var(--red); color: var(--red-ink); }
.say.speaking { background: var(--red); border-color: var(--red); color: #fff; }
.no-tts .say { display: none; }
.tts-unavailable { display: none; }
.no-tts .tts-unavailable { display: block; }
.audio-status:empty { display: none; }
.audio-status { position: fixed; bottom: 1rem; left: 1rem; right: 1rem; z-index: 100; max-width: 40rem; margin: auto; padding: 1rem; background: var(--surface); color: var(--ink); border: 1px solid var(--red); border-radius: .5rem; }
.interview-check { display: flex; align-items: center; gap: .5rem; padding: .75rem 0; cursor: pointer; }
.interview-check input { width: 1.25rem; height: 1.25rem; }
.interview-finish { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- Study toolbar ---------- */
.toolbar {
  margin: 14px 0;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center;
}
.toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer; user-select: none;
}
.toggle[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.toolbar select, .toolbar input[type="search"], .field {
  font: inherit; font-size: .9rem; padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); min-height: 38px;
}
.toolbar input[type="search"] { flex: 1 1 140px; min-width: 120px; }
.progress-line { display: flex; align-items: center; gap: 10px; width: 100%; font-size: .84rem; color: var(--muted); }
progress { flex: 1; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); accent-color: var(--ok); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--ok); }
progress::-moz-progress-bar { background: var(--ok); }

/* ---------- Word list ---------- */
.words { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.word {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  display: grid; gap: 4px 14px; grid-template-columns: 1fr auto;
  grid-template-areas: "head known" "ja ja" "ex ex";
}
.word-head { grid-area: head; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.word-no { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.word-en { font-family: var(--font-en); font-size: 1.22rem; font-weight: 800; letter-spacing: -.005em; }
.pos { font-size: .72rem; font-weight: 800; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; color: var(--muted); }
.word-ja { grid-area: ja; margin: 0; font-weight: 700; }
.word-ex { grid-area: ex; margin: 0; font-size: .92rem; color: var(--muted); line-height: 1.65; }
.word-ex .ex-en { color: var(--ink); }
.word-ex .say { width: 28px; height: 28px; margin: 0 2px; }
.word-ex .say::before { width: 13px; height: 13px; }
.ex-ja { display: block; }
.known { grid-area: known; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.known input { width: 20px; height: 20px; accent-color: var(--ok); cursor: pointer; }
.word[id] { scroll-margin-top: 72px; }
.range-nav { margin: 0 0 10px; }
.range-nav a { font-family: var(--font-en); font-variant-numeric: tabular-nums; }
.word.is-known { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.hide-known .word.is-known { display: none; }
.word.filtered, [data-w].filtered { display: none; }

@media (min-width: 860px) {
  .toolbar { position: sticky; top: 61px; z-index: 20; }
  .word[id] { scroll-margin-top: 190px; }
  .word {
    grid-template-columns: minmax(190px, 1.1fr) minmax(150px, 1fr) 2.4fr auto; align-items: center;
    grid-template-areas: "head ja ex known";
  }
}

/* 赤シート: masked text is hidden until tapped */
.mask { border-radius: 5px; }
.hide-ja .mask.m-ja, .hide-en .mask.m-en {
  color: transparent; background: var(--red); cursor: pointer; user-select: none;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hide-ja .mask.m-ja *, .hide-en .mask.m-en * { visibility: hidden; }
.hide-ja .mask.m-ja.revealed, .hide-en .mask.m-en.revealed { color: inherit; background: var(--red-soft); }
.hide-ja .mask.m-ja.revealed *, .hide-en .mask.m-en.revealed * { visibility: visible; }
.empty-note { padding: 18px; text-align: center; color: var(--muted); }

/* ---------- Phrases ---------- */
.phrases { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: ph; }
.phrase { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.phrase-en { font-family: var(--font-en); font-size: 1.1rem; font-weight: 700; margin: 0; }
.phrase-ja { margin: 0; grid-column: 1 / -1; font-weight: 700; }
.phrase-note { margin: 2px 0 0; grid-column: 1 / -1; font-size: .86rem; color: var(--muted); }
.phrase-note::before { content: "POINT"; font-size: .68rem; font-weight: 800; letter-spacing: .1em; color: var(--red-ink); margin-right: 8px; }

/* ---------- Verb table ---------- */
.verbs td { font-family: var(--font-en); font-size: 1rem; }
.verbs td.v-ja { font-family: var(--font); font-size: .9rem; color: var(--muted); }
.verbs td:first-child { font-weight: 800; white-space: nowrap; }
.verbs .say { width: 28px; height: 28px; margin-left: 4px; }
.verbs .say::before { width: 13px; height: 13px; }
.type-tag { font-family: var(--font-en); font-size: .72rem; font-weight: 800; border-radius: 6px; padding: 1px 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }

@media (max-width: 639px) {
  /* Verb table: on a phone each verb becomes a small card — three forms side by side, meaning underneath. */
  .verbs thead { display: none; }
  .verbs, .verbs tbody { display: block; }
  .verbs tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .verbs tbody tr:last-child { border-bottom: 0; }
  .verbs td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; }
  .verbs td:nth-child(-n+3)::before { display: block; font-family: var(--font); font-size: .66rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
  .verbs td:nth-child(1)::before { content: "原形"; }
  .verbs td:nth-child(2)::before { content: "過去形"; }
  .verbs td:nth-child(3)::before { content: "過去分詞"; }
  .verbs td.v-ja { grid-column: 1 / -1; margin-top: 2px; }
  .verbs td:nth-child(2) .say, .verbs td:nth-child(3) .say, .verbs td:nth-child(5) { display: none; }
  .verbs td:first-child .say { width: 32px; height: 32px; margin-left: 2px; }
  /* Three-panel comics: keep them readable and let the reader swipe across. */
  .card-picture.wide a { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-picture.wide img { width: 760px; max-width: none; }
}
.set-index { margin: 0 0 6px; }
.swipe-hint { display: none; font-size: .78rem; color: var(--muted); text-align: center; margin: 4px 0 0; }
@media (max-width: 639px) { .swipe-hint { display: block; } }
/* Bigger audio buttons for fingers. */
@media (pointer: coarse) {
  .say, .word-ex .say, .verbs .say { width: 40px; height: 40px; }
  .word-ex .say::before, .verbs .say::before { width: 16px; height: 16px; }
  .known input { width: 24px; height: 24px; }
}

/* ---------- Quiz ---------- */
.app { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 20px; margin: 16px 0 28px; }
.app-setup { display: grid; gap: 14px; }
.field-group { border: 0; padding: 0; margin: 0; }
.field-group legend, .field-label { font-weight: 800; font-size: .9rem; margin-bottom: 6px; padding: 0; display: block; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface-2); font-weight: 700; font-size: .9rem; cursor: pointer;
}
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.quiz-top { display: flex; align-items: center; gap: 12px; font-size: .86rem; color: var(--muted); margin-bottom: 14px; }
.quiz-q { text-align: center; padding: 14px 0 18px; }
.quiz-q .q-label { font-size: .82rem; color: var(--muted); margin: 0 0 4px; }
.quiz-q .q-text { font-size: clamp(1.7rem, 7vw, 2.5rem); font-weight: 800; line-height: 1.3; margin: 0; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.quiz-q .q-text[lang="ja"] { font-size: clamp(1.3rem, 5.4vw, 1.9rem); }
.choices { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
@media (min-width: 640px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice {
  width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; min-height: 56px;
  display: flex; gap: 10px; align-items: center;
}
.choice .key { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); font-size: .74rem; color: var(--muted); font-family: var(--font-en); }
.choice:hover:not([disabled]) { border-color: var(--ink); }
.choice.correct { background: var(--ok-soft); border-color: var(--ok); }
.choice.wrong { background: var(--red-soft); border-color: var(--red); }
.choice[disabled] { cursor: default; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.feedback .fb-title { font-weight: 800; margin: 0 0 2px; }
.feedback.good .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--red-ink); }
.feedback p { margin: 0 0 4px; font-size: .93rem; }
.quiz-next { margin-top: 14px; display: flex; justify-content: flex-end; }
.result { text-align: center; }
.score { font-family: var(--font-en); font-size: clamp(3rem, 14vw, 4.6rem); font-weight: 800; line-height: 1.1; margin: 4px 0; }
.score small { font-size: .4em; color: var(--muted); font-weight: 700; }
.review { text-align: left; list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.review li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.review .r-en { font-family: var(--font-en); font-weight: 800; font-size: 1.05rem; }
.review p { margin: 0; font-size: .9rem; }

/* ---------- Flashcards ---------- */
.fc-stage { display: grid; gap: 14px; }
.fc-card {
  width: 100%; min-height: 250px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--ink); font: inherit; cursor: pointer; padding: 22px; display: grid; place-items: center; text-align: center;
}
.fc-card:hover { border-color: var(--ink); }
.fc-front { font-family: var(--font-en); font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; line-height: 1.2; }
.fc-hint { display: block; font-family: var(--font); font-size: .8rem; font-weight: 400; color: var(--muted); margin-top: 10px; }
.fc-back { display: grid; gap: 8px; }
.fc-ja { font-size: clamp(1.3rem, 5.5vw, 1.8rem); font-weight: 800; }
.fc-ex { font-size: .98rem; }
.fc-exja { font-size: .88rem; color: var(--muted); }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fc-actions .btn { width: 100%; }
.btn.again { border-color: var(--red); color: var(--red-ink); }
.btn.got { background: var(--ok); border-color: var(--ok); color: #fff; }
.fc-meta { display: flex; align-items: center; gap: 12px; font-size: .86rem; color: var(--muted); }

/* ---------- Interview / writing practice ---------- */
.practice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.practice { scroll-margin-top: 76px; }
.practice > h3:first-child { margin-top: 0; }
.passage { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
.passage-title { font-family: var(--font-en); font-weight: 800; text-align: center; margin: 0 0 6px; }
.passage p[lang="en"] { font-size: 1.05rem; line-height: 1.75; margin: 0; }
.card-pictures { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 14px 0 10px; }
.card-picture { margin: 0; min-width: 0; }
.card-picture a { display: block; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.card-picture img { display: block; width: 100%; height: auto; }
.card-picture figcaption { text-align: center; font-family: var(--font-en); font-weight: 800; font-size: .9rem; margin-top: 4px; }
@media (min-width: 640px) { .card-pictures.pair { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
.scene { font-size: .92rem; border-left: 4px solid var(--line); padding: 4px 0 4px 12px; color: var(--muted); margin: 12px 0; }
.qa { border-top: 1px dashed var(--line); padding: 12px 0 4px; }
.qa-q { font-family: var(--font-en); font-weight: 700; margin: 0 0 2px; display: flex; gap: 8px; align-items: flex-start; }
.qa-no { flex: none; font-size: .74rem; font-weight: 800; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 2px 7px; margin-top: 4px; white-space: nowrap; }
.qa-ja { font-size: .86rem; color: var(--muted); margin: 0 0 6px; }
details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); margin: 6px 0 10px; }
details > summary { cursor: pointer; padding: 8px 12px; font-weight: 700; font-size: .9rem; list-style-position: inside; }
details > .details-body { padding: 4px 14px 12px; }
details > .details-body > :last-child { margin-bottom: 0; }
.model { font-family: var(--font-en); font-size: 1.02rem; line-height: 1.75; }
.prompt-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; white-space: pre-line; font-family: var(--font-en); line-height: 1.7; }
.pre { white-space: pre-line; }
.tip { font-size: .9rem; }
.tip::before { content: "コツ"; font-size: .7rem; font-weight: 800; background: var(--marker); color: #3d3200; border-radius: 5px; padding: 1px 6px; margin-right: 8px; }
@media (prefers-color-scheme: dark) { .tip::before { color: #fff3b0; } }
.count-box textarea {
  width: 100%; min-height: 150px; font: inherit; font-family: var(--font-en); padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); resize: vertical;
}
.count-out { font-size: .9rem; font-weight: 700; }
.count-out.in-range { color: var(--ok); }
.count-out.out-range { color: var(--red-ink); }

/* ---------- Learning record ---------- */
.progress-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: grid; gap: 12px; margin: 0 0 14px; }
.progress-panel .kicker { margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat b { font-family: var(--font-en); font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat span { font-size: .84rem; color: var(--muted); font-weight: 700; }
.pbars { display: grid; gap: 8px; }
.pbar { display: grid; grid-template-columns: minmax(4.5em, auto) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.pbar progress { width: 100%; min-width: 0; }
.pbar-label { font-weight: 700; white-space: nowrap; }
.pbar-label a { text-decoration: none; }
.pbar-label a:hover { text-decoration: underline; }
.pbar-num { font-family: var(--font-en); font-variant-numeric: tabular-nums; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.cal { display: flex; flex-wrap: wrap; gap: 4px; }
.cal i { width: 16px; height: 16px; border-radius: 4px; background: var(--line); }
.cal i.on { background: color-mix(in srgb, var(--ok) 42%, var(--line)); }
.cal i.l2 { background: color-mix(in srgb, var(--ok) 72%, var(--line)); }
.cal i.l3 { background: var(--ok); }

/* ---------- Points, daily goal, badges ---------- */
.goal-note { margin: 0; font-weight: 700; font-size: .92rem; }
.progress-panel .field-group legend { font-size: .84rem; }
.badges, .prose .badges { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge, .prose .badge { display: grid; justify-items: center; align-content: start; gap: 2px; margin: 0; text-align: center; padding: 12px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); }
.badge-icon { font-size: 1.7rem; line-height: 1.25; filter: grayscale(1); opacity: .4; }
.badge b { font-size: .9rem; line-height: 1.4; }
.badge-desc { font-size: .76rem; line-height: 1.45; }
.badge-state { font-family: var(--font-en); font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge.earned { background: var(--surface); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); box-shadow: var(--shadow); color: var(--ink); }
.badge.earned .badge-icon { filter: none; opacity: 1; }
.badge.earned .badge-state { color: var(--ok); }
.reward { max-width: 440px; margin: 14px auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 8px; text-align: left; }
.reward p { margin: 0; }
.reward-points { text-align: center; font-weight: 700; }
.reward-points b { font-family: var(--font-en); font-size: 1.5rem; color: var(--ok); margin-right: 4px; }
.toasts { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 60; display: grid; justify-items: center; gap: 8px; padding: 0 16px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 420px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .28); animation: toast-in .25s ease-out; }
.toast-icon { font-size: 1.6rem; line-height: 1; }
.toast-body { display: grid; font-size: .84rem; line-height: 1.45; }
.toast-body b { font-size: .98rem; }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.streak-chip { margin-left: auto; display: inline-flex; align-items: center; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-family: var(--font-en); font-weight: 800; font-size: .88rem; white-space: nowrap; }
.streak-chip[hidden] { display: none; }
.streak-chip + .nav-toggle { margin-left: 0; }
.streak-chip.done { border-color: var(--ok); background: var(--ok-soft); }
.streak-chip.idle { filter: grayscale(1); opacity: .7; }
@media (min-width: 1000px) {
  .streak-chip { order: 3; margin-left: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}
.grade-progress { display: grid; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.grade-progress:first-child { border-top: 0; padding-top: 0; }
.grade-progress h3 { margin: 0; font-size: 1rem; }
.backup-area { width: 100%; font: inherit; font-family: var(--font-en); font-size: .8rem; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); margin: 0 0 10px; resize: vertical; }

/* ---------- Steps ---------- */
.steps { list-style: none; counter-reset: st; padding: 0; margin: 1em 0; display: grid; gap: 10px; }
.steps > li { counter-increment: st; position: relative; padding: 12px 14px 12px 56px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.steps > li::before {
  content: counter(st); position: absolute; left: 14px; top: 12px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 800; font-family: var(--font-en);
}
.steps > li > :last-child { margin-bottom: 0; }
.steps strong { display: block; background: none; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--surface); padding: 32px 0 40px; font-size: .88rem; }
.footer-grid { display: grid; gap: 24px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.3fr 1fr 1fr 1fr; } }
.site-footer h2 { font-size: .82rem; letter-spacing: .1em; color: var(--muted); margin: 0 0 8px; border: 0; padding: 0; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.legal-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .toolbar, .say, .known, .btn-row, .crumbs { display: none !important; }
  body { background: #fff; }
  .word { break-inside: avoid; }
}
