:root {
  --bg: #f6f3ed;
  --surface: #ffffff;
  --surface-soft: #edf4f4;
  --ink: #172334;
  --muted: #667382;
  --navy: #17324d;
  --teal: #176b68;
  --teal-soft: #dcefed;
  --amber: #9b6500;
  --amber-soft: #fff1cf;
  --danger: #9e2f32;
  --danger-dark: #711e22;
  --danger-soft: #f9e4e4;
  --line: #d9dee3;
  --shadow: 0 12px 30px rgba(23, 50, 77, .09);
  --radius: 22px;
  --font-scale: 1;
  --tap: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--font-scale)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.98), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.65;
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #2c7fb8;
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 999;
  background: var(--navy);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
}
.skip-link:focus { top: 12px; }

.shell {
  min-height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  background: rgba(255,255,255,.48);
  position: relative;
  box-shadow: 0 0 0 1px rgba(23,50,77,.04);
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: calc(64px + env(safe-area-inset-top));
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(246,243,237,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(23,50,77,.08);
}
.icon-button, .brand-button {
  border: 0;
  background: transparent;
  color: var(--navy);
  min-height: 44px;
  cursor: pointer;
}
.icon-button {
  width: 44px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.15rem;
}
#backButton { grid-column: 1; font-size: 2rem; line-height: 1; }
#backButton[hidden] { display: block; visibility: hidden; pointer-events: none; }
.brand-button {
  grid-column: 2;
  min-width: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.02rem;
}
.settings-button { grid-column: 3; justify-self: end; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 11px;
  background: var(--navy);
  color: white;
  letter-spacing: 2px;
  font-size: .82rem;
}
.app-main {
  min-height: calc(100dvh - 146px);
  padding: 24px 18px 124px;
}
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 25;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  min-height: 58px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1px;
  font-size: .78rem;
  cursor: pointer;
}
.bottom-nav button[aria-current="page"] {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}
.nav-icon { font-size: 1.28rem; line-height: 1; }

.hero {
  padding: 18px 2px 6px;
}
.eyebrow {
  color: var(--teal);
  font-weight: 800;
  letter-spacing: .06em;
  font-size: .82rem;
  margin: 0 0 8px;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.35rem);
  line-height: 1.18;
  letter-spacing: -.035em;
}
h2 {
  margin: 0;
  font-size: clamp(1.55rem, 6vw, 2.25rem);
  line-height: 1.3;
  letter-spacing: -.02em;
}
h3 { margin: 0; font-size: 1.05rem; }
.lead {
  margin: 16px 0 0;
  color: #344356;
  font-size: 1.06rem;
}
.small-note, .muted {
  color: var(--muted);
  font-size: .9rem;
}
.section {
  margin-top: 24px;
}
.section-title {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid rgba(23,50,77,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 12px; }
.card.soft {
  background: var(--surface-soft);
  box-shadow: none;
}
.card.warning {
  background: var(--amber-soft);
  border-color: rgba(155,101,0,.25);
  box-shadow: none;
}
.card.danger {
  background: var(--danger-soft);
  border-color: rgba(158,47,50,.28);
  box-shadow: none;
}
.card.success {
  background: var(--teal-soft);
  border-color: rgba(23,107,104,.22);
  box-shadow: none;
}
.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.card-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--navy);
  color: white;
  font-weight: 900;
}
.card p:last-child { margin-bottom: 0; }

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.choice-card,
.text-link-button {
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.35;
}
.primary-button {
  border: 0;
  background: var(--navy);
  color: white;
  padding: 16px 18px;
  box-shadow: 0 10px 20px rgba(23,50,77,.18);
}
.primary-button.emergency {
  min-height: 76px;
  font-size: 1.13rem;
  background: var(--danger);
}
.secondary-button {
  border: 2px solid var(--navy);
  background: white;
  color: var(--navy);
  padding: 14px 18px;
}
.ghost-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 14px 18px;
}
.danger-button {
  border: 0;
  background: var(--danger);
  color: white;
  padding: 15px 18px;
}
.text-link-button {
  border: 0;
  background: transparent;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 12px;
}
.button-stack {
  display: grid;
  gap: 11px;
  margin-top: 18px;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.hero-stop {
  margin-top: 22px;
  border-radius: 28px;
  padding: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.12), transparent 40%),
    var(--navy);
  color: white;
  box-shadow: 0 18px 38px rgba(23,50,77,.22);
}
.hero-stop p { color: rgba(255,255,255,.84); }
.hero-stop .primary-button {
  background: white;
  color: var(--navy);
  box-shadow: none;
  min-height: 74px;
  font-size: 1.08rem;
}

.option-list {
  display: grid;
  gap: 10px;
}
.choice-card {
  display: grid;
  grid-template-columns: 48px 1fr 26px;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}
