/* =========================================================
   デザイン：ステッカー風（黒の太い線 ＋ ずらした影）
   級ごとの色は [data-grade] で --g / --g-soft を切りかえる
   ========================================================= */
:root {
  --bg: #fff4d6;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #5d5a52;
  --line: #111111;
  --soft-line: #e9dfc4;
  --brand: #3b82ff;
  --brand-dark: #1f5fd6;
  --brand-soft: #dceaff;
  --accent: #ffde3b;
  --pink: #ff5c8a;
  --ok: #129a5f;
  --ok-soft: #c9f5df;
  --ng: #e5484d;
  --ng-soft: #ffe0e1;
  --typed: #b9b4a6;
  --radius: 16px;
  --bw: 3px;                         /* 線の太さ */
  --shadow: 5px 5px 0 var(--ink);    /* シール風の影 */
  --shadow-s: 3px 3px 0 var(--ink);
  --mono: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
  --display: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif; /* 見出し用：丸ゴシックの極太 */
  --g: var(--brand);
  --g-soft: var(--brand-soft);
  --book: #ff7a2f;        /* 単語帳の色（どの級の色ともちがうオレンジ） */
  --book-soft: #ffe2cc;
}
/* 級ごとの色 */
[data-grade="5"]  { --g: #ff8fb1; --g-soft: #ffe1eb; }
[data-grade="4"]  { --g: #ffd23b; --g-soft: #fff3c2; }
[data-grade="3"]  { --g: #5fe0a8; --g-soft: #d6f8e9; }
[data-grade="p2"] { --g: #7cc4ff; --g-soft: #dcefff; }
[data-grade="2"]  { --g: #c4a7ff; --g-soft: #ece3ff; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
  background: var(--bg);
  background-image: radial-gradient(#f3e3b5 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
kbd {
  font-family: var(--mono);
  font-size: .8em;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--ink);
  padding: 0 .45em;
  color: var(--ink);
}
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.sp { display: none; }

/* 押せるもの共通：押すと影の分だけへこむ */
.pressable, .grade-card:not(:disabled), .stage-btn, .quick-btn:not(:disabled), .btn:not(:disabled), .speak-btn, .close, .rv-say {
  transition: transform .08s, box-shadow .08s;
}

/* ---------- header / footer ---------- */
.site-header {
  background: var(--surface);
  border-bottom: var(--bw) solid var(--ink);
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 0;
}
.logo-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: var(--ink);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-s);
  font-family: var(--mono); font-weight: 700;
  transform: rotate(-4deg);
}
.logo-text { font-weight: 800; font-size: 20px; letter-spacing: .04em; } /* 小さい文字は太い装飾フォントだと読みにくいので、丸ゴシックの太字 */
.site-footer {
  margin-top: auto;
  padding: 20px 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  border-top: var(--bw) solid var(--ink);
  background: var(--surface);
}
.site-footer a { color: var(--ink); }

main { width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 16px 48px; }
.section-title { font-family: var(--display); font-weight: 800; font-size: 22px; margin: 36px 0 16px; }
.section-title::before {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px;
  background: var(--pink); border: var(--bw) solid var(--ink); border-radius: 4px;
  transform: rotate(45deg); vertical-align: 1px;
}

/* ---------- home ---------- */
.hero {
  position: relative;
  margin-top: 12px;
  background: var(--brand);
  color: #fff;
  border: var(--bw) solid var(--ink);
  border-radius: 20px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 34px 32px;
}
.hero h1 {
  margin: 0 0 12px;
  font-family: var(--display); font-weight: 800;
  font-size: 34px; line-height: 1.35;
  text-shadow: 3px 3px 0 var(--ink);
}
.hero h1 br.sp { display: inline; } /* 見出しは2行にする */
.hero p { margin: 0; font-weight: 700; }
.sticker {
  position: absolute; right: 22px; top: -20px;
  background: var(--pink); color: var(--ink);
  border: var(--bw) solid var(--ink); border-radius: 99px;
  box-shadow: var(--shadow-s);
  padding: 4px 16px; font-weight: 800; font-size: 15px;
  transform: rotate(6deg);
}
/* タイピング風の表示（js の typeHero） */
.tw-ch { visibility: hidden; }
.tw-ch.on { visibility: visible; }
.tw-caret { display: inline-block; width: 3px; height: 1em; margin: 0 -1.5px; vertical-align: -0.12em; background: var(--accent); animation: tw-blink 1s steps(1) infinite; }
.tw-caret.done { display: none; }
@keyframes tw-blink { 50% { opacity: 0; } }

.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}
.grade-card {
  background: var(--g);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow);
}
.grade-card:not(:disabled):hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.grade-card:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.grade-card:disabled { cursor: default; background: #efe8d6; border-style: dashed; box-shadow: none; }
.grade-card .g-name { font-family: var(--display); font-weight: 800; font-size: 24px; display: block; line-height: 1.3; }
.grade-card .g-level { font-size: 12px; font-weight: 700; display: block; }
.grade-card .g-badge {
  display: inline-block; margin-top: 10px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 10px;
  background: #fff; border: 2px solid var(--ink);
}
.grade-card:disabled .g-badge { background: transparent; border-style: dashed; color: var(--muted); }
.g-badge .g-count { display: block; line-height: 1.7; }

.howto {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 4px 26px 18px; margin-top: 36px;
}
.howto ol { padding-left: 1.3em; margin: 0; }
.howto li { margin: 8px 0; }
.howto li::marker { font-family: var(--display); font-weight: 800; color: var(--pink); }
.note { font-size: 13px; color: var(--muted); }

/* ---------- grade page ---------- */
.back {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 99px;
  padding: 2px 14px; font-weight: 800; box-shadow: 2px 2px 0 var(--ink);
}
.back:hover { background: var(--accent); }
.grade-head h1 {
  display: table; /* 戻るボタンの下に、幅は文字に合わせる */
  margin: 14px 0 4px; font-family: var(--display); font-weight: 800; font-size: 32px;
  background: var(--g); border: var(--bw) solid var(--ink); border-radius: 14px;
  box-shadow: var(--shadow-s); padding: 2px 18px;
}
.grade-head p { margin: 0; font-weight: 700; color: var(--muted); }
.settings {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  margin-top: 20px;
}
.setting { display: flex; align-items: center; gap: 8px; }
.setting-label { font-size: 13px; font-weight: 800; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg button {
  border: 0; background: var(--surface);
  padding: 4px 12px;
  font-size: 14px; color: var(--muted); font-weight: 800;
}
.seg button + button { border-left: 2px solid var(--ink); }
.seg button:hover { background: var(--g-soft); }
.seg button.on { background: var(--g); color: var(--ink); }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.quick-btn {
  text-align: left;
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  padding: 14px 20px;
  background: var(--brand); color: #fff;
  box-shadow: var(--shadow);
}
.quick-btn:not(:disabled):hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.quick-btn:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.quick-btn.weak { background: var(--pink); color: var(--ink); }
.quick-btn.book { background: var(--book); color: var(--ink); }
.quick-btn:disabled { cursor: default; background: #efe8d6; color: var(--muted); border-style: dashed; box-shadow: none; }
.quick-title { display: block; font-family: var(--display); font-weight: 800; font-size: 19px; }
.quick-sub { display: block; font-size: 13px; font-weight: 700; }

.category { margin-top: 34px; }
.category-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.category-head h2 {
  font-size: 17px; margin: 0; font-weight: 800;
  background: var(--g-soft); border: 2px solid var(--ink); border-radius: 10px; padding: 2px 12px;
}
.category-head span { font-size: 13px; font-weight: 700; color: var(--muted); }
.stage-list { display: flex; flex-direction: column; gap: 12px; }
.stage-row {
  display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 14px; align-items: stretch;
}
.stage-btn {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 12px;
  min-width: 0;
}
.stage-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); background: var(--g-soft); }
.stage-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.stage-btn .s-no {
  flex: none; display: grid; place-items: center;
  min-width: 42px; height: 42px; padding: 0 6px;
  background: var(--g); border: 2px solid var(--ink); border-radius: 10px;
  font-family: var(--display); font-weight: 800; font-size: 17px;
}
.stage-btn .s-body { min-width: 0; flex: 1; }
.stage-btn .s-name { font-weight: 800; display: block; }
.stage-btn .s-words {
  display: block; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono);
}
/* ステージの右：いつ・どれをやったか */
.stage-hist {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 0 12px; border: 2px dashed #d6cdb8; border-radius: 14px;
}
.stage-row.played .stage-hist { border: 2px solid var(--ink); background: var(--surface); }
.stage-row.empty .stage-hist { visibility: hidden; }
.sh-none { font-size: 13px; font-weight: 700; color: #b3a98f; }
.sh-sum { flex: none; display: flex; align-items: center; gap: 8px; padding-right: 12px; border-right: 2px solid #e6dfcf; }
.sh-sum .mini-rank { width: 34px; height: 34px; font-size: 18px; }
.sh-sum span { font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1.25; white-space: nowrap; }
.sh-sum span b { font-family: var(--mono); font-size: 20px; color: var(--ink); margin-right: 1px; }
.sh-sum small { display: block; font-size: 11px; }
.sh-track {
  display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 2px;
  min-width: 0; overflow-x: auto; scrollbar-width: thin;
}
.sh-track li { flex: none; }
.sh-more { font-size: 11px; font-weight: 700; color: var(--muted); padding-right: 4px; white-space: nowrap; }
.sh-play {
  display: grid; justify-items: center; gap: 0; min-width: 46px; padding: 1px 4px; line-height: 1.25;
  background: transparent; border: 2px solid transparent; border-radius: 10px; cursor: pointer;
}
.sh-play:hover { background: var(--g-soft); border-color: var(--ink); }
.sh-play.best { border-color: var(--ink); background: #fff7d6; }
.sh-play .mini-rank { width: 24px; height: 24px; font-size: 13px; border-radius: 7px; margin: 1px 0; }
.sh-date { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sh-score { font-family: var(--mono); font-size: 11px; font-weight: 700; }

/* ---------- play ---------- */
.play-top { display: flex; align-items: center; gap: 12px; }
.play-title {
  font-weight: 800; flex: 1; min-width: 0;
}
.play-title::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  background: var(--g); border: 2px solid var(--ink); border-radius: 50%; vertical-align: -1px;
}
.play-progress {
  font-family: var(--mono); font-weight: 700;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 99px; padding: 0 12px;
}
.close {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  border: 2px solid var(--ink); background: var(--surface);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 20px; line-height: 1; font-weight: 800;
}
.close:hover { background: var(--pink); }
.progress-bar {
  height: 16px; background: var(--surface);
  border: var(--bw) solid var(--ink); border-radius: 99px;
  margin: 12px 0 18px; overflow: hidden;
}
#progress-fill {
  height: 100%; width: 0; transition: width .25s;
  background: repeating-linear-gradient(-45deg, var(--g) 0 10px, color-mix(in srgb, var(--g) 70%, #fff) 10px 20px);
  border-right: var(--bw) solid var(--ink);
}

.play-card {
  position: relative;
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 22px 28px 26px;
  min-height: 360px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.play-card.miss { animation: shake .18s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.steps { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; }
.step { padding: 1px 12px; border-radius: 99px; background: var(--surface); border: 2px solid var(--ink); color: var(--muted); }
.step.on { background: var(--brand); color: #fff; }
.step.done { background: var(--ok-soft); color: var(--ok); }
.steps.word-only .step-arrow, .steps.word-only [data-step="ex"] { display: none; }

.pics { display: flex; justify-content: center; align-items: center; gap: 8px; height: 132px; margin-top: 14px; }
.pics img { width: 120px; height: 120px; filter: drop-shadow(3px 3px 0 rgba(17,17,17,.18)); }
.pics[data-count="2"] img { width: 104px; height: 104px; }
.pics[data-count="3"] img { width: 88px; height: 88px; }
.pics[data-count="0"] { display: none; } /* 絵のない語は、絵の場所をつめる */
.word-block { margin-top: 12px; min-height: 64px; }
.word-meta { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pos {
  font-size: 12px; font-weight: 800;
  padding: 0 10px; border-radius: 99px;
  border: 2px solid var(--ink); background: var(--accent); color: var(--ink);
}
.ja { font-size: 26px; font-weight: 800; }
.word-mini { font-family: var(--mono); font-size: 20px; color: var(--brand-dark); font-weight: 700; min-height: 1.4em; }

.target {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
}
.target.sentence { font-size: 30px; }
.target .w { white-space: nowrap; }
.target .ch { position: relative; white-space: pre; }
.target > .ch { white-space: pre-wrap; } /* 単語のあいだのスペースでは折り返してよい */
.target .ch.done { color: var(--typed); }
.target .ch.hl { text-decoration: underline; text-decoration-color: var(--pink); text-decoration-thickness: 4px; text-underline-offset: 7px; }
.target .ch.done.hl { text-decoration-color: #ffc2d4; }
.target .ch.cur { color: var(--ink); background: var(--accent); border-radius: 5px; box-shadow: inset 0 0 0 2px var(--ink); }
.target .ch.cur.err { background: var(--ng-soft); box-shadow: inset 0 0 0 2px var(--ng); color: var(--ng); }
.target .ch.hid { color: #cfc8b6; }
.target .ch.hint { color: var(--ng); }
.target-ja { margin-top: 10px; font-size: 18px; font-weight: 700; color: var(--muted); min-height: 1.6em; }

.speak-btn {
  margin-top: auto;
  border: 2px solid var(--ink); background: var(--surface);
  border-radius: 99px; padding: 5px 16px;
  font-size: 14px; font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink);
}
.speak-btn:hover { background: var(--g-soft); }
.speak-btn:active, .close:active, .rv-say:active { transform: translate(2px, 2px); box-shadow: none; }

.ready {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(255, 244, 214, .9);
  border-radius: 19px;
}
.ready-inner {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px 28px;
}
.ready-key { font-family: var(--display); font-weight: 800; font-size: 24px; margin: 0; }
.ready-key kbd { font-size: 22px; padding: 2px 16px; background: var(--accent); box-shadow: 0 4px 0 var(--ink); }
.ready-sub { margin: 8px 0 0; font-weight: 700; color: var(--muted); }
/* 3・2・1 のカウントダウン */
.ready-count { display: none; }
.ready.counting .ready-inner { display: none; }
.ready.counting .ready-count {
  display: grid; place-items: center;
  width: 140px; height: 140px; border-radius: 50%;
  background: var(--g); border: var(--bw) solid var(--ink); box-shadow: var(--shadow);
  font-family: var(--display); font-weight: 800; font-size: 84px; line-height: 1;
}
.ready-count.pop { animation: count-pop .9s ease-out; }
@keyframes count-pop {
  0% { transform: scale(.4); opacity: 0; }
  25% { transform: scale(1.12); opacity: 1; }
  45% { transform: scale(1); }
  100% { transform: scale(1); opacity: 1; }
}
.ime-warn {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: var(--ng); color: #fff;
  border: var(--bw) solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-s);
  padding: 8px 16px; font-size: 14px; font-weight: 700;
  white-space: nowrap;
}
.play-stats { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; margin-top: 18px; font-size: 14px; font-weight: 700; }
.play-stats > span {
  background: var(--surface); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 14px;
}
.play-stats > span.muted { background: transparent; border-style: dashed; }
.play-stats b { font-family: var(--mono); font-size: 16px; }

/* ---------- result ---------- */
.result-card {
  background: var(--surface);
  border: var(--bw) solid var(--ink); border-radius: 22px;
  box-shadow: 8px 8px 0 var(--ink);
  padding: 26px 28px;
}
.result-head { display: flex; gap: 24px; align-items: center; }
.rank {
  width: 104px; height: 104px; flex: none;
  display: grid; place-items: center;
  border-radius: 24px;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow);
  font-family: var(--display); font-weight: 800; font-size: 58px;
  background: var(--brand); color: #fff;
  text-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-6deg);
}
.rank.S { background: var(--accent); }
.rank.A { background: var(--pink); }
.rank.B { background: var(--brand); }
.rank.C, .rank.D { background: #c9c1ad; }
.res-title { font-weight: 800; color: var(--muted); }
.score { font-size: 18px; font-weight: 800; }
.score b { font-family: var(--mono); font-size: 34px; }
.res-msg { font-weight: 800; color: var(--ink); background: var(--g-soft); display: inline-block; border-radius: 8px; padding: 0 8px; }
.res-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 22px; }
.res-stats div { background: var(--bg); border: 2px solid var(--ink); border-radius: 12px; padding: 8px; text-align: center; }
.res-stats span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.res-stats b { font-family: var(--mono); font-size: 20px; }
.res-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.btn {
  border: var(--bw) solid var(--ink); background: var(--surface);
  border-radius: 12px; padding: 9px 18px; font-weight: 800;
  box-shadow: 4px 4px 0 var(--ink);
}
.btn:not(:disabled):hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); background: var(--g-soft); }
.btn:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--pink); }
.btn.primary:not(:disabled):hover { background: #ff7aa0; }
.btn.primary kbd { background: rgba(255,255,255,.6); }
.btn.ghost { box-shadow: none; border-style: dashed; background: transparent; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }

.review-list, .word-list { list-style: none; margin: 0; padding: 0; }
.review-list li, .word-list li {
  display: grid;
  grid-template-columns: 36px 112px minmax(110px, 190px) 1fr auto;
  grid-template-areas: "say pics en ja miss" "say pics ex ex book";
  gap: 2px 12px; align-items: center;
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 12px;
  box-shadow: 4px 4px 0 var(--ink);
}
.word-list li { box-shadow: none; border-width: 2px; }
.rv-say {
  grid-area: say; align-self: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--accent); font-size: 14px;
  box-shadow: 2px 2px 0 var(--ink);
}
.rv-say:hover { background: var(--g); }
.rv-en { grid-area: en; font-family: var(--mono); font-weight: 700; font-size: 18px; }
.rv-ja { grid-area: ja; font-weight: 800; }
.rv-ja .pos { margin-right: 6px; }
.rv-pics { grid-area: pics; display: flex; align-items: center; justify-content: center; gap: 2px; }
.rv-pics img { width: 36px; height: 36px; }
.rv-pics img:only-child { width: 56px; height: 56px; }
.rv-pics img:first-child:nth-last-child(2), .rv-pics img:first-child:nth-last-child(2) ~ img { width: 48px; height: 48px; }
.rv-ex { grid-area: ex; font-size: 14px; color: var(--muted); }
.rv-ex span { font-family: var(--mono); color: var(--ink); }
.rv-miss { grid-area: miss; justify-self: end; font-size: 12px; font-weight: 800; padding: 0 10px; border-radius: 99px; border: 2px solid var(--ink); background: var(--ok-soft); color: var(--ok); }
.rv-miss.ng { background: var(--ng-soft); color: var(--ng); }
.rv-en .g-chip { font-family: inherit; vertical-align: 3px; }
/* 単語帳に追加・外す */
.rv-book {
  grid-area: book; align-self: end; justify-self: end; white-space: nowrap;
  font: inherit; font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 99px;
  border: 2px solid var(--ink); background: var(--surface); box-shadow: 2px 2px 0 var(--ink); cursor: pointer;
}
.rv-book:hover { background: var(--book-soft); }
.rv-book:active { transform: translate(2px, 2px); box-shadow: none; }
.rv-book.on { background: var(--book); }
.book-list .rv-book.on { background: var(--surface); }
.book-list .rv-book.on:hover { background: var(--ng-soft); }
.book-list li.removed > :not(.rv-book) { opacity: .35; }
.book-list li.removed { box-shadow: none; border-style: dashed; }

/* トップの単語帳への入口 */
.book-entry {
  display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 20px; text-align: left;
  padding: 14px 20px; background: var(--book); border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); font: inherit; color: var(--ink); cursor: pointer;
}
.book-entry:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.book-entry:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.book-icon { font-size: 30px; line-height: 1; }
.book-entry-body { flex: 1; min-width: 0; }
.book-entry-body b { display: block; font-family: var(--display); font-weight: 800; font-size: 20px; }
.book-entry-body small { display: block; font-size: 13px; font-weight: 700; }
.book-entry-count { font-family: var(--display); font-weight: 800; font-size: 18px; background: var(--surface); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 14px; white-space: nowrap; }
.book-entry-go { font-size: 22px; font-weight: 800; }

/* 単語帳の画面 */
.book-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 14px; }
.book-tabs button {
  font: inherit; font-weight: 800; font-size: 15px; padding: 6px 14px; border-radius: 99px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--surface); box-shadow: 2px 2px 0 var(--ink);
}
.book-tabs button small { font-family: var(--mono); font-size: 12px; margin-left: 6px; padding: 0 6px; border-radius: 99px; background: #f1ece0; }
.book-tabs button.on { background: var(--g); }
.book-tabs button[data-tab="all"].on { background: var(--book); }
#screen-book .grade-head h1 { background: var(--book); }
.book-tabs button.on small { background: var(--surface); }
.book-actions { margin-bottom: 16px; }
.book-actions .muted { margin: 0; font-size: 14px; font-weight: 700; }
.book-empty { text-align: center; font-weight: 700; color: var(--muted); padding: 36px 16px; border: 2px dashed #d6cdb8; border-radius: var(--radius); }

/* ---------- modal ---------- */
.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: var(--bw) solid var(--ink); border-radius: 20px; padding: 0;
  box-shadow: 10px 10px 0 var(--ink);
  background: var(--bg);
}
.modal::backdrop { background: rgba(17, 17, 17, .45); }
.modal-head { display: flex; align-items: center; padding: 14px 20px; border-bottom: var(--bw) solid var(--ink); position: sticky; top: 0; z-index: 1; background: var(--g); }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 800; }
.modal .word-list { padding: 16px 20px; }
.modal-foot { position: sticky; bottom: 0; background: var(--surface); padding: 14px 20px; border-top: var(--bw) solid var(--ink); text-align: right; }


