@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Noto+Serif+JP:wght@400;700&family=Zen+Kaku+Gothic+New:wght@300;400;700&display=swap");

:root {
  --red: #c0392b;
  --red-dark: #922b21;
  --red-light: #e74c3c;
  --red-pale: #fadbd8;
  --white: #fdfcfb;
  --off-white: #f5f0ec;
  --cream: #ede8e3;
  --ink: #1a1a1a;
  --ink-mid: #4a4a4a;
  --ink-light: #8a8a8a;
  --gold: #d4ac0d;
  --green: #1e8449;
  --green-pale: #d5f5e3;
  --shadow: rgba(0, 0, 0, 0.08);
  --font-main:
    "Avenir Next", "Segoe UI", "Hiragino Sans", "Yu Gothic", "Noto Sans JP",
    sans-serif;
  --font-serif: "Noto Serif JP", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  font-size: 16px;
  background: var(--off-white);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── BACKGROUND PATTERN ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(
      circle at 15% 20%,
      rgba(192, 57, 43, 0.06) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 85% 80%,
      rgba(192, 57, 43, 0.04) 0%,
      transparent 50%
    );
}

body::after {
  content: "belajarwibu";
  position: fixed;
  top: 24px;
  right: 24px;
  font-size: 72px;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  letter-spacing: 2px;
}

/* ══════════════════════════════════════
     SCREENS
  ══════════════════════════════════════ */
.screen {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ══════════════════════════════════════
     INTRO SCREEN
  ══════════════════════════════════════ */
#introScreen {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(160deg, #fff 0%, var(--off-white) 60%);
}

.intro-card {
  background: var(--white);
  border-radius: 18px;
  max-width: 760px;
  width: 100%;
  box-shadow: 0 2px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  animation: fadeUp 0.7s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-header {
  background: var(--red);
  padding: 40px 48px 32px;
  position: relative;
  overflow: hidden;
}
.intro-header::after {
  content: "日";
  position: absolute;
  right: -10px;
  top: -20px;
  font-family: "Noto Serif JP", serif;
  font-size: 180px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  user-select: none;
}

.badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 16px;
  font-weight: 500;
}

.intro-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(34px, 6vw, 52px);
  color: #fff;
  line-height: 1.12;
  font-weight: 700;
}
.intro-header h1 span {
  display: block;
  font-family: var(--font-main);
  font-size: clamp(14px, 2.2vw, 18px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 12px;
  letter-spacing: 0.3px;
}

.intro-body {
  padding: 42px 48px 46px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.info-item {
  background: var(--off-white);
  border-left: 3px solid var(--red);
  padding: 14px 16px;
  border-radius: 0 4px 4px 0;
}
.info-item .label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 4px;
  font-weight: 500;
}
.info-item .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--red);
}
.info-item .unit {
  font-size: 13px;
  color: var(--ink-mid);
  margin-left: 2px;
}

.section-list {
  margin-bottom: 36px;
}
.section-list h3 {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 14px;
  font-weight: 500;
}

.section-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--cream);
  gap: 10px;
}
.section-row:last-child {
  border-bottom: none;
}
.sec-name {
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
  flex: 1;
}
.sec-count {
  font-size: 13px;
  color: var(--ink-light);
  background: var(--cream);
  padding: 2px 8px;
  border-radius: 20px;
}

.btn-start {
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 20px 22px;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 16px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition:
    background 0.2s,
    transform 0.1s;
  position: relative;
  overflow: hidden;
}
.btn-start::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn-start:hover {
  background: var(--red-dark);
}
.btn-start:hover::before {
  transform: translateX(100%);
}
.btn-start:active {
  transform: scale(0.99);
}

.disclaimer {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--ink-light);
  text-align: center;
  line-height: 1.75;
}

