:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #141414;
  background: #f6f7f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f6f7f8 100%);
}

button { font: inherit; }

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 28px 20px 40px;
}

.screen { display: none; }
.screen.active { display: block; }
#home-screen { padding-top: 38px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand span {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eceff1;
  font-weight: 700;
}

h1 {
  margin: 18px 0 10px;
  font-size: clamp(34px, 10vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.lead {
  margin: 0 0 24px;
  color: #62666b;
  font-size: 16px;
  line-height: 1.7;
}

.subject-section {
  margin: 0 0 20px;
  padding: 14px;
  border: 1px solid #e7e9ec;
  border-radius: 20px;
  background: #ffffff;
}
.subject-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.subject-heading span { font-size: 10px; font-weight: 900; letter-spacing: 0.12em; color: #8a8f96; }
.subject-heading h2 { margin: 0; font-size: 15px; }
.subject-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.subject-button {
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid #e2e5e8;
  border-radius: 15px;
  background: #f6f7f8;
  color: #4f545a;
  text-align: left;
  cursor: pointer;
}
.subject-button strong, .subject-button small { display: block; }
.subject-button strong { font-size: 15px; }
.subject-button small { margin-top: 3px; color: #858a91; font-size: 11px; }
.subject-button.active { background: #111214; border-color: #111214; color: #ffffff; }
.subject-button.active small { color: #d6d9dd; }

.subject-release-note { margin: 0 0 10px; color: #6f747a; font-size: 12px; line-height: 1.6; }
.subject-button.coming-soon, .subject-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  background: #f4f5f6;
  border-color: #e4e6e8;
  color: #676c72;
  box-shadow: none;
}
.subject-button.coming-soon small, .subject-button:disabled small { color: #8b9096; }


.primary-button,
.secondary-button,
.answer-button {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-button:active,
.secondary-button:active,
.answer-button:active { transform: scale(0.985); }

.primary-button {
  width: 100%;
  padding: 18px 20px;
  background: #111214;
  color: #ffffff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 12px 30px rgba(17, 18, 20, 0.14);
}

.primary-button.compact {
  margin-top: 18px;
  padding: 15px 18px;
}

.secondary-button {
  width: 100%;
  padding: 16px 20px;
  background: #e9ecef;
  color: #111214;
  font-weight: 800;
}

.random-start { margin-top: 12px; }

.daily-card {
  padding: 18px;
  border: 1px solid #e7e9ec;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(17, 18, 20, 0.06);
}

.daily-copy {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
}

.daily-label {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  background: #f0f2f4;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.daily-copy strong { font-size: 19px; }
.daily-copy small { color: #858a91; }

.daily-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eef0f2;
}

.daily-stats span { color: #7b8087; font-size: 12px; }
.daily-stats strong { font-size: 22px; }

.stats-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.stats-card > div,
.result-card {
  background: #ffffff;
  border: 1px solid #eceff1;
  border-radius: 18px;
  padding: 18px;
}

.stat-label,
.result-card span {
  display: block;
  color: #7b8087;
  font-size: 12px;
  margin-bottom: 6px;
}

.stats-card strong,
.result-card strong { font-size: 22px; }

.rule-note {
  margin: 16px 4px 0;
  color: #8a8f96;
  font-size: 12px;
  line-height: 1.6;
}

.quiz-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}

.text-button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #777c82;
  cursor: pointer;
}

.text-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.progress-wrap { min-width: 0; }

.progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

.progress-bar {
  height: 8px;
  background: #e6e9ec;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 10%;
  height: 100%;
  background: #17191c;
  transition: width 0.2s ease;
}

.mode-badge {
  width: fit-content;
  margin: 18px 0 -10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eceff1;
  color: #555a60;
  font-size: 11px;
  font-weight: 800;
}

.question-card {
  margin-top: 28px;
  padding: 28px 22px;
  background: #ffffff;
  border: 1px solid #ebedef;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(17, 18, 20, 0.06);
}

.question-meta {
  margin: 0 0 14px;
  color: #8a8f96;
  font-size: 12px;
  font-weight: 700;
}

.question-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.65;
  letter-spacing: -0.02em;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.answer-button {
  min-height: 118px;
  font-size: 52px;
  font-weight: 900;
  background: #f2f4f6;
  color: #15171a;
}

.answer-button:hover { background: #e9ecef; }
.answer-button:disabled { cursor: default; opacity: 0.7; }
.answer-button.picked-correct { background: #e8f4ec; opacity: 1; }
.answer-button.picked-wrong { background: #f8e8e8; opacity: 1; }

.feedback {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid #eceff1;
}

.feedback.hidden,
.hidden { display: none; }

.feedback-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.feedback-result { font-size: 20px; font-weight: 900; }
.answer-time { color: #777c82; font-size: 13px; font-weight: 800; }

.feedback-text {
  margin: 10px 0 0;
  color: #5f646a;
  line-height: 1.7;
}

#result-screen {
  padding-top: 34px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: #8b9096;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.result-mode-label {
  margin: 6px 0 0;
  color: #7d8288;
  font-size: 13px;
  font-weight: 800;
}

.result-time {
  margin-top: 18px;
  font-size: clamp(54px, 16vw, 82px);
  font-weight: 900;
  letter-spacing: -0.05em;
}

.new-best {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #111214;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.result-message {
  min-height: 1.6em;
  margin: 14px auto 0;
  color: #62666b;
  font-size: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}

.result-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 420px) {
  .app-shell { padding-inline: 14px; }
  .question-card { padding-inline: 18px; }
  .answer-button { min-height: 104px; }
}

/* v0.3: race / streak additions */
.daily-stats > div {
  display: grid;
  gap: 3px;
}

.daily-attempt-stat {
  text-align: right;
}

.daily-attempt-stat strong {
  font-size: 18px;
}

.race-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 800;
}

#streak-text {
  color: #858a91;
  transition: color 0.2s ease, transform 0.2s ease;
}

#streak-text.is-hot {
  color: #111214;
  transform: translateY(-1px);
}

.best-delta {
  font-variant-numeric: tabular-nums;
}

.best-delta.is-ahead,
.best-comparison.is-ahead {
  color: #267243;
}

.best-delta.is-behind,
.best-comparison.is-behind {
  color: #a94343;
}

.best-comparison {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

/* v1.1: topic-focused play */
.topic-section {
  margin-top: 24px;
}

.topic-lead {
  margin: -2px 2px 10px;
  color: #7b8087;
  font-size: 12px;
  line-height: 1.55;
}

.topic-chips {
  display: flex;
  gap: 8px;
  margin-inline: -2px;
  padding: 2px 2px 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.topic-chips::-webkit-scrollbar { display: none; }

.topic-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e4e7ea;
  border-radius: 999px;
  background: #fff;
  color: #24272a;
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.topic-chip:active { transform: scale(0.98); }
.topic-chip strong { display: block; font-size: 13px; line-height: 1.1; white-space: nowrap; }
.topic-chip small { display: block; margin-top: 3px; color: #8a8f96; font-size: 10px; line-height: 1; }
.topic-chip.active { border-color: #111214; background: #111214; color: #fff; }
.topic-chip.active small { color: #c8ccd0; }

.topic-play-card {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #e7e9ec;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(17, 18, 20, 0.04);
}

.topic-play-copy {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: baseline;
  margin-bottom: 12px;
}

.topic-play-copy > span {
  padding: 3px 6px;
  border-radius: 999px;
  background: #eef0f2;
  color: #666b71;
  font-size: 9px;
  font-weight: 900;
}

.topic-play-copy strong { font-size: 16px; }
.topic-play-copy small {
  grid-column: 1 / -1;
  margin-top: 5px;
  color: #888d93;
  font-size: 11px;
  line-height: 1.45;
}

.topic-mode-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.topic-mode-button {
  min-width: 0;
  min-height: 58px;
  padding: 9px 6px;
  border: 0;
  border-radius: 15px;
  background: #f0f2f4;
  color: #17191c;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.16s ease;
}

.topic-mode-button:active { transform: scale(0.975); }
.topic-mode-button:disabled { opacity: 0.4; cursor: default; }
.topic-mode-button strong { display: block; font-size: 15px; font-weight: 950; line-height: 1.1; }
.topic-mode-button small { display: block; margin-top: 4px; color: #777c82; font-size: 9px; font-weight: 800; white-space: nowrap; }

/* v0.4: endless challenge modes */
.mode-section {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 2px 10px;
}

.section-heading span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #111214;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.section-heading h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-card-button {
  appearance: none;
  width: 100%;
  border: 1px solid #e6e9ec;
  border-radius: 20px;
  padding: 16px;
  background: #fff;
  color: #15171a;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(17, 18, 20, 0.045);
  transition: transform 0.08s ease, border-color 0.2s ease;
}

.mode-card-button:active { transform: scale(0.985); }
.mode-card-button:hover { border-color: #cfd4d9; }

.mode-card-button > span,
.mode-card-button > strong,
.mode-card-button > small,
.mode-card-button > em { display: block; }

.mode-icon {
  width: fit-content;
  min-width: 34px;
  margin-bottom: 12px;
  padding: 6px 9px;
  border-radius: 11px;
  background: #f0f2f4;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.mode-card-button strong {
  font-size: 15px;
  line-height: 1.35;
}

.mode-card-button small {
  min-height: 36px;
  margin-top: 5px;
  color: #777c82;
  font-size: 11px;
  line-height: 1.5;
}

.mode-card-button em {
  margin-top: 11px;
  color: #9a9fa5;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.mode-card-button em b {
  margin-left: 3px;
  color: #111214;
  font-size: 14px;
}

#timer-text {
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}

#timer-text.timer-danger {
  color: #a94343;
  transform: scale(1.08);
}

@media (max-width: 360px) {
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card-button small { min-height: 0; }
}

.data-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 4px 0;
  color: #7d8288;
  font-size: 11px;
  line-height: 1.5;
}

.data-status > span:first-child {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eceff1;
  color: #555a60;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.question-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f8f9;
  color: #747a80;
  font-size: 11px;
  line-height: 1.5;
}

.question-source a {
  color: #32363a;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.reviewed-badge,
.draft-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}

.reviewed-badge {
  background: #e8f4ec;
  color: #2f6842;
}

.draft-badge {
  background: #f8eee1;
  color: #8a5d20;
}

.legal-basis {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #555;
  font-size: 0.76rem;
  line-height: 1.25;
}

/* v0.9: result review */
.review-card {
  margin-top: 14px;
  background: #ffffff;
  border: 1px solid #eceff1;
  border-radius: 18px;
  text-align: left;
  overflow: hidden;
}

.review-toggle {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 17px 18px;
  border: 0;
  background: #ffffff;
  color: #15171a;
  text-align: left;
  cursor: pointer;
}

.review-toggle > span:first-child {
  font-size: 15px;
  font-weight: 900;
}

.review-toggle strong {
  color: #7f848a;
  font-size: 11px;
  font-weight: 800;
}

#review-chevron {
  width: 22px;
  text-align: center;
  color: #777c82;
  font-size: 20px;
  line-height: 1;
}

.review-panel {
  padding: 0 18px 18px;
  border-top: 1px solid #f0f1f2;
}

.review-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0 10px;
}

.review-heading h2 {
  margin: 0;
  font-size: 14px;
}

.review-filters {
  display: flex;
  gap: 5px;
  padding: 3px;
  border-radius: 999px;
  background: #f1f3f5;
}

.review-filter {
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  background: transparent;
  color: #73787e;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.review-filter.active {
  background: #ffffff;
  color: #15171a;
  box-shadow: 0 1px 4px rgba(17, 18, 20, 0.08);
}

.review-list { display: grid; gap: 10px; }

.review-item {
  padding: 14px;
  border: 1px solid #eceff1;
  border-radius: 15px;
  background: #fbfbfc;
}

.review-item.is-wrong { border-color: #ead4d4; }

.review-item-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.review-number {
  color: #969ba1;
  font-size: 10px;
  font-weight: 900;
}

.review-topic {
  overflow: hidden;
  color: #72777d;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-status {
  font-size: 10px;
  font-weight: 900;
}

.review-status.is-correct { color: #267243; }
.review-status.is-wrong { color: #a94343; }

.review-statement {
  margin: 10px 0 0;
  color: #25282b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.review-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.review-answers span {
  padding: 5px 8px;
  border-radius: 9px;
  background: #f0f2f4;
  color: #686d73;
  font-size: 10px;
  font-weight: 800;
}

.review-answers b {
  margin-left: 3px;
  color: #17191c;
  font-size: 13px;
}

.review-explanation {
  margin: 11px 0 0;
  color: #5e6369;
  font-size: 12px;
  line-height: 1.7;
}

.review-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 10px;
  color: #8a8f95;
  font-size: 9px;
  line-height: 1.5;
}

.review-foot a {
  color: #4f555b;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.review-empty {
  margin: 10px 0 2px;
  padding: 16px;
  border-radius: 12px;
  background: #f7f8f9;
  color: #72777d;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 420px) {
  .review-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* v1.0: smartphone-first interaction */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overscroll-behavior-y: contain;
}

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

.app-shell {
  padding-top: max(28px, env(safe-area-inset-top));
  padding-bottom: max(40px, calc(24px + env(safe-area-inset-bottom)));
}

.quiz-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: -8px -8px 0;
  padding: calc(8px + env(safe-area-inset-top)) 8px 10px;
  background: rgba(246, 247, 248, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.question-card {
  scroll-margin-top: 92px;
}

.answer-grid {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
  margin-inline: -8px;
  padding: 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(17, 18, 20, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.question-card.answered .answer-grid {
  position: static;
  margin-inline: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.review-item {
  padding: 0;
  overflow: clip;
}

.review-item-summary {
  position: relative;
  display: block;
  padding: 14px 36px 14px 14px;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
}

.review-item-summary::-webkit-details-marker { display: none; }
.review-item-summary::marker { content: ""; }

.review-item-body {
  padding: 0 14px 14px;
  border-top: 1px solid #edf0f2;
}

.review-item-chevron {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: #858a91;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.review-item[open] .review-item-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.review-item[open] .review-statement {
  margin-bottom: 2px;
}

@media (max-width: 480px) {
  .app-shell {
    width: 100%;
    padding-inline: 12px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  #home-screen { padding-top: 18px; }

  h1 {
    margin-top: 14px;
    font-size: clamp(34px, 11vw, 46px);
  }

  .lead {
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.6;
  }

  .daily-card { padding: 15px; border-radius: 20px; }
  .primary-button { min-height: 56px; padding: 15px 18px; }
  .secondary-button { min-height: 52px; padding: 14px 18px; }

  .topic-section { margin-top: 20px; }
  .topic-chip { min-height: 46px; padding-inline: 13px; }
  .topic-play-card { padding: 12px; border-radius: 18px; }
  .topic-mode-button { min-height: 60px; }

  .mode-section { margin-top: 22px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card-button {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon title best"
      "icon desc best";
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    min-height: 78px;
    padding: 13px 14px;
  }
  .mode-icon { grid-area: icon; margin: 0; }
  .mode-card-button strong { grid-area: title; }
  .mode-card-button small { grid-area: desc; min-height: 0; margin: 0; }
  .mode-card-button em { grid-area: best; margin: 0; text-align: right; }

  .stats-card > div,
  .result-card { padding: 14px; }

  .quiz-header {
    margin-inline: -4px;
    padding-inline: 6px;
  }

  .mode-badge { margin-top: 12px; }
  .question-card {
    margin-top: 18px;
    padding: 20px 16px;
    border-radius: 20px;
  }
  .question-meta { margin-bottom: 10px; }
  .question-title {
    font-size: 19px;
    line-height: 1.58;
  }
  .answer-grid {
    gap: 10px;
    margin-top: 22px;
  }
  .answer-button {
    min-height: 92px;
    border-radius: 17px;
    font-size: 48px;
  }

  #result-screen { padding-top: 20px; }
  .result-time { margin-top: 12px; }
  .result-grid { gap: 8px; margin-top: 18px; }
  .review-card { margin-top: 10px; }
  .review-panel { padding-inline: 12px; }
  .review-toggle { padding-inline: 14px; }
  .review-heading { padding-top: 12px; }
  .review-statement { font-size: 13px; line-height: 1.58; }
  .review-item-summary { padding: 12px 34px 12px 12px; }
  .review-item-body { padding: 0 12px 12px; }
  .result-actions {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 15;
    padding: 8px;
    margin: 12px -8px 0;
    border-radius: 18px;
    background: rgba(246, 247, 248, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* v1.4: home information architecture + smartphone polish */
.random-card {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid #e7e9ec;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(17, 18, 20, 0.05);
}

.random-copy {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
}

.random-label {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef0f2;
  color: #555a60;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.random-copy strong { font-size: 18px; }
.random-copy small { color: #858a91; }
.random-start { margin-top: 0; }

.random-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eef0f2;
}

.random-stats > div {
  display: grid;
  gap: 3px;
}

.random-stats span {
  color: #7b8087;
  font-size: 12px;
}

.random-stats strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.random-attempt-stat { text-align: right; }

.text-button {
  min-width: 48px;
  min-height: 44px;
  margin: -4px 0 0 -4px;
  padding: 8px 4px;
  font-weight: 800;
}

.quiz-header {
  align-items: center;
}

.progress-row,
.race-row,
.result-time,
#best-time,
#daily-best-time,
#timer-text {
  font-variant-numeric: tabular-nums;
}

.question-title,
.feedback-text,
.review-statement,
.review-explanation {
  overflow-wrap: anywhere;
  word-break: normal;
}

.answer-button,
.topic-mode-button,
.mode-card-button,
.topic-chip,
.primary-button,
.secondary-button,
.review-toggle,
.review-filter {
  min-height: 44px;
}

@media (max-width: 480px) {
  .daily-card,
  .random-card {
    padding: 14px;
    border-radius: 19px;
  }

  .daily-copy,
  .random-copy {
    margin-bottom: 12px;
  }

  .daily-copy strong,
  .random-copy strong {
    font-size: 18px;
  }

  .daily-stats,
  .random-stats {
    margin-top: 12px;
    padding-top: 12px;
  }

  .daily-stats strong,
  .random-stats strong {
    font-size: 19px;
  }

  .mode-section { margin-top: 24px; }
  .topic-section { margin-top: 26px; }

  .section-heading {
    margin-bottom: 9px;
  }

  .topic-lead {
    margin-bottom: 8px;
  }

  .quiz-header {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }

  .progress-row {
    margin-bottom: 6px;
  }

  .race-row {
    min-height: 20px;
    margin-top: 5px;
  }

  .mode-badge {
    margin-bottom: -6px;
  }

  .question-card {
    padding-bottom: 16px;
  }

  .question-title {
    line-height: 1.62;
  }

  .answer-grid {
    bottom: calc(6px + env(safe-area-inset-bottom));
    margin-inline: -5px;
    padding: 6px;
    border-radius: 19px;
  }

  .answer-button {
    min-height: 88px;
  }

  .feedback-heading {
    align-items: center;
  }

  .feedback-text {
    font-size: 13px;
    line-height: 1.65;
  }

  .question-source {
    gap: 6px;
    padding: 9px 10px;
    font-size: 10px;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .review-toggle {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 7px;
  }

  .review-toggle strong {
    white-space: nowrap;
  }
}

@media (max-width: 340px) {
  .app-shell { padding-inline: 10px; }

  .daily-stats span,
  .random-stats span { font-size: 11px; }
  .daily-stats strong,
  .random-stats strong { font-size: 17px; }

  .topic-mode-actions {
    gap: 6px;
  }

  .topic-mode-button {
    padding-inline: 4px;
  }

  .topic-mode-button strong { font-size: 14px; }
  .topic-mode-button small { font-size: 8px; }

  .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .question-card.answered .answer-grid {
    display: none;
  }

  .primary-button.compact {
    margin-top: 14px;
  }

  .feedback .question-source {
    margin-top: 12px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: clamp(31px, 9vw, 40px);
    letter-spacing: -0.05em;
    white-space: nowrap;
  }
}

/* v1.5: shared challenge / social share */
.shared-challenge-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #dfe3e7;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(17, 18, 20, 0.05);
}

.shared-challenge-card > div {
  display: grid;
  gap: 4px;
}

.shared-challenge-card > div > span {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: #111214;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .12em;
}

.shared-challenge-card strong { font-size: 16px; }
.shared-challenge-card small { color: #7c8187; line-height: 1.5; }
.shared-challenge-card .primary-button.compact { margin-top: 0; }

.share-result-button {
  appearance: none;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 1px solid #dfe3e7;
  border-radius: 16px;
  background: #fff;
  color: #17191c;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(17, 18, 20, 0.035);
}

.share-result-button:active { transform: scale(.985); }
.share-result-button span { margin-right: 5px; }

.share-status {
  margin: 8px 4px 0;
  color: #687078;
  font-size: 12px;
  line-height: 1.5;
}

.review-detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid #dfe3e7;
  border-radius: 13px;
  background: #fff;
  color: #17191c;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.review-detail-link:active { transform: scale(.99); }

.related-review {
  margin-top: 13px;
  border: 1px solid #e4e8eb;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.related-review-summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 11px 12px;
  color: #202326;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.related-review-summary::-webkit-details-marker { display: none; }
.related-review-summary::marker { content: ""; }

.related-review-summary strong {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f0f3f5;
  color: #697078;
  font-size: 9px;
  font-weight: 900;
}

.related-review-chevron {
  color: #848a90;
  font-size: 15px;
  transition: transform .18s ease;
}

.related-review[open] .related-review-chevron { transform: rotate(180deg); }

.related-review-intro {
  margin: 0;
  padding: 0 12px 10px;
  color: #747a80;
  font-size: 10px;
  line-height: 1.55;
}

.related-review-list {
  display: grid;
  gap: 9px;
  padding: 0 10px 10px;
}

.related-question-card {
  padding: 11px;
  border: 1px solid #eceff1;
  border-radius: 12px;
  background: #fafbfb;
}

.related-question-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.related-question-label,
.related-question-reason {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}

.related-question-label {
  background: #202326;
  color: #ffffff;
}

.related-question-reason {
  background: #eef2f5;
  color: #626970;
}

.related-question-statement {
  margin: 9px 0 0;
  color: #25282b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.62;
}

.related-answer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.related-answer-button {
  min-height: 46px;
  border: 1px solid #d9dee2;
  border-radius: 11px;
  background: #ffffff;
  color: #24272a;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.related-answer-button:active:not(:disabled) { transform: scale(.985); }
.related-answer-button:disabled { cursor: default; opacity: .58; }
.related-answer-button.selected { opacity: 1; border-color: #8c939a; }
.related-answer-button.is-correct-choice { opacity: 1; border-color: #8bb89a; background: #f0f8f2; }

.related-feedback {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f3f5f6;
}

.related-feedback.is-correct { background: #edf7f0; }
.related-feedback.is-wrong { background: #fbefef; }

.related-feedback-title {
  color: #34383c;
  font-size: 11px;
  font-weight: 900;
}

.related-feedback.is-correct .related-feedback-title { color: #267243; }
.related-feedback.is-wrong .related-feedback-title { color: #a94343; }

.related-feedback-text {
  margin: 5px 0 0;
  color: #5c6268;
  font-size: 11px;
  line-height: 1.6;
}

.related-detail-link {
  display: inline-flex;
  margin-top: 9px;
  color: #4f555b;
  font-size: 10px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 430px) {
  .share-result-button { min-height: 50px; }
  .shared-challenge-card { padding: 14px; }
}
