:root {
  --bg: #090a0c;
  --panel: rgba(255,255,255,.055);
  --panel-strong: rgba(255,255,255,.085);
  --paper: #eee4d5;
  --muted: #a99f92;
  --line: rgba(238,228,213,.16);
  --orange: #d8752d;
  --orange-bright: #ffad67;
  --red: #d25343;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--paper); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 78% 6%, rgba(216,117,45,.18), transparent 34%),
    radial-gradient(circle at 14% 30%, rgba(238,228,213,.07), transparent 28%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.app-shell { width: min(1600px, calc(100% - 32px)); margin: 0 auto; padding: 2.4rem 0 3rem; }
.builder-workspace { display: block; }
.specialty-gate { min-height: calc(100vh - 4.8rem); display: grid; align-content: center; gap: 2rem; }
.specialty-hero { max-width: 980px; }
.specialty-gate h1 { max-width: 980px; }
.specialty-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.specialty-card {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid rgba(238,228,213,.14);
  background:
    radial-gradient(circle at 72% 18%, rgba(255,173,103,.20), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.075), rgba(0,0,0,.22));
  padding: 1.25rem;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}
.specialty-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255,173,103,.10);
  pointer-events: none;
}
.specialty-card::after {
  content: '';
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.35rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,173,103,.72), transparent);
  animation: specialty-scan 3.8s ease-in-out infinite;
}
.specialty-card:hover { background: linear-gradient(145deg, rgba(216,117,45,.15), rgba(0,0,0,.24)); }
.specialty-icon {
  display: inline-grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.4rem;
  border: 1px solid rgba(255,173,103,.28);
  background: rgba(0,0,0,.22);
  box-shadow: 0 0 44px rgba(216,117,45,.13);
  animation: node-float 5.2s ease-in-out infinite;
}
.specialty-icon svg { width: 3.25rem; height: 3.25rem; fill: none; stroke: var(--orange-bright); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.specialty-card strong {
  display: block;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: -.045em;
  margin-bottom: .85rem;
}
.specialty-card small { display: block; max-width: 34ch; color: var(--muted); font-size: .95rem; line-height: 1.62; }
.specialty-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin: -1.1rem 0 1.4rem;
  border-top: 1px solid rgba(238,228,213,.08);
  border-bottom: 1px solid rgba(238,228,213,.08);
  padding: .8rem 0;
}
.specialty-tab {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.7rem;
  border-color: rgba(238,228,213,.14);
  background: rgba(0,0,0,.18);
}
.specialty-tab.active { background: rgba(216,117,45,.16); border-color: rgba(255,173,103,.55); color: var(--orange-bright); }
.specialty-tab span { display: inline-flex; }
.specialty-tab svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.app-header { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 2rem; align-items: start; padding: 1rem 0 2.4rem; }
.back-link { color: var(--muted); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; padding-top: .85rem; }
.back-link:hover { color: var(--orange-bright); }
.home-button { display: inline-flex; align-items: center; justify-content: center; width: fit-content; border: 1px solid rgba(238,228,213,.16); color: var(--paper); background: rgba(0,0,0,.2); padding: .82rem .95rem; font-size: .66rem; font-weight: 820; letter-spacing: .12em; text-transform: uppercase; transition: transform .2s, border-color .2s, background .2s; }
.home-button:hover { transform: translateY(-2px); border-color: rgba(255,173,103,.5); background: rgba(216,117,45,.08); }
.eyebrow { color: var(--orange); font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin: 0 0 .8rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: var(--font-display); font-size: clamp(3.4rem, 7vw, 7rem); line-height: .9; letter-spacing: -.065em; font-weight: 500; margin-bottom: 1.1rem; }
.lead { max-width: 850px; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.15rem); line-height: 1.65; margin-bottom: 0; }
.mobile-disclaimer {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: -1rem 0 1.35rem 180px;
  border: 1px solid rgba(255,173,103,.34);
  background: linear-gradient(135deg, rgba(216,117,45,.13), rgba(0,0,0,.22));
  padding: .9rem 1rem;
  color: rgba(238,228,213,.82);
  line-height: 1.5;
}
.mobile-disclaimer strong {
  flex: 0 0 auto;
  color: var(--orange-bright);
  font-size: .66rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.mobile-disclaimer span { color: var(--muted); font-size: .9rem; }

.builder-layout { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.control-panel, .scenario-output { border: 1px solid var(--line); background: linear-gradient(145deg, var(--panel), rgba(255,255,255,.02)); box-shadow: 0 26px 90px rgba(0,0,0,.22); }
.control-panel, .scenario-output { min-width: 0; }
.control-panel {
  position: relative;
  top: 0;
  max-height: none;
  overflow: visible;
  padding: 1.05rem;
}
form { display: grid; gap: 1rem; }
label, fieldset { min-width: 0; border: 1px solid rgba(238,228,213,.1); background: rgba(0,0,0,.17); padding: .9rem; margin: 0; }
label span, legend { display: block; color: var(--muted); font-size: .66rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 780; margin-bottom: .55rem; }
select, input[type='range'] { width: 100%; }
select {
  min-width: 0;
  color: var(--paper);
  background: #111316;
  border: 1px solid rgba(238,228,213,.18);
  border-radius: 0;
  padding: .78rem .85rem;
}
.range-label { display: grid; grid-template-columns: 1fr auto; gap: .55rem; align-items: center; }
.range-label input { grid-column: 1 / -1; accent-color: var(--orange-bright); }
.range-label strong { color: var(--orange-bright); font-size: .82rem; }
fieldset { padding-top: .8rem; }
.control-drawer { padding: 0; overflow: hidden; }
.control-drawer legend {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  margin: 0;
  padding: .88rem .9rem;
  cursor: pointer;
  user-select: none;
}
.control-drawer legend::after {
  content: '-';
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-left: auto;
  border: 1px solid rgba(255,173,103,.24);
  color: var(--orange-bright);
  font-size: .9rem;
  line-height: 1;
}
.control-drawer.is-collapsed legend::after { content: '+'; }
.control-drawer > :not(legend) { margin-left: .9rem; margin-right: .9rem; }
.control-drawer > :last-child { margin-bottom: .9rem; }
.control-drawer.is-collapsed > :not(legend) { display: none; }
.drawer-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.25rem;
  border: 1px solid rgba(238,228,213,.12);
  background: rgba(255,255,255,.035);
  color: rgba(238,228,213,.62);
  padding: .12rem .38rem;
  font-size: .57rem;
  letter-spacing: .08em;
  white-space: nowrap;
}
.complication-list { min-width: 0; display: grid; gap: .62rem; max-height: none; overflow: visible; padding-right: 0; }
#specific-complications { max-height: none; }
.check-card { min-width: 0; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: .68rem; padding: .72rem; cursor: pointer; transition: border-color .2s, background .2s; }
.check-card:hover { border-color: rgba(255,173,103,.45); background: rgba(216,117,45,.06); }
.check-card input { width: 18px; height: 18px; accent-color: var(--orange); margin-top: .1rem; }
.check-card span { min-width: 0; }
.check-card strong { display: block; min-width: 0; color: var(--paper); font-size: .84rem; line-height: 1.28; margin-bottom: .25rem; overflow-wrap: anywhere; }
.check-card small { display: block; min-width: 0; color: var(--muted); line-height: 1.45; overflow-wrap: anywhere; }
.specific-check-card.auto-selected { border-color: rgba(255,173,103,.28); background: rgba(255,173,103,.07); }
.specific-check-card.auto-selected strong::after { content: 'AUTO'; display: inline-flex; margin-left: .45rem; border: 1px solid rgba(255,173,103,.38); color: var(--orange); padding: .08rem .28rem; font-size: .55rem; letter-spacing: .09em; vertical-align: middle; }
.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  position: sticky;
  top: .75rem;
  z-index: 6;
  margin: -.15rem -.15rem .1rem;
  padding: .25rem;
  border: 1px solid rgba(255,173,103,.18);
  background: linear-gradient(145deg, rgba(9,10,12,.94), rgba(32,22,16,.94));
  backdrop-filter: blur(10px);
}
button, .ghost-button { border: 1px solid rgba(238,228,213,.16); cursor: pointer; text-transform: uppercase; letter-spacing: .12em; font-size: .66rem; font-weight: 820; padding: .9rem 1rem; color: var(--paper); background: transparent; transition: transform .2s, border-color .2s, background .2s; }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; }
button:hover, .ghost-button:hover { transform: translateY(-2px); border-color: rgba(255,173,103,.5); }
button:disabled { cursor: wait; opacity: .72; transform: none; }
.primary-button { background: var(--orange); color: #1b1008; border-color: transparent; }
.primary-button:hover { background: var(--orange-bright); }

.scenario-output { min-height: 740px; padding: 1.2rem; }
.output-toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: start; padding: .4rem .2rem 1.1rem; border-bottom: 1px solid rgba(238,228,213,.1); }
.toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
h2 { font-family: var(--font-display); font-size: clamp(2.1rem, 4vw, 4.3rem); line-height: .98; letter-spacing: -.055em; font-weight: 500; margin-bottom: 0; }
.scenario-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.scenario-meta span { border: 1px solid rgba(255,173,103,.24); color: rgba(238,228,213,.82); background: rgba(216,117,45,.08); padding: .42rem .55rem; font-size: .65rem; letter-spacing: .11em; text-transform: uppercase; font-weight: 760; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.scenario-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(255,173,103,.24);
  background: linear-gradient(135deg, rgba(216,117,45,.12), rgba(0,0,0,.18));
}
.brand-lockup { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border: 1px solid rgba(255,173,103,.38);
  color: var(--orange-bright);
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1;
  background: rgba(0,0,0,.22);
}
.brand-lockup strong { display: block; color: var(--paper); font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; line-height: 1.05; }
.brand-lockup small { display: block; color: var(--muted); margin-top: .25rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1.35; }
.brand-title { min-width: 0; flex: 1; text-align: right; }
.brand-title span { display: block; color: var(--orange); font-size: .62rem; font-weight: 820; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .25rem; }
.brand-title b { display: block; color: var(--paper); font-family: var(--font-display); font-size: clamp(1.25rem, 2.2vw, 2rem); font-weight: 500; line-height: 1.05; }
.brand-logo {
  display: inline-grid;
  place-items: center;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,173,103,.34);
  background:
    radial-gradient(circle at 50% 18%, rgba(255,173,103,.18), transparent 42%),
    rgba(0,0,0,.22);
  color: var(--orange-bright);
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1;
  opacity: .92;
}
.template-section { border: 1px solid rgba(238,228,213,.12); background: rgba(0,0,0,.2); padding: 1rem; min-height: 140px; }
.template-section.wide { grid-column: 1 / -1; }
.template-section.highlight { border-color: rgba(255,173,103,.34); background: rgba(216,117,45,.06); }
.template-section.difficulty-section { border-color: rgba(255,173,103,.28); background: linear-gradient(145deg, rgba(216,117,45,.09), rgba(255,255,255,.025)); }
.template-section.danger { border-color: rgba(210,83,67,.36); background: rgba(210,83,67,.07); }
.template-section h3 { color: var(--orange-bright); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .8rem; }
.template-section p, .template-section li { color: var(--muted); line-height: 1.58; font-size: .93rem; }
.template-section p:last-child, .template-section ul, .template-section ol { margin-bottom: 0; }
.template-section ul, .template-section ol { padding-left: 1.1rem; }
.thinking-loader { min-height: 420px; display: grid; place-items: center; align-content: center; gap: .8rem; text-align: center; color: var(--muted); }
.thinking-loader span { width: 54px; height: 54px; border: 1px solid rgba(255,173,103,.2); border-top-color: var(--orange-bright); border-radius: 50%; animation: loader-spin 1s linear infinite; box-shadow: 0 0 42px rgba(216,117,45,.14); }
.thinking-loader strong { color: var(--paper); font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 500; letter-spacing: -.04em; }
.thinking-loader p { max-width: 420px; color: var(--muted); margin-bottom: 0; }
.scenario-empty { min-height: 590px; display: grid; align-content: center; gap: 1.4rem; padding: clamp(1rem, 4vw, 3rem); overflow: hidden; }
.scenario-empty-visual { position: relative; min-height: 330px; border: 1px solid rgba(238,228,213,.11); background: radial-gradient(circle at 50% 48%, rgba(255,173,103,.13), transparent 34%), rgba(0,0,0,.18); overflow: hidden; }
.sim-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(238,228,213,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(238,228,213,.05) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(circle at center, black 30%, transparent 78%); animation: grid-drift 11s linear infinite; }
.sim-pulse { position: absolute; left: 50%; top: 50%; width: 160px; height: 160px; border: 1px solid rgba(255,173,103,.34); border-radius: 50%; transform: translate(-50%, -50%); animation: pulse-ring 3.2s ease-out infinite; }
.sim-pulse.pulse-b { animation-delay: 1.55s; border-color: rgba(238,228,213,.18); }
.sim-map { position: absolute; inset: 18%; }
.sim-map span { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--orange-bright); box-shadow: 0 0 0 7px rgba(216,117,45,.13), 0 0 30px rgba(255,173,103,.45); }
.sim-map span:nth-child(1) { left: 8%; top: 24%; animation: node-float 4.2s ease-in-out infinite; }
.sim-map span:nth-child(2) { right: 13%; top: 18%; animation: node-float 5.1s ease-in-out .4s infinite; }
.sim-map span:nth-child(3) { left: 22%; bottom: 14%; animation: node-float 4.8s ease-in-out .8s infinite; }
.sim-map span:nth-child(4) { right: 22%; bottom: 20%; animation: node-float 5.4s ease-in-out 1.1s infinite; }
.sim-map::before, .sim-map::after { content: ''; position: absolute; left: 13%; right: 18%; height: 1px; background: linear-gradient(90deg, rgba(255,173,103,.08), rgba(255,173,103,.44), rgba(238,228,213,.1)); transform-origin: center; }
.sim-map::before { top: 38%; transform: rotate(19deg); }
.sim-map::after { bottom: 34%; transform: rotate(-16deg); }
.sim-wave { position: absolute; left: 50%; bottom: 22px; width: min(88%, 620px); transform: translateX(-50%); filter: drop-shadow(0 0 12px rgba(255,173,103,.24)); }
.sim-wave path { fill: none; stroke: var(--orange-bright); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 680; animation: wave-draw 3.6s linear infinite; }
.scenario-empty-copy { max-width: 760px; }
.scenario-empty-copy h3 { font-family: var(--font-display); font-size: clamp(2.1rem, 4vw, 4.4rem); line-height: .95; letter-spacing: -.055em; font-weight: 500; margin-bottom: .85rem; }
.scenario-empty-copy p:last-child { color: var(--muted); line-height: 1.65; max-width: 650px; margin-bottom: 0; }
.scenario-timeline { position: relative; display: grid; gap: .85rem; padding-left: 1.1rem; }
.scenario-timeline::before { content: ''; position: absolute; left: .42rem; top: .45rem; bottom: .45rem; width: 1px; background: linear-gradient(180deg, rgba(255,173,103,.65), rgba(238,228,213,.14)); }
.timeline-event { position: relative; display: grid; grid-template-columns: minmax(74px, .18fr) minmax(0, 1fr); gap: .9rem; padding: .85rem .9rem .85rem 1.05rem; border: 1px solid rgba(238,228,213,.1); background: rgba(0,0,0,.18); }
.timeline-event::before { content: ''; position: absolute; left: -1.02rem; top: 1.05rem; width: 11px; height: 11px; border-radius: 50%; background: var(--orange-bright); box-shadow: 0 0 0 5px rgba(216,117,45,.12), 0 0 18px rgba(255,173,103,.36); }
.timeline-event time { color: var(--orange-bright); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 820; padding-top: .12rem; white-space: nowrap; }
.timeline-event strong { display: block; color: var(--paper); margin-bottom: .28rem; }
.timeline-event p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }
.timeline-event.complication { border-color: rgba(210,83,67,.34); background: rgba(210,83,67,.07); }
.timeline-event.complication::before { background: var(--red); box-shadow: 0 0 0 5px rgba(210,83,67,.13), 0 0 18px rgba(210,83,67,.28); }
.trigger-list { display: grid; gap: .8rem; padding-left: 0; counter-reset: trigger; }
.trigger-list li { list-style: none; counter-increment: trigger; display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .85rem; row-gap: .25rem; align-items: start; border: 1px solid rgba(238,228,213,.09); background: rgba(0,0,0,.14); padding: .75rem; }
.trigger-list li::before { content: counter(trigger, decimal-leading-zero); color: var(--orange-bright); font-size: .68rem; letter-spacing: .12em; padding-top: .15rem; }
.trigger-list strong { color: var(--paper); display: block; grid-column: 2; min-width: 0; }
.trigger-list span { color: var(--muted); grid-column: 2; min-width: 0; }
.bottom-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; padding-top: 1.2rem; }
.bottom-actions .home-button { min-height: 2.65rem; }
.app-footer { color: rgba(238,228,213,.48); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: 2.4rem 0 0; line-height: 1.5; }
@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes pulse-ring {
  0% { opacity: .8; transform: translate(-50%, -50%) scale(.58); }
  70% { opacity: .18; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.35); }
}
@keyframes grid-drift { to { background-position: 34px 34px; } }
@keyframes node-float {
  0%, 100% { transform: translateY(0); opacity: .82; }
  50% { transform: translateY(-9px); opacity: 1; }
}
@keyframes wave-draw {
  0% { stroke-dashoffset: 680; opacity: .42; }
  18%, 78% { opacity: 1; }
  100% { stroke-dashoffset: -680; opacity: .42; }
}