.resume-card {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  background: #fff8f7;
  border: 1px solid rgba(192, 57, 43, 0.16);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.resume-card[hidden] {
  display: none;
}
.resume-copy {
  min-width: 0;
}
.resume-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.resume-meta {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-mid);
}
.resume-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.resume-btn {
  position: relative;
  z-index: 3;
  pointer-events: auto;
  border: 1px solid var(--cream);
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.resume-btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ══════════════════════════════════════
     EXAM SCREEN
  ══════════════════════════════════════ */
#examScreen {
  background: var(--off-white);
}

/* TOP BAR */
.topbar {
  background: var(--white);
  border-bottom: 2px solid var(--red);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 68px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px var(--shadow);
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--red);
  flex-shrink: 0;
}

.section-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar {
  display: none;
}

.sec-tab {
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ink-light);
  background: transparent;
  border: 1.5px solid transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sec-tab.active {
  background: var(--red);
  color: #fff !important;
  border-color: var(--red);
}
.sec-tab.done {
  border-color: var(--green);
  color: var(--green);
}
.sec-tab.done.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.sec-tab.locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.sec-tab.current-only {
  border-color: var(--cream);
  color: var(--ink-mid);
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  flex-shrink: 0;
}
.timer-icon {
  font-size: 14px;
}
.timer-display {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 68px;
}
.timer-box.warning {
  background: var(--red);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* PROGRESS */
.progress-bar-wrap {
  height: 3px;
  background: var(--cream);
}
.progress-bar-fill {
  height: 100%;
  background: var(--red);
  transition: width 0.4s ease;
}

/* EXAM CONTENT */
.exam-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 34px 20px 110px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.sec-badge {
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.sec-badge.grammar {
  background: #2980b9;
}
.sec-badge.reading {
  background: #8e44ad;
}
.sec-badge.listening {
  background: #16a085;
}

.sec-title-text {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.q-counter {
  margin-left: auto;
  font-size: 14px;
  color: var(--ink-light);
}

.q-counter-inline {
  font-size: 14px;
  color: var(--ink-light);
  font-weight: 500;
}

.mobile-only {
  display: none;
}

.q-counter-desktop {
  color: var(--ink-light);
  font-weight: 500;
}
/* Hide mobile-only on desktop by default */

/* PASSAGE */
.passage-box {
  background: var(--white);
  border: 1px solid var(--cream);
  border-left: 4px solid var(--red);
  padding: 22px 24px;
  border-radius: 0 14px 14px 0;
  margin-bottom: 20px;
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--ink-mid);
}
.passage-box.grammar-style {
  border-left-color: #2980b9;
}
.passage-box.reading-style {
  border-left-color: #8e44ad;
}
.passage-box.listening-style {
  border-left-color: #16a085;
}

.reading-doc {
  display: grid;
  gap: 14px;
  color: var(--ink);
}

.reading-doc-title {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0;
}

.reading-doc-note {
  border: 1px solid #c9cdd4;
  border-radius: 6px;
  background: #fff;
  padding: 16px 18px;
  line-height: 1.9;
}

.reading-doc-card {
  border: 2px solid #555;
  border-radius: 6px;
  background: #fff;
  padding: 18px;
  line-height: 1.9;
}

.reading-doc-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #bbb;
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-weight: 700;
}

.reading-doc-list {
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.reading-doc-table-wrap {
  overflow-x: auto;
}

.reading-doc-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  line-height: 1.65;
}

.reading-doc-table th,
.reading-doc-table td {
  border: 1px solid #555;
  padding: 8px 10px;
  vertical-align: top;
}

.reading-doc-table th {
  background: #f1f3f5;
  font-weight: 700;
  text-align: center;
}

.reading-doc-table .center {
  text-align: center;
}

.reading-doc-price {
  display: grid;
  gap: 8px;
  border: 2px solid #555;
  border-radius: 6px;
  background: #fff;
  padding: 14px 16px;
}

.reading-doc-price-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px dashed #bbb;
  padding-bottom: 6px;
}

.reading-doc-price-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.reading-doc-flyer {
  border: 2px solid #3d3d3d;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.reading-doc-flyer-title {
  background: #f1f3f5;
  border-bottom: 2px solid #3d3d3d;
  padding: 10px 14px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}

