/* Sovereign Walkman — Phosphor/CRT HUD
   Readable at arm's length. Dim at rest, blazing at threshold.
*/

:root {
    --phosphor-amber:   #e8e8e8;
    --phosphor-red:     #ff3b30;
    --phosphor-dim:     #6a6a6a;
    --bg:               #080808;
    --scanline-opacity: 0.03;
    --glow-amber:       0 0 8px #ffffff55, 0 0 20px #ffffff22;
    --glow-red:         0 0 10px #ff3b30aa, 0 0 24px #ff3b3066;
    --font-mono:        'Courier New', 'Lucida Console', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--phosphor-amber);
    font-family: var(--font-mono);
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0,0,0,var(--scanline-opacity)) 3px,
        rgba(0,0,0,var(--scanline-opacity)) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 999;
}

/* ── HUD CONTAINER ─────────────────────────── */

#walkman-hud {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: env(safe-area-inset-top, 20px) 16px env(safe-area-inset-bottom, 16px);
    gap: 10px;
    position: relative;
    z-index: 1;
}

/* ── HEADER ─────────────────────────────────── */

#hud-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 8px;
}

#hud-title {
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--phosphor-dim);
}

#hud-clock {
    font-size: 13px;
    color: var(--phosphor-amber);
    opacity: 0.7;
    letter-spacing: 0.1em;
}

/* ── STAT GRID ───────────────────────────────── */

#stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex: 1;
}

.stat-cell {
    border: 1px solid #2a2a2a;
    padding: 12px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    background: rgba(255, 179, 71, 0.02);
    transition: border-color 0.4s ease, background 0.4s ease;
}

/* Nominal: dim but LEGIBLE — this was the problem */
.stat-cell.nominal .stat-value { color: #888888; }
.stat-cell.nominal .stat-label { color: var(--phosphor-dim); }
.stat-cell.nominal .stat-sub   { color: #3a3a3a; }
.stat-cell.nominal .stat-bar-fill { background: #3a3a3a; }

/* Warming */
.stat-cell.warming {
    border-color: var(--phosphor-amber);
    background: rgba(255, 179, 71, 0.04);
}
.stat-cell.warming .stat-value { color: var(--phosphor-amber); }
.stat-cell.warming .stat-bar-fill {
    background: var(--phosphor-amber);
    box-shadow: var(--glow-amber);
}

/* Elevated */
.stat-cell.elevated {
    border-color: var(--phosphor-amber);
    background: rgba(255, 179, 71, 0.07);
}
.stat-cell.elevated .stat-value { color: var(--phosphor-amber); text-shadow: var(--glow-amber); }
.stat-cell.elevated .stat-bar-fill { background: var(--phosphor-amber); box-shadow: var(--glow-amber); }

/* Critical */
.stat-cell.critical {
    border-color: var(--phosphor-red);
    background: rgba(255, 59, 48, 0.08);
    animation: breach-pulse 1s ease-in-out infinite;
}
.stat-cell.critical .stat-value,
.stat-cell.critical .stat-label { color: var(--phosphor-red); text-shadow: var(--glow-red); }
.stat-cell.critical .stat-bar-fill { background: var(--phosphor-red); box-shadow: var(--glow-red); }

@keyframes breach-pulse {
    0%, 100% { box-shadow: none; }
    50%       { box-shadow: 0 0 16px rgba(255,59,48,0.5), inset 0 0 10px rgba(255,59,48,0.1); }
}

/* ── STAT CELL INTERNALS ─────────────────────── */

.stat-label {
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--phosphor-dim);
}

.stat-sub {
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #2a2a2a;
    margin-top: -4px;
}

.stat-value {
    font-size: 42px;
    font-weight: bold;
    letter-spacing: -0.02em;
    color: var(--phosphor-amber);
    line-height: 1;
}

.stat-unit {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 3px;
    font-weight: normal;
}

.stat-bar {
    height: 4px;
    background: #141414;
    width: 100%;
    overflow: hidden;
    border-radius: 1px;
}

.stat-bar-fill {
    height: 100%;
    width: 0%;
    background: #4a3a1a;
    transition: width 0.8s linear;
    border-radius: 1px;
}

/* ── SHORT FUSE — full width ─────────────────── */

#stat-shortfuse {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
}

#stat-shortfuse .stat-info { flex: 0 0 auto; }
#stat-shortfuse .stat-value { font-size: 52px; }

#stat-shortfuse .fuse-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#stat-shortfuse .fuse-segments {
    display: flex;
    gap: 3px;
    height: 16px;
}

.fuse-seg {
    flex: 1;
    background: #141414;
    transition: background 0.5s ease;
    border-radius: 1px;
}

.fuse-seg.active-nominal  { background: #555555; }
.fuse-seg.active-warming  { background: var(--phosphor-amber); box-shadow: var(--glow-amber); }
.fuse-seg.active-elevated { background: #ff8c00; }
.fuse-seg.active-critical { background: var(--phosphor-red); box-shadow: var(--glow-red); }

/* ── THERMAL STRIP ───────────────────────────── */

#thermal-strip {
    border-top: 1px solid #2a2a2a;
    padding-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--phosphor-dim);
    text-transform: uppercase;
}

#thermal-stage { flex: 1; text-align: right; }

#thermal-t120 {
    color: var(--phosphor-red);
    display: none;
    font-weight: bold;
}
#thermal-t120.visible {
    display: inline;
    animation: breach-pulse 0.7s ease-in-out infinite;
}

/* ── SILENCE BANNER ──────────────────────────── */

#silence-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(255,59,48,0.15);
    border-bottom: 1px solid var(--phosphor-red);
    padding: 8px 16px;
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--phosphor-red);
    text-align: center;
    display: none;
    z-index: 998;
    text-transform: uppercase;
}
#silence-banner.visible { display: block; }

/* ── DEV CONTROLS ────────────────────────────── */

#dev-controls {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.dev-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid #2a2a2a;
    color: var(--phosphor-dim);
    padding: 8px 6px;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s ease;
    min-height: 36px;
}

.dev-btn:hover,
.dev-btn.active {
    border-color: var(--phosphor-amber);
    color: var(--phosphor-amber);
    background: rgba(255,179,71,0.06);
}

.dev-btn.active-critical {
    border-color: var(--phosphor-red);
    color: var(--phosphor-red);
}
