:root {
  --ink: #18324a;
  --muted: #506476;
  --paper: #fff;
  --bg: #f4f8ef;
  --accent: #0b6b57;
  --accent-dark: #064b3e;
  --warm: #fff4d6;
  --line: #9aabb5;
  --focus: #8b2fc9;
  --danger: #8a3b15;
  --shadow: 0 4px 16px #18324a1c;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 18px;
  line-height: 1.85;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #f6faef, #eef7f7); }
img, svg { display: block; max-width: 100%; }
button { max-width: 100%; font: inherit; color: inherit; overflow-wrap: anywhere; }
p, h1, h2, h3, dt, dd, strong, span { overflow-wrap: anywhere; word-break: normal; }
ruby { ruby-align: center; ruby-position: over; }
rt { font-size: .72em; line-height: 1.25; font-weight: 700; letter-spacing: .02em; }
.skip-link { position: absolute; left: 1rem; top: -6rem; z-index: 20; background: #fff; padding: 1rem; }
.skip-link:focus { top: 1rem; }
.site-header { min-height: 72px; padding: .7rem clamp(1rem, 4vw, 3rem); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .7rem 1rem; background: var(--paper); border-bottom: 3px solid var(--accent); }
.site-header > div { min-width: 0; display: flex; align-items: center; }
.site-header strong { min-width: 0; line-height: 1.55; }
.logo-mark { flex: 0 0 44px; display: inline-grid; place-items: center; width: 44px; height: 44px; margin-right: .5rem; border: 3px solid var(--ink); border-radius: 10px; background: var(--warm); }
.practice-badge { flex: 0 0 auto; white-space: nowrap; border: 2px solid var(--accent); border-radius: 999px; padding: .2rem .8rem; font-weight: 700; }
.screen { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.2rem, 4vw, 3rem) 0 4rem; }
.screen > h1 { margin-top: 0; line-height: 1.65; }
.hero { text-align: center; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.7rem); line-height: 1.5; margin: .4rem 0; }
.subtitle { font-size: clamp(1.15rem, 3vw, 1.6rem); font-weight: 700; color: var(--accent-dark); }
.hero-art { width: min(520px, 90%); margin: 2rem auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; align-items: center; }
.package-shape { flex: 0 1 160px; min-height: 190px; border: 5px solid var(--ink); border-radius: 20px; background: #ffe69a; transform: rotate(-3deg); }
.label-shape { flex: 0 1 230px; min-height: 150px; background: #fff; border: 5px solid var(--ink); padding: 1rem; box-shadow: var(--shadow); transform: rotate(2deg); }
.label-shape span { display: block; border-bottom: 3px solid var(--ink); min-height: 26px; }
.button-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; align-items: stretch; width: 100%; margin-top: 1.5rem; }
.btn { flex: 0 1 auto; min-height: 60px; min-width: min(180px, 100%); border: 3px solid var(--ink); border-radius: 14px; background: #fff; padding: .75rem 1.2rem; font-weight: 800; line-height: 1.55; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.btn:hover { background: #eef7f4; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible, .choice-card:focus-visible, .level-card:focus-visible, .view-label:focus-visible, .dialog-tabs button:focus-visible { outline: 5px solid var(--focus); outline-offset: 4px; }
.panel, .question-area, .product-area, .message-area, .result-details { min-width: 0; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: clamp(1rem, 3vw, 2rem); box-shadow: var(--shadow); }
.panel h1, .panel h2 { line-height: 1.65; }
.notice { min-width: 0; background: var(--warm); border: 4px double var(--danger); border-radius: 14px; padding: 1rem 1.2rem; margin: 1.2rem 0; font-weight: 700; line-height: 2; }
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.level-card { min-width: 0; text-align: left; min-height: 190px; background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 1.2rem; cursor: pointer; box-shadow: var(--shadow); }
.level-card h2 { font-size: 1.35rem; color: var(--accent-dark); line-height: 1.65; }
.question-area, .product-area, .message-area { margin-bottom: 1.5rem; }
.question-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
.eyebrow { font-weight: 800; color: var(--accent-dark); }
.progress-percent { font-weight: 900; white-space: nowrap; }
.progress-wrap { margin: .7rem 0 1.5rem; }
.progress-track { height: 20px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); }
.question-text { max-width: 28em; font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 800; white-space: pre-line; line-height: 2; margin: 1rem 0 0; }
.reference-date { display: inline-block; max-width: 100%; margin-top: .4rem; padding: .35rem .8rem; border: 3px solid var(--ink); background: var(--warm); font-weight: 800; }
.section-heading { margin-top: 0; font-size: 1.35rem; line-height: 1.7; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; align-items: stretch; width: 100%; }
.choice-wrap { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .75rem; align-items: stretch; }
.choice-card { width: 100%; min-width: 0; min-height: 300px; border: 4px solid var(--ink); border-radius: 18px; background: #fff; padding: 1rem; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .8rem; }
.choice-card[aria-pressed="true"] { border: 7px solid var(--accent-dark); padding: calc(1rem - 3px); background: #edf8f3; }
.choice-image { width: min(180px, 100%); aspect-ratio: 4 / 3; display: grid; place-items: center; flex: 0 0 auto; }
.choice-card img { width: 100%; height: 100%; object-fit: contain; }
.choice-card strong { margin-top: auto; font-size: 1.2rem; line-height: 1.85; text-align: center; }
.selected-label { min-height: 2rem; font-weight: 900; line-height: 1.55; text-align: center; }
.view-label { width: 100%; min-height: 64px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; padding: .65rem 1rem; font-weight: 800; line-height: 1.55; cursor: pointer; }
.message-area { padding: clamp(.8rem, 2vw, 1.3rem); }
.feedback { min-width: 0; min-height: 110px; border: 3px solid var(--ink); border-radius: 14px; padding: 1.2rem; margin: 0; background: #fff; line-height: 2; }
.feedback p { margin: .7rem 0; }
.feedback .btn { margin-top: .6rem; }
.feedback-title { font-size: 1.4rem; font-weight: 900; line-height: 1.8; }
.feedback.correct { border-style: double; border-width: 6px; }
.feedback.retry { border-style: dashed; }
.controls-area { padding-top: .25rem; }
.dialog-backdrop { position: fixed; inset: 0; background: #10283dcc; z-index: 10; overflow-y: auto; padding: max(1rem, env(safe-area-inset-top)) 1rem; }
.dialog { width: min(920px, 100%); min-height: min-content; margin: 0 auto; background: #f5f7f7; border: 5px solid var(--ink); border-radius: 18px; padding: clamp(1rem, 3vw, 1.5rem); }
.dialog-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: .5rem; }
.dialog-head h2 { margin: 0; line-height: 1.7; }
.dialog-help { margin: .5rem 0 1rem; }
.dialog-tabs { display: flex; flex-wrap: wrap; gap: .75rem; padding: .4rem 0 1.2rem; }
.dialog-tabs button { flex: 1 1 210px; min-width: 0; min-height: 60px; border: 3px solid var(--ink); border-radius: 10px; background: #fff; padding: .65rem .8rem; font-weight: 800; line-height: 1.7; }
.dialog-tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.label-viewer { min-width: 0; width: 100%; background: #e9f2f3; border: 4px solid var(--ink); border-radius: 16px; padding: clamp(.8rem, 2.5vw, 1.4rem); }
.label-viewer-heading { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 900; }
.label-card { width: min(760px, 100%); min-width: 0; margin: 0 auto; background: #fff; border: 5px solid #1f2933; padding: clamp(.6rem, 2vw, 1rem); color: #111; }
.label-card h2 { margin: .2rem 0 1rem; text-align: center; font-size: clamp(1.35rem, 4vw, 1.7rem); line-height: 1.9; }
.label-row { min-width: 0; display: grid; grid-template-columns: minmax(145px, 31%) minmax(0, 1fr); border-top: 2px solid #333; }
.label-row:last-child { border-bottom: 2px solid #333; }
.label-key, .label-value { min-width: 0; padding: .75rem; line-height: 2; overflow-wrap: anywhere; }
.label-key { font-weight: 900; border-right: 2px solid #333; }
.label-row.highlight { border: 6px solid #111; margin: 5px 0; background: #fff4c2; }
.label-row.highlight .label-value { text-decoration: underline 5px; text-underline-offset: 8px; font-weight: 900; }
.result-overview { margin-bottom: 1.5rem; }
.result-message { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 800; line-height: 2; }
.result-details { margin-top: 1.5rem; }
.result-details > h2 { margin-top: 0; }
.summary-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
.summary-item { min-width: 0; background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: clamp(1rem, 2.5vw, 1.4rem); }
.summary-item h3 { margin-top: 0; }
.summary-question { line-height: 2; font-weight: 700; }
.summary-item dl { min-width: 0; display: grid; grid-template-columns: minmax(180px, 28%) minmax(0, 1fr); margin: 0; border-top: 1px solid var(--line); }
.summary-item dt, .summary-item dd { min-width: 0; padding: .7rem; border-bottom: 1px solid var(--line); margin: 0; line-height: 1.9; overflow-wrap: anywhere; }
.summary-item dt { font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.stat { min-width: 0; background: #fff; border: 3px solid var(--ink); border-radius: 12px; text-align: center; padding: .8rem; line-height: 1.8; }
.stat strong { display: block; font-size: 2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-wrap:last-child { grid-column: 1 / -1; width: min(50%, 360px); justify-self: center; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { font-size: 17px; }
  .screen { width: min(100% - 1rem, 1160px); }
  .site-header { align-items: flex-start; }
  .site-header > div { flex: 1 1 100%; }
  .site-header strong { font-size: .92rem; }
  .practice-badge { font-size: .8rem; }
  .level-grid, .choices, .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .choice-wrap:last-child { grid-column: auto; width: 100%; }
  .choice-card { min-height: 250px; }
  .question-top { grid-template-columns: minmax(0, 1fr); }
  .button-row { align-items: stretch; }
  .btn { flex: 1 1 100%; width: 100%; }
  .dialog-backdrop { padding: .5rem; }
  .dialog { border-width: 3px; padding: .8rem; }
  .dialog-head { align-items: stretch; }
  .dialog-head .btn { flex: 0 0 auto; width: auto; }
  .dialog-tabs { display: grid; grid-template-columns: minmax(0, 1fr); }
  .dialog-tabs button { width: 100%; }
  .label-row { grid-template-columns: minmax(0, 1fr); }
  .label-key { border-right: 0; border-bottom: 1px solid #333; background: #f0f3f4; }
  .summary-item dl { grid-template-columns: minmax(0, 1fr); }
  .summary-item dt { border-bottom: 0; padding-bottom: .2rem; }
  .summary-item dd { padding-top: .2rem; }
  rt { font-size: .72em; }
}

@media (max-width: 420px) {
  .screen > h1 { font-size: 1.55rem; }
  .question-text { font-size: 1.32rem; }
  .label-card { border-width: 3px; }
  .label-row.highlight { border-width: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