.reading-doc-flyer-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.reading-doc-flyer-box {
  border: 1px solid #787878;
  border-radius: 4px;
  padding: 10px 12px;
  background: #fff;
}

.reading-doc-flyer-box strong {
  display: block;
  margin-bottom: 4px;
}

.reading-doc-bullets {
  padding-left: 20px;
  display: grid;
  gap: 6px;
  line-height: 1.8;
}

.listen-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #16a085;
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: background 0.2s;
}
.listen-btn:hover {
  background: #138d75;
}
.listen-btn:disabled {
  background: var(--ink-light);
  cursor: not-allowed;
  opacity: 0.7;
}

.listen-meta {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-light);
}

.script-box {
  display: none;
  background: #e8f8f5;
  border: 1px solid #a9dfbf;
  border-left: 4px solid #16a085;
  padding: 16px 20px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  line-height: 2;
  color: var(--ink);
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.script-box.visible {
  display: block;
}

/* QUESTION CARD */
.q-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: 0 2px 16px var(--shadow);
  padding: 30px;
  margin-bottom: 20px;
}

.q-card.nav-enter-forward,
.passage-box.nav-enter-forward {
  animation: navSlideForward 0.22s ease both;
}

.q-card.nav-enter-backward,
.passage-box.nav-enter-backward {
  animation: navSlideBackward 0.22s ease both;
}

@keyframes navSlideForward {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes navSlideBackward {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.q-number-label {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 10px;
  font-weight: 500;
}

.q-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.q-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-btn {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--cream);
  background: var(--white);
  color: var(--ink-mid);
  cursor: pointer;
  transition: all 0.15s;
}
.tool-btn:hover {
  border-color: var(--red);
  color: var(--red);
}
.tool-btn.active {
  border-color: rgba(192, 57, 43, 0.18);
  background: #fff8f7;
  color: var(--red);
}
.your-language-box {
  background: #f6f7fb;
  border: 1px solid #e4e7f1;
  border-left: 4px solid #5563de;
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  margin-bottom: 18px;
}
.your-language-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #5563de;
  margin-bottom: 8px;
}
.your-language-box ul {
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: var(--ink-mid);
  font-size: 14px;
  line-height: 1.75;
}
.question-note {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-light);
  margin-bottom: 14px;
}

.question-image-wrap {
  width: min(100%, 360px);
  margin: 0 0 24px;
  background: #f7f8fa;
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  padding: 12px;
}

.question-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.question-image-placeholder {
  display: none;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed #b6bdc8;
  border-radius: 6px;
  padding: 20px;
  color: var(--ink-mid);
  font-size: 13px;
  line-height: 1.7;
  background: #fff;
}

.question-image-placeholder strong {
  display: inline-block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--red);
  font-weight: 700;
}

.question-image-wrap.image-missing .question-image-placeholder {
  display: flex;
  flex-direction: column;
}

.question-image-caption {
  margin-top: 10px;
  color: var(--ink-light);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.q-text {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.7;
  font-weight: 500;
  margin-bottom: 26px;
  color: var(--ink);
}
.q-text ruby rt {
  font-size: 11px;
  color: var(--ink-light);
}

/* OPTIONS */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--off-white);
  border: 2px solid var(--cream);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}
.option-btn:active:not(:disabled) {
  transform: scale(0.992);
}

@media (hover: hover) and (pointer: fine) {
  .option-btn:hover:not(:disabled) {
    border-color: var(--red);
    background: var(--red-pale);
  }
}
.option-btn.selected {
  border-color: var(--red);
  background: var(--red-pale);
  color: var(--red-dark);
  font-weight: 500;
  box-shadow: 0 10px 22px rgba(192, 57, 43, 0.12);
}
.option-btn:disabled {
  cursor: default;
}

