:root {
  --navy: #10233f;
  --blue: #2f6fed;
  --blue-dark: #2359c6;
  --blue-soft: #edf3ff;
  --teal: #0d837a;
  --teal-soft: #eaf8f6;
  --red: #c63e3e;
  --red-soft: #fff1f1;
  --ink: #172033;
  --muted: #5d687b;
  --line: #d4ddea;
  --surface: #ffffff;
  --background: #f4f7fc;
  --line-green: #06c755;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, #e8f0ff 0, transparent 38rem),
    var(--background);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(47, 111, 237, 0.38);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: calc(38px + env(safe-area-inset-bottom));
}

.app-frame {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 0 16px 32px;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -16px 16px;
  padding: calc(17px + env(safe-area-inset-top)) 16px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.topbar h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(18px, 5vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.progress-summary {
  display: flex;
  flex: none;
  align-items: baseline;
  gap: 4px;
  min-width: 64px;
  padding: 8px 12px;
  border: 1px solid #c8d6ee;
  border-radius: 999px;
  background: #f7f9fd;
}

.progress-summary strong {
  color: var(--blue);
  font-size: 19px;
}

.progress-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.question-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(32, 61, 110, 0.07);
  animation: card-in 0.22s ease-out;
}

.question-card {
  padding: 20px;
}

.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.subject-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #bfd1fb;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
}

.question-title {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 17px;
  line-height: 1.7;
}

.question-statement {
  margin: 0 0 24px;
  color: var(--navy);
  overflow-wrap: anywhere;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 750;
  line-height: 1.75;
}

.question-divider {
  display: block;
  width: 48px;
  height: 3px;
  margin: 18px 0;
  border-radius: 999px;
  background: #c9d7f6;
}

.loading-copy {
  margin: 0;
  color: var(--muted);
}

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer-button {
  display: flex;
  min-height: 82px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 2px solid;
  border-radius: 14px;
  background: #fff;
  font-size: 17px;
  font-weight: 850;
  transition: transform 0.12s, background 0.18s, border-color 0.18s, opacity 0.18s;
}

.answer-button:not(:disabled):active {
  transform: scale(0.97);
}

.answer-button:disabled {
  cursor: default;
}

.answer-true {
  border-color: #27a9a0;
  color: #087e76;
  background: #fbffff;
}

.answer-false {
  border-color: #e46b6b;
  color: #bd3838;
  background: #fffdfd;
}

.answer-symbol {
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.answer-button.correct {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 3px rgba(13, 131, 122, 0.08);
}

.answer-button.incorrect {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.answer-button.muted {
  opacity: 0.42;
}

.feedback {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  animation: reveal 0.25s ease-out;
}

.feedback.success {
  border: 1px solid #a9d9d4;
  background: var(--teal-soft);
}

.feedback.error {
  border: 1px solid #e9b9b9;
  background: var(--red-soft);
}

.feedback-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 24px;
  font-weight: 800;
}

.success .result-mark {
  color: var(--teal);
}

.error .result-mark {
  color: var(--red);
}

.feedback-heading strong {
  display: block;
  font-size: 17px;
}

.feedback-heading span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.explanation-label {
  margin: 18px 0 6px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 850;
}

.explanation {
  margin: 0;
  color: #344257;
  font-size: 14px;
  line-height: 1.85;
}

.subtle-line-link,
.next-button,
.restart-button,
.line-button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.subtle-line-link {
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid #aec8ba;
  border-radius: 10px;
  color: #176d3e;
  background: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  font-weight: 850;
}

.next-button,
.restart-button {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  cursor: pointer;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--blue);
  font-size: 15px;
  font-weight: 850;
  box-shadow: 0 7px 18px rgba(47, 111, 237, 0.22);
}

.result-card {
  padding: 24px 20px;
  text-align: center;
}

.score-badge {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 2px auto 20px;
  place-items: center;
  border: 8px solid #dbe6fb;
  border-radius: 50%;
  color: var(--blue);
  background: #f8faff;
  box-shadow: inset 0 0 0 2px #fff;
}

.score-badge strong {
  font-size: 34px;
  line-height: 1;
}

.score-badge span {
  margin-left: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.result-card h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 25px;
}

.result-lead {
  margin: 0 auto;
  color: #3f4b60;
  font-size: 15px;
  line-height: 1.8;
}

.feature-list {
  max-width: 430px;
  margin: 20px auto;
  padding: 16px 18px;
  border-radius: 14px;
  text-align: left;
  color: #334157;
  background: #f7f9fd;
  font-size: 14px;
  line-height: 1.9;
  list-style: none;
}

.feature-list li::before {
  content: "✓";
  margin-right: 8px;
  color: var(--blue);
  font-weight: 900;
}

.line-button {
  min-height: 58px;
  margin-top: 18px;
  border-radius: 12px;
  color: #073b1d;
  background: var(--line-green);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 9px 22px rgba(6, 199, 85, 0.24);
}

.line-note {
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.restart-button {
  border: 1px solid #c5d2e5;
  color: var(--blue);
  background: #fff;
  box-shadow: none;
}

.privacy-note {
  margin: 18px 2px 0;
  color: #7a8597;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
}

.noscript {
  margin: 20px;
  padding: 16px;
  border: 1px solid #e9b9b9;
  border-radius: 12px;
  color: var(--red);
  background: var(--red-soft);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@media (min-width: 700px) {
  .app-frame {
    padding-inline: 28px;
  }

  .topbar {
    margin-inline: -28px;
    padding-inline: 28px;
  }

  .question-card,
  .result-card {
    padding: 32px;
    border-radius: 20px;
  }

  .answer-button {
    min-height: 96px;
    font-size: 20px;
  }

  .answer-symbol {
    font-size: 40px;
  }
}

@media (hover: hover) {
  .answer-button:not(:disabled):hover,
  .next-button:hover,
  .restart-button:hover,
  .subtle-line-link:hover,
  .line-button:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 370px) {
  .app-frame {
    padding-inline: 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .question-card,
  .result-card {
    padding: 17px 14px;
  }

  .question-title {
    font-size: 15px;
  }

  .question-statement {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
