/* ============================================================================
   IBM PC/XT & x86 Web Emulator Suite Styling
   ============================================================================ */

:root {
    --bg-dark: #0a0e14;
    --bg-panel: #131920;
    --bg-panel-header: #1b232c;
    --border-color: #273444;
    --border-focus: #00ff9d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #536374;
    --accent-cyan: #00e5ff;
    --accent-green: #00ff9d;
    --accent-amber: #ffb86c;
    --accent-red: #ff5555;
    --font-mono: 'Fira Code', 'Cascadia Code', 'Source Code Pro', 'Consolas', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
}

/* App Header */
.app-header {
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #ffffff, #90e0ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Main Layout */
.main-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* IBM PC Case & Monitor Frame */
.pc-desktop-case {
    background: #141b24;
    border: 2px solid #28374a;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* CRT Screen Frame */
.crt-monitor-frame {
    background: #0d1218;
    border: 14px solid #1c2633;
    border-radius: 16px;
    padding: 10px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9), 0 8px 24px rgba(0, 0, 0, 0.6);
    position: relative;
    max-width: 100%;
    width: 664px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.cga-canvas {
    display: block;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 4 / 3;
    height: auto;
    background: #000;
    border-radius: 4px;
    image-rendering: pixelated;
    outline: none;
    cursor: text;
    touch-action: none;
}

.cga-canvas:focus {
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.45);
}

.crt-scanlines {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    border-radius: 4px;
}

/* Invisible input trap for mobile keyboards */
.mobile-input-trap {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    top: 0;
    left: 0;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    z-index: -1;
}

/* Monitor Badging & Mode Switchers */
.monitor-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 640px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.ibm-badge {
    color: #38bdf8;
    font-weight: 800;
    letter-spacing: 1px;
}

.filter-buttons {
    display: flex;
    gap: 6px;
}

.btn-filter {
    background: #182230;
    border: 1px solid #2b3b50;
    color: #94a3b8;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-filter.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
}

/* Storage & Drives Bay */
.storage-bay {
    width: 100%;
    max-width: 800px;
    background: #0e151e;
    border: 1px solid #222f40;
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.drive-unit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drive-label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
}

.btn-boot {
    background: rgba(0, 255, 157, 0.12);
    border-color: rgba(0, 255, 157, 0.4);
    color: var(--accent-green);
    font-size: 11px;
    padding: 2px 7px;
    font-weight: 600;
}

.btn-boot:hover {
    background: rgba(0, 255, 157, 0.25);
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.15s;
}

.led-off {
    background: #2b394a;
}

.led-active-red {
    background: #ff3333;
    box-shadow: 0 0 10px #ff3333;
}

.led-active-amber {
    background: #ffb86c;
    box-shadow: 0 0 10px #ffb86c;
}

.led-active-green {
    background: #00ff9d;
    box-shadow: 0 0 10px #00ff9d;
}

/* Control Buttons & Sliders */
.btn-retro {
    background: #1b2636;
    color: #e2e8f0;
    border: 1px solid #2e415b;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.btn-retro:hover {
    background: #283952;
    border-color: #38bdf8;
    color: #38bdf8;
}

.btn-run {
    background: rgba(0, 255, 157, 0.15);
    color: #00ff9d;
    border-color: #00ff9d;
}

.btn-danger {
    background: rgba(255, 85, 85, 0.15);
    color: #ff5555;
    border-color: #ff5555;
}

.status-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(0, 255, 157, 0.15);
    color: #00ff9d;
    border: 1px solid #00ff9d;
}

/* --- Turbo Panel & Retro 7-Segment LED Display --- */
.turbo-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 8px;
}

.seven-segment-display {
    background: #06090e;
    border: 2px solid #1a2535;
    border-radius: 4px;
    padding: 3px 10px;
    display: flex;
    align-items: baseline;
    gap: 5px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(255, 255, 255, 0.05);
}

.segment-text {
    font-family: 'Courier New', 'VT323', monospace;
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #ff3344;
    text-shadow: 0 0 6px #ff2233, 0 0 12px rgba(255, 34, 51, 0.6);
    min-width: 32px;
    text-align: center;
    transition: all 0.2s ease;
}

.seven-segment-display.turbo-active .segment-text {
    color: #00ffaa;
    text-shadow: 0 0 6px #00ffaa, 0 0 14px rgba(0, 255, 170, 0.7);
}

.seven-segment-display.warp-active .segment-text {
    color: #ffb833;
    text-shadow: 0 0 6px #ffb833, 0 0 14px rgba(255, 184, 51, 0.7);
}

