/* oboenote vertical slice: 書き取りモード UI
 * クリーム地 + 濃いオレンジ（動画ブランドと一致）
 * コントラスト AA 以上 (4.5:1)
 * モバイル縦向き前提（学校 iPad を想定）
 */

:root {
  --bg: #FFF6E3;         /* クリーム地 */
  --accent: #C2410C;     /* 濃いオレンジ */
  --accent-light: #FF8A3D;
  --text: #2A1A08;
  --text-sub: #6B5641;
  --correct: #178045;
  --incorrect: #C92A45;
  --card: #FFFFFF;
  --border: #E8D8BC;
  --shadow: 0 2px 8px rgba(60, 40, 10, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
               "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  min-height: 100vh;
}

h1 {
  font-size: 24px;
  color: var(--accent);
  margin: 0 0 16px;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 20px;
  margin: 24px 0 12px;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================================================
 * ランディングページ（LP、初回訪問・未ログイン時）
 * ====================================================================== */

.lp {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ① Hero */
.lp-hero {
  text-align: center;
  padding: 36px 16px 28px;
  background: linear-gradient(180deg, #fff6e3 0%, #fff 100%);
  border-radius: 0 0 24px 24px;
  margin: 0 -16px 24px;
  box-shadow: 0 2px 8px rgba(60,40,10,0.05);
}
.lp-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.lp-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: block;
}
.lp-brand-text {
  font-size: 17px;
  color: var(--accent);
  letter-spacing: 0.15em;
  font-weight: 700;
}
.lp-headline {
  font-size: 26px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 20px;
  font-weight: 700;
}
.lp-highlight {
  background: linear-gradient(180deg, transparent 60%, #ffe4b5 60%);
  padding: 0 4px;
  color: var(--accent);
}
.lp-lead {
  font-size: 15px;
  color: var(--text-sub);
  line-height: 1.8;
  margin: 0 0 28px;
}
.lp-lead strong {
  color: var(--accent);
}
.lp-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  padding: 16px 32px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(194,65,12,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.lp-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(194,65,12,0.4);
}
.lp-cta-arrow {
  display: inline-block;
  animation: bounceDown 1.5s ease-in-out infinite;
}
@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* セクション共通 */
.lp-section-title {
  font-size: 22px;
  text-align: center;
  color: var(--accent);
  margin: 0 0 22px;
  font-weight: 700;
}

/* ② Problem */
.lp-problem {
  background: var(--card);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.lp-compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px 0 20px;
}
.lp-compare-item {
  background: #faf0d8;
  border-radius: 12px;
  padding: 16px 12px;
  flex: 1;
  text-align: center;
  min-width: 0;
}
.lp-compare-label {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
  font-weight: 600;
}
.lp-compare-example {
  font-size: 48px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  margin: 8px 0;
}
.lp-compare-arrow {
  color: var(--accent);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}
.lp-compare-arrow svg {
  width: 28px;
  height: 28px;
}
.lp-compare-blank {
  color: var(--accent-light);
}
.lp-compare-hint {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}
.lp-problem-note {
  text-align: center;
  font-size: 15px;
  color: var(--text);
  line-height: 1.8;
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.lp-problem-note strong {
  color: var(--accent);
}

/* ③ Solution ステップ */
.lp-solution {
  margin-bottom: 28px;
}
.lp-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.lp-step {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.lp-step-num {
  background: var(--accent);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}
.lp-step-body {
  flex: 1;
  min-width: 0;
}
.lp-step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}
.lp-step-text {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.6;
}

/* ④ 特徴（1 列、横並び） */
.lp-features {
  margin-bottom: 28px;
}
.lp-feature-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lp-feature {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.lp-feature-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: #fff6e3;
  border-radius: 10px;
}
.lp-feature-icon svg {
  width: 26px;
  height: 26px;
}
.lp-feature-body {
  flex: 1;
  min-width: 0;
}
.lp-feature-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.4;
}
.lp-feature-text {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ⑤ 作った人セクション */
.lp-maker {
  background: linear-gradient(135deg, #fff6e3, #ffe8c7);
  border-radius: 16px;
  padding: 24px 20px;
  margin-bottom: 20px;
  text-align: center;
}
.lp-maker-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(194,65,12,0.15);
}
.lp-maker-icon svg {
  width: 32px;
  height: 32px;
}
.lp-maker-title {
  font-size: 18px;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 700;
}
.lp-maker-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 10px;
  font-weight: 500;
}
.lp-maker-sub {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.7;
  margin: 0;
}

/* ⑥ 安心材料 */
.lp-trust {
  background: #eef9f2;
  border: 2px solid #b6e5c9;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 28px;
  text-align: center;
}
.lp-trust-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  color: var(--correct);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lp-trust-icon svg {
  width: 40px;
  height: 40px;
}
.lp-trust-title {
  font-size: 18px;
  color: var(--correct);
  margin: 0 0 10px;
  font-weight: 700;
}
.lp-trust-lead {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 14px;
}
.lp-trust-lead strong {
  color: var(--correct);
  font-weight: 700;
}
.lp-trust-list {
  text-align: left;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  padding-left: 20px;
  margin: 0;
}
.lp-trust-list strong {
  color: var(--correct);
}

/* ⑥ CTA ブロック（学年ピッカー） */
.lp-cta-block {
  scroll-margin-top: 20px;
}

/* ⑦ Footer */
.lp-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
}
.lp-footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 12px 0;
}
.lp-footer-links a {
  color: var(--accent);
  text-decoration: none;
}
.lp-footer-links a:hover {
  text-decoration: underline;
}
.lp-footer-note {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 8px;
}

.picker-card {
  background: var(--card);
  border-radius: 20px;
  padding: 24px 20px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  text-align: center;
}
.picker-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.picker-sub {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 16px;
}
.grade-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}
.grade-btn {
  background: linear-gradient(135deg, #fff6e3, #ffe4b5);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px 10px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  /* コンテンツに合わせたコンパクトな縦長 */
}
.grade-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.grade-btn:active {
  transform: translateY(0);
}
.grade-num {
  font-size: 34px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 2px;
}
.grade-label {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1;
}
.picker-note {
  font-size: 12px;
  color: var(--text-sub);
  margin: 0;
  line-height: 1.6;
}

.lp-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}
.lp-feature {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}
.lp-feature-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}
.lp-feature-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.lp-feature-text {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* ---- ホーム: 今日の予定 ---- */

.today-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  text-align: center;
}

