/* blaze.css
 * Blaze Simulator -- light app theme with Blaze brand accents (navy/gold/red), taken
 * from the flame/phoenix logo (blaze-icon.svg / blaze-banner.svg). The receiver's
 * monitor display is the one deliberate exception: it stays a dark/black "device
 * screen" regardless of this theme, since that's what reads as an actual patient
 * monitor -- see .monitor-screen below, which hardcodes its own dark palette.
 */

:root {
    --blaze-navy: #20314b;
    --blaze-navy-light: #2c4164;
    --blaze-navy-dark: #141f33;
    --blaze-gold: #f59e0b;
    --blaze-gold-light: #fcd34d;
    --blaze-red: #dc2626;
    --blaze-red-dark: #a9142b;
    --blaze-red-soft: #fff1f2;
    --blaze-white: #ffffff;

    /* Light-theme surface tokens */
    --blaze-bg: #f8fafc;
    --blaze-surface: #ffffff;
    --blaze-text: #1c2740;
    --blaze-text-muted: #5b6b8c;
    --blaze-border: #dbe1ee;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { color-scheme: light; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }

.brand { text-decoration: none; }
.brand-lockup { display: block; width: auto; height: 42px; }

.simulator-landing {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(520px, 1.1fr);
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    margin: 0.25rem 0 1.5rem;
    padding: clamp(2.5rem, 6vw, 5.5rem) clamp(1.5rem, 5vw, 5rem);
    overflow: hidden;
    border-radius: 18px;
    background:
        radial-gradient(circle at 10px 10px, rgba(255,255,255,.065) 1px, transparent 1.5px) 0 0 / 28px 28px,
        linear-gradient(125deg, #e21f1f 0%, #c41525 52%, #562141 100%);
    box-shadow: 0 24px 60px rgba(126, 20, 36, .18);
}
.simulator-intro { max-width: 610px; }
.eyebrow, .step-label { color: var(--blaze-red); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.simulator-intro .eyebrow { display: inline-flex; padding: 0.4rem 0.75rem; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: #fff; background: rgba(255,255,255,.1); }
.simulator-intro h1 { margin: 0.8rem 0 1rem; color: #fff; font-size: clamp(2.5rem, 5vw, 4.65rem); line-height: 0.98; letter-spacing: -0.055em; text-shadow: 0 2px 15px rgba(66, 14, 28, .2); }
.simulator-intro > p { max-width: 570px; margin: 0; color: rgba(255,255,255,.9); font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.65; }
.training-notice { display: flex; align-items: flex-start; gap: 0.55rem; margin-top: 1.35rem; color: rgba(255,255,255,.75); font-size: 0.78rem; line-height: 1.5; }
.connection-card { margin: 0; padding: clamp(1.4rem, 3vw, 2rem); border: 0; border-top: 4px solid var(--blaze-red); box-shadow: 0 20px 45px rgba(62, 13, 29, .24); }
.connection-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.connection-card-heading h2 { margin: 0.25rem 0 0; font-size: 1.6rem; }
.secure-note { color: #15803d; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.connection-form { display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: end; }
.connection-form .field { min-width: 0; }
.connection-form input, .advanced-settings input { width: 100%; box-sizing: border-box; }
.connect-button { grid-column: 1 / -1; width: 100%; min-height: 50px; }
.advanced-settings { margin-top: 1rem; color: #53647d; font-size: 0.78rem; }
.advanced-settings summary { cursor: pointer; font-weight: 700; }
.advanced-settings .field { margin-top: 0.75rem; }
.connection-status { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 0.82rem; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.connection-status.ok { color: #15803d; }.connection-status.ok .status-dot { background: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,.12); }
.connection-status.err { color: #b91c1c; }.connection-status.err .status-dot { background: #dc2626; }
.simulator-capabilities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 0 0 clamp(3rem, 7vw, 6rem); }
.simulator-capabilities article { display: flex; gap: 1rem; padding: 1.2rem; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 5px 16px rgba(31,48,72,.05); }
.simulator-capabilities h2 { margin: 0 0 0.3rem; font-size: 0.95rem; }.simulator-capabilities p { margin: 0; color: #64748b; font-size: 0.78rem; line-height: 1.5; }
.capability-index { color: var(--blaze-red); font: 700 0.68rem ui-monospace, "Cascadia Mono", monospace; }
.session-bar { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 0.8rem; padding: 0.8rem 1rem; border: 1px solid #d8e1ed; border-left: 4px solid #16a34a; border-radius: 10px; background: #fff; box-shadow: 0 6px 18px rgba(31,48,72,.06); }
.session-identity { display: flex; align-items: center; gap: 0.65rem; }.session-identity div { display: flex; flex-direction: column; }.session-identity strong { color: #1f3048; }
.session-status { display: flex; flex: 1; gap: 0.45rem; color: #64748b; font-size: 0.76rem; }.session-status span + span::before { content: "·"; margin-right: 0.45rem; }

.broadcast-access { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); align-items: center; gap: clamp(2rem, 7vw, 6rem); min-height: calc(100vh - 180px); padding: clamp(2.5rem, 7vw, 6rem) clamp(1rem, 4vw, 3rem); }
.broadcast-access-copy { max-width: 600px; }
.broadcast-access-copy h1 { margin: .55rem 0 1rem; color: var(--blaze-navy); font-size: clamp(2.4rem, 5vw, 4.6rem); line-height: 1; letter-spacing: -.05em; }
.broadcast-access-copy > p { max-width: 560px; margin: 0; color: #64748b; font-size: 1.05rem; line-height: 1.65; }
.broadcast-notice { color: #64748b; }
.broadcast-login-card { position: relative; margin: 0; padding: clamp(1.5rem, 4vw, 2.25rem); overflow: hidden; border-top: 4px solid var(--blaze-red); }
.broadcast-lock { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 1.1rem; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #e52b2b, var(--blaze-red)); box-shadow: 0 8px 20px rgba(220,38,38,.22); font-size: 1.25rem; }
.broadcast-login-card h2 { margin: .35rem 0 1.4rem; font-size: 1.45rem; text-transform: none; letter-spacing: -.02em; }
.broadcast-login-form { display: grid; gap: 1rem; }
.broadcast-login-form input { width: 100%; min-height: 46px; }
.broadcast-login-form button { min-height: 48px; margin-top: .25rem; }
.broadcast-login-error { display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem; border: 1px solid #fecaca; border-radius: 7px; color: #b91c1c; background: #fff1f2; font-size: .78rem; font-weight: 700; }
.broadcast-login-error span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: #dc2626; font-size: .65rem; }
.broadcast-login-card footer { margin: 1.35rem -2.25rem -2.25rem; padding: .75rem 1rem; border-top: 1px solid #e2e8f0; color: #94a3b8; background: #f8fafc; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(220, 38, 38, 0.42); outline-offset: 3px; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--blaze-bg);
    color: var(--blaze-text);
    font-family: "Inter", "Segoe UI", Roboto, -apple-system, sans-serif;
    scroll-behavior: smooth;
}

body { background: var(--blaze-bg); }

::selection { background: #fecaca; color: var(--blaze-navy-dark); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--blaze-bg); }
::-webkit-scrollbar-thumb { background: #c2cbdd; border-radius: 6px; border: 2px solid var(--blaze-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--blaze-red); }

.app-shell { min-height: 100vh; }

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.5rem;
    background: var(--blaze-surface);
    border-bottom: 1px solid #edf0f4;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(32, 49, 75, 0.08);
}

.app-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; width: 100%; max-width: 1220px; margin: 0 auto; }

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-nav { display: flex; align-items: center; gap: 0.1rem; }

.app-nav a {
    position: relative;
    padding: 0.55rem 0.62rem;
    border-radius: 6px;
    color: var(--blaze-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.81rem;
    transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.2s var(--ease);
}

.app-nav a:hover { background: var(--blaze-bg); color: var(--blaze-navy); transform: translateY(-1px); }
.app-nav a:active { transform: translateY(0); }
.app-nav a:first-child { color: var(--blaze-red); background: var(--blaze-red-soft); }
.app-nav .simulator-site-link { display: inline-flex; align-items: center; gap: .42rem; margin-left: .7rem; padding: .65rem .9rem; border: 1px solid var(--blaze-navy); color: var(--blaze-navy); background: #fff; white-space: nowrap; }
.app-nav .simulator-site-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-nav .simulator-site-link:hover { color: #fff; background: var(--blaze-navy); }
.app-nav .enquire-link { margin-left: 0.8rem; padding: 0.7rem 1rem; color: #fff; background: var(--blaze-red); box-shadow: 0 4px 12px rgba(220,38,38,.18); }
.app-nav .enquire-link:hover { color: #fff; background: #b91c1c; }
.menu-toggle { display: none; width: 44px; height: 44px; padding: 10px; border: 1px solid #e2e8f0; background: #fff; box-shadow: none; }
.menu-toggle span { display: block; width: 100%; height: 2px; margin: 4px 0; border-radius: 2px; background: var(--blaze-navy); transition: transform .2s ease, opacity .2s ease; }
.menu-toggle:hover:not(:disabled) { background: #f8fafc; box-shadow: none; transform: none; }

.simulator-nav-shell { position: sticky; top: 64px; z-index: 9; border-bottom: 1px solid #dfe5ee; background: rgba(248,250,252,.94); backdrop-filter: blur(12px); }
.simulator-nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1220px; min-height: 56px; margin: 0 auto; padding: 0 1.5rem; }
.simulator-title { display: flex; align-items: center; gap: .6rem; color: var(--blaze-navy); text-decoration: none; }
.simulator-title > span:nth-child(2) { display: flex; flex-direction: column; line-height: 1.15; }
.simulator-title strong { font-size: .78rem; }.simulator-title small { color: #8491a5; font-size: .57rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.simulator-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blaze-red); box-shadow: 0 0 0 4px rgba(220,38,38,.11); }
.simulator-nav { display: flex; gap: .35rem; }
.simulator-nav a { display: inline-flex; align-items: center; gap: .38rem; padding: .48rem .8rem; border: 1px solid transparent; border-radius: 7px; color: #64748b; font-size: .75rem; font-weight: 800; text-decoration: none; }
.simulator-nav a:hover { color: var(--blaze-navy); background: #fff; border-color: #e2e8f0; }
.simulator-nav a.active { color: var(--blaze-red); background: #fff; border-color: #fecaca; box-shadow: 0 3px 10px rgba(31,48,72,.05); }

.app-body { padding: 1.25rem 1.5rem 2rem; max-width: 1250px; margin: 0 auto; }

.hero-banner {
    text-align: center;
    margin-bottom: 1.25rem;
    animation: float-in 0.7s var(--ease) both;
}

.hero-banner img {
    max-width: 100%;
    height: auto;
    max-height: 110px;
    filter: drop-shadow(0 6px 18px rgba(32, 49, 75, 0.12));
    animation: hover-float 6s ease-in-out infinite;
}

@keyframes float-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hover-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.card {
    background: var(--blaze-surface);
    border: 1px solid var(--blaze-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(32, 49, 75, 0.06);
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
    animation: rise-in 0.45s var(--ease) both;
}

.card:hover {
    border-color: #fecaca;
    box-shadow: 0 8px 22px rgba(32, 49, 75, 0.1), 0 0 0 1px rgba(220, 38, 38, 0.08);
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.card h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: var(--blaze-navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 90px; }
.field label { font-size: 0.72rem; color: var(--blaze-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

input, select {
    background: var(--blaze-surface);
    border: 1px solid var(--blaze-border);
    color: var(--blaze-text);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

input:hover, select:hover { border-color: var(--blaze-text-muted); }

input:focus, select:focus {
    outline: none;
    border-color: var(--blaze-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.13);
}

input[type="number"] { width: 85px; }
input[type="checkbox"] { width: auto; accent-color: var(--blaze-red); cursor: pointer; }

.checkbox-inline { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; font-weight: 600; white-space: nowrap; padding: 0.45rem 0; cursor: pointer; color: var(--blaze-text); }

button {
    background: linear-gradient(135deg, #e52b2b, var(--blaze-red));
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 0.55rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.88rem;
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.22);
    transition: filter 0.15s ease, transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

button:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(220, 38, 38, 0.28); }
button:active:not(:disabled) { transform: translateY(0) scale(0.98); box-shadow: 0 2px 6px rgba(220, 38, 38, 0.24); }
button:disabled { opacity: 0.45; cursor: default; filter: grayscale(0.3); }

button.secondary {
    background: var(--blaze-surface);
    color: var(--blaze-navy);
    border: 1px solid var(--blaze-border);
    box-shadow: none;
}
button.secondary:hover:not(:disabled) { background: var(--blaze-bg); border-color: var(--blaze-navy-light); box-shadow: 0 4px 12px rgba(32, 49, 75, 0.1); }

button.danger {
    background: linear-gradient(135deg, #e8503f, var(--blaze-red));
    color: var(--blaze-white);
    box-shadow: 0 3px 10px rgba(211, 39, 20, 0.3);
}
button.danger:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(211, 39, 20, 0.4); }

.status-line { margin: 0.5rem 0 1rem; font-size: 0.9rem; color: var(--blaze-text-muted); display: flex; align-items: center; gap: 0.4rem; }

.status-line .ok, .status-line .err { font-weight: 700; display: inline-flex; align-items: center; gap: 0.45rem; }
.status-line .ok { color: #1f9d55; }
.status-line .err { color: var(--blaze-red); }

.status-line .ok::before, .status-line .err::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 1.6s ease-out infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(31, 157, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); }
}
.status-line .err::before { animation-name: pulse-dot-err; }
@keyframes pulse-dot-err {
    0% { box-shadow: 0 0 0 0 rgba(211, 39, 20, 0.5); }
    70% { box-shadow: 0 0 0 7px rgba(211, 39, 20, 0); }
    100% { box-shadow: 0 0 0 0 rgba(211, 39, 20, 0); }
}

.vitals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }

.tile {
    background: var(--blaze-surface);
    border: 1px solid var(--blaze-border);
    border-radius: 12px;
    padding: 0.7rem 0.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.tile::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: currentColor; opacity: 0.7; }
.tile:hover { transform: translateY(-3px); border-color: currentColor; box-shadow: 0 10px 22px rgba(32, 49, 75, 0.12); }

.tile .tile-label { font-size: 0.72rem; color: var(--blaze-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tile .tile-value { font-size: 1.9rem; font-weight: 700; font-family: "JetBrains Mono", "Consolas", monospace; }
.tile.hr { color: #1f9d55; } .tile.hr .tile-value { color: #1f9d55; }
.tile.spo2 { color: #0f8fc2; } .tile.spo2 .tile-value { color: #0f8fc2; }
.tile.bp { color: #b9791f; } .tile.bp .tile-value { color: #b9791f; }
.tile.temp { color: var(--blaze-red); } .tile.temp .tile-value { color: var(--blaze-red); }
.tile.etco2 { color: #9a8a12; } .tile.etco2 .tile-value { color: #9a8a12; }

details.panel {
    border: 1px solid var(--blaze-border);
    border-radius: 10px;
    margin-bottom: 0.6rem;
    background: var(--blaze-surface);
    overflow: hidden;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

details.panel:hover { border-color: var(--blaze-text-muted); }
details.panel[open] { border-color: var(--blaze-gold); box-shadow: 0 4px 16px rgba(32, 49, 75, 0.1); }

details.panel > summary {
    cursor: pointer;
    padding: 0.6rem 0.9rem;
    font-weight: 700;
    color: var(--blaze-navy);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    transition: background 0.2s var(--ease);
}

details.panel > summary:hover { background: rgba(249, 156, 82, 0.08); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "▸"; display: inline-block; transition: transform 0.2s var(--ease); color: var(--blaze-gold); }
details.panel[open] > summary::before { transform: rotate(90deg); }

details.panel .panel-body { padding: 0.9rem; border-top: 1px solid var(--blaze-border); display: flex; flex-direction: column; gap: 0.6rem; }

@supports (interpolate-size: allow-keywords) {
    details.panel::details-content {
        opacity: 0;
        block-size: 0;
        overflow: clip;
        transition: content-visibility 0.25s allow-discrete, opacity 0.25s var(--ease), block-size 0.25s var(--ease);
    }
    details.panel[open]::details-content { opacity: 1; block-size: auto; }
}

.panel-apply { align-self: flex-start; margin-top: 0.3rem; }

/* ===================== Receiver: patient monitor display =====================
   Deliberately NOT themed by the light palette above -- modeled on a real bedside
   multiparameter monitor's dark chassis + phosphor oscilloscope grid, so this block
   hardcodes its own colors regardless of --blaze-bg/--blaze-surface. */

.monitor-screen {
    background: #121722;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #2a3548;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    margin-bottom: 1rem;
    color: #e6ecf7;
}

.monitor-screen:fullscreen {
    border-radius: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
}

/* True fullscreen has no page chrome above it, so (unlike the normal in-page
   view) it's safe to let every fixed min-height collapse to 0 and let flex/grid
   divide the real 100dvh instead -- this is what makes fullscreen landscape fit
   without scrolling. */
.monitor-screen:fullscreen .monitor-body,
.monitor-screen:fullscreen .twelve-lead-body,
.monitor-screen:fullscreen .defib-workstation-body { flex: 1; min-height: 0; }
.monitor-screen:fullscreen .monitor-wave-bank,
.monitor-screen:fullscreen .monitor-side,
.monitor-screen:fullscreen .twelve-lead-grid,
.monitor-screen:fullscreen .twelve-lead-stage { min-height: 0; }
.monitor-screen:fullscreen .monitor-side { overflow-y: auto; }
.monitor-screen:fullscreen .monitor-wave-row,
.monitor-screen:fullscreen .monitor-param,
.monitor-screen:fullscreen .twelve-lead-tile { min-height: 0; flex: 1; }
.monitor-screen:fullscreen canvas.trace,
.monitor-screen:fullscreen .twelve-lead-tile canvas.trace,
.monitor-screen:fullscreen .twelve-rhythm-row,
.monitor-screen:fullscreen .twelve-rhythm-row canvas.trace { min-height: 0; }
.monitor-screen:fullscreen .defib-trace-stage { min-height: 0 !important; flex: 1; }

@media (orientation: landscape) {
    .monitor-screen:fullscreen .monitor-body { flex-direction: row; }
    .monitor-screen:fullscreen .defib-workstation-body { grid-template-columns: minmax(0, 1fr) minmax(190px, 1fr) !important; }
}

.monitor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.9rem;
    background: #0d121b;
    border-bottom: 1px solid #000;
}

.monitor-toolbar-title {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: #8c9bb8;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.monitor-toolbar-title::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #39ff6a;
    box-shadow: 0 0 6px #39ff6a;
}

.monitor-fullscreen-btn { padding: 0.35rem 0.8rem; font-size: 0.78rem; }

.monitor-body { display: flex; gap: 0; min-height: 280px; }

.monitor-main {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    position: relative;
    background-color: #05070a;
    background-image:
        linear-gradient(to right, rgba(30, 41, 59, 0.25) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(30, 41, 59, 0.25) 1px, transparent 1px);
    background-size: 24px 24px;
}

.monitor-channel-label {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(5, 7, 10, 0.85);
    border: 1px solid rgba(0, 230, 118, 0.3);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem;
    color: #00e676;
    pointer-events: none;
}

canvas.trace {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 260px;
    background: transparent;
    border-radius: 6px;
}

.monitor-side {
    width: 210px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    background: #0a0e16;
    border-left: 1px solid #1c2534;
}

.monitor-param {
    flex: 1;
    padding: 0.5rem 0.7rem;
    border: 1px solid #1e293b;
    border-radius: 10px;
    background: #0d121c;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.monitor-param-label {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    opacity: 0.9;
}

.monitor-param-unit { font-weight: 500; opacity: 0.7; margin-left: 0.2rem; }

.monitor-param-value {
    font-family: "JetBrains Mono", monospace;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    transition: opacity 0.15s ease;
}

.monitor-param-sub { font-size: 1.15rem; opacity: 0.85; }

.monitor-param.hr { color: #00e676; }
.monitor-param.spo2 { color: #00e5ff; }
.monitor-param.nbp { color: #ff5252; }
.monitor-param.temp { color: #c084fc; }
.monitor-param.etco2 { color: #ffea00; }

@media (max-width: 720px) {
    .monitor-body { flex-direction: column; }
    .monitor-side { width: 100%; flex-direction: row; flex-wrap: wrap; border-left: none; border-top: 1px solid #1c2534; }
    .monitor-param { min-width: 45%; }
}

/* Compact the monitor/defib/12-lead screens' vertical footprint on short viewports.
   This is deliberately NOT gated on :fullscreen or orientation -- the fixed
   min-heights below (sized for a desktop window) make these screens taller than a
   phone's viewport in the ordinary in-page view too, in both portrait and landscape. */
@media (max-height: 760px) {
    .monitor-wave-row { min-height: 60px; }
    .monitor-wave-row canvas.trace { min-height: 60px; }
    .monitor-wave-row.ecg-wave canvas.trace { min-height: 82px; }
    .monitor-param { min-height: 56px; }
    .monitor-param-value { font-size: clamp(1.4rem, 4vw, 2.2rem); }
    .defib-trace-stage { min-height: 150px !important; }
    .defib-screen canvas.trace { min-height: 110px; }
    .twelve-lead-tile, .twelve-lead-tile canvas.trace { min-height: 90px; }
    .twelve-rhythm-row { min-height: 70px; }
    .twelve-rhythm-row canvas.trace { min-height: 56px; }
}

@media (max-height: 520px) {
    .monitor-toolbar { padding: 0.3rem 0.6rem; min-height: 0; }
    .device-subtitle { display: none; }
    .monitor-wave-row { min-height: 44px; }
    .monitor-wave-row canvas.trace { min-height: 44px; }
    .monitor-wave-row.ecg-wave canvas.trace { min-height: 62px; }
    .monitor-param { min-height: 44px; padding: 0.3rem 0.5rem; }
    .monitor-param-value { font-size: clamp(1.1rem, 4vw, 1.6rem); }
    .device-statusbar, .ecg-specbar { padding: 0.2rem 0.6rem; }
    .defib-trace-stage { min-height: 110px !important; }
    .twelve-lead-tile, .twelve-lead-tile canvas.trace { min-height: 64px; }
    .twelve-rhythm-row { min-height: 50px; }
    .twelve-rhythm-row canvas.trace { min-height: 38px; }
}

/* Phones in landscape are usually wide enough (>720px) to keep the wave bank and
   side panel side-by-side, but short enough that the side panel's row-wrap (3
   wrapped rows of params) still overflows -- pull it back into a tight column so
   its height matches the wave bank instead of stacking its own extra rows. */
@media (orientation: landscape) and (max-height: 520px) {
    .monitor-body { flex-direction: row; }
    .monitor-side { width: clamp(120px, 20vw, 190px); flex-direction: column; flex-wrap: nowrap; border-left: 1px solid #1c2534; border-top: 0; }
    .monitor-param { min-width: 0; }
}

/* ===================== Defib / Pacer panel =====================
   Modeled on a real biphasic defibrillator's brushed-metal chassis: a compact
   therapy screen on top (rhythm strip + mode/energy/charge readouts), then
   numbered hardware "zones" below (mode select, defib workflow, pacer). */

.defib-local-note { font-size: 0.68rem; text-transform: none; letter-spacing: 0; opacity: 0.7; font-weight: 500; }

.defib-screen {
    background: linear-gradient(145deg, #1b222e 0%, #121720 55%, #0e1219 100%);
    border-color: #323e52;
}

.defib-screen .monitor-toolbar-title::before { background: #f99c52; box-shadow: 0 0 6px #f99c52; }

/* Always stacked (canvas strip above, controls below) rather than side-by-side like the
   main monitor -- side-by-side broke in fullscreen on narrower screens, where the canvas's
   flex-shrink:0 claimed its full 1000px intrinsic width and pushed the controls off-screen. */
.defib-screen .monitor-body { flex-direction: column; background: transparent; }

.defib-therapy-screen {
    margin: 0.75rem 0.75rem 0;
    background: #05070a;
    border: 2px solid #263144;
    border-radius: 10px;
    overflow: hidden;
}

.defib-therapy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.7rem;
    background: #111723;
    border-bottom: 1px solid #1f293b;
    font-size: 0.7rem;
}

.defib-mode-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: #fff;
    background: #059669;
}
.defib-mode-badge.sync { background: #f59e0b; color: #1c1206; }
.defib-mode-badge.pacer { background: #0d9488; }

.defib-mode-row button { background: #1a2230; color: #cbd5e1; border: 1px solid #2f3d54; }
.defib-mode-row button:not(.secondary) { background: #059669; color: #fff; border-color: #059669; }

.defib-screen .monitor-main { flex: 0 0 auto; padding: 0.5rem; min-height: 0; }
.defib-screen canvas.trace { min-height: 140px; }

.defib-readout-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 0.6rem;
    padding: 0.6rem 0.7rem 0.8rem;
    background: #090d14;
}

.defib-readout-tile {
    background: #101622;
    border: 1px solid #243044;
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
}

.defib-readout-tile-label {
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: #8c9bb8;
    text-transform: uppercase;
}

.defib-energy-lcd {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.7rem;
    font-weight: 800;
    color: #f99c52;
    line-height: 1.2;
}

.capacitor-bar-track {
    width: 100%;
    height: 8px;
    background: #05070a;
    border: 1px solid #28354a;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.3rem;
}

.capacitor-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f5c344, #e2401c);
    transition: width 3s linear;
}

.capacitor-bar.charging { width: 100%; }
.capacitor-bar.charged { width: 100%; transition: none; }
.capacitor-bar.discharged { width: 0%; transition: none; }

.defib-controls-panel { flex: 0 0 auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.defib-vitals-row { display: flex; gap: 0.6rem; margin-top: auto; }
.defib-vitals-row .monitor-param { min-height: 70px; }

.defib-zone {
    background: #111620;
    border: 1px solid #283447;
    border-radius: 10px;
    padding: 0.6rem 0.7rem;
}

.defib-zone.zone-defib { border-color: rgba(249, 156, 82, 0.35); }
.defib-zone.zone-pacer { border-color: rgba(57, 224, 210, 0.3); }

.defib-zone-title {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8c9bb8;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.defib-zone-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f99c52;
    color: #2b1c0c;
    font-size: 0.62rem;
    font-weight: 800;
}

.defib-mode-row { display: flex; gap: 0.5rem; }
.defib-mode-row button { flex: 1; min-width: 0; font-weight: 800; letter-spacing: 0.04em; }

.defib-screen .field label { color: #8c9bb8; }

.stepper { display: flex; align-items: center; gap: 0.5rem; }
.stepper button { padding: 0.35rem 0.8rem; min-width: 36px; }
.stepper-value {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 46px;
    text-align: center;
    color: var(--blaze-navy);
}
.defib-screen .stepper-value { color: #e6ecf7; }

.defib-charge-btn, .defib-shock-btn {
    width: 100%;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 0.7rem 0.5rem;
}

.defib-charge-btn {
    background: linear-gradient(180deg, #fde68a, #f99c52);
    color: #2b1c0c;
    border: 2px solid #fdd18e;
}

.defib-shock-btn {
    background: #291518;
    border: 2px solid #4d2229;
    color: rgba(226, 64, 28, 0.4);
}

.defib-shock-btn:not(:disabled) {
    background: linear-gradient(180deg, #ff3d00, #d50000);
    border-color: #ffab91;
    color: #fff;
    animation: shockReadyGlow 0.65s infinite ease-in-out;
}

@keyframes shockReadyGlow {
    0%, 100% { box-shadow: 0 0 26px rgba(255, 61, 0, 0.9), inset 0 0 12px rgba(255, 255, 255, 0.35); }
    50% { box-shadow: 0 0 6px rgba(255, 61, 0, 0.25); }
}

.defib-pacer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.5rem; }

.defib-pacer-start-stop { flex: 2; }
.defib-pacer-actions { display: flex; gap: 0.5rem; }

.monitor-toolbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ===================== 12-Lead ECG panel =====================
   Modeled on a diagnostic 12-lead cart's dark chassis -- a distinct blue accent so it
   reads as a third device, separate from the monitor's green and the defib's amber. */

.twelve-lead-screen {
    background: linear-gradient(155deg, #1b2230 0%, #111621 55%, #0c1018 100%);
    border-color: #2d384d;
}

.twelve-lead-screen .monitor-toolbar-title::before { background: #0ea5e9; box-shadow: 0 0 6px #0ea5e9; }

.twelve-lead-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background: #070a0f;
}

@media (max-width: 900px) {
    .twelve-lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.twelve-lead-tile {
    position: relative;
    background-color: #05070a;
    background-image:
        linear-gradient(to right, rgba(30, 41, 59, 0.3) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(30, 41, 59, 0.3) 1px, transparent 1px);
    background-size: 12px 12px;
    border: 1px solid #1d273b;
    border-radius: 6px;
    overflow: hidden;
}

.twelve-lead-tile-label {
    position: absolute;
    top: 0.3rem;
    left: 0.4rem;
    z-index: 2;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.68rem;
    font-weight: 700;
    color: #0ea5e9;
    background: rgba(5, 7, 10, 0.85);
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
}

.twelve-lead-tile canvas.trace { min-height: 110px; }

/* Pink ECG paper theme -- classic thermal-print look instead of the dark phosphor scope */
.twelve-lead-screen.pink-paper .twelve-lead-grid { background: #f4dfe3; }

.twelve-lead-screen.pink-paper .twelve-lead-tile {
    background-color: #fbeef0;
    background-image:
        linear-gradient(to right, rgba(214, 110, 130, 0.35) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(214, 110, 130, 0.35) 1px, transparent 1px);
    border-color: #e3b8c2;
}

.twelve-lead-screen.pink-paper .twelve-lead-tile-label {
    color: #7a1f2b;
    background: rgba(251, 238, 240, 0.9);
}

.twelve-lead-screen.pink-paper .twelve-rhythm-row {
    background-color: #fbeef0;
    background-image:
        linear-gradient(to right, rgba(214, 110, 130, 0.35) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(214, 110, 130, 0.35) 1px, transparent 1px);
}

.twelve-lead-screen.pink-paper .twelve-rhythm-row .monitor-channel-label {
    color: #7a1f2b;
    background: rgba(251, 238, 240, 0.9);
    border-color: rgba(122, 31, 43, 0.3);
}

/* ===================== Receiver device switcher + reference layouts ===================== */

.receiver-view-switcher {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    padding: 0.45rem;
    margin: 0 0 0.8rem;
    border: 1px solid #263248;
    border-radius: 12px;
    background: #0b1019;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.receiver-view-switcher button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    color: #94a3b8;
    background: #151c29;
    border: 1px solid #2a374d;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.receiver-view-switcher button:hover { color: #e5edf9; background: #1b2535; }
.receiver-view-switcher button.active { color: #04130d; background: #10b981; border-color: #6ee7b7; box-shadow: 0 0 18px rgba(16, 185, 129, 0.25); }

.view-switcher-index {
    display: inline-grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.66rem;
}

.monitor-toolbar { gap: 0.75rem; flex-wrap: wrap; min-height: 57px; }
.device-identity { display: flex; flex-direction: column; gap: 0.12rem; }
.device-subtitle { padding-left: 1.05rem; color: #64748b; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; }
.device-model { padding: 0.08rem 0.32rem; border: 1px solid rgba(56, 189, 248, 0.45); border-radius: 4px; color: #7dd3fc; background: rgba(14, 165, 233, 0.13); }
.monitor-toolbar-title::before { background: #00e676; box-shadow: 0 0 7px #00e676; }
.monitor-live-banner, .twelve-patient-strip { display: flex; align-items: center; gap: 0.45rem; color: #9fb0c9; font: 700 0.66rem "JetBrains Mono", monospace; }
.live-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #10b981; box-shadow: 0 0 7px #10b981; }
.training-badge { padding: 0.28rem 0.55rem; border: 1px solid rgba(245, 158, 11, 0.4); border-radius: 5px; color: #fcd34d; background: rgba(120, 53, 15, 0.25); font-size: 0.6rem; font-weight: 900; letter-spacing: 0.06em; }

.monitor-wave-bank {
    min-width: 0;
    flex: 1;
    display: grid;
    grid-template-rows: 1.35fr 1fr 1fr 1fr;
    background: #05070a;
    border-right: 1px solid #1c2534;
}

.monitor-wave-row {
    position: relative;
    min-height: 92px;
    overflow: hidden;
    border-bottom: 1px solid rgba(30, 41, 59, 0.75);
    background-image: linear-gradient(to right, rgba(30, 41, 59, 0.23) 1px, transparent 1px), linear-gradient(to bottom, rgba(30, 41, 59, 0.23) 1px, transparent 1px);
    background-size: 24px 24px;
}

.monitor-wave-row:last-child { border-bottom: 0; }
.monitor-wave-row canvas.trace { min-height: 92px; border-radius: 0; }
.monitor-wave-row.ecg-wave canvas.trace { min-height: 125px; }
.monitor-wave-row .monitor-channel-label { top: 0.45rem; left: 0.55rem; }
.monitor-wave-row .monitor-channel-label small { font-size: 0.58rem; font-weight: 500; opacity: 0.8; }
.pleth-wave .monitor-channel-label { color: #00e5ff; border-color: rgba(0, 229, 255, 0.3); }
.co2-wave .monitor-channel-label { color: #ffea00; border-color: rgba(255, 234, 0, 0.3); }
.art-wave .monitor-channel-label { color: #ff5252; border-color: rgba(255, 82, 82, 0.3); }

.freeze-badge { position: absolute; z-index: 3; top: 0.5rem; right: 0.6rem; padding: 0.17rem 0.5rem; border-radius: 4px; color: #06111d; background: #38bdf8; font-size: 0.6rem; font-weight: 900; letter-spacing: 0.08em; }
.monitor-side { width: clamp(205px, 22vw, 285px); gap: 0.45rem; }
.monitor-param { min-height: 80px; }
.monitor-param-label { display: flex; justify-content: space-between; align-items: center; }
.monitor-limit { color: #64748b; font: 500 0.57rem "JetBrains Mono", monospace; letter-spacing: 0; }
.monitor-param-value { display: flex; align-items: baseline; gap: 0.25rem; font-size: clamp(2rem, 4vw, 3.15rem); }
.monitor-param-value small { font-size: 0.62rem; font-weight: 600; opacity: 0.7; }
.monitor-param-value.bp-value { display: block; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.monitor-param-detail { color: currentColor; opacity: 0.75; font: 600 0.65rem "JetBrains Mono", monospace; }
.monitor-param.compact { min-height: 58px; flex-direction: row; align-items: center; justify-content: space-between; }
.monitor-param.compact .monitor-param-value { font-size: 1.7rem; }

.device-statusbar, .ecg-specbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.38rem 0.75rem; border-top: 1px solid #222c3f; color: #8795aa; background: #0b0f17; font: 600 0.62rem "JetBrains Mono", monospace; }

/* Defibrillator: display and physical control deck share the workstation horizontally. */
.defib-screen .monitor-body.defib-workstation-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(330px, 5fr); align-items: stretch; }
.defib-therapy-screen { min-width: 0; margin: 0.8rem; }
.defib-controls-panel { min-width: 0; border-left: 1px solid #303b4e; background: linear-gradient(145deg, #1b222e, #111720); }
.defib-therapy-header { gap: 0.65rem; }
.defib-therapy-header .defib-local-note { flex: 1; text-align: center; }
.pads-status { color: #6ee7b7; font: 800 0.6rem "JetBrains Mono", monospace; }
.defib-trace-stage { min-height: 260px !important; }
.defib-trace-stage .monitor-channel-label { color: #00e676; }
.defib-energy-lcd span { font-size: 0.9rem; }
.charge-status { margin-top: 0.3rem; color: #f6c75d; font: 800 0.63rem "JetBrains Mono", monospace; text-align: right; }
.defib-energy-control { display: flex; align-items: end; justify-content: space-between; gap: 0.65rem; }
.defib-energy-control label { display: block; margin-bottom: 0.25rem; color: #8c9bb8; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; }
.defib-energy-control .stepper-value { min-width: 75px; }
.analyze-button { min-width: 105px; }
.defib-action-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0.55rem; margin-top: 0.65rem; }
.defib-screen:fullscreen .defib-workstation-body { flex: 1; }

/* Diagnostic cart: 4x3 lead field plus a real-data measurement rail. */
.twelve-patient-strip { flex-wrap: wrap; justify-content: center; }
.twelve-patient-strip strong { color: #38bdf8; }
.twelve-patient-strip span { padding-left: 0.45rem; border-left: 1px solid #334155; }
.twelve-lead-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; }
.twelve-lead-stage { position: relative; min-width: 0; display: flex; flex-direction: column; }
.twelve-lead-grid { flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: stretch; }
.twelve-lead-tile { min-height: 140px; }
.twelve-lead-tile canvas.trace { min-height: 140px; }
.twelve-freeze { top: 0.8rem; right: 0.9rem; }
.ecg-specbar { border-top-color: #2b3548; }
.twelve-rhythm-row { min-height: 110px; border-top: 1px solid #253044; }
.twelve-rhythm-row canvas.trace { min-height: 90px; }

@media (max-width: 1050px) {
    .defib-screen .monitor-body.defib-workstation-body { grid-template-columns: 1fr; }
    .defib-controls-panel { border-left: 0; border-top: 1px solid #303b4e; }
    .twelve-lead-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .simulator-landing { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
    .connection-form { grid-template-columns: 1fr; }
    .simulator-capabilities { grid-template-columns: 1fr; }
    .receiver-view-switcher { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
    .receiver-view-switcher button { min-width: max-content; flex: 1 0 auto; scroll-snap-align: start; }
    .session-status { display: none; }
    .monitor-live-banner, .training-badge, .twelve-patient-strip { order: 3; width: 100%; }
    .monitor-wave-bank { border-right: 0; }
    .monitor-side { width: 100%; }
    .monitor-param { min-width: calc(50% - 0.45rem); }
    .twelve-lead-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .device-statusbar, .ecg-specbar { flex-wrap: wrap; }
}

@media (max-width: 460px) {
    .app-header { padding-inline: 0.75rem; }
    .brand-lockup { height: 34px; }
    .simulator-nav-inner { padding-inline: .75rem; }
    .simulator-title small { display: none; }
    .simulator-nav a { padding-inline: .62rem; }
    .connection-card-heading { display: block; }.secure-note { display: inline-block; margin-top: 0.7rem; }
    .session-bar { gap: 0.7rem; }.session-bar .secondary { margin-left: auto; padding-inline: 0.7rem; }
    .twelve-lead-grid { grid-template-columns: 1fr; }
    .defib-pacer-row, .defib-action-row { grid-template-columns: 1fr; }
    .defib-vitals-row { flex-direction: column; }
}

@media (max-width: 900px) {
    .app-header { gap: 1rem; }
    .simulator-landing { grid-template-columns: 1fr; }
    .simulator-intro { max-width: 720px; }
    .broadcast-access { grid-template-columns: 1fr; min-height: 0; gap: 2rem; padding-top: 2.5rem; }
    .broadcast-access-copy { max-width: 720px; }
}

@media (max-width: 1120px) {
    .app-header { position: sticky; }
    .app-header-inner { position: relative; }
    .menu-toggle { display: block; }
    .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    .app-nav { position: absolute; top: calc(100% + .7rem); right: 0; display: none; width: min(360px, calc(100vw - 2rem)); max-height: calc(100vh - 100px); padding: .6rem; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 20px 50px rgba(15,23,42,.18); }
    .app-nav.open { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; }
    .app-nav a { min-height: 44px; display: flex; align-items: center; padding: .65rem .8rem; font-size: .86rem; }
    .app-nav .simulator-site-link { grid-column: 1 / -1; justify-content: center; margin: .4rem 0 0; }
    .app-nav .enquire-link { grid-column: 1 / -1; justify-content: center; margin: .4rem 0 0; }
    .simulator-nav-shell { top: 64px; }
}

@media (max-width: 560px) {
    .app-nav { position: fixed; top: 67px; right: .75rem; left: .75rem; width: auto; }
    .app-nav.open { grid-template-columns: 1fr; }
}

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