:root {
    --panel-bg: #0a0a0c;
    --bezel: #1c1d1f;
    --bezel-edge: #2e3033;
    --face: #101113;
    --needle: #f2f2f2;
    --text-dim: #8a8f96;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--panel-bg);
    color: #e8e8e8;
    font-family: 'Segoe UI', Arial, sans-serif;
    overflow: hidden;
}

.cockpit-wrap {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    padding: 14px;
    gap: 12px;
}

.cockpit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    flex: 0 0 auto;
}

.gauge {
    position: relative;
    width: clamp(140px, 16vw, 250px);
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, var(--bezel-edge), var(--bezel));
    border-radius: 14px;
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    padding: 10px;
}

.gauge svg {
    width: 100%;
    height: 100%;
    display: block;
}

.gauge .screw {
    fill: #45484c;
    stroke: #0a0a0a;
    stroke-width: 0.6;
}

.gauge .screw-slot {
    stroke: #0a0a0a;
    stroke-width: 1;
}

.needle {
    transform-origin: 100px 100px;
    transition: transform ease-in-out;
}

.tick-major {
    stroke: #e8e8e8;
    stroke-width: 2;
}

.tick-minor {
    stroke: #8a8f96;
    stroke-width: 1;
}

.tick-label {
    fill: #e8e8e8;
    font-size: 13px;
    font-family: Arial, sans-serif;
    text-anchor: middle;
    dominant-baseline: middle;
}

.face-label {
    fill: #d8d8d8;
    font-size: 10.5px;
    letter-spacing: 0.5px;
    text-anchor: middle;
    font-family: Arial, sans-serif;
}

.redline {
    stroke: #e74c3c;
    stroke-width: 2.5;
}

/* ---- MFD monitors row ---- */

.monitors-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 14px;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
}

.monitor {
    min-height: 0;
    min-width: 0;
}

.monitor-empty .screen {
    opacity: 0.4;
}

.screen {
    background: #000;
    height: 100%;
    width: 100%;
    padding: 8px 12px;
    font-family: 'Menlo', 'Consolas', monospace;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

/* fuel screen */

.caution-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    gap: 1px 10px;
    font-size: clamp(9px, 1.3vw, 15px);
    flex: 1 1 auto;
}

.caution-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.caution-page {
    color: var(--sys-cyan, #35d6c8);
    text-align: center;
    margin-bottom: 2px;
}

.caution-item {
    white-space: nowrap;
    letter-spacing: 0.5px;
}

@keyframes blink-red {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.15; }
}

.state-off { visibility: hidden; }