@media (min-width: 1241px) and (min-height: 900px) {
  .control-panel { position: sticky; top: 1rem; }
}

@media (max-width: 1240px) {
  .app-header, .builder-layout { grid-template-columns: 1fr; }
  .specialty-cards { grid-template-columns: 1fr; }
  .specialty-card { min-height: 240px; }
  .control-panel { position: relative; top: 0; max-height: none; overflow: visible; }
  .mobile-disclaimer { margin: -.8rem 0 1.2rem; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 28px, 1600px); padding-top: 1.2rem; }
  .app-header > div, .specialty-hero { min-width: 0; }
  h1 {
    font-size: clamp(2.45rem, 14vw, 3.55rem);
    overflow-wrap: anywhere;
  }
  .template-grid { grid-template-columns: 1fr; }
  .output-toolbar { display: grid; }
  .toolbar-actions { justify-content: stretch; }
  .toolbar-actions > * { flex: 1; }
  .button-row { grid-template-columns: 1fr; }
  .mobile-disclaimer { display: grid; gap: .45rem; }
  .specialty-tabs { justify-content: stretch; }
  .specialty-tab { flex: 1; justify-content: center; }
  .bottom-actions { justify-content: stretch; }
  .bottom-actions > * { width: 100%; }
  .timeline-event { grid-template-columns: 1fr; gap: .35rem; }
  .scenario-brand { display: grid; grid-template-columns: 1fr; align-items: start; }
  .brand-lockup { grid-column: 1; }
  .brand-title { grid-column: 1 / -1; text-align: left; }
  .brand-logo { display: none; }
}