.choice-card.selected {
  border: 2px solid var(--teal);
  background: var(--teal-soft);
}
.choice-symbol {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #edf1f5;
  color: var(--navy);
  font-weight: 900;
  font-size: 1.1rem;
}
.choice-card.selected .choice-symbol {
  background: var(--teal);
  color: white;
}
.choice-title { display: block; font-weight: 800; }
.choice-description { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.choice-check {
  width: 23px;
  height: 23px;
  border: 2px solid #9aa6b1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: transparent;
}
.choice-card.selected .choice-check {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.sticky-action {
  position: sticky;
  bottom: calc(12px + env(safe-area-inset-bottom));
  margin-top: 18px;
  padding: 10px;
  background: rgba(246,243,237,.92);
  border-radius: 22px;
  backdrop-filter: blur(12px);
}

.progress-wrap { margin: 4px 0 24px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 7px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #dfe4e8;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
  transition: width .18s ease;
}
.question-card {
  min-height: 235px;
  display: grid;
  align-content: center;
  text-align: center;
}
.question-card h2 {
  font-size: clamp(1.45rem, 6vw, 2rem);
}
.answer-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.answer-button {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.answer-button.yes { border-color: rgba(158,47,50,.45); }
.answer-button.unknown { background: #f4f5f6; }

.stop-band {
  margin: -24px -18px 22px;
  padding: 18px;
  background: var(--danger);
  color: white;
}
.stop-band h1 { font-size: clamp(1.8rem, 8vw, 2.65rem); }
.stop-symbol {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 5px solid white;
  border-radius: 50%;
  font-size: 1.9rem;
  font-weight: 900;
  margin-bottom: 12px;
}
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #714900;
  font-weight: 800;
  margin-bottom: 14px;
}
.reason-list, .plain-list, .check-list {
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}
.reason-list li, .check-list li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(23,50,77,.08);
}
.reason-list li::before {
  content: "!";
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--amber);
  color: white;
  font-weight: 900;
}
.check-list li::before {
  content: "✓";
  color: var(--teal);
  font-weight: 900;
}
.step-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
}
.step-card + .step-card { margin-top: 16px; }
.step-number {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  font-size: 1.2rem;
  font-weight: 900;
}
.phrase-box {
  background: var(--navy);
  color: white;
  border-radius: 26px;
  padding: 26px 22px;
  font-size: clamp(1.28rem, 5.8vw, 1.8rem);
  line-height: 1.75;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(23,50,77,.2);
}
.phrase-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.segmented {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 1px 10px;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  font-weight: 800;
}
textarea, input[type="text"], input[type="tel"], input[type="email"] {
  width: 100%;
  border: 1px solid #b9c2ca;
  border-radius: 16px;
  background: white;
  color: var(--ink);
  padding: 14px;
  min-height: 52px;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.65; }
label {
  display: block;
  font-weight: 800;
  margin: 14px 0 6px;
}
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.switch {
  position: relative;
  width: 54px;
  height: 32px;
}
.switch input {
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch span {
  position: absolute;
  inset: 0;
  background: #aab3bb;
  border-radius: 999px;
  cursor: pointer;
}
.switch span::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 26px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,.2);
  transition: transform .16s ease;
}
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(22px); }

.training-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
}
.training-icon {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 1.3rem;
  font-weight: 900;
}
.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
}
.meta span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1f3;
  color: var(--muted);
  font-size: .78rem;
}
.training-choice {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 15px;
  border-radius: 16px;
  text-align: left;
  cursor: pointer;
  margin-top: 9px;
}
.training-choice.correct { background: var(--teal-soft); border-color: var(--teal); }
.training-choice.wrong { background: var(--danger-soft); border-color: var(--danger); }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(90%, 430px);
  background: #111d2b;
  color: white;
  padding: 13px 16px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  text-align: center;
  font-weight: 700;
}
.noscript {
  margin: 30px;
  padding: 20px;
  background: white;
  border: 2px solid var(--danger);
  border-radius: 18px;
}

html.large-text { --font-scale: 1.16; }
html.max-text { --font-scale: 1.31; }
html.high-contrast {
  --bg: #fff;
  --surface: #fff;
  --surface-soft: #f2f2f2;
  --ink: #000;
  --muted: #333;
  --navy: #001f3f;
  --teal: #005b58;
  --line: #555;
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  scroll-behavior: auto !important;
  animation: none !important;
  transition: none !important;
}

@media (max-width: 390px) {
  .app-main { padding-left: 14px; padding-right: 14px; }
  .two-col, .phrase-actions { grid-template-columns: 1fr; }
  .brand-text { font-size: .9rem; }
}
@media (min-width: 700px) {
  .app-main { padding-left: 34px; padding-right: 34px; }
}
@media print {
  .app-header, .bottom-nav, .sticky-action, .toast { display: none !important; }
  .app-main { padding: 0; }
  body { background: white; }
  .card { box-shadow: none; break-inside: avoid; }
}


.link-button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}
.resume-card {
  border: 2px solid var(--teal);
  background: var(--teal-soft);
  box-shadow: none;
}
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--navy);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.official-card {
  border-left: 6px solid var(--teal);
}
.physical-band {
  margin: -24px -18px 22px;
  padding: 22px 18px;
  background: var(--danger-dark);
  color: white;
}
.physical-band h1 { font-size: clamp(1.8rem, 8vw, 2.7rem); }
.call-grid { display: grid; gap: 11px; }
@media (min-width: 560px) { .call-grid { grid-template-columns: 1fr 1fr; } }
