:root {
  color-scheme: light;
  --ink: #17363d;
  --ink-soft: #687a7e;
  --paper: #f5f3ee;
  --surface: #fffefb;
  --line: #d9dfdc;
  --soft: #edf1ef;
  --coral: #e96f56;
  --coral-dark: #bd4e39;
  --safe: #26745e;
  --warning: #c17b2a;
  --danger: #bd4646;
  --cream: #fff8eb;
  --shadow: 0 24px 70px rgba(17, 47, 54, 0.12);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; overflow-x: hidden; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button, a, input, select, summary, .option-card { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
.is-hidden { display: none !important; }

.site-header {
  width: min(1080px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; color: var(--cream); background: var(--ink); font-size: 14px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: 0.08em; }
.brand small { margin-top: 1px; color: var(--ink-soft); font-size: 10px; }
.privacy-note { justify-self: end; display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; }
.privacy-note i { width: 7px; height: 7px; border-radius: 50%; background: #4ba780; box-shadow: 0 0 0 4px rgba(75,167,128,0.13); }

.page-shell { width: min(1080px, calc(100% - 32px)); margin: 12px auto 90px; }
.quiz-shell { min-height: max(620px, calc(100vh - 84px)); min-height: max(620px, calc(100svh - 84px)); display: grid; grid-template-columns: 38% 62%; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.quiz-cover { position: relative; min-height: 620px; overflow: hidden; isolation: isolate; }
.quiz-cover picture, .quiz-cover picture img, .cover-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.quiz-cover picture img { object-fit: cover; object-position: 62% center; }
.cover-shade { z-index: 1; background: linear-gradient(180deg, rgba(8,29,37,0.12), rgba(8,29,37,0.84)); }
.cover-copy { position: absolute; left: 30px; right: 30px; bottom: 32px; z-index: 2; color: var(--cream); }
.cover-copy > p { margin-bottom: 12px; color: #ffb69f; font-size: 11px; font-weight: 850; letter-spacing: 0.12em; }
.cover-copy h1 { margin-bottom: 26px; font-size: clamp(31px, 3.4vw, 43px); line-height: 1.14; letter-spacing: -0.045em; }
.cover-copy ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cover-copy li { padding: 6px 9px; border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; background: rgba(8,29,37,0.22); backdrop-filter: blur(8px); font-size: 9px; }

.quiz-panel { min-width: 0; padding: 34px 44px; display: flex; flex-direction: column; justify-content: center; }
.quiz-progress-row { display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 10px; }
.text-button { padding: 0; border: 0; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.progress-track { height: 5px; margin: 11px 0 42px; overflow: hidden; border-radius: 99px; background: var(--soft); }
.progress-track span { display: block; width: 16.66%; height: 100%; border-radius: inherit; background: var(--coral); transition: width 220ms ease; }
.question-stage fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.question-kicker { display: block; margin-bottom: 9px; color: var(--coral-dark); font-size: 10px; font-weight: 850; letter-spacing: 0.1em; }
.question-stage legend { width: 100%; margin-bottom: 10px; padding: 0; font-size: clamp(27px, 3.2vw, 39px); line-height: 1.18; letter-spacing: -0.04em; font-weight: 850; }
.question-help { margin-bottom: 24px; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.option-list { display: grid; gap: 9px; }
.option-list.two-columns { grid-template-columns: 1fr 1fr; }
.option-card { position: relative; display: block; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-content { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fafaf6; transition: border-color 150ms ease, background 150ms ease, transform 150ms ease; }
.option-dot { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #aab8b6; border-radius: 50%; background: #fff; }
.option-dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); transform: scale(0); transition: transform 150ms ease; }
.option-card[data-type="multi"] .option-dot { border-radius: 6px; }
.option-card[data-type="multi"] .option-dot::after { content: "✓"; width: auto; height: auto; color: #fff; background: transparent; font-size: 12px; font-weight: 900; }
.option-copy b, .option-copy small { display: block; }
.option-copy b { font-size: 13px; }
.option-copy small { margin-top: 3px; color: var(--ink-soft); font-size: 10px; line-height: 1.45; }
.option-card input:focus-visible + .option-content { outline: 3px solid rgba(126,203,223,0.32); outline-offset: 2px; }
.option-card input:checked + .option-content { border-color: var(--coral); background: #fff0ea; box-shadow: inset 4px 0 0 var(--coral); }
.option-card input:checked + .option-content .option-dot { border-color: var(--coral); background: var(--coral); }
.option-card input:checked + .option-content .option-dot::after { transform: scale(1); }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.back-button, .next-button, .save-button { min-height: 46px; padding: 0 19px; border-radius: 11px; cursor: pointer; font-size: 12px; font-weight: 800; }
.back-button { border: 1px solid var(--line); background: var(--surface); }
.back-button:disabled { opacity: 0.35; cursor: default; }
.next-button, .save-button { border: 0; color: var(--cream); background: var(--ink); }
.next-button:hover, .next-button:focus-visible, .save-button:hover, .save-button:focus-visible { background: var(--coral-dark); }
.quiz-actions .next-button { min-width: 118px; }
.quiz-footnote { margin: 18px 0 0; color: #94a19f; font-size: 9px; text-align: center; }

.result-view { align-self: stretch; }
.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.result-topline span { color: var(--coral-dark); font-size: 10px; font-weight: 850; letter-spacing: 0.1em; }
.result-topline strong { padding: 6px 9px; border-radius: 999px; color: var(--safe); background: #e7f3ed; font-size: 10px; }
.result-view.warning .result-topline strong { color: var(--warning); background: #fff0dc; }
.result-view.danger .result-topline strong { color: var(--danger); background: #ffe8e5; }
.result-view h2 { margin: 17px 0 9px; font-size: clamp(38px, 5vw, 58px); line-height: 1; letter-spacing: -0.06em; }
.result-view.warning h2 { color: var(--warning); }
.result-view.danger h2 { color: var(--danger); }
.result-summary { color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.result-grid h3 { margin-bottom: 10px; font-size: 12px; }
.result-trigger { padding: 9px 0; border-top: 1px solid var(--line); }
.result-trigger:first-child { border-top: 0; }
.result-trigger b { display: block; font-size: 11px; }
.result-trigger p { margin: 3px 0 0; color: var(--ink-soft); font-size: 9px; line-height: 1.5; }
.result-grid ol { margin: 0; padding-left: 18px; }
.result-grid li { margin-bottom: 9px; padding-left: 3px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }
.paid-reminder { margin: 19px 0 0; padding: 12px 14px; border-radius: 10px; color: #74401b; background: #fff0dc; font-size: 10px; line-height: 1.6; }
.result-actions-row { display: flex; gap: 9px; margin-top: 22px; }
.result-disclaimer { margin: 15px 0 0; color: #94a19f; font-size: 8px; line-height: 1.5; }

.saved-summary { margin: 17px 0 0; color: var(--ink-soft); font-size: 10px; text-align: center; }
.saved-summary a { font-weight: 750; text-underline-offset: 3px; }
.budget-section, .knowledge-section { padding-top: 90px; scroll-margin-top: 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.section-heading > div > span, .emergency-section > div > span { display: block; margin-bottom: 8px; color: var(--coral-dark); font-size: 9px; font-weight: 850; letter-spacing: 0.12em; }
.section-heading h2, .emergency-section h2 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.045em; }
.section-heading p, .emergency-section p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.65; }
.month-field { color: var(--ink-soft); font-size: 9px; }
.month-field input { display: block; min-height: 40px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.budget-card { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 15px 40px rgba(17,47,54,0.07); }
.budget-entry-form { display: grid; grid-template-columns: 1fr 1fr 0.8fr 1fr auto; gap: 10px; align-items: end; }
.budget-entry-form label { color: var(--ink-soft); font-size: 9px; font-weight: 700; }
.input-shell { height: 43px; display: flex; align-items: center; margin-top: 6px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fafaf6; }
.input-shell b { font-size: 12px; }
.input-shell input { width: 100%; min-width: 0; height: 100%; padding-left: 7px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.budget-entry-form > label > input, .budget-entry-form select { width: 100%; height: 43px; margin-top: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fafaf6; }
.save-button { min-width: 140px; }
.budget-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.budget-summary > div { padding: 18px; border-right: 1px solid var(--line); }
.budget-summary > div:last-child { border-right: 0; }
.budget-summary span { display: block; color: var(--ink-soft); font-size: 9px; }
.budget-summary strong { display: block; margin-top: 6px; font-size: 20px; }
.budget-meter { height: 7px; margin-top: 17px; overflow: hidden; border-radius: 99px; background: var(--soft); }
.budget-meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--safe); transition: width 220ms ease, background 220ms ease; }
.budget-meter span.warning { background: var(--warning); }
.budget-meter span.over_budget { background: var(--danger); }
.budget-alert { margin: 12px 0 0; padding: 10px 12px; border-radius: 9px; color: #74401b; background: #fff0dc; font-size: 10px; }
.budget-alert.danger { color: #7e2929; background: #ffe8e5; }
.notification-button { margin-top: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: #fafaf6; cursor: pointer; font-size: 9px; }
.notification-button:hover, .notification-button:focus-visible { color: var(--ink); border-color: #a9b9b6; }
.ledger-details { margin-top: 18px; }
.ledger-details summary { display: flex; justify-content: space-between; cursor: pointer; font-size: 11px; font-weight: 800; }
.ledger-details summary span { color: var(--ink-soft); font-weight: 500; }
.ledger-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.ledger-toolbar button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fafaf6; cursor: pointer; font-size: 9px; }
.ledger-list { margin-top: 8px; }
.ledger-row { display: grid; grid-template-columns: 70px 1fr auto auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.ledger-row span, .ledger-row small { color: var(--ink-soft); font-size: 9px; }
.ledger-row b { font-size: 11px; }
.ledger-row div small { display: block; margin-top: 2px; }
.ledger-row button { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 7px; background: transparent; cursor: pointer; }
.empty-ledger { margin: 20px 0 8px; color: var(--ink-soft); font-size: 10px; text-align: center; }

.section-heading.compact { align-items: start; }
.knowledge-list { border-top: 1px solid var(--line); }
.knowledge-list details { border-bottom: 1px solid var(--line); }
.knowledge-list summary { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 10px; padding: 18px 4px; cursor: pointer; list-style: none; }
.knowledge-list summary::-webkit-details-marker { display: none; }
.knowledge-list summary span { color: var(--coral-dark); font-size: 9px; }
.knowledge-list summary b { font-size: 13px; }
.knowledge-list summary::after { content: "+"; color: var(--ink-soft); font-size: 18px; }
.knowledge-list details[open] summary::after { content: "−"; }
.knowledge-answer { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; padding: 0 56px 20px; }
.knowledge-answer p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.7; }
.knowledge-answer b { color: var(--ink); }

.emergency-section { margin-top: 90px; padding: 28px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 30px; align-items: center; border-radius: 20px; color: var(--cream); background: var(--ink); }
.emergency-section > div > span { color: #ffb39b; }
.emergency-section h2 { color: var(--cream); }
.emergency-section p { color: #b9c8c8; }
.help-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.help-links a { display: flex; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid rgba(255,255,255,0.16); border-radius: 11px; text-decoration: none; }
.help-links small { color: #aebfc0; font-size: 9px; }
.help-links strong { color: #ffb39b; font-size: 18px; }
.official-sources { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; color: #8fa6a8; font-size: 8px; }
.official-sources a { color: #b9c8c8; text-underline-offset: 3px; }

footer { width: min(1080px, calc(100% - 32px)); margin: 0 auto 26px; padding-top: 20px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
footer p { margin: 0; color: var(--ink-soft); font-size: 9px; }
footer button { padding: 0; border: 0; color: var(--ink-soft); background: transparent; cursor: pointer; font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 20; display: grid; gap: 7px; }
.toast { max-width: 320px; padding: 12px 14px; border-radius: 10px; color: var(--cream); background: var(--ink); box-shadow: var(--shadow); font-size: 10px; }
:focus-visible { outline: 3px solid rgba(88,166,184,0.3); outline-offset: 3px; }

@media (hover: hover) and (pointer: fine) {
  .option-card:hover .option-content { border-color: #a9b9b6; transform: translateY(-1px); }
}

@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; }
  .quiz-shell { grid-template-columns: 32% 68%; }
  .quiz-panel { padding: 30px; }
  .budget-entry-form { grid-template-columns: 1fr 1fr; }
  .save-button { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  body { background: var(--surface); }
  input, select, textarea { font-size: 16px; }
  .site-header { width: 100%; min-height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); grid-template-columns: 1fr auto; background: var(--surface); }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .brand strong { font-size: 15px; }
  .privacy-note { max-width: 48vw; white-space: nowrap; font-size: 11px; }
  .page-shell { width: 100%; margin: 0 0 76px; }
  footer { width: calc(100% - 32px); }
  .quiz-shell { min-height: calc(100vh - 56px - env(safe-area-inset-top)); min-height: calc(100dvh - 56px - env(safe-area-inset-top)); grid-template-columns: 1fr; overflow: visible; border-inline: 0; border-radius: 0; box-shadow: none; scroll-margin-top: env(safe-area-inset-top); }
  .quiz-cover { min-height: 112px; }
  .quiz-cover picture img { object-position: center 48%; }
  .cover-shade { background: linear-gradient(90deg, rgba(8,29,37,0.78), rgba(8,29,37,0.08)); }
  .cover-copy { left: 16px; right: 16px; bottom: 14px; }
  .cover-copy > p, .cover-copy ul { display: none; }
  .cover-copy h1 { max-width: 300px; margin: 0; font-size: 22px; line-height: 1.16; }
  .quiz-shell.has-progress .quiz-cover, .quiz-shell.has-result .quiz-cover { display: none; }
  .quiz-panel { min-height: calc(100vh - 168px - env(safe-area-inset-top)); min-height: calc(100dvh - 168px - env(safe-area-inset-top)); padding: 18px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); justify-content: flex-start; }
  .quiz-shell.has-progress .quiz-panel, .quiz-shell.has-result .quiz-panel { min-height: calc(100vh - 56px - env(safe-area-inset-top)); min-height: calc(100dvh - 56px - env(safe-area-inset-top)); }
  #quiz-view, #quiz-form { width: 100%; min-height: 0; flex: 1; display: flex; flex-direction: column; }
  .question-stage { flex: 1; }
  .quiz-progress-row { min-height: 44px; font-size: 12px; }
  .text-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; font-size: 12px; }
  .progress-track { height: 6px; margin: 4px 0 22px; }
  .question-kicker { margin-bottom: 7px; font-size: 11px; }
  .question-stage legend { margin-bottom: 8px; font-size: clamp(25px, 7.2vw, 30px); line-height: 1.2; }
  .question-help { margin-bottom: 18px; font-size: 14px; line-height: 1.55; }
  .option-list.two-columns { grid-template-columns: 1fr; }
  .option-list { gap: 10px; }
  .option-content { min-height: 58px; padding: 12px 14px; border-radius: 14px; }
  .option-copy b { font-size: 15px; line-height: 1.35; }
  .option-copy small { margin-top: 3px; font-size: 12px; line-height: 1.4; }
  .option-card:active .option-content { border-color: var(--coral); background: #fff5f0; }
  .quiz-actions { position: sticky; bottom: 0; z-index: 3; min-height: calc(76px + env(safe-area-inset-bottom)); margin: 16px -2px 0; padding: 12px 2px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(255,254,251,0), var(--surface) 18px); }
  .back-button, .next-button, .save-button { min-height: 52px; border-radius: 14px; font-size: 15px; }
  .quiz-actions button { flex: 1; }
  .quiz-actions .back-button:disabled { display: none; }
  .quiz-actions .next-button { min-width: 132px; }
  .quiz-footnote { margin: 8px 8px 0; font-size: 11px; line-height: 1.55; }
  .result-view { width: 100%; padding-top: 10px; display: flex; flex-direction: column; scroll-margin-top: calc(12px + env(safe-area-inset-top)); }
  .result-topline span { font-size: 11px; }
  .result-topline strong { font-size: 11px; }
  .result-view h2 { font-size: 34px; line-height: 1.08; }
  .result-summary { font-size: 14px; line-height: 1.65; }
  .result-grid { order: 3; grid-template-columns: 1fr; gap: 18px; margin-top: 22px; }
  .result-grid h3 { font-size: 15px; }
  .result-trigger { padding: 12px 0; }
  .result-trigger b { font-size: 14px; }
  .result-trigger p { margin-top: 5px; font-size: 12px; line-height: 1.55; }
  .result-grid li { margin-bottom: 11px; font-size: 13px; line-height: 1.6; }
  .paid-reminder { order: 1; padding: 14px; font-size: 13px; line-height: 1.6; }
  .result-actions-row { order: 2; align-items: stretch; flex-direction: column; margin-top: 18px; }
  .result-actions-row .text-button { align-self: center; }
  .result-disclaimer { order: 4; font-size: 10px; line-height: 1.55; }
  .saved-summary { margin: 16px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 12px; line-height: 1.55; }
  .budget-section, .knowledge-section { margin-right: max(16px, env(safe-area-inset-right)); margin-left: max(16px, env(safe-area-inset-left)); padding-top: 56px; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 18px; }
  .section-heading h2, .emergency-section h2 { font-size: 30px; line-height: 1.12; }
  .section-heading p, .emergency-section p { font-size: 14px; line-height: 1.6; }
  .section-heading > div > span, .emergency-section > div > span { font-size: 11px; }
  .month-field { font-size: 12px; }
  .month-field input { width: 100%; min-height: 50px; font-size: 16px; }
  .budget-card { padding: 16px; border-radius: 16px; box-shadow: none; }
  .budget-entry-form { grid-template-columns: 1fr; gap: 14px; }
  .budget-entry-form label { font-size: 13px; }
  .input-shell, .budget-entry-form > label > input, .budget-entry-form select { height: 52px; border-radius: 12px; }
  .input-shell b { font-size: 16px; }
  .save-button { grid-column: auto; width: 100%; }
  .budget-summary { grid-template-columns: 1fr 1fr; margin-top: 20px; }
  .budget-summary > div { padding: 14px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .budget-summary > div:first-child { border-right: 1px solid var(--line); }
  .budget-summary > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .budget-summary span { font-size: 12px; }
  .budget-summary strong { font-size: 18px; line-height: 1.25; }
  .budget-meter { height: 9px; }
  .budget-alert { padding: 12px 14px; font-size: 13px; line-height: 1.55; }
  .notification-button { min-height: 44px; padding-inline: 14px; font-size: 13px; }
  .ledger-details { margin-top: 14px; }
  .ledger-details summary { min-height: 56px; align-items: center; font-size: 14px; }
  .ledger-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .ledger-toolbar button { min-height: 44px; font-size: 12px; }
  .ledger-row { grid-template-columns: 48px minmax(0, 1fr) 44px; grid-template-areas: "date meta delete" ". amount amount"; gap: 5px 10px; padding: 13px 0; }
  .ledger-row > span { grid-area: date; }
  .ledger-row > div { grid-area: meta; min-width: 0; }
  .ledger-row > strong { grid-area: amount; justify-self: end; font-size: 14px; }
  .ledger-row > button { grid-area: delete; width: 44px; height: 44px; align-self: start; }
  .ledger-row span, .ledger-row small { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
  .ledger-row b { font-size: 14px; }
  .empty-ledger { font-size: 13px; }
  .knowledge-list summary { min-height: 64px; grid-template-columns: 34px 1fr auto; padding: 14px 4px; }
  .knowledge-list summary span { font-size: 11px; }
  .knowledge-list summary b { font-size: 15px; }
  .knowledge-answer { grid-template-columns: 1fr; gap: 12px; padding: 0 4px 20px 38px; }
  .knowledge-answer p { font-size: 13px; line-height: 1.65; }
  .emergency-section { margin: 56px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 20px; grid-template-columns: 1fr; gap: 20px; border-radius: 18px; }
  .help-links { grid-template-columns: 1fr; }
  .help-links a { min-height: 64px; padding: 14px 16px; }
  .help-links small { font-size: 12px; }
  .help-links strong { font-size: 20px; }
  .official-sources { grid-column: auto; }
  .official-sources, .official-sources a { font-size: 11px; line-height: 1.5; }
  footer { width: auto; margin: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); padding: 22px 0 calc(22px + env(safe-area-inset-bottom)); align-items: flex-start; flex-direction: column; }
  footer p, footer button { font-size: 11px; line-height: 1.55; }
  footer button { min-height: 44px; }
  .toast-region { top: calc(64px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); bottom: auto; left: max(12px, env(safe-area-inset-left)); }
  .toast { width: 100%; max-width: none; padding: 13px 14px; font-size: 13px; line-height: 1.5; }
}

@media (min-width: 360px) and (max-width: 700px) {
  .option-list.two-columns { grid-template-columns: 1fr 1fr; }
  .option-list.two-columns .option-content { height: 100%; }
}

@media (max-width: 420px) {
  .brand small { display: none; }
  .quiz-actions { align-items: stretch; }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 1024px) {
  .page-shell { width: 100%; margin-top: 0; }
  .quiz-shell { min-height: calc(100dvh - 48px - env(safe-area-inset-top)); grid-template-columns: 1fr; overflow: visible; border-inline: 0; border-radius: 0; box-shadow: none; }
  .quiz-cover { display: none; }
  .quiz-panel, .quiz-shell.has-progress .quiz-panel, .quiz-shell.has-result .quiz-panel { min-height: calc(100dvh - 48px - env(safe-area-inset-top)); padding-top: 14px; justify-content: flex-start; }
  .site-header { min-height: calc(48px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media print {
  @page { size: A4 portrait; margin: 15mm; }
  body { background: #fff; }
  .site-header, .quiz-shell, .saved-summary, .section-heading, .budget-entry-form, .budget-meter, .budget-alert, .notification-button, .ledger-toolbar, .knowledge-section, .emergency-section, footer, .toast-region { display: none !important; }
  .page-shell { width: 100%; margin: 0; }
  .budget-section { padding: 0; }
  .budget-card { padding: 0; border: 0; box-shadow: none; }
  .ledger-details { display: block; }
  .ledger-details summary { display: none; }
  .ledger-details[open] .ledger-list, .ledger-details .ledger-list { display: block; }
  .ledger-row button { display: none; }
}