.opt-key {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.18s;
}
.option-btn.selected .opt-key {
  background: var(--red);
  color: #fff;
}
.opt-text {
  flex: 1;
  line-height: 1.6;
}

/* NAVIGATION */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--cream);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 -4px 20px var(--shadow);
  overflow: visible;
}

.btn-nav {
  padding: 12px 22px;
  border-radius: 14px;
  border: 2px solid var(--cream);
  background: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink);
}
.btn-nav:hover {
  border-color: var(--ink-mid);
}
.btn-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-nav.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  margin-left: auto;
}
.btn-nav.primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}
.btn-nav.finish {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  margin-left: auto;
}

/* DOT NAV */
.dot-nav {
  display: flex;
  gap: 6px;
  flex: 1 1 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  order: -1;
  position: relative;
  gap: 8px;
  scroll-snap-type: x mandatory;
  padding: 6px 0;
  overflow-y: visible;
}
.dot-nav::before,
.dot-nav::after {
  content: "";
  position: absolute;
  top: 0;
  width: 24px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.dot-nav::before {
  left: 0;
  background: linear-gradient(to right, var(--white), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.dot-nav::after {
  right: 0;
  background: linear-gradient(to left, var(--white), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.dot-nav.can-scroll-left::before {
  opacity: 1;
}

.dot-nav.can-scroll-right::after {
  opacity: 1;
}
.dot-nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 601px) {
  .dot-nav {
    order: 0;
    flex: 1;
    justify-content: center;
  }
}
.q-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cream);
  cursor: pointer;
  transition: all 0.18s ease;
  flex-shrink: 0;
  border: 2px solid #d0c8c2;
  opacity: 0.4;
  scroll-snap-align: center;
}
.q-dot.current {
  border-color: var(--red-dark);
  transform: scale(1.25);
  box-shadow:
    0 0 0 2px rgba(192, 57, 43, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.08);
  background: var(--white);
}
.q-dot.current.answered {
  background: var(--red);
  border-color: var(--red-dark);
  box-shadow:
    0 0 0 3px rgba(192, 57, 43, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.1);
}
.q-dot.answered {
  background: var(--red);
  border-color: var(--red-dark);
  opacity: 1;
  transform: scale(1.05);
}
.q-dot.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ══════════════════════════════════════
     RESULT SCREEN
  ══════════════════════════════════════ */
#resultScreen {
  background: var(--off-white);
  align-items: center;
  padding: 40px 20px 60px;
}

.result-wrap {
  max-width: 720px;
  width: 100%;
}

.result-hero {
  background: var(--red);
  border-radius: 8px 8px 0 0;
  padding: 40px 40px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.result-hero::before {
  content: "合格";
  position: absolute;
  right: -20px;
  bottom: -20px;
  font-family: "Noto Serif JP", serif;
  font-size: 120px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.result-hero.fail::before {
  content: "再挑";
}

.result-label {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
}
.result-score {
  font-family: "Noto Serif JP", serif;
  font-size: clamp(60px, 12vw, 96px);
  color: #fff;
  font-weight: 700;
  line-height: 1;
}
.result-score span {
  font-size: 0.4em;
  color: rgba(255, 255, 255, 0.7);
}
.result-verdict {
  margin-top: 12px;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}
.result-score-meter {
  width: min(520px, 100%);
  margin: 24px auto 0;
}
.result-score-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.result-score-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
  transition: width 0.6s ease;
}
.result-score-pass-marker {
  position: absolute;
  left: calc(((200 - 10) / (250 - 10)) * 100%);
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.72);
  transform: translateX(-1px);
}
.result-meta-row {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.result-band,
.result-passline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.result-band {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.result-passline {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
}

.diagnosis-panel {
  background: var(--white);
  padding: 26px 40px 22px;
  border-bottom: 1px solid var(--cream);
}
.diagnosis-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.diagnosis-copy {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-mid);
  margin-bottom: 16px;
}
.diagnosis-list {
  display: grid;
  gap: 10px;
}
.diagnosis-item {
  background: var(--off-white);
  border-radius: 12px;
  padding: 14px 15px;
  border: 1px solid var(--cream);
}
.diagnosis-item strong {
  display: block;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}
.diagnosis-item span {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-mid);
}

.result-stats {
  background: var(--white);
  padding: 28px 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
  border-bottom: 1px solid var(--cream);
}
.stat-item {
  padding: 8px 0;
}
.stat-num {
  font-size: 38px;
  font-weight: 700;
  display: block;
}
.stat-num.correct {
  color: var(--green);
}
.stat-num.wrong {
  color: var(--red);
}
.stat-label {
  font-size: 13px;
  color: var(--ink-light);
  margin-top: 4px;
}

.breakdown {
  background: var(--white);
  padding: 24px 40px;
  border-bottom: 1px solid var(--cream);
}
.breakdown h3 {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 16px;
  font-weight: 500;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--off-white);
}
.br-left {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 220px;
  flex-shrink: 0;
}
.breakdown-row .sec-badge {
  flex-shrink: 0;
}
.breakdown-row:last-child {
  border-bottom: none;
}
.br-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.br-bar-wrap {
  flex: 1;
  min-width: 0;
  background: var(--off-white);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}
