* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #03090d;
    color: #e8fbff;
    font-family: "Trebuchet MS", Arial, sans-serif;
}

body {
    background-color: #02070a;
    background-image: linear-gradient(to bottom, rgba(1, 5, 8, 0.08), rgba(1, 5, 8, 0.64)), url("reactor-hall-background-v2.png");
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}

#reactorCanvas {
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hud {
    position: fixed;
    z-index: 3;
    top: 18px;
    left: 18px;
    width: 322px;
    pointer-events: none;
}

.brand-panel,
.core-panel,
.fault-panel,
.crew-panel {
    margin-bottom: 10px;
    border: 1px solid #235467;
    border-left: 4px solid #17bed4;
    background-color: rgba(3, 17, 23, 0.92);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.36);
}

.brand-panel {
    padding: 17px 18px 15px;
    border-left-color: #ffc33f;
}

.eyebrow-row,
.panel-heading {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.eyebrow,
.shift-label,
.panel-heading,
.reactor-stats span,
.fault-meta,
.crew-state {
    font-family: Consolas, "Courier New", monospace;
    letter-spacing: 1.3px;
}

.eyebrow,
.shift-label {
    color: #8fd9e4;
    font-size: 10px;
    font-weight: bold;
}

.shift-label {
    color: #ffc33f;
}

h1 {
    margin: 5px 0 2px;
    color: #f3fbfc;
    font-family: Impact, "Arial Narrow", sans-serif;
    font-size: 35px;
    font-weight: normal;
    letter-spacing: 2px;
    line-height: 1;
}

h1 span {
    color: #ffba2f;
}

.mission-text {
    margin: 7px 0 0;
    color: #91aeb5;
    font-size: 13px;
    line-height: 1.35;
}

.core-panel,
.fault-panel,
.crew-panel {
    padding: 13px 14px;
}

.panel-heading {
    color: #91bdc7;
    font-size: 10px;
    font-weight: bold;
}

.panel-heading strong {
    color: #e8fbff;
    font-size: 14px;
}

.stability-track {
    height: 12px;
    margin: 10px 0 12px;
    padding: 2px;
    border: 1px solid #244956;
    background-color: #071117;
}

.stability-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ffc43d, #3ce0b0 45%, #50eef1);
    -webkit-transition: width 0.25s linear, background-color 0.25s linear;
    transition: width 0.25s linear, background-color 0.25s linear;
}

.stability-bar.warning {
    background: #ffb12f;
}

.stability-bar.critical {
    background: #ff4d45;
}

.reactor-stats {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.reactor-stats div {
    width: 33.33%;
    padding-right: 5px;
}

.reactor-stats span,
.reactor-stats strong {
    display: block;
}

.reactor-stats span {
    margin-bottom: 3px;
    color: #668b95;
    font-size: 8px;
}

.reactor-stats strong {
    color: #eefcff;
    font-family: Consolas, "Courier New", monospace;
    font-size: 17px;
}

.fault-list,
.crew-list {
    margin-top: 9px;
}

.fault-row,
.crew-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-height: 34px;
    margin-top: 5px;
    padding: 6px 7px;
    border: 1px solid #1b3c48;
    background-color: #081a21;
}

.fault-light,
.crew-light {
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    margin-right: 9px;
    background-color: #ffb331;
    box-shadow: 0 0 9px currentColor;
}

.fault-row.critical .fault-light {
    color: #ff4c45;
    background-color: #ff4c45;
}

.fault-copy,
.crew-copy {
    min-width: 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
}