.segment-unit {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.turbo-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-turbo {
    display: flex;
    align-items: center;
    gap: 7px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px 12px;
}

.btn-turbo.active {
    background: rgba(0, 255, 170, 0.12);
    border-color: #00ffaa;
    color: #00ffaa;
    box-shadow: 0 0 8px rgba(0, 255, 170, 0.3);
}

.btn-warp {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 6px 10px;
    color: #94a3b8;
}

.btn-warp.active {
    background: rgba(255, 184, 51, 0.15);
    border-color: #ffb833;
    color: #ffb833;
    box-shadow: 0 0 8px rgba(255, 184, 51, 0.35);
}

/* Drop Zone */
.drop-zone {
    width: 100%;
    max-width: 800px;
    border: 2px dashed #2b3b50;
    background: rgba(15, 23, 35, 0.6);
    border-radius: 8px;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease-in-out;
}

.drop-zone.drag-over {
    border-color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.12);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.25);
}

.drop-zone-text {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.drop-icon {
    font-size: 26px;
    flex-shrink: 0;
}

.drop-prompt strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
}

.drop-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.drop-zone-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-drop-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    padding: 6px 12px;
    white-space: nowrap;
}

.btn-drop-action input[type="file"] {
    display: none;
}

/* Assembler & Debugger Grid */
.dev-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
}

@media (max-width: 900px) {
    .dev-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #38bdf8;
}

.editor-wrap {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.code-textarea {
    width: 100%;
    height: 280px;
    background: #090e15;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #a5f3fc;
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 12px;
    resize: vertical;
    outline: none;
    line-height: 1.4;
}

.code-textarea:focus {
    border-color: var(--border-focus);
}

/* Registers View */
.reg-grid {
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.reg-box {
    background: #0b1118;
    border: 1px solid #1e2a3a;
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
}

.reg-name {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
}

.reg-val {
    font-size: 13px;
    color: var(--accent-amber);
    font-weight: 700;
}

/* ============================================================================
   Mobile & Touchscreen Companion Suite Styling
   ============================================================================ */

.mobile-companion-panel {
    width: 100%;
    max-width: 664px;
    background: #0f1620;
    border: 1px solid #223247;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    margin: 0 auto;
}

/* Tab Bar for Switching Companion Modes */
.mobile-mode-bar {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
    background: #090e15;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #1a2738;
}

.btn-touch-tab {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    padding: 7px 6px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    white-space: nowrap;
    touch-action: manipulation;
}

.btn-touch-tab:hover {
    color: #e2e8f0;
    background: rgba(56, 189, 248, 0.08);
}

.btn-touch-tab.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Quick Control Keys Ribbon */
.mobile-quick-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.btn-touch-key {
    background: #182333;
    color: #e2e8f0;
    border: 1px solid #2b3d54;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 8px 10px;
    cursor: pointer;
    transition: transform 0.08s, background 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    min-width: 38px;
    text-align: center;
}

.btn-touch-key:active,
.btn-touch-key.active {
    background: #2b4566;
    border-color: #38bdf8;
    color: #38bdf8;
    transform: translateY(2px);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.btn-touch-primary {
    background: rgba(0, 255, 157, 0.15);
    border-color: #00ff9d;
    color: #00ff9d;
    font-weight: 800;
}

.btn-touch-primary:active {
    background: #00ff9d;
    color: #000000;
}

.btn-touch-danger {
    background: rgba(255, 85, 85, 0.15);
    border-color: #ff5555;
    color: #ff5555;
}

.btn-touch-ctrl {
    background: rgba(255, 184, 108, 0.15);
    border-color: #ffb86c;
    color: #ffb86c;
}

/* Quick DOS Macro Command Pills */
.mobile-cmd-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    background: #0b1118;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #1b2635;
}

.mobile-pill-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    color: #38bdf8;
    margin-right: 2px;
}

.btn-cmd-pill {
    background: #141c27;
    border: 1px solid #24354a;
    color: #94a3b8;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    touch-action: manipulation;
}

.btn-cmd-pill:hover,
.btn-cmd-pill:active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(1px);
}

/* Touch Controller Dock - sits directly beneath CRT monitor frame */
.touch-controller-dock {
    width: 100%;
    max-width: 664px;
    margin: -6px auto 0 auto;
    z-index: 5;
    animation: drawerFadeIn 0.2s ease-out;
}

