/* Crowcon T4 — 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;
}

.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, #1a1a1a, #3a2e00);
    border-color: transparent;
    color: #fff;
}

.hero .eyebrow,
.hero h2,
.hero strong {
    color: var(--brand);
}

.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%, 700px);
    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: 12px;
    padding: 10px 12px;
    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;
}

.screen-overlay.is-off * {
    visibility: hidden !important;
    pointer-events: none;
}

/* ══ Message screen ══ */
.screen-msg {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.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;
}

.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;
}

.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;
}

.screen-msg > 

/* ══ Message / menu mode ══ */
.screen-normal.is-msg .screen-lbl-row,
.screen-normal.is-msg .screen-bot {
    display: none;
}

.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;
}

.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;
}

.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 ══ */
.screen-normal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.screen-normal > * {
    min-height: 0;
}
.screen-normal > .screen-lbl-row {
    flex: 1 1 0;
}
.screen-normal > .screen-val-row,
.screen-normal > .screen-bot {
    flex: 3 1 0;
}

/* ── Label rows ── */
.screen-lbl-row {
    display: flex;
    justify-content: space-between;
    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;
}

/* ── 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: center;
    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.18), 90px);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1;
    color: #0b3562;
}

/* Bottom status bar */
.screen-bot .screen-time {
    display: inline-block;
    font-size: clamp(8px, calc(var(--screen-row-unit, 24px) * 1.05), 75px);
    line-height: 1;
}

.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;
    gap: 0.08em;
    vertical-align: middle;
}

.batt-

.batt-fill {
    position: absolute;
    left: 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 0.08em 0.08em 0;
}

.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.55), 32px);
    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; }
}

/* ── Reading card alarm flashing ── */
.reading-alarm-a1 strong {
    animation: blink-text 0.95s steps(2, end) infinite;
}

.reading-alarm-a2 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(245, 168, 0, 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);
    -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(245, 168, 0, 0.40);
    box-shadow: 0 0 0 3px rgba(255, 216, 75, 0.7);
    outline: none;
}

.hotspot span {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 10px);
    background: rgba(26, 26, 0, 0.92);
    color: #ffd966;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.hotspot-left,
.hotspot-enter,
.hotspot-right {
    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-a1 #alarmState,
.alarm-a1 .status-chip {
    color: var(--warning);
}

.alarm-a2 #alarmState,
.alarm-a2 .status-chip {
    color: var(--danger);
}

.alarm-a1 .alarm-beacon {
    animation: flash-beacon 0.95s steps(2, end) infinite;
}

.alarm-a2 .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; }
}

/* Report modal */
.report-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
}

.report-card {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    max-width: 640px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.report-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}

.rpt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.rpt-kicker {
    margin: 0 0 4px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.rpt-title {
    margin: 0 0 4px;
    font-size: 1.4rem;
}

.rpt-date {
    margin: 0;
    font-size: 0.84rem;
    color: var(--muted);
}

.rpt-score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 18px;
    border-radius: 16px;
    min-width: 80px;
    flex-shrink: 0;
}

.grade-dist { background: #d4f5e2; color: #1d835a; }
.grade-pass { background: #fffbe6; color: #a66f13; }
.grade-partial { background: #fff0e0; color: #bb5e00; }
.grade-fail { background: #fde8e8; color: #bb342d; }

.rpt-score-pct {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1;
}

.rpt-score-grade {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.rpt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.rpt-table th {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid var(--border);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.rpt-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
}

.rpt-status { width: 30px; text-align: center; font-size: 1rem; }
.rpt-time   { width: 70px; text-align: right; color: var(--muted); font-size: 0.82rem; }

.rpt-pass .rpt-status { color: var(--ok); }
.rpt-fail .rpt-status { color: var(--danger); }
.rpt-fail td           { color: var(--muted); }

.rpt-footer {
    text-align: center;
    font-size: 0.84rem;
    color: var(--muted);
}

.rpt-note { margin: 4px 0 0; }
.rpt-note-ok { color: var(--ok); font-weight: 600; }

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.task-progress {
    font-size: 0.88rem;
    color: var(--muted);
}

.task-report-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.task-report-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.task-list {
    margin: 12px 0 0;
}

@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;
    }
}
