:root {
  --ink: #202529;
  --paper: #f8f3e8;
  --cream: #fffaf0;
  --red: #e24a3b;
  --red-dark: #c9372c;
  --blue: #337b8c;
  --blue-dark: #245f6c;
  --yellow: #f4c83e;
  --line: #d7d0c1;
  font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 15% 10%, #fffdf7 0 7%, transparent 24%), var(--paper); }
button, a { font: inherit; }
button { color: inherit; }

.page-shell { width: min(100%, 980px); min-height: 100vh; margin: 0 auto; padding: 26px clamp(20px, 5vw, 56px) 20px; display: flex; flex-direction: column; }
.site-header { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: .02em; }
.brand b { color: var(--red); }
.brand-ball, .mini-ball { position: relative; display: inline-block; border: 2px solid var(--ink); border-radius: 50%; background: linear-gradient(var(--red) 0 44%, var(--ink) 44% 56%, #fff 56%); }
.brand-ball { width: 32px; height: 32px; transform: rotate(-8deg); }
.mini-ball { width: 52px; height: 52px; }
.brand-ball i, .mini-ball i { position: absolute; width: 28%; aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 50%; background: #fff; left: 36%; top: 36%; }
.sound-button { width: 42px; height: 42px; border: 1.5px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-weight: 800; }
.sound-button[aria-pressed="false"] { opacity: .35; text-decoration: line-through; }

main { flex: 1; display: grid; }
.screen { display: none; animation: enter .35s ease both; }
.screen.active { display: grid; }
.start-screen { grid-template-columns: 1.15fr .85fr; gap: 32px 52px; align-items: center; padding: clamp(40px, 9vh, 92px) 0 24px; }
.hero-copy .eyebrow, .result-screen .eyebrow { display: inline-block; margin: 0 0 18px; padding: 7px 13px; border: 1.5px solid var(--ink); border-radius: 99px; font-size: .72rem; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-family: "Hachi Maru Pop", sans-serif; font-size: clamp(2.6rem, 6.7vw, 5.25rem); line-height: 1.17; letter-spacing: -.06em; }
h1 span { color: var(--red); position: relative; }
.lead { margin: 28px 0 0; line-height: 2; font-weight: 500; color: #65635e; }
.start-card { min-height: 300px; padding: 42px 32px 30px; border: 2px solid var(--ink); border-radius: 28px; background: var(--cream); box-shadow: 10px 10px 0 var(--yellow); text-align: center; display: flex; flex-direction: column; justify-content: center; }
.duel-icons { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 38px; }
.duel-icons b { font-size: 1rem; font-style: italic; }
.medicine-icon { display: inline-grid; place-items: center; color: var(--blue); border: 2px solid var(--blue); border-radius: 14px; background: #eef8f8; }
.duel-icons .medicine-icon { width: 52px; height: 52px; font-size: 1.8rem; transform: rotate(6deg); }
.primary-button { width: 100%; min-height: 62px; padding: 14px 20px; border: 2px solid var(--ink); border-radius: 15px; color: #fff; background: var(--red); box-shadow: 0 5px 0 var(--ink); cursor: pointer; font-weight: 800; font-size: 1rem; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-button:hover { background: var(--red-dark); transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.primary-button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.primary-button span { float: right; }
.start-card > p { margin: 18px 0 0; color: #88847c; font-size: .75rem; }
.average-card { grid-column: 1 / -1; width: min(100%, 480px); display: flex; align-items: center; gap: 13px; padding: 15px 18px; border-top: 1px solid var(--line); }
.chart-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 10px; background: #eee4cc; font-weight: 800; }
.average-card div { display: flex; align-items: baseline; gap: 10px; }
.average-card small, .comparison-card small { color: #74716b; }
.average-card strong { font-size: 1.35rem; }
.average-card p { margin: 0 0 0 auto; color: #938f86; font-size: .72rem; }

.quiz-screen { width: min(100%, 760px); margin: auto; align-content: center; padding: 40px 0; }
.quiz-topline { display: flex; justify-content: space-between; font-size: .77rem; font-weight: 800; letter-spacing: .15em; }
.quiz-time { color: var(--blue); white-space: nowrap; }
.quiz-time strong, .result-time strong { font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; margin: 12px 0 clamp(50px, 10vh, 92px); border-radius: 99px; background: #dfd9cc; overflow: hidden; }
.progress-track span { display: block; width: 10%; height: 100%; border-radius: inherit; background: var(--red); transition: width .3s; }
.question-wrap { text-align: center; }
.question-wrap > p:first-child { color: #88847c; font-size: .9rem; }
.question-wrap h2 { margin: 18px 0 10px; font-size: clamp(2.75rem, 8vw, 5.5rem); letter-spacing: .04em; line-height: 1.15; }
.question-wrap .reading { margin: 0; color: #918e87; font-size: .78rem; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: clamp(52px, 9vh, 80px); }
.answer-button { min-height: 110px; display: flex; justify-content: center; align-items: center; gap: 20px; border: 2px solid var(--ink); border-radius: 20px; background: var(--cream); cursor: pointer; box-shadow: 0 5px 0 var(--ink); transition: transform .15s, background .15s; }
.answer-button:hover { transform: translateY(-3px); }
.answer-button.pokemon:hover { background: #fff1ee; }
.answer-button.medicine:hover { background: #edf7f8; }
.answer-button .medicine-icon { width: 52px; height: 52px; font-size: 1.7rem; }
.answer-button span:last-child { display: flex; flex-direction: column; text-align: left; }
.answer-button strong { font-size: 1.25rem; }
.answer-button small { margin-top: 3px; font-size: .62rem; letter-spacing: .15em; color: #8e8980; }
.answer-button:disabled { cursor: default; transform: none; opacity: .5; }
.answer-button.correct { opacity: 1; outline: 4px solid #88c37a; background: #eef8e9; }
.answer-button.wrong { opacity: 1; outline: 4px solid #e67e73; background: #fff0ee; }
.feedback { margin: 28px auto 0; width: min(100%, 530px); text-align: center; }
.pokemon-reveal { width: 150px; height: 124px; margin: -12px auto 12px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 24px; background: #fff; box-shadow: 5px 5px 0 var(--yellow); animation: pop .28s ease both; }
.pokemon-reveal[hidden] { display: none; }
.pokemon-reveal img { width: 136px; height: 112px; object-fit: contain; image-rendering: pixelated; }
.feedback strong { font-size: 1.15rem; }
.feedback p { margin: 5px 0 0; color: #74716b; font-size: .82rem; }

.result-screen { width: min(100%, 640px); margin: auto; padding: 44px 0; align-content: center; justify-items: center; text-align: center; }
.result-medal { width: 180px; height: 180px; display: flex; align-items: baseline; justify-content: center; padding-top: 42px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 8px 8px 0 var(--ink); }
.result-medal span { font-size: 4.3rem; font-weight: 800; line-height: 1; }
.result-medal small { font-weight: 800; }
.result-time { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 0; color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.result-time strong { color: var(--ink); font-size: 1.08rem; letter-spacing: .06em; }
.result-screen h2 { margin: 16px 0 8px; font-size: clamp(1.7rem, 5vw, 2.5rem); }
.result-screen > p:not(.eyebrow):not(.share-status):not(.result-time) { margin: 0; color: #77736b; }
.comparison-card { width: 100%; margin: 34px 0 25px; padding: 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border: 1.5px solid var(--line); border-radius: 18px; background: var(--cream); }
.comparison-card div { display: flex; flex-direction: column; gap: 4px; }
.comparison-card strong { font-size: 1.65rem; }
.comparison-card > span { color: var(--red); font-weight: 800; font-style: italic; }
.result-actions { width: min(100%, 430px); display: grid; gap: 12px; }
.share-button { background: var(--blue); }
.share-button:hover { background: var(--blue-dark); }
.x-share-button { background: var(--ink); }
.x-share-button:hover { background: #080a0b; }
.primary-button:disabled { cursor: wait; opacity: .55; transform: none; box-shadow: 0 5px 0 var(--ink); }
.secondary-button { justify-self: center; margin-top: 6px; border: 0; border-bottom: 1px solid currentColor; background: transparent; cursor: pointer; font-weight: 700; }
.share-status { min-height: 1.4em; margin: 16px 0 0; font-size: .78rem; color: var(--blue); }
footer { padding-top: 20px; text-align: center; color: #8c887f; font-size: .7rem; line-height: 1.7; }
footer a { color: inherit; }

@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.72) rotate(-5deg); } to { opacity: 1; transform: scale(1); } }
@media (max-width: 700px) {
  .page-shell { padding-top: 18px; }
  .start-screen { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-copy { text-align: center; }
  .lead { font-size: .88rem; }
  .start-card { min-height: 265px; margin: 0 4px; padding: 32px 24px 26px; }
  .average-card { grid-column: 1; }
  .quiz-topline { gap: 8px; letter-spacing: .08em; }
  .answer-grid { grid-template-columns: 1fr; }
  .answer-button { min-height: 92px; }
  .progress-track { margin-bottom: 54px; }
  .feedback:not([hidden]) {
    position: fixed;
    z-index: 20;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px;
    width: auto;
    margin: 0;
    padding: 14px 18px 16px;
    border: 2px solid var(--ink);
    border-radius: 20px;
    background: rgba(255, 250, 240, .98);
    box-shadow: 6px 6px 0 var(--yellow);
  }
  .pokemon-reveal {
    width: 128px;
    height: 106px;
    margin: 0 auto 10px;
    border-radius: 18px;
    box-shadow: none;
  }
  .pokemon-reveal img {
    width: 100%;
    height: 100%;
    padding: 6px;
  }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
