:root {
  --navy: #102a43;
  --blue: #075f96;
  --blue-dark: #06466f;
  --orange: #df8b28;
  --sky: #eaf5fc;
  --mint: #dff5ed;
  --green: #15805d;
  --ink: #1d2a36;
  --muted: #5c6c7a;
  --line: #d8e2ea;
  --white: #fff;
  --shadow: 0 18px 50px rgba(16, 42, 67, .12);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #f4f8fb; }
body { margin: 0; min-height: 100vh; }
button, a, input, audio { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid #f6b73c; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 50; padding: .75rem 1rem; color: white; background: var(--navy); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.app-header { min-height: 76px; padding: .8rem clamp(1rem, 4vw, 4rem); display: flex; align-items: center; gap: 2rem; border-bottom: 1px solid var(--line); background: var(--white); }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--navy); font-size: 1.35rem; font-weight: 850; letter-spacing: -.03em; text-decoration: none; }
.brand span { padding: .25rem .55rem; border-radius: 999px; color: var(--white); background: var(--orange); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.service-return { margin-left: auto; color: var(--blue); font-size: .86rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.service-return:hover { text-decoration: underline; }
.header-cta { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; padding: .5rem .8rem; border: 1px solid var(--orange); border-radius: .65rem; color: #fff; background: var(--orange); font-size: .8rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.header-cta:hover { background: #d97706; border-color: #d97706; }
.header-restart { min-height: 38px; padding: .45rem .75rem; border: 1px solid var(--line); border-radius: .65rem; color: var(--navy); background: var(--white); font-size: .82rem; font-weight: 800; cursor: pointer; }
.header-restart:hover { border-color: var(--blue); background: var(--sky); }
.version-label { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.app-layout { display: grid; grid-template-columns: 282px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.app-layout.map-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app-layout.map-collapsed .decision-map { min-width: 0; padding-right: 0; padding-left: 0; overflow: hidden; border-right: 0; }
.map-toggle { position: fixed; z-index: 25; left: 1rem; bottom: 1rem; display: inline-flex; min-height: 42px; align-items: center; gap: .4rem; padding: .6rem .85rem; border: 1px solid var(--blue); border-radius: 999px; color: var(--blue); background: rgba(255,255,255,.96); box-shadow: 0 8px 22px rgba(16,42,67,.16); font-size: .8rem; font-weight: 800; cursor: pointer; }
.map-toggle:hover { background: var(--sky); }
.decision-map { position: sticky; top: 0; align-self: start; min-height: calc(100vh - 76px); padding: 2.2rem 1.4rem; border-right: 1px solid var(--line); background: var(--white); }
.eyebrow, .card-label { margin: 0 0 .7rem; color: var(--blue); font-size: .74rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.map-heading h2 { margin: 0; color: var(--navy); font-size: 1.15rem; line-height: 1.25; }
.map-diagram { display: grid; gap: .2rem; margin: 2rem 0 0; overflow: hidden; }
.tree-root { display: flex; justify-content: flex-start; min-width: 0; }
.tree-down { padding-left: 1rem; color: #94b2c3; font-size: 1.1rem; line-height: 1; }
.map-node { position: relative; z-index: 1; display: flex; align-items: center; gap: .65rem; width: 100%; min-width: 0; min-height: 39px; padding: .45rem .6rem; border: 1px solid transparent; border-radius: .65rem; color: var(--muted); background: transparent; font: inherit; font-size: .82rem; line-height: 1.25; text-align: left; }
.map-node[data-map-target] { cursor: pointer; }
.map-node[data-map-target]:hover { border-color: #b8d5e5; background: var(--sky); }
.map-dot { flex: 0 0 auto; width: 12px; height: 12px; border: 3px solid var(--white); border-radius: 50%; background: #b8cfdd; box-shadow: 0 0 0 1px #b8cfdd; }
.map-node.is-current { color: var(--navy); font-weight: 850; }
.map-node.is-current .map-dot { background: var(--orange); box-shadow: 0 0 0 1px var(--orange), 0 0 0 5px #fff3dc; }
.tree-split { display: grid; gap: .45rem; margin: .4rem 0 0 1rem; padding: .55rem 0 .1rem .8rem; border-left: 2px solid #c8dce8; }
.tree-choice { display: grid; grid-template-columns: 28px 16px minmax(0, 1fr); align-items: center; gap: .15rem; min-width: 0; }
.tree-choice-no { align-items: start; }
.branch-label { flex: 0 0 auto; color: var(--blue-dark); font-size: .72rem; font-weight: 850; }
.tree-right { flex: 0 0 auto; color: #94b2c3; }
.tree-secondary { min-width: 0; width: 100%; }
.tree-secondary > .tree-root { justify-content: flex-start; }
.tree-subsplit { display: grid; grid-template-columns: 1fr; gap: .35rem; margin: .35rem 0 0 .8rem; padding: .45rem 0 0 .8rem; border-left: 2px solid #dce8ef; }
.tree-subsplit .map-node { padding-left: .3rem; }
.map-note { margin: 2rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
main { min-width: 0; padding: clamp(1.25rem, 4vw, 4rem); }
#screen { width: 100%; max-width: 1050px; margin: 0 auto; }
.screen-card { width: 100%; padding: clamp(1.25rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: 1.2rem; background: var(--white); box-shadow: var(--shadow); }
h1 { margin: 0 0 1rem; color: var(--navy); font-size: clamp(2rem, 4.5vw, 3.65rem); line-height: 1.04; letter-spacing: -.045em; }
h2 { color: var(--navy); }
.lead { margin: 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); line-height: 1.65; }
.intro-card { padding: 0; overflow: hidden; }
.intro-hero { aspect-ratio: 16 / 7; overflow: hidden; background: #eaf0f4; }
.intro-hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.intro-copy { padding: clamp(1.25rem, 4vw, 3rem); }
.narrator-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1.2rem; align-items: end; margin-top: 1.6rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fbfdfe; }
.narrator-card img { display: block; width: 100%; max-height: 250px; object-fit: contain; object-position: bottom; align-self: end; }
.narrator-content { min-width: 0; }
.narrator-content .card-label { margin-bottom: .4rem; }
audio { width: 100%; min-width: 0; }
.audio-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem .8rem; margin-top: .45rem; }
.link-button { padding: 0; border: 0; color: var(--blue); background: transparent; font-size: .84rem; font-weight: 800; text-decoration: underline; cursor: pointer; }
.audio-note { margin: .5rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.transcript { margin-top: .9rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--white); }
.transcript summary { color: var(--navy); font-weight: 800; cursor: pointer; }
.transcript p { margin: .7rem 0 0; color: var(--muted); line-height: 1.55; }
.intro-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 1.4rem; }
.intro-points div { display: grid; gap: .35rem; padding: .9rem; border-radius: .8rem; background: var(--sky); line-height: 1.45; }
.intro-points strong { color: var(--navy); }
.intro-points span { color: var(--muted); font-size: .9rem; }
.intro-actions, .screen-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.5rem; }
.button { min-height: 46px; padding: .72rem 1.1rem; border: 1px solid transparent; border-radius: .7rem; font-weight: 750; cursor: pointer; }
.button-primary { color: white; background: var(--blue); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { color: var(--navy); border-color: var(--line); background: white; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.assistant-trigger { min-height: 46px; padding: .68rem 1rem; border: 1px solid #a6cddd; border-radius: .7rem; color: var(--blue-dark); background: #f2f9fd; font-weight: 750; cursor: pointer; }
.assistant-trigger:hover { background: var(--sky); }
.selected-case { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-top: 1.5rem; padding: 1rem 1.1rem; border: 1px solid #b8d5e5; border-radius: .9rem; background: var(--sky); }
.selected-case h2 { margin: 0 0 .35rem; font-size: 1.2rem; }
.selected-case p { margin: 0; color: var(--muted); line-height: 1.5; }
.case-chooser { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-top: .75rem; }
.case-option { display: grid; gap: .4rem; padding: .85rem; border: 1px solid var(--line); border-radius: .75rem; color: var(--ink); background: #fbfdfe; text-align: left; cursor: pointer; }
.case-option:hover, .case-option.is-selected { border-color: var(--blue); background: var(--sky); }
.case-option span { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.data-grid { display: grid; gap: .65rem; margin-top: 1.4rem; }
.data-row { display: flex; align-items: flex-start; gap: .75rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: .75rem; background: #fbfdfe; cursor: pointer; line-height: 1.45; }
.data-row input { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; margin-top: .15rem; accent-color: var(--green); }
.data-row strong { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-right: .5rem; border-radius: 50%; color: white; background: var(--blue); font-size: .78rem; }
.checked { border-color: #a5d7c4 !important; background: #f1fbf6 !important; }
.callout, .limit-card { margin-top: 1.1rem; padding: .9rem 1rem; border-left: 4px solid var(--orange); border-radius: 0 .65rem .65rem 0; color: var(--navy); background: #fff7e8; line-height: 1.5; }
.message-card, .model-card { margin-top: 1.4rem; padding: 1rem 1.1rem; border: 1px solid #c8dfec; border-radius: .9rem; background: #f2f9fd; }
.model-card { border-color: #a5d7c4; background: var(--mint); }
.message-card p, .model-card p, .limit-card p { margin: 0; line-height: 1.6; }
.decision-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: 1.5rem; }
.decision-button { display: flex; align-items: center; gap: .8rem; min-height: 75px; padding: 1rem; border: 1px solid var(--line); border-radius: .85rem; color: var(--ink); background: #fbfdfe; text-align: left; cursor: pointer; line-height: 1.4; }
.decision-button:hover { border-color: var(--blue); background: var(--sky); }
.decision-button span { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 11px; color: white; background: var(--blue); font-weight: 850; }
.decision-a span { background: #bc6b2e; }
.decision-b span { background: var(--orange); }
.decision-c span { background: var(--green); }
.route-heading { display: flex; align-items: center; gap: .9rem; margin-bottom: .6rem; }
.route-heading h1 { margin: 0; }
.route-badge { display: grid; place-items: center; flex: 0 0 auto; width: 62px; height: 62px; border-radius: 18px; color: white; background: var(--blue); font-weight: 900; }
.route-a .route-badge { background: #bc6b2e; }
.route-b .route-badge { background: var(--orange); }
.route-c .route-badge { background: var(--green); }
.route-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.4rem; }
.route-summary > div { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #fbfdfe; }
.route-summary p { margin: 0; color: var(--navy); font-weight: 750; line-height: 1.45; }
.route-card-full h2 { margin: 1.5rem 0 .7rem; font-size: 1.2rem; }
.steps { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: .85rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: #fbfdfe; line-height: 1.5; }
.step-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; background: var(--blue); font-weight: 850; }
.route-finish { display: grid; gap: .25rem; margin-top: 1.5rem; padding: 1rem; border-radius: .85rem; color: var(--navy); background: var(--mint); line-height: 1.45; }
.route-finish span { color: var(--muted); }
.assistant-dialog { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: clamp(.75rem, 3vw, 2rem); background: rgba(16, 42, 67, .72); }
.assistant-dialog[hidden] { display: none; }
.assistant-panel { display: flex; flex-direction: column; width: min(100%, 1000px); height: min(92vh, 760px); overflow: hidden; border: 1px solid var(--line); border-radius: 1rem; background: var(--white); box-shadow: 0 26px 80px rgba(0,0,0,.3); }
.assistant-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.assistant-header h2 { margin: 0; font-size: 1.2rem; }
.assistant-header .eyebrow { margin-bottom: .25rem; }
.assistant-frame-wrap { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: .75rem; background: #f4f8fb; }
.assistant-frame-wrap iframe { flex: 1; width: 100%; min-height: 0; border: 1px solid var(--line); border-radius: .7rem; background: white; }
.assistant-status { margin: .55rem .2rem 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.assistant-fallback { margin: .55rem .2rem 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.assistant-fallback a { color: var(--blue); font-weight: 800; }
body.assistant-open { overflow: hidden; }

@media (max-width: 900px) {
  .app-header { gap: 1rem; }
  .version-label { display: none; }
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .app-layout.map-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app-layout.map-collapsed .decision-map { display: none; }
  .decision-map { position: relative; min-height: auto; padding: .9rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-heading h2, .map-note { display: none; }
  .map-diagram { display: block; max-width: 100%; margin: .2rem 0 0; padding-bottom: .2rem; }
  .tree-root { justify-content: flex-start; }
  .tree-down { display: none; }
  .map-node { min-width: 0; min-height: 34px; margin: .15rem 0; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: #fbfdfe; }
  .tree-split { grid-template-columns: 1fr; margin: .25rem 0 0 .5rem; padding: .4rem 0 .1rem .55rem; }
  .tree-subsplit { grid-template-columns: 1fr; margin-left: .55rem; padding-left: .55rem; }
  .map-dot { width: 9px; height: 9px; border-width: 2px; }
  .map-node.is-current { border-color: var(--orange); background: #fff7e8; }
  main { padding: 1rem; }
}

@media (max-width: 680px) {
  .app-header { min-height: 68px; padding: .7rem .9rem; }
  .brand { font-size: 1.12rem; }
  .brand span, .service-return { display: none; }
  .header-cta { margin-left: auto; min-height: 34px; padding: .4rem .6rem; font-size: .72rem; }
  .header-restart { margin-left: 0; }
  .screen-card { padding: 1.1rem; border-radius: .95rem; }
  h1 { font-size: clamp(1.9rem, 10vw, 2.8rem); }
  .intro-hero { aspect-ratio: 4 / 3; }
  .narrator-card, .intro-points, .case-chooser, .decision-actions, .route-summary { grid-template-columns: 1fr; }
  .narrator-card img { width: 100px; max-height: 155px; }
  .selected-case { flex-direction: column; }
  .route-heading { align-items: flex-start; }
  .route-heading h1 { font-size: 2rem; }
  .route-badge { width: 52px; height: 52px; }
  .assistant-header { align-items: flex-start; flex-direction: column; }
  .assistant-header .button { width: 100%; }
  .assistant-panel { height: 94vh; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