/* ---------- 有料プラン ---------- */
.plan-btn {
  flex: none;
  font: inherit; font-weight: 800; font-size: 14px;
  padding: 7px 14px; border-radius: 99px;
  background: var(--accent); color: var(--ink);
  border: var(--bw) solid var(--ink); box-shadow: var(--shadow-s);
  cursor: pointer;
}
.plan-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.plan-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.plan-btn.on { background: var(--ok-soft); }
.plan-btn.on::before { content: "✓ "; }

.grade-card .g-free {
  display: inline-block; margin-top: 10px;
  font-size: 12px; font-weight: 800;
  padding: 2px 10px; border-radius: 99px;
  background: var(--accent); border: 2px solid var(--ink);
}

.plan-banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 0 0 22px; padding: 14px 18px;
  background: var(--accent);
  border: var(--bw) solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-s);
}
.plan-banner p { flex: 1 1 260px; margin: 0; font-size: 14px; line-height: 1.7; }
.grade-error {
  margin: 0 0 18px; padding: 10px 14px; font-size: 14px;
  background: var(--ng-soft); border: 2px solid var(--ink); border-radius: 12px;
}

.stage-btn.locked { background: #f1ece0; box-shadow: 4px 4px 0 var(--ink); }
.stage-btn.locked .s-no { background: #fff; color: var(--muted); }
.stage-btn.locked .s-name { color: var(--muted); }
.stage-btn.locked .s-words { font-family: inherit; font-weight: 700; }
.stage-btn .s-lock { margin-right: 4px; }

.plan-modal { width: min(520px, calc(100vw - 32px)); }
.plan-body { padding: 18px 22px 22px; line-height: 1.7; }
.plan-body h3 { font-size: 16px; font-weight: 800; margin: 22px 0 8px; padding-top: 18px; border-top: 2px dashed var(--ink); }
.plan-lead { font-weight: 800; margin: 0 0 10px; }
.plan-points { margin: 0 0 16px; padding-left: 1.3em; font-size: 14px; }
.plan-points li { margin: 4px 0; }
.plan-buy { width: 100%; font-size: 17px; padding: 12px 16px; }
.plan-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.plan-note:empty, .plan-msg:empty { display: none; }
.plan-form { display: flex; gap: 10px; flex-wrap: wrap; }
.plan-form.col { flex-direction: column; align-items: stretch; margin-top: 12px; }
.plan-form input {
  flex: 1 1 200px; min-width: 0;
  font: inherit; font-size: 16px; padding: 10px 12px;
  background: #fff; border: var(--bw) solid var(--ink); border-radius: 12px;
}
#plan-key { font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.plan-form input:focus { outline: 3px solid var(--brand); outline-offset: 2px; }
.plan-msg { margin: 10px 0 0; padding: 8px 12px; font-size: 14px; border-radius: 10px; border: 2px solid var(--ink); }
.plan-msg.ok { background: var(--ok-soft); }
.plan-msg.ng { background: var(--ng-soft); }
.plan-keyline code {
  display: inline-block; margin-left: 6px;
  font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: .06em;
  padding: 2px 10px; background: #fff; border: 2px solid var(--ink); border-radius: 8px;
  user-select: all;
}
.linklike {
  margin-top: 14px; padding: 0;
  background: none; border: 0;
  font: inherit; font-size: 14px; color: var(--ink);
  text-decoration: underline; cursor: pointer;
}
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; font-size: 13px; }

@media (max-width: 640px) {
  .stage-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .stage-hist { min-height: 0; margin-left: 14px; padding: 6px 10px; }
  .stage-row:not(.played) .stage-hist { display: none; }
  .sp { display: inline; }
  main { padding-top: 22px; }
  .hero { padding: 26px 20px; box-shadow: 6px 6px 0 var(--ink); }
  .hero h1 { font-size: 24px; }
  .sticker { font-size: 13px; right: 12px; top: -18px; }
  .logo-text { font-size: 17px; }
  .site-header { padding: 10px 16px; }
  .plan-btn { font-size: 12px; padding: 6px 10px; }
  .grade-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .quick { grid-template-columns: 1fr; }
  .target { font-size: 30px; }
  .target.sentence { font-size: 20px; }
  .play-card { padding: 18px 14px; box-shadow: 6px 6px 0 var(--ink); }
  .res-stats { grid-template-columns: repeat(2, 1fr); }
  .result-head { gap: 16px; }
  .rank { width: 84px; height: 84px; font-size: 46px; }
  .review-list li, .word-list li {
    grid-template-columns: 36px 1fr;
    grid-template-areas: "say pics" "say en" "say ja" "say miss" "say ex" "say book";
  }
  .rv-pics { justify-content: flex-start; }
  .pics { height: 96px; }
  .pics img, .pics[data-count] img { width: 80px; height: 80px; }
  .rv-miss { justify-self: start; }
  .rv-book { justify-self: start; margin-top: 6px; }
  .book-entry { padding: 12px 14px; gap: 10px; }
  .book-entry-body small { font-size: 12px; }
  .ime-warn { white-space: normal; width: 90%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- 購入完了ページ ---------- */
.thanks-card {
  max-width: 640px; margin: 0 auto; padding: 26px 28px;
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 20px;
  box-shadow: var(--shadow); line-height: 1.8;
}
.thanks-key { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thanks-key code {
  font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: .08em;
  padding: 6px 14px; background: var(--accent); border: var(--bw) solid var(--ink); border-radius: 12px;
  user-select: all;
}
a.btn { display: inline-block; text-decoration: none; color: var(--ink); }

/* ---------- 法的表記のページ ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 26px 28px; background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 20px; box-shadow: var(--shadow); line-height: 1.85; }
.legal h1 { font-size: 24px; font-weight: 800; margin: 0 0 18px; }
.legal h2 { font-size: 17px; font-weight: 800; margin: 26px 0 6px; }
.legal table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 2px solid var(--soft-line); }
.legal th { width: 32%; white-space: nowrap; }
.legal .todo { background: var(--accent); padding: 0 4px; border-radius: 4px; font-weight: 700; }
@media (max-width: 640px) { .legal th { white-space: normal; } .legal, .thanks-card { padding: 20px 16px; } }

/* ---------- きろく（履歴とスタッツ） ---------- */
.header-nav { display: flex; gap: 10px; align-items: center; }
.stats-btn, .book-btn { background: var(--surface); }
.st-card {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 20px;
  box-shadow: var(--shadow); padding: 20px 22px;
}
.st-sub { font-size: 15px; font-weight: 800; margin: 22px 0 10px; }
.st-label { font-size: 13px; font-weight: 800; margin-bottom: 6px; }

/* 結果画面のお知らせ */
.res-news { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.res-news li {
  font-weight: 800; padding: 4px 12px; border-radius: 99px;
  background: var(--accent); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
  animation: news-pop .5s both;
}
.res-news li:nth-child(2) { animation-delay: .12s; } .res-news li:nth-child(3) { animation-delay: .24s; } .res-news li:nth-child(4) { animation-delay: .36s; }
@keyframes news-pop { from { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } to { transform: none; opacity: 1; } }

/* 1. きょう */
.st-today { display: grid; grid-template-columns: 1fr auto; gap: 18px 24px; align-items: center; }
.st-streak { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.st-streak .st-fire { font-size: 40px; line-height: 1; }
.st-streak > b { font-family: var(--display); font-size: 56px; line-height: 1; }
.st-streak > span:not(.st-fire) { font-weight: 800; font-size: 20px; }
.st-streak small { flex-basis: 100%; font-weight: 700; color: var(--muted); font-size: 13px; }
.st-streak.off .st-fire { filter: grayscale(1); opacity: .5; }
.st-goal { display: flex; align-items: center; gap: 14px; }
.st-ring { width: 118px; height: 118px; flex: none; }
.st-ring .ring-bg { fill: none; stroke: var(--soft-line); stroke-width: 14; }
.st-ring .ring-fg { fill: none; stroke: var(--brand); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.st-ring.done .ring-fg { stroke: var(--ok); }
.st-ring .ring-big { font-family: var(--display); font-weight: 800; font-size: 26px; text-anchor: middle; fill: var(--ink); }
.st-ring .ring-small { font-weight: 700; font-size: 13px; text-anchor: middle; fill: var(--muted); }
.st-goal .seg button { padding: 4px 10px; white-space: nowrap; }
.st-nums { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.st-nums.big { grid-template-columns: repeat(3, 1fr); }
.st-nums div, .st-bests div, .st-grade-nums div, .st-fn > div:not(.arrow) {
  background: var(--bg); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 10px; text-align: center;
}
.st-nums span, .st-bests span, .st-grade-nums span, .st-fn span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.st-nums b, .st-bests b, .st-grade-nums b, .st-fn b { font-family: var(--mono); font-size: 22px; }
.st-nums small, .st-grade-nums small { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 2px; }
.st-bests small, .st-fn small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.st-week { grid-column: 1 / -1; margin: 0; font-weight: 700; }
.st-week .up { display: inline-block; white-space: nowrap; margin-left: 10px; padding: 0 8px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 800; }

/* 2. カレンダー */
.cal-scroll { overflow-x: auto; padding-bottom: 4px; }
.cal { display: inline-block; min-width: max-content; }
.cal-months { display: flex; gap: 4px; margin-left: 26px; font-size: 11px; font-weight: 700; color: var(--muted); height: 16px; }
.cal-months span { width: var(--cal); white-space: nowrap; overflow: visible; }
.cal-grid { display: flex; gap: 4px; }
.cal { --cal: 22px; }
.cal-dow, .cal-col { display: grid; grid-template-rows: repeat(7, var(--cal)); gap: 4px; }
.cal-dow { width: 22px; font-size: 10px; font-weight: 700; color: var(--muted); line-height: var(--cal); }
.cal-cell { width: var(--cal, 16px); height: var(--cal, 16px); border-radius: 4px; padding: 0; border: 1.5px solid var(--soft-line); background: #faf6ea; display: inline-block; vertical-align: middle; }
button.cal-cell:hover { border-color: var(--ink); }
.cal-cell.lv1 { background: #dceaff; border-color: #b6d0f7; }
.cal-cell.lv2 { background: #9cc3ff; border-color: #7aa9ef; }
.cal-cell.lv3 { background: #3b82ff; border-color: #2a6ae0; }
.cal-cell.lv4 { background: #1f4fb0; border-color: #163d8c; }
.cal-cell.future { visibility: hidden; }
.cal-cell.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal-cell.sel { outline: 3px solid var(--pink); outline-offset: 1px; }
.cal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 12px; font-size: 13px; font-weight: 700; }
.cal-legend { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); flex-wrap: wrap; }
.cal-legend small { font-size: 11px; }
.cal-detail:empty { display: none; }
.cal-detail { margin-top: 12px; padding: 10px 12px; background: var(--bg); border: 2px solid var(--ink); border-radius: 12px; font-size: 14px; font-weight: 700; }
.cal-detail ul { margin: 6px 0 0; padding-left: 1.2em; font-weight: 500; }

/* 3. グラフ */
.st-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
.st-controls .seg button, .st-filter button { padding: 4px 12px; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .grid { stroke: var(--soft-line); stroke-width: 1; }
.chart .ax { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--brand); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { fill: var(--accent); stroke: var(--ink); stroke-width: 2; }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px;
  font-size: 13px; font-weight: 700; box-shadow: 2px 2px 0 var(--ink);
}
.chart-empty { text-align: center; color: var(--muted); font-weight: 700; padding: 30px 0; margin: 0; }
.st-fn { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.st-fn > div:not(.arrow) { flex: 1; }
.st-fn .now { background: var(--ok-soft); }
.st-fn .arrow { font-family: var(--display); font-weight: 800; font-size: 26px; }
.st-bests { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* 4. 級ごと */
.st-grade {
  background: var(--surface); border: var(--bw) solid var(--ink); border-radius: 20px;
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
  border-left: 14px solid var(--g);
}
.st-grade-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; }
.st-grade-head h3 { font-family: var(--display); font-size: 22px; margin: 0; }
.st-next { font-weight: 700; font-size: 14px; background: var(--g-soft); padding: 0 10px; border-radius: 8px; }
.st-grade-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.learn-bar, .st-cats .bar { display: block; height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: var(--bg); overflow: hidden; margin-top: 12px; }
.learn-bar i, .st-cats .bar i { display: block; height: 100%; background: var(--g); border-right: 2px solid var(--ink); }
.learn-bar i[style="width:0%"], .st-cats .bar i[style="width:0%"] { border-right: 0; }
.stage-map { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; }
.sm {
  width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 2px solid var(--soft-line); background: #faf6ea;
  font-family: var(--display); font-weight: 800; font-size: 13px; line-height: 1;
}
.sm:hover { border-color: var(--ink); }
.sm.rS { background: var(--accent); border-color: var(--ink); }
.sm.rA { background: var(--pink); border-color: var(--ink); }
.sm.rB { background: var(--brand); border-color: var(--ink); color: #fff; }
.sm.rC, .sm.rD { background: #c9c1ad; border-color: var(--ink); }
.sm.lock { background: repeating-linear-gradient(45deg, #eee7d4 0 3px, #f7f2e4 3px 6px); border-style: dashed; }
.st-cats { margin-top: 12px; }
.st-cats summary { cursor: pointer; font-weight: 800; font-size: 14px; }
.st-cats ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.st-cats li { display: grid; grid-template-columns: minmax(0, 11em) 1fr auto; gap: 10px; align-items: center; font-size: 13px; font-weight: 700; }
.st-cats li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-cats .bar { margin-top: 0; height: 10px; }
.st-cats b { font-family: var(--mono); font-size: 12px; min-width: 4.5em; text-align: right; }

/* 5. 履歴 */
.st-filter { margin-bottom: 12px; flex-wrap: wrap; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist { border-bottom: 2px solid var(--soft-line); }
.hist:last-child { border-bottom: 0; }
.hist-row {
  width: 100%; background: none; border: 0; padding: 10px 4px; text-align: left;
  display: grid; grid-template-columns: 7.5em 1fr auto 4.2em; grid-template-areas: "date name rank score" "date meta rank score";
  gap: 0 12px; align-items: center;
}
.hist-row:hover { background: var(--bg); }
.hist-date { grid-area: date; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.hist-name { grid-area: name; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { grid-area: meta; font-size: 12px; font-weight: 700; color: var(--muted); }
.hist-score { grid-area: score; font-family: var(--mono); font-weight: 700; font-size: 18px; text-align: right; }
.hist-score small { font-size: 11px; }
.hist .mini-rank { grid-area: rank; }
.mini-rank {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 15px; background: #c9c1ad;
}
.mini-rank.S { background: var(--accent); } .mini-rank.A { background: var(--pink); } .mini-rank.B { background: var(--brand); color: #fff; }
.g-chip { font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 7px; margin-right: 6px; border-radius: 99px; border: 2px solid var(--ink); background: var(--g); vertical-align: 1px; }
.hist-detail { padding: 2px 4px 14px 8.4em; font-size: 14px; }
.hist-detail p { margin: 4px 0; }
.mw { font-family: var(--mono); font-weight: 700; background: var(--ng-soft); border-radius: 6px; padding: 0 6px; margin-right: 2px; display: inline-block; }
.hist-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn.small { padding: 5px 12px; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
#st-more, #home-recent-more { margin-top: 12px; }
.home-recent .muted { margin: 0; font-weight: 700; }
.st-fun { margin: 14px 0 0; font-weight: 700; }
.st-fun b { background: var(--accent); padding: 0 6px; border-radius: 6px; }

@media (max-width: 640px) {
  .header-nav { gap: 6px; }
  .cal { --cal: 16px; }
  .st-goal .seg button { padding: 4px 8px; }
  .res-news li { font-size: 13px; }
  .st-card { padding: 16px 14px; }
  .st-today { grid-template-columns: 1fr; }
  .st-nums, .st-bests { grid-template-columns: repeat(2, 1fr); }
  .st-nums.big { grid-template-columns: repeat(2, 1fr); }
  .st-grade { padding: 14px 14px; border-left-width: 10px; }
  .st-grade-nums div { padding: 6px 4px; }
  .st-grade-nums b { font-size: 18px; }
  .st-fn { gap: 6px; }
  .st-fn b { font-size: 18px; }
  .hist-row { grid-template-columns: 1fr auto 3.6em; grid-template-areas: "date rank score" "name rank score" "meta meta meta"; }
  .hist-detail { padding-left: 4px; }
  .st-cats li { grid-template-columns: minmax(0, 7em) 1fr auto; }
}
@media (max-width: 420px) {
  .logo-mark { display: none; }
  .logo-text { font-size: 15px; white-space: nowrap; }
  .site-header { padding: 10px 12px; gap: 8px; }
  .plan-btn { font-size: 11px; padding: 5px 8px; white-space: nowrap; }
  .plan-btn .pc { display: none; }
  .header-nav .ic { display: none; }   /* せまい画面では、単語帳・きろくの絵をはずす */
}
@media (max-width: 360px) {
  /* もっとせまい画面では、単語帳・きろくは絵だけにする */
  .header-nav .ic { display: inline; }
  .header-nav .lb { display: none; }
  .header-nav { gap: 5px; }
}
