:root {
    --bg: #0a0e14;
    --panel-bg: #141921;
    --accent: #00e5ff;
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --border: #2d3748;

    --font-sans: system-ui, -apple-system, sans-serif;
    --font-mono: 'Roboto Mono', 'SFMono-Regular', 'Consolas', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    min-width: 1528px;
    min-height: 100vh;
}

.game-shell {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 1488px;
    flex: 0 0 auto;
}

.controls-panel {
    width: 240px;
    flex: 0 0 240px;
    padding: 14px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.38);
    font-family: var(--font-mono);
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.panel-section:last-of-type {
    margin-bottom: 10px;
}

.panel-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.12em;
}

.fuel-readout {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.fuel-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-primary);
    font-size: 0.90rem;
}

.fuel-meter {
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.fuel-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #444444, #22c55e);
    transition: width 120ms linear;
}

.control-button {
    width: 100%;
    min-height: 32px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.26);
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.90rem;
    text-align: left;
    cursor: pointer;
}

.control-button:hover {
    border-color: rgba(0, 229, 255, 0.55);
    color: var(--text-primary);
}

.control-button.is-active {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(0, 229, 255, 0.14);
    box-shadow: inset 0 0 14px rgba(0, 229, 255, 0.08);
}

.alert-button {
    border-color: rgba(255, 68, 68, 0.58);
    color: #ff9a9a;
}

.alert-button:hover {
    border-color: #ff4444;
    color: #ffe1e1;
    background: rgba(255, 68, 68, 0.14);
}

.alert-button.is-active {
    border-color: #ff4444;
    color: #ffe1e1;
    background: rgba(255, 68, 68, 0.18);
    box-shadow: inset 0 0 14px rgba(255, 68, 68, 0.12);
}

.stealth-button {
    border-color: rgba(234, 179, 8, 0.58);
    color: #fcd34d;
}

.stealth-button:hover {
    border-color: #eab308;
    color: #fef3c7;
    background: rgba(234, 179, 8, 0.14);
}

.stealth-button.is-active {
    border-color: #eab308;
    color: #fef9c3;
    background: rgba(234, 179, 8, 0.18);
    box-shadow: inset 0 0 14px rgba(234, 179, 8, 0.12);
}

.system-note {
    min-height: 38px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.83rem;
    line-height: 1.4;
}

.game-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 1234px;
    flex: 0 0 auto;
    padding: 16px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.canvas-frame {
    position: relative;
    width: 1200px;
    height: 800px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.noise-strip-container {
    width: 1200px;
    height: 81px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 0px;
}

#noiseCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

canvas { display: block; width: 100%; height: 100%; }

#gameCanvas {
    cursor: crosshair; /* overridden at runtime by CONFIG.cursorAlpha in game.js */
}

.message-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.mission-status {
    padding-bottom: 2px;
}

#messageTitle {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    overflow-wrap: anywhere;
}

#timerDisplay {
    margin: 0;
    font-size: 1.0rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    opacity: 0.8;
}

.status-label {
    margin: 2px 0 6px;
    font-size: 0.90rem;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.telemetry-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    width: 1200px;
    flex: 0 0 auto;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.telemetry-help {
    flex: 0 0 100%;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

#messageText {
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: normal;
    font-size: 0.8rem;
}

.telem-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.telem-minimap {
    flex-basis: 100%;
    height: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#miniMapCanvas {
    width: 100%;
    height: 100%;
}

.telem-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.telem-value {
    display: inline-block;
    color: var(--text-primary);
    font-weight: 500;
    min-height: 1.2em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#telemPos { min-width: 14ch; }
#telemDepth { min-width: 5ch; }
#telemSpeed { min-width: 8ch; }
#telemClearance { min-width: 6ch; }
#telemScannerRange { min-width: 6ch; }
#telemScannerSpeed { min-width: 10ch; }
#telemPingStrength { min-width: 5ch; }
#telemPingRecharge { min-width: 6ch; }
#telemHull { min-width: 4ch; }
#telemMapping { min-width: 5ch; }

.telem-group--mapping {
    min-width: 82px;
}

.telemetry-help {
    flex: 0 0 100%;
}

.graph-dashboard {
    margin-top: 4px;
    display: flex;
    gap: 12px;
}

.dashboard-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.graph-col-left {
    flex: 0 0 auto;
    padding: 0;
    background: transparent;
    border: none;
}

.graph-col-right {
    flex: 1;
}

.graph-container {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    height: 255px;
}

#graphCanvas { width: 100%; height: 100%; display: block; }

.col-title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.telem-group--mapping { flex-direction: column; gap: 3px; }
.mapping-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.mapping-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #06b6d4, #6ee7b7);
    border-radius: 2px;
    transition: width 0.4s ease;
}
