:root {
  --cream: #f7f0de;
  --paper: #fffdf7;
  --navy: #17324d;
  --dark-navy: #0a2239;
  --yellow: #f3c74f;
  --green: #4f7c55;
  --green-soft: #e7f0e2;
  --terracotta: #c86f4a;
  --line: #d6ccb8;
  --muted: #6f756e;
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body {
  margin: 0;
  background: var(--cream);
  color: var(--navy);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    var(--font-geist-sans), sans-serif;
}
button, input, select { font: inherit; }
button { color: inherit; }

.site-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 8%, rgba(255,255,255,.8), transparent 24%),
    radial-gradient(circle at 90% 15%, rgba(243,199,79,.12), transparent 22%),
    var(--cream);
}
.paper-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image:
    linear-gradient(90deg, rgba(73,55,30,.04) 1px, transparent 1px),
    linear-gradient(rgba(73,55,30,.03) 1px, transparent 1px);
  background-size: 31px 31px;
}
.site-header, .home-view, .quiz-view, .result-view {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 48px));
  margin-inline: auto;
}
.site-header {
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(23,50,77,.2);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border: 0;
  background: none;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}
.book-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--navy);
  border-radius: 7px;
  transform: rotate(-2deg);
}
.brand-sub {
  padding-left: 12px;
  border-left: 1px solid rgba(23,50,77,.28);
  font-size: 15px;
  letter-spacing: .16em;
}
.text-button, .reset-button {
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: 54px;
  min-height: 385px;
  padding: 38px 0 26px;
}
.kicker {
  margin: 0 0 14px;
  color: var(--terracotta);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .18em;
}
.hero h1 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(38px,5vw,64px);
  line-height: 1.36;
  letter-spacing: .04em;
}
.marker-line {
  display: block;
  width: 86%;
  height: 13px;
  margin-top: -3px;
  background: linear-gradient(-4deg, transparent 35%, var(--yellow) 36%, var(--yellow) 58%, transparent 60%);
}
.hero-copy { margin: 25px 0 0; font-size: 17px; font-weight: 700; }
.notebook {
  position: relative;
  width: min(100%,390px);
  margin-left: auto;
  padding: 22px 16px 18px 34px;
  transform: rotate(2deg);
  filter: drop-shadow(0 14px 12px rgba(60,44,20,.16));
}
.rings {
  position: absolute;
  top: 20px;
  left: 17px;
  z-index: 2;
  width: 10px;
  color: #817866;
  font-size: 9px;
  line-height: 2.7;
  overflow-wrap: anywhere;
}
.page {
  position: relative;
  min-height: 264px;
  padding: 135px 30px 24px 76px;
  border: 1px solid #d8cfbd;
  border-radius: 8px 18px 18px 8px;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, #d7dce0 28px), var(--paper);
}
.page::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 35px;
  width: 1px;
  background: rgba(200,111,74,.35);
}
.page p {
  margin: 5px 0;
  font-family: "Yu Mincho", serif;
  font-weight: 800;
  transform: rotate(-1deg);
}
.tape {
  position: absolute;
  top: -11px; right: 58px;
  width: 80px; height: 27px;
  background: rgba(243,199,79,.72);
  transform: rotate(-8deg);
}
.flower { position: absolute; top: 12px; right: 18px; color: #d99b10; font-size: 55px; }
.round-stamp {
  position: absolute;
  top: 27px; left: 57px;
  display: grid;
  place-items: center;
  width: 98px; height: 98px;
  border: 3px double var(--terracotta);
  border-radius: 50%;
  color: var(--terracotta);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  transform: rotate(-8deg);
}
.badge-board {
  display: grid;
  grid-template-columns: 56px 1fr 100px;
  align-items: center;
  gap: 23px;
  min-height: 94px;
  padding: 16px 22px;
  border: 1px dashed #c8bba2;
  border-radius: 16px;
  background: rgba(255,253,247,.65);
}
.stamp-handle { color: var(--terracotta); font-size: 36px; transform: rotate(-8deg); }
.badge-slots {
  display: grid;
  grid-template-columns: repeat(6,58px);
  justify-content: space-between;
  gap: 10px;
}
.badge-slot {
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  border: 3px double #718493;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  color: white;
  font-size: 22px;
  font-weight: 900;
}
.badge-slot.earned {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(79,124,85,.14);
  animation: stamp-in .45s ease-out;
}
.badge-count {
  padding-left: 22px;
  border-left: 1px solid var(--line);
  font-family: Georgia,serif;
  font-size: 42px;
}
.badge-count small { font-size: 21px; }
.subject-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 16px 20px;
  margin-top: 18px;
}
.subject-card {
  display: grid;
  grid-template-columns: 60px 1fr 34px;
  align-items: center;
  gap: 15px;
  min-height: 104px;
  padding: 17px 21px;
  border: 1px solid #cfc5b1;
  border-radius: 15px;
  background: rgba(255,253,247,.68);
  box-shadow: 0 5px 12px rgba(59,44,26,.06);
  text-align: left;
}
.subject-card:disabled { color: #6b767d; }
.subject-card.active {
  border: 2px solid var(--green);
  background: var(--paper);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.subject-card.active:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(67,55,35,.12); }
.subject-icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border: 2px solid currentColor;
  border-radius: 50% 45% 48% 46%;
  font-family: Georgia,serif;
  font-size: 19px;
  font-weight: 900;
}
.subject-copy { display: flex; flex-direction: column; gap: 7px; }
.subject-copy strong { font-size: 23px; }
.subject-copy small {
  width: max-content;
  padding: 4px 10px;
  border-radius: 99px;
  background: #ece9df;
  color: #69736f;
  font-size: 12px;
  font-weight: 800;
}
.subject-card.active .subject-copy small { background: var(--green-soft); color: var(--green); }
.arrow {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 24px;
}
.subject-card:disabled .arrow { border: 0; font-size: 7px; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 57px;
  padding: 14px 30px;
  border-radius: 9px;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
}
.primary {
  border: 0;
  background: var(--navy);
  color: white;
  box-shadow: 0 8px 0 var(--dark-navy);
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 0 var(--dark-navy); }
.primary:disabled { background: #a4aaa8; box-shadow: 0 6px 0 #7f8583; cursor: not-allowed; }
.secondary { border: 2px solid var(--navy); background: transparent; color: var(--navy); }
.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 20px auto 0;
}
.home-cta { min-width: 220px; margin: 0; font-size: 17px; }
.completion-link {
  display: block;
  margin: 24px auto 0;
  padding: 12px 22px;
  border: 2px dashed var(--terracotta);
  border-radius: 99px;
  background: #fff5d7;
  color: var(--terracotta);
  font-weight: 900;
  cursor: pointer;
}
.completion-link:hover { background: #ffedb5; }
.reset-button { display: block; margin: 25px auto 38px; color: #7a746a; font-size: 12px; }
.quiz-view { max-width: 920px; padding: 48px 0 80px; }
.quiz-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.quiz-heading h1 { margin: 0; font-family: "Yu Mincho",serif; font-size: clamp(28px,4vw,42px); }
.question-number { font-family: Georgia,serif; font-size: 20px; }
.question-number b { color: var(--terracotta); font-size: 46px; }
.progress {
  height: 10px;
  margin: 20px 0 26px;
  overflow: hidden;
  border: 1px solid #d2c8b5;
  border-radius: 99px;
  background: rgba(255,255,255,.7);
}
.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg,var(--yellow),var(--yellow) 8px,#e6b72f 8px,#e6b72f 16px);
  transition: width .3s ease;
}
.question-card {
  position: relative;
  padding: clamp(26px,5vw,54px);
  border: 1px solid #d1c7b2;
  border-radius: 18px;
  background: repeating-linear-gradient(to bottom,transparent 0,transparent 40px,rgba(181,193,200,.18) 41px),var(--paper);
  box-shadow: 0 12px 30px rgba(67,55,35,.1);
}
.question-card::before {
  content: "";
  position: absolute;
  top: -12px; right: 44px;
  width: 100px; height: 27px;
  background: rgba(243,199,79,.63);
  transform: rotate(3deg);
}
.question-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 800; }
.question-meta > span {
  padding: 5px 10px;
  border-radius: 99px;
  background: var(--green-soft);
  color: var(--green);
  letter-spacing: .08em;
}
.question-meta > span.english { background: #fcebd6; color: var(--terracotta); }
.question-card h2 { margin: 21px 0 27px; font-size: clamp(21px,3vw,29px); line-height: 1.65; }
.hint-area { margin: -10px 0 23px; }
.hint-area p {
  margin: 12px 0 0;
  padding: 13px 17px;
  border-left: 4px solid var(--yellow);
  background: #fff7d8;
  font-size: 14px;
  line-height: 1.7;
}
.option-list { display: grid; gap: 12px; }
.option {
  position: relative;
  display: grid;
  grid-template-columns: 37px 1fr;
  align-items: center;
  gap: 13px;
  min-height: 65px;
  padding: 11px 17px;
  border: 1px solid #cbc3b4;
  border-radius: 12px;
  background: rgba(255,255,255,.84);
  font-weight: 700;
  line-height: 1.55;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.option:hover { transform: translateX(3px); border-color: var(--green); }
.option.selected { border: 2px solid var(--green); background: var(--green-soft); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option b {
  display: grid;
  place-items: center;
  width: 33px; height: 33px;
  border: 2px solid #86958b;
  border-radius: 50%;
  background: var(--paper);
  color: var(--green);
  font-family: Georgia,serif;
}
.option.selected b { border-color: var(--green); background: var(--green); color: white; }
.multi-note { margin: -9px 0 15px; color: var(--terracotta); font-size: 13px; font-weight: 800; }
.match-list { display: grid; gap: 14px; }
.match-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  align-items: center;
  gap: 17px;
  padding: 15px;
  border: 1px solid #d1c8b7;
  border-radius: 12px;
  background: rgba(255,255,255,.76);
}
.match-row > span { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.match-row > span b {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yellow);
}
.match-row select {
  width: 100%;
  min-height: 48px;
  padding: 9px 35px 9px 11px;
  border: 2px solid #b9b3a6;
  border-radius: 8px;
  background: var(--paper);
  color: var(--navy);
  font-weight: 700;
}
.answer-button { min-width: 220px; margin: 30px auto 0; }
.feedback { margin-top: 30px; padding: 21px; border-radius: 13px; line-height: 1.8; }
.feedback.correct { border: 2px solid var(--green); background: #edf5e9; }
.feedback.wrong { border: 2px solid var(--terracotta); background: #fff1e8; }
.feedback h3 { display: flex; align-items: center; gap: 11px; margin: 0; font-size: 22px; }
.feedback h3 span {
  display: grid;
  place-items: center;
  width: 35px; height: 35px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.feedback p { margin: 12px 0 20px; }
.next-button { margin-left: auto; }
.result-view {
  min-height: calc(100vh - 79px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 55px 0 90px;
  text-align: center;
}
.result-view h1 { margin: 0; font-family: "Yu Mincho",serif; font-size: clamp(31px,5vw,53px); }
.result-copy { max-width: 620px; margin: 17px auto 27px; color: #53606a; font-weight: 700; line-height: 1.8; }
.result-stamp {
  display: grid;
  place-items: center;
  width: 140px; height: 140px;
  margin-bottom: 23px;
  border: 5px double var(--terracotta);
  border-radius: 50%;
  color: var(--terracotta);
  font-family: Georgia,serif;
  font-size: 34px;
  font-weight: 900;
  transform: rotate(-6deg);
}
.result-stamp small { font-size: 18px; }
.result-stamp.passed { border-color: var(--green); color: var(--green); font-size: 21px; animation: stamp-in .52s ease-out; }
.screenshot-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 22px;
  width: min(560px,100%);
  padding: 21px;
  border: 2px dashed var(--green);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(67,55,35,.1);
  text-align: left;
}
.screenshot-card small, .screenshot-card strong { display: block; }
.screenshot-card small { color: var(--terracotta); font-weight: 900; letter-spacing: .12em; }
.screenshot-card strong { margin: 4px 0; font-size: 24px; }
.screenshot-card p { margin: 0; font-size: 14px; font-weight: 700; }
.medal {
  display: grid;
  place-items: center;
  width: 84px; height: 84px;
  border: 5px double white;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: "Yu Mincho",serif;
  font-size: 35px;
  font-weight: 900;
  box-shadow: 0 0 0 4px var(--green);
}
.result-actions { display: flex; gap: 17px; margin-top: 29px; }
.completion-view {
  position: relative;
  isolation: isolate;
  padding-top: 42px;
}
.celebration-marks {
  position: absolute;
  inset: 25px 0 auto;
  z-index: -1;
  height: 540px;
  pointer-events: none;
}
.celebration-marks span {
  position: absolute;
  color: var(--yellow);
  font-size: 25px;
  animation: float-mark 2.4s ease-in-out infinite alternate;
}
.celebration-marks span:nth-child(1) { top: 7%; left: 5%; color: var(--terracotta); }
.celebration-marks span:nth-child(2) { top: 35%; left: 1%; color: var(--green); animation-delay: -.6s; }
.celebration-marks span:nth-child(3) { top: 68%; left: 8%; animation-delay: -1.1s; }
.celebration-marks span:nth-child(4) { top: 4%; right: 5%; animation-delay: -.3s; }
.celebration-marks span:nth-child(5) { top: 34%; right: 1%; color: var(--terracotta); animation-delay: -.9s; }
.celebration-marks span:nth-child(6) { top: 69%; right: 8%; color: var(--green); animation-delay: -1.5s; }
.celebration-marks span:nth-child(7) { top: 14%; left: 15%; animation-delay: -1.8s; }
.celebration-marks span:nth-child(8) { top: 17%; right: 15%; color: var(--terracotta); animation-delay: -1.2s; }
.completion-card {
  width: min(780px, 100%);
  padding: clamp(28px, 5vw, 52px);
  border: 4px double var(--green);
  border-radius: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(243,199,79,.2), transparent 22%),
    radial-gradient(circle at 85% 18%, rgba(200,111,74,.13), transparent 21%),
    var(--paper);
  box-shadow:
    0 18px 38px rgba(67,55,35,.14),
    inset 0 0 0 8px rgba(79,124,85,.07);
}
.completion-card h1 {
  margin-top: 15px;
  color: var(--dark-navy);
  font-size: clamp(35px, 6vw, 61px);
}
.completion-seal {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  margin: 0 auto;
  border: 5px double white;
  border-radius: 50%;
  background: var(--green);
  color: white;
  box-shadow: 0 0 0 5px var(--green);
  transform: rotate(-5deg);
  animation: stamp-in .55s ease-out;
}
.completion-seal span { font-size: 42px; line-height: 1; }
.completion-seal small {
  margin-top: -14px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .09em;
}
.completion-copy {
  margin: 16px auto 25px;
  color: #53606a;
  font-weight: 800;
  line-height: 1.9;
}
.completion-badges {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 0 auto 27px;
}
.completion-badges > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.completion-badges b {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 4px double white;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: "Yu Mincho", serif;
  font-size: 24px;
  box-shadow: 0 0 0 3px var(--green);
}
.completion-badges small {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.share-callout {
  padding: 18px 22px;
  border: 2px dashed var(--terracotta);
  border-radius: 14px;
  background: #fff4cf;
}
.share-callout small {
  display: block;
  margin-bottom: 5px;
  color: var(--terracotta);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
}
.share-callout strong {
  display: block;
  font-size: clamp(18px, 3vw, 25px);
  line-height: 1.55;
}
.completion-home { margin-top: 25px; }
button:focus-visible, select:focus-visible, label:has(input:focus-visible) {
  outline: 4px solid rgba(243,199,79,.8);
  outline-offset: 3px;
}
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-10deg) scale(1.35); }
  65% { transform: rotate(-6deg) scale(.94); }
  100% { opacity: 1; transform: rotate(-6deg) scale(1); }
}
@keyframes float-mark {
  from { transform: translateY(-5px) rotate(-8deg); }
  to { transform: translateY(8px) rotate(9deg); }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 10px; }
  .notebook { width: 360px; margin: 0 auto; }
  .subject-grid { grid-template-columns: repeat(2,1fr); }
  .badge-board { grid-template-columns: 40px 1fr 72px; gap: 12px; }
  .badge-slots { grid-template-columns: repeat(6,44px); }
  .badge-slot { width: 44px; height: 44px; }
  .badge-count { padding-left: 12px; font-size: 31px; }
}
@media (max-width: 640px) {
  .site-header, .home-view, .quiz-view, .result-view { width: min(100% - 28px,1160px); }
  .site-header { min-height: 66px; }
  .brand { gap: 8px; font-size: 18px; }
  .brand-sub { display: none; }
  .text-button { font-size: 13px; }
  .hero { min-height: 0; padding-top: 33px; }
  .hero h1 { font-size: 35px; }
  .hero-copy { font-size: 14px; }
  .notebook { width: min(100%,340px); padding-left: 27px; }
  .page { min-height: 225px; }
  .badge-board { grid-template-columns: 1fr auto; padding: 13px; }
  .stamp-handle { display: none; }
  .badge-slots { grid-template-columns: repeat(6,minmax(30px,1fr)); gap: 6px; }
  .badge-slot { width: 34px; height: 34px; border-width: 2px; font-size: 14px; }
  .badge-count { font-size: 25px; }
  .badge-count small { font-size: 15px; }
  .subject-grid { grid-template-columns: 1fr; }
  .subject-card { min-height: 86px; grid-template-columns: 50px 1fr 30px; padding: 13px 16px; }
  .subject-icon { width: 46px; height: 46px; }
  .subject-copy strong { font-size: 20px; }
  .home-actions { width: 100%; flex-direction: column-reverse; }
  .home-cta { width: 100%; min-width: 0; }
  .completion-link { width: 100%; }
  .quiz-view { padding-top: 30px; }
  .quiz-heading { align-items: start; }
  .question-number b { font-size: 34px; }
  .question-card { padding: 28px 18px; }
  .question-card h2 { font-size: 20px; }
  .option { padding: 11px 12px; }
  .match-row { grid-template-columns: 1fr; gap: 10px; }
  .answer-button, .next-button { width: 100%; }
  .screenshot-card { grid-template-columns: 66px 1fr; gap: 15px; padding: 17px; }
  .medal { width: 62px; height: 62px; font-size: 26px; }
  .screenshot-card strong { font-size: 20px; }
  .result-actions { width: 100%; flex-direction: column; }
  .completion-view { padding-top: 28px; }
  .completion-card { padding: 25px 15px; }
  .completion-card h1 { font-size: 34px; }
  .completion-copy { font-size: 13px; }
  .completion-badges { grid-template-columns: repeat(3, 1fr); gap: 17px 8px; }
  .completion-badges b { width: 55px; height: 55px; font-size: 21px; }
  .share-callout { padding: 16px 11px; }
  .completion-home { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