@media print {
  @page { size: A4; margin: 10mm; }
  * { box-shadow: none !important; text-shadow: none !important; }
  html, body { background: white !important; color: #111 !important; }
  body { font-size: 9.5pt; }
  .specialty-gate, .specialty-tabs, .app-header, .control-panel, .output-toolbar, .back-link, .home-button, .bottom-actions, .app-footer, .ghost-button, .primary-button { display: none !important; }
  .app-shell { width: 100%; padding: 0; }
  .builder-layout { display: block; }
  .scenario-output { min-height: 0; padding: 0; border: 0; background: white !important; }
  .scenario-meta { gap: .25rem; margin: 0 0 .55rem; }
  .scenario-meta span { border-color: #bbb; background: #f6f0e8; color: #222; padding: .18rem .32rem; font-size: 7pt; }
  .template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
  .template-section { min-height: 0; padding: .42rem .5rem; border-color: #bbb; background: white !important; break-inside: avoid; page-break-inside: avoid; }
  .template-section.wide { grid-column: 1 / -1; }
  .template-section h3 { margin-bottom: .28rem; color: #8a4b20; font-size: 7.5pt; letter-spacing: .08em; }
  .template-section p, .template-section li, .template-section span, .template-section small, .lead { color: #222 !important; font-size: 8.5pt !important; line-height: 1.25 !important; }
  .template-section ul, .template-section ol { padding-left: .85rem; }
  .diagnosis-line { color: #111 !important; font-size: 13pt !important; }
}

/* Rozszerzona karta prowadzącego */
.fieldset-hint { color: rgba(238,228,213,.52); font-size: .75rem; line-height: 1.45; margin: -.15rem 0 .75rem; }
select optgroup { color: var(--orange-bright); background: #111316; font-weight: 800; }
select option { color: var(--paper); background: #111316; font-weight: 500; }
.muted-inline { color: rgba(238,228,213,.52) !important; font-style: italic; }
.template-section.success { border-color: rgba(103,184,135,.38); background: rgba(103,184,135,.07); }
.template-section.instructor-only { border-color: rgba(210,83,67,.5); background: linear-gradient(145deg, rgba(210,83,67,.12), rgba(0,0,0,.19)); }
.template-section.participant-brief { border-color: rgba(238,228,213,.24); background: rgba(238,228,213,.045); }
.template-section.instructor-guide { border-color: rgba(255,173,103,.4); background: linear-gradient(145deg, rgba(216,117,45,.12), rgba(0,0,0,.18)); }
.template-section.safety-note { min-height: 0; border-style: dashed; }
.template-section.specialty-section { border-color: rgba(255,173,103,.32); background: linear-gradient(145deg, rgba(216,117,45,.10), rgba(255,255,255,.025)); }
.diagnosis-line { color: var(--paper) !important; font-family: var(--font-display); font-size: 1.35rem !important; line-height: 1.25 !important; }
.source-tag { display: inline-flex; margin-left: .45rem; border: 1px solid rgba(238,228,213,.15); padding: .12rem .28rem; color: rgba(238,228,213,.56); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.recommendation-list { display: grid; gap: .8rem; padding: 0 !important; counter-reset: none; }
.recommendation-list li { list-style: none; display: grid; gap: .3rem; border: 1px solid rgba(238,228,213,.1); background: rgba(0,0,0,.16); padding: .85rem; }
.recommendation-list strong { color: var(--paper); line-height: 1.45; }
.recommendation-list span { display: block; color: var(--muted); line-height: 1.5; }
.recommendation-list b { color: var(--orange-bright); font-weight: 750; }
.ecg-section { border-color: rgba(255,173,103,.34); background: rgba(255,255,255,.035); }
.ecg-generator-block { display: grid; gap: .7rem; margin-top: .85rem; }
.ecg-generator-block canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(238,228,213,.18);
  background: #fff;
}
.ecg-badges { display: flex; flex-wrap: wrap; gap: .4rem; }
.ecg-badges span {
  border: 1px solid rgba(255,173,103,.26);
  background: rgba(216,117,45,.08);
  color: var(--paper);
  padding: .25rem .45rem;
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ecg-disclaimer {
  border-left: 3px solid var(--orange-bright);
  padding: .7rem .85rem;
  background: rgba(216,117,45,.08);
  color: rgba(238,228,213,.78) !important;
  font-size: .82rem !important;
}

body.pdf-exporting .scenario-output::before {
  content: 'MD Latarnik · Scenariuszator';
  display: block;
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid #222;
  color: #111;
  font-family: var(--font-display);
  font-size: 1.7rem;
}
@keyframes specialty-scan {
  0%, 100% { opacity: .20; transform: scaleX(.45); }
  50% { opacity: 1; transform: scaleX(1); }
}

@media print {
  body.pdf-exporting .scenario-output::before { display: none !important; content: none !important; }
  .scenario-brand { margin-bottom: .55rem; padding: .45rem .55rem; border-color: #8a4b20; background: #fff !important; }
  .brand-mark { width: 2.1rem; height: 2.1rem; color: #8a4b20; border-color: #8a4b20; background: #fff !important; font-size: 1.05rem; }
  .brand-lockup strong { color: #111; font-size: 13pt; }
  .brand-lockup small { color: #555; font-size: 7pt; }
  .brand-title span { color: #8a4b20; font-size: 6.5pt; }
  .brand-title b { color: #111; font-size: 12pt; }
  .brand-logo { width: 44px; height: 44px; }
  .template-section.instructor-only { border: 2px solid #555; }
  .template-section.success, .template-section.instructor-guide, .template-section.participant-brief, .template-section.safety-note, .template-section.specialty-section, .ecg-section { background: white; }
  .recommendation-list li { background: white; border-color: #aaa; }
  .recommendation-list strong, .diagnosis-line { color: black !important; }
  .recommendation-list span { color: #222; }
  .recommendation-list { gap: .35rem; }
  .recommendation-list li { padding: .35rem .45rem; gap: .15rem; }
  .scenario-timeline { gap: .3rem; padding-left: .7rem; }
  .timeline-event { grid-template-columns: 54px minmax(0, 1fr); gap: .45rem; padding: .35rem .45rem .35rem .55rem; border-color: #bbb; background: white !important; }
  .timeline-event::before { left: -.72rem; top: .6rem; width: 7px; height: 7px; box-shadow: none; background: #8a4b20; }
  .timeline-event time { color: #8a4b20; font-size: 7pt; }
  .trigger-list { gap: .35rem; }
  .trigger-list li { grid-template-columns: 1.5rem minmax(0, 1fr); gap: .3rem; padding: .35rem .45rem; border-color: #bbb; background: white !important; }
  .trigger-list li::before { color: #8a4b20; font-size: 7pt; }
  .source-tag { color: #555; border-color: #bbb; font-size: 6.5pt; }
  .ecg-generator-block { gap: .35rem; margin-top: .35rem; }
  .ecg-generator-block canvas { max-height: 125mm; object-fit: contain; border-color: #777; page-break-inside: avoid; break-inside: avoid; }
  .ecg-disclaimer { color: #222 !important; background: white; border-color: #555; }
}

body.pdf-exporting .scenario-output::before { display: none !important; content: none !important; }