.today-label {
  color: var(--text-sub);
  font-size: 14px;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.today-count {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.today-count-unit {
  font-size: 18px;
  color: var(--text);
  margin-left: 6px;
}

.start-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  padding: 18px;
  border: none;
  border-radius: 12px;
  margin: 20px 0;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.start-btn:hover { background: #a3340a; }
.start-btn:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}

/* ---- 1 週間カレンダー ---- */

.calendar {
  background: var(--card);
  border-radius: 16px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.calendar-title {
  font-size: 16px;
  color: var(--text-sub);
  margin-bottom: 14px;
  text-align: center;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  text-align: center;
  padding: 10px 2px;
  border-radius: 10px;
  background: #faf0d8;
}

.day-cell.today {
  background: var(--accent-light);
  color: #fff;
}

.day-cell .dow {
  font-size: 12px;
  opacity: 0.8;
}

.day-cell .count {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.day-cell.today .count { color: #fff; }

.day-cell .unit {
  font-size: 10px;
  opacity: 0.7;
}

/* ---- 書き取り画面 ---- */

.drill-card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.reading {
  font-size: 24px;
  text-align: center;
  color: var(--text-sub);
  margin: 0 0 16px;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* 文脈文：熟語を 1 塊のスロットとして扱う */
.context-sentence {
  text-align: center;
  font-size: 30px;
  line-height: 2.0;
  margin: 24px 0 20px;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* 熟語スロット: ブランク時 = 下線 / revealed = 淡い背景 */
.jukugo-slot {
  display: inline-block;
  margin: 0 4px;
  vertical-align: baseline;
  font-size: inherit;
  line-height: 1.2;
}

.jukugo-slot.blank {
  color: var(--accent-light);
  border-bottom: 2px dashed var(--accent);
  padding: 0 6px;
  letter-spacing: 0.1em;
}

.jukugo-slot.revealed {
  background: #faf0d8;
  color: var(--text);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ruby: 字ごとに控えめな読みを付ける */
.jukugo-slot ruby rt {
  font-size: 0.4em;
  color: var(--text-sub);
  letter-spacing: 0.02em;
  font-weight: 400;
}

/* タップで間違い指定可能な字 */
.jukugo-slot .ch-wrap {
  display: inline-block;
  padding: 0 4px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.jukugo-slot .ch-wrap.tappable {
  cursor: pointer;
  position: relative;
}
.jukugo-slot .ch-wrap.tappable:hover {
  background: #fff3e0;
}
.jukugo-slot .ch-wrap.marked-wrong {
  background: var(--incorrect) !important;
  color: #fff !important;
}
.jukugo-slot .ch-wrap.marked-wrong rt {
  color: #ffd4d9 !important;
}

/* 旧 UI の互換用（他画面が使う場合） */
.jukugo-display {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 28px 0;
}

.jukugo-display .ch {
  font-size: 72px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 12px;
  background: #faf0d8;
  color: var(--text);
  min-width: 90px;
  text-align: center;
}

.jukugo-display .ch.blank,
.jukugo-inline .ch.blank {
  background: transparent;
  border: 2px dashed var(--accent);
  color: var(--accent-light);
}

.jukugo-display .ch.revealed,
.jukugo-inline .ch.revealed {
  background: #faf0d8;
  border: none;
  color: var(--text);
}

/* 意味 — シンプルなラベル + 箱 */
.meaning-wrapper {
  margin: 24px 0 16px;
}
.meaning-badge {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  padding-left: 4px;
}
.meaning-box {
  background: #faf0d8;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.meaning-text {
  font-size: 18px;
  color: var(--text);
  line-height: 1.5;
}

/* かけた？ ラベル */
.grade-label {
  text-align: center;
  color: var(--text-sub);
  margin: 20px 0 12px;
  font-size: 16px;
}

/* 3 回書こう促し */
.write3-prompt {
  background: #fff3e0;
  border: 2px solid var(--accent-light);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}
.write3-icon {
  font-size: 32px;
}
.write3-text {
  font-size: 18px;
  color: var(--text);
  margin-top: 4px;
}
.write3-count {
  color: var(--accent);
  font-weight: 700;
  font-size: 22px;
}

/* full-width ボタン */
.btn.full {
  width: 100%;
  margin-top: 8px;
}

/* 残り問題数 */
.remaining {
  float: right;
}

/* セッション進捗バー（drill 画面の上部） */
.session-progress {
  margin: 0 0 16px;
}
.progress-text {
  text-align: center;
  font-size: 15px;
  color: var(--text-sub);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}
.progress-current {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.progress-sep {
  margin: 0 4px;
  color: var(--text-sub);
}
.progress-total {
  font-size: 18px;
  color: var(--text);
}
.progress-unit {
  margin-left: 4px;
  font-size: 13px;
}
.progress-bar-outer {
  height: 8px;
  background: #f0e4cc;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease-out;
}

/* Cram ラウンド中はラベル表示 + 進捗バーの色を赤系に */
.round-label {
  text-align: center;
  font-size: 13px;
  color: var(--incorrect);
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.session-progress.is-cram .progress-bar-inner {
  background: linear-gradient(90deg, #ec9fa8, var(--incorrect));
}
.session-progress.is-cram .progress-current {
  color: var(--incorrect);
}

/* 完了画面のラウンド達成バッジ */
.round-summary {
  margin-top: 16px;
  padding: 10px 18px;
  background: #fff3e0;
  border: 2px solid var(--accent);
  border-radius: 999px;
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}
.round-summary.round-pending {
  background: #fde0e3;
  border-color: var(--incorrect);
  color: var(--incorrect);
}

/* ========================================================================
 * 先行登録モーダル（完了画面の後に表示、localStorage で制御）
 * ====================================================================== */
.prompt-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: promptFadeIn 0.25s ease-out;
}
@keyframes promptFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.prompt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(60, 40, 10, 0.5);
}
.prompt-modal-card {
  position: relative;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  text-align: center;
  animation: promptSlideUp 0.3s ease-out;
}
@keyframes promptSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
.prompt-modal-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 8px;
}
.prompt-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 12px;
  line-height: 1.4;
}
.prompt-modal-note {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0 0 20px;
}
.prompt-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  width: 100%;
}
.prompt-btn-line {
  background: #06C755; /* LINE ブランドカラー */
}
.prompt-btn-line:hover { background: #05a847; }
.prompt-btn-mail {
  background: var(--accent);
}
.prompt-btn-mail:hover { background: #a3340a; }
.prompt-btn-icon {
  font-size: 18px;
}
.prompt-btn-dismiss {
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 14px;
  padding: 8px;
  margin-top: 4px;
  cursor: pointer;
}
.prompt-btn-dismiss:hover {
  color: var(--text);
}

/* ========================================================================
 * セッション完了画面 v2（視覚強化版）
 * ====================================================================== */

/* ヒーローカード（🎉 + 「おわり！」+ スコアバッジ） */
.done-hero {
  background: linear-gradient(135deg, #fff 0%, #fff6e3 100%);
  border-radius: 20px;
  padding: 32px 20px 28px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 20px;
}
.done-hero-icon {
  font-size: 68px;
  line-height: 1;
  margin-bottom: 8px;
}
.done-hero-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 20px;
}

/* 大きなスコアバッジ（⭕/✗） */
.score-row {
  display: flex;
  justify-content: center;
  gap: 16px;
}
.score-badge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border: 3px solid var(--card);
}
.score-correct {
  background: linear-gradient(135deg, #d9f2e4, #b6e5c9);
}
.score-incorrect {
  background: linear-gradient(135deg, #fde0e3, #fac2c8);
}
.score-icon {
  font-size: 22px;
  margin-top: 4px;
  line-height: 1;
}
.score-correct .score-icon { color: var(--correct); }
.score-incorrect .score-icon { color: var(--incorrect); }
.score-num {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}
.score-correct .score-num { color: var(--correct); }
.score-incorrect .score-num { color: var(--incorrect); }

/* 「つぎは いつ？」カード */
.when-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.when-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 18px;
}
.when-group {
  margin-bottom: 18px;
}
.when-group:last-of-type {
  margin-bottom: 8px;
}
.when-group-label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  padding-left: 4px;
  border-left: 4px solid var(--accent);
  padding-left: 10px;
}
.when-when {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.when-count {
  font-size: 13px;
  color: var(--text-sub);
}

/* 字タイル（grid） */
.when-chars {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
}
.when-char {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 500;
  border-radius: 12px;
  color: var(--text);
}
.when-char.was-correct {
  background: linear-gradient(135deg, #d9f2e4, #c3ebd4);
  border: 2px solid #8ed4a6;
}
.when-char.was-incorrect {
  background: linear-gradient(135deg, #fde0e3, #fbcad0);
  border: 2px solid #ec9fa8;
}

.when-note {
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.done-footer {
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
  margin-top: 18px;
}

/* ========================================================================
 * 学年テーマ別のオーバーライド
 * ====================================================================== */

/* 中学年 (mid): 絵文字 1 段階減、文字サイズやや控えめ */
[data-theme="mid"] .done-hero-icon { font-size: 56px; }
[data-theme="mid"] .done-hero-title {
  font-size: 22px;
  color: var(--text);
}
[data-theme="mid"] .score-badge {
  width: 86px;
  height: 86px;
  border-radius: 20px;
}
[data-theme="mid"] .when-char {
  border-radius: 10px;
  font-size: 30px;
}

/* 高学年 (high): モノトーン寄り、絵文字最小、角丸抑制、数値中心 */
[data-theme="high"] .done-hero {
  background: var(--card);
  padding: 24px 20px 20px;
}
[data-theme="high"] .done-hero-icon {
  font-size: 40px;
  color: var(--correct);
  font-weight: 300;
}
[data-theme="high"] .done-hero-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}
[data-theme="high"] .score-badge {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  background: var(--card);
  border: 2px solid var(--border);
  box-shadow: none;
}
[data-theme="high"] .score-correct {
  border-color: #8ed4a6;
}
[data-theme="high"] .score-incorrect {
  border-color: #ec9fa8;
}
[data-theme="high"] .score-icon {
  font-size: 20px;
}
[data-theme="high"] .score-num {
  font-size: 26px;
  font-weight: 700;
}
[data-theme="high"] .when-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: 0.05em;
}
[data-theme="high"] .when-when {
  font-size: 16px;
  color: var(--text);
}
[data-theme="high"] .when-group-label {
  border-left-width: 3px;
}
[data-theme="high"] .when-char {
  border-radius: 6px;
  font-size: 24px;
  border-width: 1px;
}
[data-theme="high"] .when-char.was-correct {
  background: #eef9f2;
}
[data-theme="high"] .when-char.was-incorrect {
  background: #fdf0f2;
}
[data-theme="high"] .when-note {
  font-style: normal;
  font-size: 12px;
}
[data-theme="high"] .start-btn {
  border-radius: 8px;
  font-size: 16px;
  padding: 14px;
}

/* テーマプレビュースイッチャー（開発用） */
.theme-switcher {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
}
.theme-switcher span { margin-right: 8px; }
.theme-switcher a {
  display: inline-block;
  margin: 0 4px;
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-sub);
}
.theme-switcher a:hover {
  background: #faf0d8;
  border-color: var(--accent);
  color: var(--accent);
}

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  flex: 1;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.btn-reveal {
  background: #faf0d8;
  color: var(--accent);
  flex: 2;
}

.btn-correct {
  background: var(--correct);
  color: #fff;
}
.btn-correct:hover { background: #126033; }

.btn-incorrect {
  background: var(--incorrect);
  color: #fff;
}
.btn-incorrect:hover { background: #9e1d35; }

/* ---- 完了画面 ---- */

.done-card {
  background: var(--card);
  border-radius: 16px;
  padding: 36px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 20px;
}

.done-icon {
  font-size: 72px;
  margin-bottom: 12px;
}

.done-title {
  font-size: 24px;
  color: var(--accent);
  margin: 0 0 16px;
  font-weight: 700;
}

.done-detail {
  background: #faf0d8;
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
}

.done-char {
  font-size: 56px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.done-next {
  font-size: 18px;
  color: var(--text);
}

.done-next .days {
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
}

/* ---- 共通 ---- */

.nav-link {
  display: inline-block;
  padding: 10px 16px;
  color: var(--text-sub);
  font-size: 14px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-sub);
}

.empty-state .big {
  font-size: 48px;
  margin-bottom: 12px;
}
