/* GX-2009 — Simulator-specific styles (extends shared/simulator-theme.css) */

.sim-shell {
    padding: 24px;
}

.topbar,
.hero,
.sim-main,
.sim-sidebar {
    padding: 22px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.brand {
    height: 54px;
    flex-shrink: 0;
}

.eyebrow,
.section-kicker {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* top-reading strong styling is handled by the shared .reading-card strong rule */
.hero h2,
.sim-main h2,
.sim-sidebar h3,
.tip-card h3 {
    margin: 0;
}

.meta,
.hero-copy,
.tip-card p,
.event-log,
.status-row span {
    color: var(--muted);
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 11px 15px;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button.ghost {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
}

.hero {
    display: block;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #0b4d77, #14837b);
    border-color: transparent;
    color: #fff;
}

.hero .eyebrow,
.hero h2,
.hero strong {
    color: #fff;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
    gap: 18px;
}

.sim-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.status-chip {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
}

.device-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 20px;
    align-items: start;
}

.device-wrap {
    position: relative;
    width: min(100%, 720px);
    margin: 0 auto;
}

.device-image {
    width: 100%;
    display: block;
    border-radius: 28px;
}

.alarm-beacon {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    background: rgba(220, 30, 30, 0.82);
    box-shadow: 0 0 12px rgba(220, 30, 30, 0.6);
}

.screen-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    border-radius: 18px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #c8edf8 0%, #a6ddf0 100%);
    color: #0f4268;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 0 0 2px rgba(10, 40, 70, 0.22);
    overflow: hidden;
}

.screen-overlay.is-off {
    background: #0a0a0a;
    overflow: hidden;
}

/* Blank screen when instrument is off — hide ALL content regardless of nesting */
.screen-overlay.is-off * {
    visibility: hidden !important;
    pointer-events: none;
}

/* ══ Message screen (startup, cal menus, fresh-air prompts) — 3 vertical sections ══ */
.screen-msg {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Section 1 of message: large primary text */
.screen-msg-top {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(6px, calc(var(--screen-scale, 1) * 18px), 18px);
    color: #0b3562;
    text-align: center;
    white-space: pre-wrap;
    letter-spacing: 0.05em;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1 1 0;
    padding: clamp(6px, calc(var(--screen-scale, 1) * 10px), 10px);
    box-sizing: border-box;
    overflow: auto;
    word-break: break-word;
}

/* Section 2 of message: horizontal divider rule (renamed to screen-msg-mid) */
.screen-msg-mid {
    width: 88%;
    height: clamp(2px, calc(var(--screen-scale, 1) * 2px), 2px);
    background: rgba(11, 53, 98, 0.35);
    margin: 0 auto;
    flex: 0 0 auto;
}

/* Section 3 of message: smaller detail / instruction text */
.screen-msg-bot {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(4px, calc(var(--screen-scale, 1) * 10px), 10px);
    color: #0b3562;
    text-align: center;
    white-space: pre-wrap;
    letter-spacing: 0.03em;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1 1 0;
    padding: clamp(6px, calc(var(--screen-scale, 1) * 8px), 8px);
    box-sizing: border-box;
    overflow: auto;
    word-break: break-word;
}

/* Allow flex children to shrink properly inside .screen-msg */
.screen-msg > 

/* ══ Message / menu mode — text only in rows 2 and 4 ══ */

/* Hide label rows (1 & 3) */
.screen-normal.is-msg .screen-lbl-row {
    display: none;
}

/* In msg/cal mode: move status bar to top so battery shows top-left */
.screen-normal.is-msg .screen-bot {
    order: -1;
    flex: 0 0 auto;
    padding-bottom: 2px;
}
.screen-normal.is-msg .screen-time,
.screen-normal.is-msg .screen-alarm-lbl {
    display: none;
}

/* Switch val-rows from grid to flex so height:100% on children
   resolves against the flex-allocated row height, not an auto grid track */
.screen-normal.is-msg .screen-val-row {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.screen-normal.is-msg .screen-val-row > div:last-child {
    display: none;
}

.screen-normal.is-msg .screen-val-row > div:first-child {
    width: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Row 2 — heading: large, single line (~1.5× row-unit, max 56px) */
.screen-normal.is-msg .screen-val-row:nth-child(2) strong {
    font-size: clamp(5px, calc(var(--screen-row-unit, 24px) * 1.5), 56px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    width: 100%;
    line-height: 1;
}

/* Row 4 — content: font scales with line count set via --msg-lines in JS */
.screen-normal.is-msg .screen-val-row:nth-child(4) strong {
    font-size: clamp(5px, calc(var(--screen-row-unit, 24px) * 1.72 / var(--msg-lines, 1)), 40px);
    white-space: pre-wrap;
    word-break: break-word;
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

/* ══ Normal operation screen — 3 equal vertical sections (each 1/3 of display height) ══ */
.screen-normal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* label(1) / value(3) / label(1) / value(3) / status(1) */
.screen-normal > * {
    min-height: 0;
}
.screen-normal > .screen-lbl-row {
    flex: 1 1 0;
}
.screen-normal > .screen-val-row {
    flex: 3 1 0;
}
.screen-normal > .screen-bot {
    flex: 1 1 0;
}

/* ── Row 1 & 3: thin label rows ── */
.screen-lbl-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: start;
    align-items: center;
}

.screen-lbl-row span {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(4px, calc(var(--screen-row-unit, 24px) * 0.38), 15px);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #0f4268;
    line-height: 1;
}

/* ── Row 2 & 4: big value rows ── */
.screen-val-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.screen-val-row > div {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    min-height: 0;
}

.screen-val-row strong {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(10px, calc(var(--screen-row-unit, 24px) * 1.36), 90px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    color: #0b3562;
}

/* Bottom status bar — thin strip, small font */
.screen-bot .screen-time {
    display: inline-block;
    font-size: clamp(4px, calc(var(--screen-row-unit, 24px) * 0.45), 22px);
    line-height: 1;
}

/* ── Row 5: Status bar — battery | alarm text | time ── */
.screen-bot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 0 clamp(2px, calc(var(--screen-scale, 1) * 4px), 4px);
}

.batt-icon {
    display: inline-flex;
    align-items: center;
    flex-direction: row-reverse;
    gap: 0.08em;
    vertical-align: middle;
}

.batt-

.batt-fill {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: currentColor;
    transition: width 0.3s ease;
}

.batt-tip {
    display: inline-block;
    width: 0.2em;
    height: 0.5em;
    background: currentColor;
    border-radius: 0.08em 0 0 0.08em;
}

.screen-batt,
.screen-alarm-lbl,
.screen-mode-lbl {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(4px, calc(var(--screen-row-unit, 24px) * 0.45), 22px);
    color: #0b3562;
    line-height: 1;
}

.screen-time {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    color: #0b3562;
    line-height: 1;
}

/* ── Alarm text flash animations ── */
.flash-warning {
    animation: blink-text 0.95s steps(2, end) infinite;
}

.flash-danger {
    animation: blink-text 0.55s steps(2, end) infinite;
}

.flash-batt {
    animation: blink-text 1.2s steps(2, end) infinite;
}

@keyframes blink-text {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* ── Individual reading card alarm flashing ── */
.reading-alarm-warning strong {
    animation: blink-text 0.95s steps(2, end) infinite;
}

.reading-alarm-danger strong {
    animation: blink-text 0.55s steps(2, end) infinite;
}

.reading-card {
    border-radius: clamp(2px, calc(var(--screen-scale, 1) * 5px), 5px);
    padding: clamp(1px, calc(var(--screen-scale, 1) * 4px), 4px) clamp(2px, calc(var(--screen-scale, 1) * 6px), 6px);
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.reading-card span {
    display: block;
    font-size: clamp(3px, calc(var(--screen-scale, 1) * 10px), 10px);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #0f4268;
    line-height: 1.1;
}

.reading-card strong {
    display: block;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(5px, calc(var(--screen-scale, 1) * 52px), 52px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    color: #0b3562;
}

.hotspot {
    position: absolute;
    border: 0;
    border-radius: 999px;
    background: rgba(11, 77, 119, 0.18);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
    /* Prevent long-press context menu on mobile browsers */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

.hotspot:hover,
.hotspot:focus-visible,
.hotspot.is-held {
    transform: scale(1.05);
    background: rgba(20, 131, 123, 0.36);
    box-shadow: 0 0 0 3px rgba(255, 216, 75, 0.6);
    outline: none;
}

.hotspot span {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 10px);
    background: rgba(22, 49, 71, 0.92);
    color: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.hotspot-air {
    left: 0;
    top: 0;
    width: 0;
    height: 0;
}

.hotspot-power {
    left: 0;
    top: 0;
    width: 0;
    height: 0;
}

.device-help {
    display: grid;
    gap: 12px;
}

.tip-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel-soft);
}

.tip-card p {
    margin: 10px 0 0;
    line-height: 1.65;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.task-num {
    flex-shrink: 0;
    font-weight: 700;
    color: var(--accent);
}

.task-

.task-label {
    font-weight: 600;
}

.task-hint {
    font-size: 0.85rem;
    color: var(--muted);
}

.slider-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.slider-card {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
}

.slider-card span {
    font-size: 0.86rem;
    color: var(--muted);
}

.slider-card strong {
    font-size: 1.1rem;
}

.slider-card input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.status-list {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
}

.status-row strong {
    color: var(--ink);
}

.event-log {
    margin: 10px 0 0 20px;
    padding: 0;
    line-height: 1.6;
}

.event-log li + li {
    margin-top: 8px;
}

.alarm-normal #alarmState,
.alarm-normal .status-chip {
    color: var(--ok);
}

.alarm-warning #alarmState,
.alarm-warning .status-chip {
    color: var(--warning);
}

.alarm-danger #alarmState,
.alarm-danger .status-chip {
    color: var(--danger);
}

.alarm-warning .alarm-beacon {
    animation: flash-beacon 0.95s steps(2, end) infinite;
}

.alarm-danger .alarm-beacon {
    animation: flash-beacon-urgent 0.55s steps(2, end) infinite;
}

@keyframes flash-beacon {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes flash-beacon-urgent {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
}

@media (max-width: 1080px) {
    .device-stage,
    .layout {
        grid-template-columns: 1fr;
    }

    .device-help {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .sim-shell {
        padding: 8px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .top-actions {
        width: 100%;
    }

    .top-actions .button {
        flex: 1 1 calc(50% - 5px);
    }

    .sim-header,
    .device-help {
        grid-template-columns: 1fr;
    }

    .sim-header {
        flex-direction: column;
    }

    .sim-main {
        padding: 14px 8px;
    }

    .device-wrap {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .top-actions .button {
        flex-basis: 100%;
    }

    .hotspot span {
        font-size: 0.68rem;
        padding: 4px 8px;
    }
}

/* ── Gas Supply Panel ─────────────────────────────────────── */
.gas-supply-box + h3 {
    margin-top: 18px;
}

.gas-supply-box {
    margin-top: 0;
    padding: 14px 14px 12px;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.gas-supply-box .gs-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 7px;
}

.gas-supply-box select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.84rem;
    background: #fff;
    color: var(--ink);
    margin-bottom: 7px;
    cursor: pointer;
}

.gas-cyl-info {
    font-size: 0.76rem;
    color: var(--muted);
    font-family: 'Share Tech Mono', monospace;
    margin-bottom: 10px;
    line-height: 1.5;
}

.gas-flow-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 9px;
}

.gas-flow-controls .cryo-btn {
    flex: 1;
    font-size: 0.82rem;
    padding: 7px 10px;
}

.gas-flow-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    text-align: center;
    transition: background 0.3s, color 0.3s;
}

.gas-flow-status.off {
    color: var(--muted);
    background: transparent;
}

.gas-flow-status.on {
    color: var(--ok);
    background: rgba(29, 131, 90, 0.1);
}

.gas-flow-status.flowing {
    color: var(--warning);
    background: rgba(166, 111, 19, 0.12);
    animation: blink-text 1.2s steps(2, end) infinite;
}

.gas-flow-status.purging {
    color: var(--muted);
    background: rgba(96, 119, 137, 0.08);
    animation: blink-text 1.4s steps(2, end) infinite;
}