.fault-name,
.crew-name {
    display: block;
    overflow: hidden;
    color: #ecfbff;
    font-size: 11px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fault-meta,
.crew-state {
    display: block;
    margin-top: 2px;
    color: #6e9da8;
    font-size: 8px;
}

.fault-severity {
    color: #ffbf42;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
}

.crew-light {
    color: #35e2db;
    background-color: currentColor;
}

.crew-score {
    color: #ffca56;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    font-weight: bold;
}

.empty-fault,
.empty-crew {
    padding: 9px 5px;
    color: #587983;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    text-align: center;
}

.qr-shell {
    position: fixed;
    z-index: 4;
    bottom: 14px;
    left: 18px;
    -webkit-transform: scale(0.72);
    transform: scale(0.72);
    -webkit-transform-origin: bottom left;
    transform-origin: bottom left;
}

.rcRoomQrCodeLink,
.rcRoomQrCodeLink * {
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: block;
    width: 150px;
    margin-top: 8px;
    margin-right: auto;
    margin-bottom: 8px;
    margin-left: auto;
    border: solid 8px #fff;
    border-radius: 8px;
    color: #fff;
    background-color: #fff;
    box-shadow: 0 0 0 1px #fff;
    text-align: center;
    -webkit-transition: opacity 1s ease;
    transition: opacity 1s ease;
    text-decoration: none;
}

.rcTechLabel {
    margin: 0 0 8px 0;
    padding: 4px;
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.2em;
}

.rcRoomQrCode {
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
    width: 150px;
    height: 150px;
    overflow: hidden;
    background-color: #ffffff;
}

.rcRoomQrCode img,
.rcRoomQrCode canvas {
    display: block;
    width: 150px;
    height: 150px;
    background-color: #fff;
}

.rcRoomId {
    margin: 8px 0 0 0;
    padding: 4px;
    background-color: #000;
    color: #fff;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 0.25em;
}

.sound-button {
    position: fixed;
    z-index: 5;
    right: 16px;
    bottom: 16px;
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid #2e6474;
    border-radius: 2px;
    color: #9ed7df;
    background-color: #06171e;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
}

.sound-button.active {
    border-color: #ffc33f;
    color: #ffc33f;
}

.sound-icon {
    margin-right: 6px;
    font-size: 16px;
}

.event-banner {
    position: fixed;
    z-index: 5;
    top: 22px;
    left: 50%;
    width: 370px;
    margin-left: -185px;
    padding: 10px 18px;
    border: 1px solid #3b6d78;
    border-top: 3px solid #ffc13d;
    background-color: rgba(3, 18, 24, 0.94);
    opacity: 0;
    text-align: center;
    -webkit-transform: translateY(-20px);
    transform: translateY(-20px);
    -webkit-transition: opacity 0.2s linear, transform 0.2s ease;
    transition: opacity 0.2s linear, transform 0.2s ease;
}

.event-banner.visible {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.event-banner span,
.event-banner strong {
    display: block;
}

.event-banner span {
    color: #82c9d5;
    font-family: Consolas, "Courier New", monospace;
    font-size: 9px;
    letter-spacing: 2px;
}

.event-banner strong {
    margin-top: 3px;
    color: #fff3c6;
    font-family: Impact, "Arial Narrow", sans-serif;
    font-size: 21px;
    font-weight: normal;
    letter-spacing: 1px;
}

.meltdown-overlay {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: none;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    background-color: rgba(68, 4, 3, 0.82);
}

.meltdown-overlay.visible {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.meltdown-card {
    width: 430px;
    padding: 32px;
    border: 5px solid #ff4c3f;
    background-color: #190807;
    text-align: center;
}

.meltdown-card span {
    color: #ffbd45;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 3px;
}

.meltdown-card strong {
    display: block;
    margin: 9px 0;
    color: #ffffff;
    font-family: Impact, "Arial Narrow", sans-serif;
    font-size: 48px;
    font-weight: normal;
    letter-spacing: 3px;
}

.meltdown-card p {
    margin: 0;
    color: #e6a69d;
}

body.lean-paint {
    background: #061117;
}

body.lean-paint .brand-panel,
body.lean-paint .core-panel,
body.lean-paint .fault-panel,
body.lean-paint .crew-panel,
body.lean-paint .event-banner {
    background-color: #06171e;
    box-shadow: none;
}

body.lean-paint .stability-bar {
    background: #37d8b7;
}

@media (max-height: 650px), (max-width: 1100px) {
    .hud {
        top: 8px;
        left: 8px;
        width: 270px;
    }

    .brand-panel,
    .core-panel,
    .fault-panel,
    .crew-panel {
        margin-bottom: 6px;
        padding: 9px 10px;
    }

    h1 {
        font-size: 27px;
    }

    .mission-text,
    .crew-state,
    .fault-meta {
        display: none;
    }

    .fault-row,
    .crew-row {
        min-height: 27px;
        padding: 4px 5px;
    }

    .qr-shell {
        bottom: 7px;
        left: 8px;
        -webkit-transform: scale(0.54);
        transform: scale(0.54);
    }
}

@media (orientation: portrait) {
    .hud {
        top: 8px;
        left: 8px;
        width: 248px;
    }

    .brand-panel,
    .core-panel,
    .fault-panel,
    .crew-panel {
        padding: 9px 10px;
    }

    h1 {
        font-size: 25px;
    }

    .fault-panel {
        max-height: 172px;
        overflow: hidden;
    }

    .crew-panel {
        max-height: 142px;
        overflow: hidden;
    }

    .event-banner {
        top: auto;
        bottom: 16px;
        width: 310px;
        margin-left: -155px;
    }

    .sound-button {
        top: 12px;
        right: 10px;
        bottom: auto;
    }
}
