:root {
  color-scheme: light;
  --navy: #12344d;
  --navy-2: #0b2639;
  --green: #287a68;
  --green-pale: #e9f5f1;
  --red: #b4232e;
  --red-pale: #fff0f1;
  --amber: #8a5700;
  --amber-pale: #fff7df;
  --ink: #18232b;
  --muted: #55646e;
  --line: #d8e0e4;
  --surface: #f5f7f8;
  --white: #fff;
  --shadow: 0 12px 30px rgba(18, 52, 77, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font-size: 17px; line-height: 1.75; }
a { color: #075b87; text-underline-offset: 3px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #f2b134; outline-offset: 3px; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 100; background: #fff; padding: 12px; }
.skip-link:focus { top: 12px; }

.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 8px 16px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--navy); font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--green); color: white; font-size: 24px; }
.icon-button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); font-weight: 700; cursor: pointer; }
.site-nav { position: fixed; inset: 64px 0 auto 0; z-index: 19; max-height: calc(100vh - 64px); overflow: auto; padding: 14px 16px 22px; background: #fff; box-shadow: var(--shadow); }
.site-nav a { display: block; min-height: 48px; padding: 10px 8px; border-bottom: 1px solid var(--line); color: var(--navy); font-weight: 700; text-decoration: none; }

main { min-height: 70vh; }
.page { width: min(100%, 780px); margin: 0 auto; padding: 28px 16px 100px; }
.hero { margin: -28px -16px 24px; padding: 42px 20px 28px; color: white; background: linear-gradient(145deg, var(--navy-2), var(--navy) 62%, #1b5f64); }
.hero h1 { max-width: 690px; margin: 6px 0 10px; font-size: clamp(2rem, 8vw, 3.4rem); line-height: 1.15; letter-spacing: -.035em; }
.hero p { max-width: 650px; margin: 8px 0; color: #eaf4f4; }
.hero .eyebrow { color: #9ee1d1; }
.eyebrow { margin: 0; color: var(--green); font-size: .82rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.14); font-size: .9rem; font-weight: 700; }
h1, h2, h3 { color: var(--navy); line-height: 1.35; }
h1 { font-size: 2rem; }
h2 { margin: 38px 0 14px; font-size: 1.55rem; }
h3 { margin: 24px 0 8px; font-size: 1.18rem; }
p { margin: 8px 0 16px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.card { margin: 14px 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 4px 14px rgba(18,52,77,.05); }
.card h2, .card h3 { margin-top: 0; }
.critical { border: 2px solid var(--red); background: var(--red-pale); }
.critical .label { color: var(--red); font-weight: 900; }
.tip { border-left: 5px solid var(--green); background: var(--green-pale); }
.caution { border-left: 5px solid #d99b22; background: var(--amber-pale); }
.chapter-grid { display: grid; gap: 12px; margin: 18px 0; }
.chapter-link { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--navy); text-decoration: none; box-shadow: 0 4px 12px rgba(18,52,77,.04); }
.chapter-link strong { display: block; }
.chapter-link small { color: var(--muted); }
.chapter-number { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--green-pale); color: var(--green); font-size: 1.2rem; font-weight: 900; }
.steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; margin: 0 0 10px; padding: 14px 14px 14px 58px; border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 14px; top: 13px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 900; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 17px; border: 0; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 800; text-decoration: none; cursor: pointer; }
.button.secondary { border: 1px solid var(--navy); background: #fff; color: var(--navy); }
.button.danger { background: var(--red); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.quiz { margin: 32px 0; padding: 20px; border-radius: 20px; background: var(--navy); color: #fff; }
.quiz h2, .quiz h3 { color: #fff; }
.quiz-option { width: 100%; margin: 7px 0; padding: 14px; border: 2px solid transparent; border-radius: 13px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.quiz-option:hover { border-color: #9ee1d1; }
.feedback { margin-top: 12px; padding: 14px; border-radius: 12px; background: #fff; color: var(--ink); }
.feedback.correct { border-left: 6px solid var(--green); }
.feedback.review { border-left: 6px solid #f2b134; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.quiz-nav .button { background: #fff; color: var(--navy); }
.observation-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.observation { padding: 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.observation strong { display: block; color: var(--green); font-size: 1.15rem; }
.figure { margin: 20px 0; padding: 18px; overflow: hidden; border-radius: 20px; background: #fff; border: 1px solid var(--line); }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { margin-top: 12px; color: var(--muted); font-size: .9rem; }
.flow { display: grid; gap: 8px; margin: 12px 0; }
.flow-box { position: relative; padding: 13px; border: 2px solid var(--navy); border-radius: 13px; background: #fff; text-align: center; font-weight: 800; }
.flow-box + .flow-box::before { content: "↓"; position: absolute; top: -22px; left: calc(50% - 8px); padding: 0 2px; background: #fff; color: var(--navy); }
.flow-box.red { border-color: var(--red); color: var(--red); background: var(--red-pale); }
.flow-branch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flow-branch .flow-box { font-size: .94rem; }
.flow-branch .flow-box::before { display: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--green-pale); color: var(--navy); }
.checklist { padding-left: 0; list-style: none; }
.checklist li { position: relative; padding: 9px 0 9px 34px; border-bottom: 1px solid var(--line); }
.checklist li::before { content: "□"; position: absolute; left: 4px; font-size: 1.3rem; color: var(--green); }
.references { font-size: .9rem; color: var(--muted); }
.references li { margin-bottom: 8px; }
.floating-flow { position: fixed; right: 14px; bottom: 14px; z-index: 18; min-height: 52px; padding: 12px 17px; border: 0; border-radius: 99px; background: var(--red); color: #fff; font-weight: 900; box-shadow: var(--shadow); cursor: pointer; }
.flow-dialog { width: min(94vw, 680px); max-height: 90vh; padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.flow-dialog::backdrop { background: rgba(8,25,35,.65); }
.dialog-head { position: sticky; top: 0; display: flex; justify-content: space-between; gap: 12px; align-items: start; padding: 18px; background: #fff; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; }
#flowContent { padding: 18px; }
.dialog-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 18px; background: #fff; border-top: 1px solid var(--line); }
.timer { text-align: center; }
.timer-display { margin: 8px 0; color: var(--navy); font-size: clamp(3.5rem, 18vw, 6rem); font-variant-numeric: tabular-nums; font-weight: 900; line-height: 1.1; }
.timer-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timer-presets button { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--navy); font-weight: 800; }
.pulse { width: 80px; height: 80px; margin: 16px auto; border-radius: 50%; background: var(--green); opacity: .35; }
.pulse.active { animation: beat .545s infinite; }
@keyframes beat { 0%,100% { transform: scale(.78); opacity: .3; } 40% { transform: scale(1); opacity: 1; } }
.page-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 34px; }
.page-nav a { flex: 1; }
footer { padding: 26px 18px 100px; background: var(--navy-2); color: #dce7eb; font-size: .9rem; text-align: center; }
footer a { color: white; }

@media (min-width: 650px) {
  .chapter-grid { grid-template-columns: 1fr 1fr; }
  .observation-grid { grid-template-columns: repeat(5, 1fr); }
  .page { padding-left: 24px; padding-right: 24px; }
  .hero { margin-left: -24px; margin-right: -24px; padding-left: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; font-size: 11pt; line-height: 1.45; }
  .app-header, .site-nav, .floating-flow, footer, .page-nav, .no-print { display: none !important; }
  .page { width: 100%; max-width: none; padding: 0; }
  .print-only-title { display: block !important; }
  .flow-box { break-inside: avoid; padding: 7px; }
  .flow { gap: 6px; }
  h1 { font-size: 22pt; }
  h2 { font-size: 15pt; margin-top: 14px; }
  a { color: #000; text-decoration: none; }
}
