:root {
  --navy: #10263f;
  --navy-2: #193a5b;
  --ink: #193047;
  --muted: #728198;
  --line: #e4e9ef;
  --paper: #f7f9fc;
  --white: #fff;
  --orange: #e9783f;
  --orange-soft: #fff1e9;
  --green: #2b9270;
  --green-soft: #eaf8f2;
  --red: #d65b5b;
  --red-soft: #fff0f0;
  --shadow: 0 16px 40px rgba(24, 51, 79, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--paper); font-family: "Noto Sans JP", sans-serif; overflow-x: hidden; }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(233, 120, 63, .45); outline-offset: 3px; }
.site-header { min-height: 74px; padding: 0 max(24px, calc((100% - 1120px) / 2)); background: var(--navy); color: white; display: flex; align-items: center; justify-content: space-between; }
.brand { color: white; text-decoration: none; display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; background: var(--orange); font-size: 19px; transform: rotate(-8deg); }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand strong { font-size: 17px; letter-spacing: .08em; }
.brand small { margin-top: 3px; color: #a9bfd5; font-size: 10px; letter-spacing: .12em; }
.header-note { color: #b7c8d8; font-size: 11px; }
.status-dot { width: 7px; height: 7px; display: inline-block; margin-right: 7px; border-radius: 50%; background: #64d2a4; }
.shell { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 130px); margin: 0 auto; padding: 58px 0 72px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 38px; }
.eyebrow { margin: 0 0 12px; color: var(--orange); font: 700 12px "DM Sans", sans-serif; letter-spacing: .18em; }
h1 { margin: 0; color: var(--navy); font-size: clamp(29px, 4vw, 45px); letter-spacing: .04em; line-height: 1.35; }
.hero-copy { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.hero-badge { min-width: 165px; padding: 17px 20px; border: 1px solid #dfe7ef; border-radius: 14px; background: white; text-align: center; }
.hero-badge strong { display: block; color: var(--navy); font: 700 30px "DM Sans", sans-serif; }
.hero-badge span { color: var(--muted); font-size: 11px; }
.panel { padding: 27px; border: 1px solid var(--line); border-radius: 17px; background: var(--white); box-shadow: var(--shadow); }
.account-panel { margin-bottom: 20px; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.account-row h2, .account-row p { margin: 0; }
.account-row p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.auth-panel { max-width: 560px; margin: 0 auto; }
.auth-panel input { display: block; width: 100%; margin: 10px 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; }
.auth-error { min-height: 20px; margin: 8px 0 0; color: var(--red); font-size: 12px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 17px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.subjects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.subject-card { position: relative; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: left; transition: .2s ease; }
.subject-card:hover, .subject-card.selected { border-color: var(--orange); box-shadow: 0 5px 16px rgba(233, 120, 63, .14); transform: translateY(-2px); }
.subject-card.selected::after { content: "✓"; position: absolute; top: 14px; right: 16px; color: var(--orange); font-weight: 800; }
.subject-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 13px; border-radius: 11px; background: var(--orange-soft); color: var(--orange); font-size: 18px; }
.subject-card h3 { margin: 0 0 5px; font-size: 15px; }
.subject-card p { margin: 0; color: var(--muted); font-size: 11px; }
.subject-count { float: right; color: var(--orange); font: 600 11px "DM Sans", sans-serif; }
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 21px; }
.primary, .secondary { border-radius: 10px; padding: 12px 19px; font-weight: 700; }
.primary { border: 0; background: var(--orange); color: white; box-shadow: 0 5px 14px rgba(233, 120, 63, .25); }
.primary:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.primary:hover { background: #d96731; }
.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary:hover { border-color: #b6c4d2; }
.study-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.question-panel { padding: 32px; }
.question-top { display: flex; justify-content: space-between; color: var(--muted); font: 600 12px "DM Sans", sans-serif; letter-spacing: .08em; }
.progress-track { height: 5px; margin: 13px 0 31px; border-radius: 5px; background: #edf0f4; overflow: hidden; }
.progress-bar { height: 100%; background: var(--orange); transition: width .3s ease; }
.question-text { margin: 0 0 24px; color: var(--navy); font-size: 19px; font-weight: 700; line-height: 1.9; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); text-align: left; transition: .15s ease; }
.choice:hover:not(:disabled) { border-color: var(--orange); background: #fffaf7; }
.choice:disabled { cursor: default; }
.choice-label { display: grid; flex: 0 0 27px; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: #f0f3f6; color: var(--muted); font: 700 12px "DM Sans", sans-serif; }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.correct .choice-label { background: var(--green); color: white; }
.choice.incorrect { border-color: var(--red); background: var(--red-soft); }
.choice.incorrect .choice-label { background: var(--red); color: white; }
.result { margin-top: 22px; padding: 17px 18px; border-radius: 11px; }
.result.correct { background: var(--green-soft); }
.result.incorrect { background: var(--red-soft); }
.result-title { margin: 0 0 5px; font-weight: 800; }
.result.correct .result-title { color: var(--green); }
.result.incorrect .result-title { color: var(--red); }
.result p { margin: 0; color: #4e6175; font-size: 13px; line-height: 1.8; }
.explanation { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.explanation h3 { margin: 0 0 8px; font-size: 13px; }
.explanation p, .explanation li { color: #596b7e; font-size: 13px; line-height: 1.9; }
.explanation p { margin: 0 0 10px; }
.explanation p:last-child { margin-bottom: 0; }
.explanation ul { margin: 0 0 10px; padding-left: 1.4em; }
.explanation li { margin: 3px 0; }
.explanation h4 { margin: 12px 0 7px; color: var(--navy); font-size: 13px; }
.explanation hr { margin: 12px 0; border: 0; border-top: 1px solid var(--line); }
.explanation code { padding: 2px 5px; border-radius: 4px; background: #f0f3f6; font-family: "DM Sans", monospace; font-size: .92em; }
.side-panel { padding: 23px; }
.side-panel h3 { margin: 0 0 17px; font-size: 14px; }
.side-stat { display: flex; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.side-stat strong { color: var(--navy); font: 700 15px "DM Sans", sans-serif; }
.side-tip { margin-top: 17px; padding: 14px; border-radius: 10px; background: var(--orange-soft); color: #9c542f; font-size: 11px; line-height: 1.7; }
.back-link { display: inline-block; margin-bottom: 19px; color: var(--muted); font-size: 12px; text-decoration: none; }
.back-link:hover { color: var(--orange); }
.summary { max-width: 700px; margin: 0 auto; text-align: center; }
.summary h2 { margin: 0 0 10px; color: var(--navy); font-size: 28px; }
.summary-lead { margin: 0 0 27px; color: var(--muted); font-size: 13px; }
.score { display: flex; justify-content: center; align-items: baseline; gap: 7px; margin: 15px 0 7px; color: var(--orange); }
.score strong { font: 700 70px "DM Sans", sans-serif; line-height: 1; }
.score span { color: var(--muted); font-size: 14px; }
.score-message { margin: 0 0 27px; color: var(--ink); font-size: 14px; font-weight: 700; }
.summary-bar { width: 80%; height: 8px; margin: 0 auto 28px; border-radius: 5px; background: #edf0f4; overflow: hidden; }
.summary-bar span { display: block; height: 100%; background: var(--orange); }
.review-list { margin-top: 30px; text-align: left; }
.review-list h3 { margin: 0 0 13px; font-size: 14px; }
.review-item { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 12px; }
.review-item span { color: var(--muted); }
.review-item strong.ok { color: var(--green); }
.review-item strong.ng { color: var(--red); }
.site-footer { display: flex; justify-content: space-between; width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 20px 0 28px; border-top: 1px solid var(--line); color: #8b9aaa; font-size: 11px; }
@media (max-width: 900px) {
  .shell { width: min(760px, calc(100% - 40px)); padding-top: 44px; }
  .study-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; }
  .question-panel { padding: 26px; }
  .question-text { font-size: 18px; }
}
@media (max-width: 720px) {
  .site-header { min-height: 65px; padding: 0 max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .header-note { display: none; }
  .shell { width: calc(100% - 28px); padding-top: 35px; padding-bottom: 48px; }
  .hero { display: block; margin-bottom: 26px; }
  h1 { font-size: clamp(28px, 8vw, 38px); }
  .hero-copy { font-size: 13px; }
  .hero-badge { display: inline-block; min-width: 130px; margin-top: 21px; padding: 11px 16px; }
  .hero-badge strong { font-size: 24px; }
  .subjects { grid-template-columns: 1fr; }
  .subject-card { padding: 16px; }
  .subject-icon { display: inline-grid; margin: 0 10px 0 0; vertical-align: middle; }
  .subject-card h3 { display: inline; }
  .subject-card p { margin: 7px 0 0 50px; }
  .panel, .question-panel { padding: 18px; border-radius: 14px; }
  .panel-heading { display: block; }
  .panel-heading > p { margin-top: 8px; }
  .study-layout { grid-template-columns: 1fr; }
  .question-top { gap: 12px; align-items: flex-start; font-size: 10px; }
  .question-top span:last-child { flex: 0 0 auto; }
  .progress-track { margin-bottom: 23px; }
  .question-text { font-size: 17px; line-height: 1.8; }
  .choice { min-height: 54px; padding: 12px; font-size: 13px; line-height: 1.6; }
  .side-panel { order: 2; }
  .actions { justify-content: stretch; }
  .actions button { flex: 1; min-height: 47px; }
  .summary h2 { font-size: 24px; }
  .score strong { font-size: 60px; }
  .review-item { align-items: center; }
  .review-item span { min-width: 0; overflow-wrap: anywhere; }
  .site-footer { width: calc(100% - 28px); padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .brand strong { font-size: 15px; }
  .brand small { font-size: 9px; }
  .subject-card p { font-size: 10px; }
  .question-panel { padding: 15px; }
  .question-text { font-size: 16px; }
  .result p, .explanation p { font-size: 12px; }
  .site-footer { display: block; text-align: center; }
  .site-footer span { display: block; }
  .site-footer span + span { margin-top: 5px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { min-height: 58px; }
  .shell { padding-top: 24px; padding-bottom: 32px; }
  .hero { margin-bottom: 22px; }
  .hero-badge { margin-top: 10px; }
}