.br-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--red);
  transition: width 0.8s ease;
}
.br-score {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

.result-actions {
  background: var(--white);
  border-radius: 0 0 8px 8px;
  padding: 28px 40px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-result {
  flex: 1;
  min-width: 140px;
  padding: 14px;
  border-radius: 4px;
  border: 2px solid var(--cream);
  background: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-result:hover {
  border-color: var(--ink-mid);
  background: var(--off-white);
}
.btn-result.red {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-result.red:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 18, 17, 0.5);
}
.confirm-overlay[hidden] {
  display: none;
}
.confirm-dialog {
  width: min(460px, 100%);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--cream);
  padding: 24px;
}
.confirm-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--red-pale);
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 14px;
}
.confirm-title {
  color: var(--ink);
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
}
.confirm-message {
  white-space: pre-line;
  color: var(--ink-mid);
  font-size: 14px;
  line-height: 1.75;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
.confirm-btn {
  min-width: 112px;
  border: 2px solid var(--cream);
  border-radius: 8px;
  padding: 12px 20px;
  background: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.15s;
}
.confirm-btn:hover {
  border-color: var(--ink-mid);
}
.confirm-btn.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: none;
}
.confirm-btn.primary:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}
.confirm-btn.secondary {
  background: var(--off-white);
  color: var(--ink-mid);
}

/* ══════════════════════════════════════
     REVIEW SCREEN
  ══════════════════════════════════════ */
#reviewScreen {
  background: var(--off-white);
  padding: 0;
}

.review-topbar {
  background: var(--white);
  border-bottom: 2px solid var(--red);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px var(--shadow);
}
.review-topbar h2 {
  font-size: 18px;
  font-weight: 700;
}
.btn-back {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1.5px solid var(--cream);
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-back:hover {
  border-color: var(--red);
  color: var(--red);
}

.review-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.review-summary {
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(24, 24, 27, 0.06);
  padding: 24px 24px 20px;
  margin-bottom: 20px;
}
.review-summary h3 {
  font-size: 22px;
  margin-bottom: 8px;
}
.review-summary p {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-mid);
}
.review-summary ul {
  padding-left: 18px;
  margin-top: 12px;
  display: grid;
  gap: 8px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-mid);
}

.review-section-title {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-light);
  padding: 8px 0 12px;
  border-bottom: 2px solid var(--cream);
  margin-bottom: 16px;
  font-weight: 500;
}

.review-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 12px var(--shadow);
  padding: 24px 28px;
  margin-bottom: 16px;
  border-left: 4px solid transparent;
}
.review-card.correct-card {
  border-left-color: var(--green);
}
.review-card.wrong-card {
  border-left-color: var(--red);
}

