*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: #fff;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ── Header ── */
.site-header {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-title { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.05em; }
.site-header nav a {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
}
.site-header nav a:hover { color: #2563eb; }

/* ── Main ── */
.main-content { flex: 1; }
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1rem;
}
.container-narrow {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  margin-top: 2rem;
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ── Page title ── */
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 0.75rem;
}
.page-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fafafa;
  padding: 1rem;
  text-align: center;
}
.stat-label { font-size: 0.7rem; color: #6b7280; margin-bottom: 0.25rem; font-weight: 500; }
.stat-value { font-size: 1.25rem; font-weight: 700; }

/* ── Section heading ── */
.section-heading {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

/* ── Difficulty / Set list ── */
.card-list { display: flex; flex-direction: column; gap: 0.75rem; }
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  transition: border-color .15s, background .15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.card-link:hover { border-color: #2563eb; background: #eff6ff; }
.card-link .card-main { flex: 1; }
.card-link .card-title { font-weight: 700; font-size: 1rem; letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.card-link .card-desc { font-size: 0.8rem; color: #6b7280; }
.card-link .card-meta { font-size: 0.85rem; font-weight: 700; text-align: right; }
.card-link .card-sub { font-size: 0.75rem; color: #9ca3af; }
.circle-dots { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-top: 0.5rem; }
.circle-dot { font-size: 0.85rem; color: #9ca3af; font-weight: 600; }

/* ── Ad placeholder ── */
.ad-box {
  border: 1px dashed #d1d5db;
  border-radius: 0.5rem;
  background: #f9fafb;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 2rem;
}

/* ── Submit CTA ── */
.cta-box {
  margin-top: 2rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fafafa;
  padding: 2rem;
  text-align: center;
}
.cta-box h2 { font-size: 1rem; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.cta-box p { font-size: 0.85rem; color: #6b7280; line-height: 1.7; margin-bottom: 1.5rem; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.75rem 2.5rem;
  border-radius: 0.375rem;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: #fff; color: #1a1a2e; border: 1px solid #e5e7eb; }
.btn-outline:hover { background: #f3f4f6; }
.btn-black { background: #000; color: #fff; }
.btn-black:hover { background: #222; }
.btn-full { width: 100%; display: block; text-align: center; }

/* ── Quiz sticky bar ── */
.quiz-bar {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: sticky;
  top: 56px;
  z-index: 40;
  padding: 0.75rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.quiz-bar-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}
.quiz-bar-title { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.05em; }
.quiz-bar-progress {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  padding: 0.25rem 0.75rem;
  white-space: nowrap;
}
.quiz-dots {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.quiz-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #9ca3af;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quiz-dot.answered { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── Question card ── */
.question-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.question-badge {
  display: inline-block;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.75rem;
  border-radius: 0.25rem;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}
.question-text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.option-list { display: flex; flex-direction: column; gap: 0.75rem; }
.option-btn {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color .1s, background .1s;
  font-family: inherit;
}
.option-btn:hover:not(:disabled) { border-color: #93c5fd; background: #eff6ff; }
.option-btn:disabled { cursor: default; }
.option-btn .opt-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #6b7280;
  flex-shrink: 0;
}
.option-btn.correct { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 700; }
.option-btn.correct .opt-label { background: #2563eb; border-color: #2563eb; color: #fff; }
.option-btn.wrong { border-color: #ef4444; background: #fef2f2; color: #b91c1c; font-weight: 700; }
.option-btn.wrong .opt-label { background: #ef4444; border-color: #ef4444; color: #fff; }
.option-btn.dimmed { opacity: 0.4; }

/* ── Feedback box ── */
.feedback {
  margin-top: 1.25rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 0.9rem;
}
.feedback.correct-fb { background: #f0fdf4; border: 1px solid #bbf7d0; }
.feedback.wrong-fb   { background: #fef2f2; border: 1px solid #fecaca; }
.feedback-title { font-weight: 700; font-size: 1rem; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.feedback-title.c { color: #16a34a; }
.feedback-title.w { color: #dc2626; }
.feedback-explanation { color: #4b5563; line-height: 1.6; border-top: 1px solid rgba(0,0,0,.06); margin-top: 0.75rem; padding-top: 0.75rem; }

/* ── Submit section ── */
.submit-section { padding: 2rem 0; text-align: center; border-top: 1px solid #e5e7eb; margin-top: 1rem; }
.submit-section p { font-size: 0.85rem; font-weight: 700; color: #1a1a2e; margin-bottom: 1.5rem; letter-spacing: 0.05em; }

/* ── Results ── */
.result-header {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2rem;
}
.result-header h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.1em; margin-bottom: 0.25rem; }
.result-header p { font-size: 0.85rem; color: #6b7280; }
.result-card { border: 1px solid #e5e7eb; border-radius: 0.5rem; overflow: hidden; margin-bottom: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.result-top {
  padding: 2rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.score-big { font-size: 3rem; font-weight: 700; line-height: 1; }
.score-big span { font-size: 1.5rem; }
.score-label { font-size: 0.75rem; font-weight: 700; color: #6b7280; letter-spacing: 0.08em; margin-top: 0.25rem; }
.rank-badge {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  padding: 0.75rem 1.25rem;
  border-radius: 0.375rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.result-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.result-table th, .result-table td { padding: 1rem 1.25rem; }
.result-table th { background: #f9fafb; font-weight: 700; color: #6b7280; width: 35%; text-align: left; }
.result-table tr { border-bottom: 1px solid #e5e7eb; }
.result-table tr:last-child { border-bottom: none; }
.rank-value { color: #2563eb; font-weight: 700; font-size: 1rem; }

/* ── Comparison bars ── */
.compare-section { border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 2rem; margin-bottom: 2rem; background: #fafafa; }
.bar-group { margin-bottom: 1.5rem; }
.bar-group:last-child { margin-bottom: 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem; }
.bar-track { width: 100%; background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.bar-fill-blue { height: 16px; background: #2563eb; border-radius: 9999px; transition: width 1s ease; }
.bar-fill-gray { height: 12px; background: #9ca3af; border-radius: 9999px; transition: width 1s ease; }
.percentile-note { text-align: center; font-size: 0.875rem; font-weight: 700; padding-top: 1.25rem; border-top: 1px solid #e5e7eb; margin-top: 1.25rem; }

/* ── Missed questions ── */
.missed-card { border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1.5rem; margin-bottom: 1rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.missed-q { font-size: 0.875rem; font-weight: 700; margin-bottom: 0.75rem; line-height: 1.5; }
.missed-answer { font-size: 0.75rem; color: #6b7280; margin-bottom: 0.75rem; }
.missed-answer strong { background: #f3f4f6; padding: 0.15rem 0.5rem; border-radius: 0.25rem; color: #1a1a2e; }
.nat-rate-label { font-size: 0.75rem; font-weight: 700; color: #6b7280; margin-bottom: 0.4rem; }
.nat-bar-track { width: 100%; background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.nat-bar-fill { height: 8px; border-radius: 9999px; }
.nat-bar-fill.red    { background: #ef4444; }
.nat-bar-fill.yellow { background: #f59e0b; }
.nat-bar-fill.green  { background: #22c55e; }

/* ── Share & actions ── */
.share-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-bottom: 2rem; padding-top: 2rem; border-top: 1px solid #e5e7eb; }
.share-actions .btn { max-width: 360px; width: 100%; }

/* ── Form ── */
.form-card { border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 2rem; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; font-weight: 700; font-size: 0.875rem; margin-bottom: 0.5rem; }
.form-label span { color: #ef4444; }
.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
textarea.form-control { min-height: 100px; resize: vertical; }
.option-input-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.option-input-row input[type=radio] { width: 16px; height: 16px; accent-color: #2563eb; flex-shrink: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; margin-top: 1rem; }
.success-box { text-align: center; padding: 3rem 2rem; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 0.5rem; }
.success-box h2 { color: #16a34a; font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ── Breadcrumb ── */
.breadcrumb { font-size: 0.8rem; color: #6b7280; margin-bottom: 1rem; }
.breadcrumb a { color: #6b7280; }
.breadcrumb a:hover { color: #2563eb; }

/* ── Back link ── */
.back-link { font-size: 0.8rem; color: #6b7280; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: #2563eb; }