/* Touch Drawers */
.touch-drawer {
    width: 100%;
    background: #0f1620;
    border: 1px solid #223247;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    animation: drawerFadeIn 0.2s ease-out;
}

@keyframes drawerFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Virtual Gamepad & D-Pad --- */
.touch-gamepad-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 16px;
    padding: 6px 0;
}

.dpad-cross {
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
}

.dpad-row {
    display: flex;
    align-items: center;
}

.dpad-btn {
    width: 48px;
    height: 48px;
    background: #1c2635;
    border: 2px solid #334761;
    color: #94a3b8;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: background 0.1s, transform 0.08s;
}

.dpad-up {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}

.dpad-down {
    border-radius: 0 0 8px 8px;
    border-top: none;
}

.dpad-left {
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.dpad-right {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.dpad-center {
    width: 48px;
    height: 48px;
    background: #141c26;
    border: none;
}

.dpad-btn:active,
.dpad-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.gamepad-actions {
    display: flex;
    gap: 18px;
    align-items: center;
}

.btn-action-round {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: var(--font-mono);
    border: 2px solid;
    transition: transform 0.08s, box-shadow 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.btn-action-round span {
    font-size: 16px;
    font-weight: 900;
}

.btn-action-round small {
    font-size: 8px;
    font-weight: 700;
    opacity: 0.8;
}

.btn-action-a {
    background: rgba(0, 255, 157, 0.15);
    border-color: #00ff9d;
    color: #00ff9d;
}

.btn-action-a:active,
.btn-action-a.active {
    background: #00ff9d;
    color: #000;
    transform: scale(0.94);
    box-shadow: 0 0 16px rgba(0, 255, 157, 0.7);
}

.btn-action-b {
    background: rgba(255, 85, 85, 0.15);
    border-color: #ff5555;
    color: #ff5555;
}

.btn-action-b:active,
.btn-action-b.active {
    background: #ff5555;
    color: #fff;
    transform: scale(0.94);
    box-shadow: 0 0 16px rgba(255, 85, 85, 0.7);
}

/* --- Virtual Touchpad Surface --- */
.virtual-touchpad-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.touchpad-surface {
    width: 100%;
    height: 140px;
    background: radial-gradient(circle at center, #141c27, #0b1118);
    border: 2px dashed #24354a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
}

.touchpad-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

.touchpad-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-mouse-click {
    flex: 1;
    background: #182333;
    border: 1px solid #2b3d54;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.1s ease;
}

.btn-mouse-click:active,
.btn-mouse-click.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
    transform: translateY(2px);
}

/* Fullscreen CRT Monitor Mode */
:fullscreen .crt-monitor-frame,
:-webkit-full-screen .crt-monitor-frame {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: #000 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

:fullscreen .cga-canvas,
:-webkit-full-screen .cga-canvas {
    width: auto !important;
    height: 100% !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: 4 / 3 !important;
}

:fullscreen .crt-scanlines,
:-webkit-full-screen .crt-scanlines {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* Responsive Scaling for Small Displays & Smartphones */
@media (max-width: 768px) {
    .main-container {
        padding: 10px;
        gap: 14px;
    }

    .pc-desktop-case {
        padding: 12px;
        border-radius: 8px;
        gap: 14px;
    }

    .crt-monitor-frame {
        border-width: 8px;
        padding: 6px;
        border-radius: 10px;
    }

    .crt-scanlines {
        top: 6px;
        left: 6px;
        right: 6px;
        bottom: 6px;
    }

    .app-header {
        padding: 8px 12px;
    }

    .app-title {
        font-size: 15px;
    }

    .brand-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .monitor-bar {
        flex-direction: column;
        gap: 8px;
        align-items: center;
        text-align: center;
    }

    .filter-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .storage-bay {
        padding: 10px 12px;
        justify-content: center;
    }

    .turbo-panel {
        margin-left: 0;
    }

    .drop-zone {
        flex-direction: column;
        text-align: center;
    }

    .drop-zone-text {
        flex-direction: column;
        text-align: center;
    }

    .touch-controller-dock {
        margin: -4px auto 0 auto;
    }

    .desktop-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .crt-monitor-frame {
        border-width: 4px;
        padding: 3px;
        border-radius: 6px;
    }

    .crt-scanlines {
        top: 3px;
        left: 3px;
        right: 3px;
        bottom: 3px;
    }

    .touch-controller-dock {
        margin: -2px auto 0 auto;
    }

    .touch-controller-dock .touch-drawer {
        padding: 8px 10px;
        border-radius: 8px;
    }

    .mobile-mode-bar {
        flex-wrap: wrap;
    }

    .btn-touch-tab {
        flex: 1 1 40%;
    }

    .dpad-btn {
        width: 42px;
        height: 42px;
        font-size: 15px;
    }

    .dpad-center {
        width: 42px;
        height: 42px;
    }

    .btn-action-round {
        width: 52px;
        height: 52px;
    }
}

/* ============================================================================
   HDD Persistence Panel & Auto-Save Badge
   ============================================================================ */
.hdd-persist-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.persist-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(39, 52, 68, 0.6);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.persist-badge.saved {
    background: rgba(0, 255, 157, 0.1);
    color: var(--accent-green);
    border-color: rgba(0, 255, 157, 0.3);
}

.persist-badge.saving {
    background: rgba(255, 184, 108, 0.15);
    color: var(--accent-amber);
    border-color: rgba(255, 184, 108, 0.4);
    animation: persistPulse 1s infinite alternate;
}

@keyframes persistPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

.btn-mini {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

/* Footer Link Buttons */
.btn-footer-link {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-footer-link:hover {
    color: #7dd3fc;
    background-color: rgba(56, 189, 248, 0.1);
    text-decoration: underline;
}

/* ============================================================================
   Modal Dialog Component (Impressum, Datenschutz, Reset Confirm)
   ============================================================================ */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 12, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 16px;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.modal-window {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 229, 255, 0.1);
    border-radius: 10px;
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.modal-tabs {
    display: flex;
    gap: 8px;
}

.modal-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.modal-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-tab-btn.active {
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.08);
    border-bottom-color: var(--accent-cyan);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.modal-close-btn:hover {
    color: var(--accent-red);
    background: rgba(255, 85, 85, 0.1);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    flex: 1 1 auto;
}

.modal-body h2 {
    font-size: 16px;
    margin: 16px 0 8px 0;
    color: var(--accent-cyan);
    border-bottom: 1px solid rgba(39, 52, 68, 0.6);
    padding-bottom: 4px;
}

.modal-body h2:first-child {
    margin-top: 0;
}

.modal-body h3 {
    font-size: 14px;
    margin: 14px 0 6px 0;
    color: var(--accent-green);
}

.modal-body p {
    margin-bottom: 10px;
}

.modal-body ul {
    margin: 8px 0 12px 20px;
}

.modal-body li {
    margin-bottom: 4px;
}

.modal-body .legal-box {
    background: rgba(10, 14, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 14px;
    margin: 12px 0;
}

.modal-footer {
    background: var(--bg-panel-header);
    border-top: 1px solid var(--border-color);
    padding: 10px 18px;
    display: flex;
    justify-content: flex-end;
}

/* ============================================================================
   Changelog Modal Component
   ============================================================================ */
.changelog-toolbar {
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    padding: 2px 0 10px 0;
    z-index: 2;
    border-bottom: 1px solid rgba(39, 52, 68, 0.4);
}

.changelog-search-input {
    flex: 1;
    background: rgba(10, 14, 20, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.changelog-search-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}

.changelog-count {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.changelog-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    padding: 24px 0;
    font-size: 13px;
    justify-content: center;
}

.changelog-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: changelogSpin 0.8s linear infinite;
    display: inline-block;
}

@keyframes changelogSpin {
    to { transform: rotate(360deg); }
}

.changelog-release {
    background: rgba(14, 19, 27, 0.65);
    border: 1px solid rgba(39, 52, 68, 0.7);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 16px;
    transition: border-color 0.15s ease, transform 0.1s ease;
}

.changelog-release:hover {
    border-color: rgba(0, 229, 255, 0.35);
}

.changelog-release-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(39, 52, 68, 0.5);
}

.changelog-version-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.28);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.changelog-date {
    font-size: 12px;
    color: var(--text-muted);
}

.changelog-category {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-green);
    margin: 10px 0 6px 0;
}

.changelog-release ul {
    margin: 6px 0 10px 18px;
    padding: 0;
}

.changelog-release li {
    margin-bottom: 5px;
    line-height: 1.5;
}

.changelog-release code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--accent-amber);
}

.changelog-release a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.changelog-release a:hover {
    text-decoration: underline;
}

.btn-eject {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
    transition: all 0.15s ease;
}

.btn-eject:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #ef4444;
}

/* Retro Toast HUD Notification */
.retro-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(10, 16, 26, 0.95);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 229, 255, 0.35);
    color: #e0f2fe;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
    letter-spacing: 0.3px;
    max-width: 90vw;
    text-align: center;
}

.retro-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