.review-q-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.review-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
}
.correct-badge {
  background: var(--green-pale);
  color: var(--green);
}
.wrong-badge {
  background: var(--red-pale);
  color: var(--red);
}

.review-q-text {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.7;
  margin-bottom: 16px;
}
.review-passage {
  background: var(--off-white);
  border-left: 3px solid var(--ink-light);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-mid);
  border-radius: 0 10px 10px 0;
  margin-bottom: 14px;
}

.review-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.review-opt {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--off-white);
}
.review-opt.user-ans {
  background: var(--red-pale);
  color: var(--red-dark);
}
.review-opt.correct-ans {
  background: var(--green-pale);
  color: var(--green);
  font-weight: 500;
}
.review-opt.user-ans.correct-ans {
  background: var(--green-pale);
  color: var(--green);
}
.rev-opt-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.explanation-box {
  background: #fef9e7;
  border: 1px solid #f9e79f;
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-mid);
}
.explanation-box strong {
  color: var(--ink);
}

.review-cta-card {
  background: linear-gradient(160deg, #fff 0%, #fff4f2 100%);
  border: 1px solid rgba(192, 57, 43, 0.14);
  border-radius: 18px;
  padding: 22px 24px;
  margin-top: 24px;
  text-align: center;
}
.review-cta-card h3 {
  font-size: 24px;
  margin-bottom: 8px;
}
.review-cta-card p {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-mid);
  margin-bottom: 16px;
}
.review-cta-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  min-width: 220px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

/* ══════════════════════════════════════
     RESPONSIVE
  ══════════════════════════════════════ */
@media (max-width: 600px) {
  .intro-header,
  .intro-body {
    padding: 28px 24px;
  }
  .intro-header h1 {
    font-size: clamp(30px, 9vw, 40px);
  }
  .info-item .value {
    font-size: 21px;
  }
  .resume-card,
  .q-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .resume-actions,
  .q-tools {
    width: 100%;
  }
  .resume-btn,
  .tool-btn {
    flex: 1;
  }
  .result-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .result-hero,
  .diagnosis-panel,
  .result-stats,
  .breakdown,
  .result-actions {
    padding-left: 24px;
    padding-right: 24px;
  }
  .confirm-dialog {
    padding: 22px;
  }
  .confirm-actions {
    flex-direction: column-reverse;
  }
  .confirm-btn {
    width: 100%;
  }
  .br-name {
    width: 120px;
    font-size: 13px;
  }
  .topbar {
    gap: 10px;
    padding: 0 14px;
    height: 64px;
  }
  .topbar-title {
    font-size: 15px;
  }
  .timer-display {
    font-size: 18px;
  }
  .section-header {
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  .sec-title-text {
    font-size: 18px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sec-badge {
    flex-shrink: 0;
  }

  .q-counter-inline {
    margin-left: auto;
    white-space: nowrap;
  }
  .q-counter-inline {
    font-size: 13px;
  }
  .q-counter {
    width: 100%;
    margin-left: 0;
    font-size: 13px;
  }
  .passage-box {
    font-size: 15.5px;
  }
  .q-card {
    padding: 24px 20px;
  }
  .q-text {
    font-size: 21px;
    line-height: 1.65;
  }
  .option-btn {
    font-size: 15px;
    padding: 15px 14px;
  }
  .btn-nav,
  .btn-result {
    font-size: 14px;
  }
  .review-topbar {
    padding: 14px 16px;
  }
  .review-q-text {
    font-size: 18px;
  }
  .nav-bar {
    flex-wrap: wrap;
  }

  .dot-nav {
    flex: 1 1 100%;
    order: -1;
    margin-bottom: 6px;
  }

  .btn-nav.primary,
  .btn-nav.finish {
    margin-left: auto;
  }

  .q-number-label {
    display: none;
  }
}

.mobile-only {
  display: none;
}

.q-counter-desktop {
  display: inline;
}

@media (max-width: 600px) {
  .mobile-only {
    display: inline;
  }

  .q-counter-desktop {
    display: none;
  }
}
