/* Mode switcher + chrome visibility (always loaded) */

.mode-switcher {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin: 0 0 16px;
    position: relative;
    z-index: 20;
}

.mode-switcher button {
    padding: 6px 12px !important;
    font-size: 0.85em !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    border: 1px solid #555 !important;
    background: #2a2a2a !important;
    color: #ccc !important;
    cursor: pointer;
    transform: none !important;
    box-shadow: none !important;
    min-width: auto !important;
}

.mode-switcher button:hover {
    border-color: #888 !important;
    color: #fff !important;
    transform: none !important;
    box-shadow: none !important;
}

.mode-switcher button.active {
    border-color: #2c8898 !important;
    color: #fff !important;
    background: #1e4a52 !important;
}

body[data-mode="cyber"] .mode-switcher button.active {
    border-color: #00ffff !important;
    color: #00ffff !important;
    background: rgba(0, 255, 255, 0.12) !important;
}

body[data-mode="chaos"] .mode-switcher button.active {
    border-color: #ff00ff !important;
    color: #ff00ff !important;
    background: rgba(255, 0, 255, 0.15) !important;
}

/* Mode-only chrome */
.mode-cyber-only,
.mode-chaos-only {
    display: none !important;
}

body[data-mode="cyber"] .mode-cyber-only {
    display: revert !important;
}

body[data-mode="chaos"] .mode-chaos-only {
    display: revert !important;
}

/* .hidden must win over mode-chaos-only revert (troll popup / fake error) */
body[data-mode="chaos"] .mode-chaos-only.hidden {
    display: none !important;
}

body[data-mode="cyber"] .mode-cyber-only.inline,
body[data-mode="chaos"] .mode-chaos-only.inline {
    display: inline !important;
}

/* Clean: hide decorative button chrome extras if any stay visible */
body[data-mode="clean"] .btn-icon,
body[data-mode="clean"] .btn-glitch {
    display: none;
}

body[data-mode="clean"] .btn-text {
    display: inline;
}

/* Chaos overlays: keep out of flow in other modes */
body:not([data-mode="chaos"]) .noise-overlay,
body:not([data-mode="chaos"]) .particles,
body:not([data-mode="chaos"]) .troll-popup,
body:not([data-mode="chaos"]) .fake-error-overlay,
body:not([data-mode="chaos"]) #fluidCanvas,
body:not([data-mode="chaos"]) #effectsCanvas {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body[data-mode="clean"] #headerSubtitle:empty,
body[data-mode="clean"] .footer-line {
    display: none !important;
}

body[data-mode="clean"] .chaos-footer,
body[data-mode="clean"] .footer {
    margin-top: 24px;
    opacity: 0.7;
    font-size: 0.9em;
    text-align: center;
}

/* Mode switcher must stay clickable above cyber scanlines (z-index 9999) */
.mode-switcher {
    z-index: 10001;
}

/* Firmware ECU selector */
.firmware-select-section {
    margin: 20px 0;
    padding: 16px;
    border: 1px dashed #555;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.firmware-select-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.firmware-select-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: stretch;
}

.firmware-select-row select {
    flex: 1 1 220px;
    min-width: 180px;
    padding: 10px 12px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #555;
    background: #1a1a1a;
    color: #e4e4e7;
}

.firmware-select-row button {
    flex: 0 0 auto;
    padding: 10px 16px !important;
    font-size: 0.95em !important;
    font-weight: 600;
    border-radius: 6px !important;
    border: 1px solid #2c8898 !important;
    background: #2c8898 !important;
    color: #fff !important;
    cursor: pointer;
    transform: none !important;
    box-shadow: none !important;
}

.firmware-select-row button:hover:not(:disabled) {
    background: #257a8a !important;
}

.firmware-select-row button:disabled,
.firmware-select-row select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ecu-meta {
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.85;
    line-height: 1.4;
}

.ecu-meta code {
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #111;
    color: #e4e4e7;
    border: 1px solid #555;
    white-space: normal;
    word-break: break-all;
}

.ecu-meta .fw-error {
    color: #f87171;
    font-weight: 600;
}

body[data-mode="cyber"] .firmware-select-section {
    border-color: rgba(0, 255, 255, 0.35);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.08);
}

body[data-mode="cyber"] .firmware-select-row button {
    border-color: #00ffff !important;
    background: rgba(0, 255, 255, 0.15) !important;
    color: #00ffff !important;
}

body[data-mode="chaos"] .firmware-select-section {
    border-color: #ff00ff;
    font-family: inherit;
}

body[data-mode="chaos"] .firmware-select-row button {
    border-color: #ff00ff !important;
    background: rgba(255, 0, 255, 0.2) !important;
    color: #ff00ff !important;
}
