* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  background: #f1f5f9; color: #1e293b; line-height: 1.5;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f1f5f9; }
.screen { padding: 0 16px 32px; }

/* ===== hero ===== */
.hero { text-align: center; padding: 28px 8px 20px; }
.hero-badge {
  display: inline-block; background: #dbeafe; color: #1d4ed8;
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
}
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.hero-sub { font-size: 13px; color: #64748b; margin-top: 4px; }

/* ===== cards ===== */
.card {
  background: #fff; border-radius: 16px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 14px;
}
.card-title { font-weight: 800; font-size: 15px; }
.card-sub { font-size: 12px; color: #64748b; margin-top: 4px; }
.kari { font-size: 11px; color: #94a3b8; font-weight: 400; }

/* choice toggle */
.choice-toggle { display: flex; gap: 8px; margin-top: 10px; }
.choice-toggle button {
  flex: 1; padding: 10px 0; border-radius: 10px; border: 2px solid #e2e8f0;
  background: #fff; font-size: 15px; font-weight: 700; color: #64748b; cursor: pointer;
}
.choice-toggle button.on { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }

/* exam tabs */
.exam-tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.exam-tab {
  border: 2px solid #e2e8f0; background: #fff; border-radius: 10px;
  padding: 8px 4px; font-size: 12px; font-weight: 800; color: #64748b; cursor: pointer;
  line-height: 1.3; text-align: center;
}
.exam-tab.on { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.exam-tab-prog { display: block; font-size: 10px; font-weight: 700; color: #94a3b8; margin-top: 2px; }
.exam-tab.on .exam-tab-prog { color: #3b82f6; }

/* category cards */
.cat-card { display: block; width: 100%; text-align: left; border: none; cursor: pointer; position: relative; }
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px;
}
.cat-info { flex: 1; min-width: 0; }
.cat-name { font-weight: 800; font-size: 16px; }
.cat-sub { font-size: 12px; color: #64748b; }
.cat-go { color: #94a3b8; font-size: 20px; }
.cat-meter { margin-top: 10px; }
.cat-meter-label { font-size: 11px; color: #64748b; margin-bottom: 4px; display: flex; justify-content: space-between; }

.meter { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: linear-gradient(90deg,#3b82f6,#06b6d4); border-radius: 999px; width: 0%; transition: width .4s; }

/* box card */
.box-card { border: 2px solid #fecaca; }
.box-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.box-count {
  min-width: 46px; height: 46px; border-radius: 12px; background: #fef2f2; color: #dc2626;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; padding: 0 8px;
}
.exam-meter { margin-top: 12px; }
.exam-meter-label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.exam-meter .meter-fill { background: linear-gradient(90deg,#f59e0b,#ef4444); }

.exam-card .btn { margin-top: 10px; }
.exam-history { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.exam-chip { background: #f1f5f9; border-radius: 8px; font-size: 12px; font-weight: 700; padding: 4px 10px; color: #334155; }
.goal-card { border: 2px solid #86efac; background: #f0fdf4; }

/* ===== buttons ===== */
.btn {
  display: block; width: 100%; padding: 14px; border-radius: 12px; border: none;
  font-size: 15px; font-weight: 800; cursor: pointer; text-align: center;
}
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row.col { flex-direction: column; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-fire { background: #ef4444; color: #fff; }
.btn-fire:disabled { background: #fca5a5; }
.btn-dark { background: #1e293b; color: #fff; }
.btn-ghost { background: #fff; color: #475569; border: 2px solid #e2e8f0; }
.btn:active { transform: scale(.98); }

/* ===== quiz ===== */
.quiz-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; }
.quiz-quit {
  width: 36px; height: 36px; border-radius: 10px; border: none; background: #e2e8f0;
  font-size: 16px; color: #475569; cursor: pointer;
}
.quiz-mode { font-weight: 800; font-size: 14px; }
.quiz-progress-num { font-weight: 800; font-size: 14px; color: #64748b; min-width: 44px; text-align: right; }
.quiz-meter { margin-bottom: 8px; }

.q-word-wrap { text-align: center; padding: 22px 8px 14px; }
.q-src { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }
.q-word-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.q-word { font-size: 30px; font-weight: 800; letter-spacing: .5px; word-break: break-word; }
.speak-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; flex-shrink: 0;
  background: #dbeafe; font-size: 20px; cursor: pointer;
}
.speak-btn:active { transform: scale(.92); background: #bfdbfe; }
.speak-btn.small { width: 34px; height: 34px; font-size: 15px; background: #f1f5f9; }
.q-ask { font-size: 12px; color: #64748b; margin-top: 8px; }

.choices { display: grid; grid-template-columns: 1fr; gap: 8px; }
.choices.cols2 { grid-template-columns: 1fr 1fr; }
.choice-btn {
  background: #fff; border: 2px solid #e2e8f0; border-radius: 12px;
  padding: 13px 12px; font-size: 14px; font-weight: 700; color: #1e293b;
  text-align: left; cursor: pointer; min-height: 50px;
}
.choice-btn.correct { border-color: #22c55e; background: #f0fdf4; color: #15803d; }
.choice-btn.wrong { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }
.choice-btn.dim { opacity: .45; }
.choice-btn:disabled { cursor: default; }

.feedback { text-align: center; font-size: 18px; font-weight: 800; min-height: 30px; padding-top: 12px; }
.feedback.ok { color: #16a34a; }
.feedback.ng { color: #dc2626; }
.btn-next { background: #3b82f6; color: #fff; margin-top: 8px; }

/* ===== result ===== */
.result-head { text-align: center; padding: 36px 0 18px; }
.result-emoji { font-size: 48px; }
.result-score { font-size: 56px; font-weight: 800; color: #1e293b; line-height: 1.1; }
.result-denom { font-size: 24px; color: #94a3b8; }
.result-msg { font-size: 14px; color: #64748b; margin-top: 6px; font-weight: 700; }
.exam-banner {
  background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #78350f;
  border-radius: 16px; padding: 16px; font-weight: 800; text-align: center; margin-bottom: 14px;
}
.exam-banner .btn { margin-top: 10px; }
.miss-list { margin-top: 8px; }
.miss-item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.miss-item:last-child { border-bottom: none; }
.miss-en { font-weight: 800; }
.miss-ja { color: #64748b; text-align: right; }

/* ===== box list ===== */
.box-list { padding-top: 8px; }
.box-item { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.box-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.box-en { font-weight: 800; font-size: 15px; }
.box-streak { font-size: 11px; color: #f59e0b; font-weight: 700; white-space: nowrap; }
.box-ja { font-size: 13px; color: #64748b; margin-top: 2px; }
.box-empty { text-align: center; color: #94a3b8; padding: 40px 0; font-weight: 700; }

.foot { text-align: center; font-size: 11px; color: #cbd5e1; padding-top: 8px; }

/* ===== coins & ranking ===== */
.coin-card { border: 2px solid #fde68a; background: #fffbeb; }
.coin-row { display: flex; gap: 10px; }
.coin-stat { flex: 1; background: #fff; border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.coin-num { font-size: 26px; font-weight: 800; color: #b45309; min-width: 40px; text-align: center; }
.coin-label { font-size: 12px; font-weight: 700; color: #78350f; line-height: 1.3; }
.coin-label span { font-size: 10px; color: #a16207; font-weight: 400; }
.name-row { font-size: 13px; color: #78350f; margin: 10px 2px; }
.name-edit { border: 1px solid #d6d3d1; background: #fff; border-radius: 8px; font-size: 11px; padding: 2px 8px; cursor: pointer; color: #57534e; }
.coin-card .btn { margin-top: 2px; }

.rank-live { color: #ef4444; font-size: 11px; font-weight: 800; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.rank-note { text-align: center; font-size: 12px; color: #64748b; margin: 4px 0 12px; }
.rank-list { padding-bottom: 20px; }
.rank-row {
  display: flex; align-items: center; gap: 10px; background: #fff;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); font-size: 14px;
}
.rank-row.me { border: 2px solid #3b82f6; background: #eff6ff; }
.rank-pos { min-width: 42px; font-weight: 800; }
.rank-name { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-coins { font-weight: 800; color: #b45309; }
.rank-points { font-weight: 700; color: #64748b; min-width: 44px; text-align: right; }

/* ===== mode switch & 過去問チャレンジ ===== */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mode-btn {
  border: 3px solid #e2e8f0; background: #fff; border-radius: 16px;
  padding: 16px 8px; font-size: 15px; font-weight: 800; color: #64748b;
  line-height: 1.4; cursor: pointer;
}
.mode-btn.on { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
#btn-mode-kako.on { border-color: #f59e0b; background: #fffbeb; color: #b45309; }
.kako-book-hint {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
  padding: 10px 14px; font-size: 13px; color: #78350f; margin: 10px 0;
}
.kako-qnum { text-align: center; font-size: 44px; font-weight: 800; padding: 18px 0 4px; }
.kako-ask { text-align: center; font-size: 12px; color: #64748b; margin-bottom: 14px; }
.kako-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kako-choice {
  background: #fff; border: 2px solid #e2e8f0; border-radius: 14px;
  font-size: 26px; font-weight: 800; padding: 18px 0; cursor: pointer; color: #1e293b;
}
.kako-choice.ok { border-color: #22c55e; background: #f0fdf4; color: #15803d; }
.kako-choice.ng { border-color: #ef4444; background: #fef2f2; color: #b91c1c; }
.kako-choice:disabled { cursor: default; }

/* ===== grade tabs ===== */
.grade-tabs { display: flex; gap: 8px; margin: 10px 0 4px; }
.grade-tab {
  flex: 1; padding: 10px 0; border-radius: 10px; border: 2px solid #e2e8f0;
  background: #fff; font-size: 14px; font-weight: 800; color: #64748b; cursor: pointer;
}
.grade-tab.on { border-color: #1d4ed8; background: #1d4ed8; color: #fff; }

/* ===== 登録画面 ===== */
.reg-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reg-label { display: block; font-size: 12px; font-weight: 700; color: #475569; margin-bottom: 10px; }
.reg-label input, .reg-label select {
  display: block; width: 100%; margin-top: 4px; padding: 12px 10px;
  border: 2px solid #e2e8f0; border-radius: 10px; font-size: 16px; background: #fff;
}
.reg-label input:focus, .reg-label select:focus { outline: none; border-color: #3b82f6; }
.reg-error { color: #dc2626; font-size: 13px; font-weight: 700; min-height: 20px; margin-bottom: 6px; }
.reg-banner { border: 2px solid #fbbf24; background: #fffbeb; text-align: left; cursor: pointer; width: 100%; font-size: 13px; color: #78350f; }
.reg-banner span { font-size: 11px; color: #a16207; font-weight: 400; }