.state-green {
    visibility: visible;
    color: var(--sys-green, #3ddc47);
}

.state-amber {
    visibility: visible;
    color: var(--sys-yellow, #f0d43a);
}

.state-red {
    visibility: visible;
    color: #ff3b30;
    font-weight: bold;
    animation: blink-red 1s steps(1, end) infinite;
}

.master-warning {
    visibility: hidden;
    text-align: center;
    color: #fff;
    font-weight: bold;
    letter-spacing: 2px;
    background: #e0392b;
    padding: 4px 0;
    margin-bottom: 4px;
    flex: 0 0 auto;
}

.master-warning.visible {
    visibility: visible;
    animation: blink-red 1s steps(1, end) infinite;
}

.fuel-hr {
    height: 1px;
    background: var(--sys-cyan, #35d6c8);
    flex: 0 0 auto;
    margin-top: 4px;
}

.fuel-heading {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 16px;
    flex: 0 0 auto;
    padding: 6px 0 4px;
    position: relative;
}

.fuel-end {
    color: var(--sys-yellow, #f0d43a);
    font-size: 0.75em;
    position: absolute;
    left: 0;
}

.fuel-title {
    color: var(--sys-cyan, #35d6c8);
    font-size: 1.6em;
    font-weight: bold;
}

.fuel-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 4px 0;
}

.fuel-flow-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 0 0 auto;
    width: 15%;
    color: #fff;
}

.fuel-flow-lbl { color: #fff; }
.fuel-flow-val { color: var(--sys-cyan, #35d6c8); font-size: 1.3em; }
.fuel-flow-unit { color: #fff; }

.fuel-tank {
    display: flex;
    align-items: stretch;
    flex: 1 1 auto;
    min-width: 0;
    border: 2px solid #fff;
}

.fuel-tank-section {
    position: relative;
    border-left: 2px solid #fff;
}

.fuel-tank-section:first-child {
    border-left: none;
}

.tank-side {
    flex: 1 1 22%;
}

.tank-center {
    flex: 1 1 56%;
}

.tank-notch {
    clip-path: polygon(0 0, 100% 0, 100% 78%, 75% 78%, 75% 100%, 0 100%);
}

.fuel-tank-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #2f6fd8, #1c4a9e);
    transition: height 400ms ease-in-out;
}

.fuel-tank-value {
    position: absolute;
    top: 14%;
    left: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: 1.15em;
    font-weight: bold;
}

/* engine screen */

.engine-screen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 2px;
}

.engine-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: clamp(9px, 1.5vw, 16px);
    color: #7fd97f;
    width: 19%;
    text-align: center;
}

.engine-col .fail-flag {
    font-weight: bold;
    line-height: 1.15;
    font-size: clamp(10px, 1.7vw, 18px);
    margin-bottom: 4px;
}

.engine-label-row {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    margin-top: 6px;
}

.engine-dot {
    width: 0.7em;
    height: 0.7em;
    background: #2ecc40;
    display: inline-block;
    flex: 0 0 auto;
}

.engine-val {
    color: var(--sys-cyan, #35d6c8);
    font-size: 1.15em;
}

.engine-dial {
    width: auto;
    height: 96%;
    aspect-ratio: 1 / 1;
}

.engine-dial svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* system screen */

:root {
    --sys-cyan: #35d6c8;
    --sys-green: #3ddc47;
    --sys-yellow: #f0d43a;
    --sys-red: #e0392b;
}

.system-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: clamp(9px, 1.35vw, 15px);
}

.sys-top {
    display: flex;
    align-items: flex-start;
    flex: 0 0 auto;
    padding-bottom: 4px;
    gap: 10px;
}

.sys-oat { flex: 0 0 auto; color: #fff; white-space: nowrap; }
.sys-vdiv { width: 1px; background: var(--sys-cyan); align-self: stretch; }
.sys-vne { flex: 1 1 auto; text-align: right; line-height: 1.35; }
.sys-vne-main { color: #fff; white-space: nowrap; }
.sys-ias { color: var(--sys-yellow); }

.lbl-green { color: var(--sys-green); }
.lbl-white { color: #fff; }
.lbl-cyan { color: var(--sys-cyan); }
.unit-cyan { color: var(--sys-cyan); }
.arrow-green { color: var(--sys-green); font-weight: bold; margin-right: 4px; }
.val-white { color: #fff; }

.sys-hr {
    height: 1px;
    background: var(--sys-cyan);
    flex: 0 0 auto;
}

.sys-spacer {
    flex: 1 1 auto;
    min-height: 6px;
}

.sys-dc {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 10px;
    flex: 0 0 auto;
    padding: 6px 0;
    white-space: nowrap;
}

.sys-cols {
    display: flex;
    justify-content: space-between;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 4px;
}

.sys-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 31%;
    min-height: 0;
}

.sys-col-title {
    color: #fff;
    white-space: nowrap;
}

.sys-col-bars {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin-top: 2px;
    padding: 0 8px;
}

.sys-col-bars .unit-cyan {
    align-self: flex-start;
    font-size: 0.9em;
}

.bar-v-track {
    width: 22%;
    max-width: 22px;
    background: transparent;
    border: none;
    position: relative;
}

.bar-v-track .zone {
    position: absolute;
    left: 0;
    width: 100%;
}

.zone-red { background: var(--sys-red); }
.zone-green { background: var(--sys-green); }

.bar-v-pointer {
    position: absolute;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    transform: translateY(50%);
    transition: bottom 400ms ease-in-out;
}

.pointer-left-facing {
    left: 100%;
    border-right: 14px solid #cfd6d6;
}

.pointer-right-facing {
    right: 100%;
    border-left: 14px solid #cfd6d6;
}

.sys-col-values {
    display: flex;
    gap: 14px;
    color: #fff;
    margin-top: 4px;
    white-space: nowrap;
}

.status-bar {
    position: fixed;
    bottom: 6px;
    right: 10px;
    font-size: 11px;
    color: var(--text-dim);
    font-family: monospace;
}
