/* ==============================================================================
   ⚙️ DREAMERS STEAMPUNK DISPATCHER & TRAFFIC ROUTER STYLESHEET ⚙️
   Ultra-Fast, Premium Victorian Steampunk Theme with 60fps Hardware Acceleration
   ============================================================================== */

:root {
    --bg-dark: #0d0b09;
    --bg-card: rgba(22, 17, 13, 0.88);
    --bg-card-inner: rgba(14, 11, 8, 0.95);
    
    /* Steampunk Metals */
    --brass-light: #f3d478;
    --brass-main: #d4af37;
    --brass-dark: #8c6d1f;
    --copper-main: #c5832b;
    --copper-dark: #6e4111;
    --bronze-main: #9c6835;
    --bronze-dark: #3a2210;
    
    /* Glowing Filament & Nixie Accents */
    --amber-glow: #ff9900;
    --amber-light: #ffd180;
    --emerald-glow: #10b981;
    --ruby-glow: #ef4444;
    
    /* Typography */
    --font-heading: 'Cinzel', 'Playfair Display', Georgia, serif;
    --font-mono: 'Special Elite', 'Courier New', monospace;
    --font-ui: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --shadow-brass: 0 0 20px rgba(212, 175, 55, 0.25), 0 0 40px rgba(255, 153, 0, 0.15);
    --shadow-gear: 0 10px 25px rgba(0, 0, 0, 0.7);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
}

/* Reset & Base Setup */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100%;
    background-color: var(--bg-dark);
    color: #e5dac9;
    font-family: var(--font-ui);
    overflow-x: hidden;
    line-height: 1.5;
}

body {
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(197, 131, 43, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(140, 109, 31, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 20% 70%, rgba(110, 65, 17, 0.12) 0%, transparent 50%),
        linear-gradient(180deg, #0d0b09 0%, #16110c 50%, #0a0806 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 16px 40px;
    position: relative;
}

/* Ambient Grain & Vignette */
.ambient-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.85);
    background: radial-gradient(circle, transparent 60%, rgba(5, 4, 3, 0.8) 100%);
}

/* Canvas for Steam particles */
#steam-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.65;
}

/* Background Clockwork Gears */
.steampunk-gears-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.gear {
    position: absolute;
    color: rgba(212, 175, 55, 0.07);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.05));
    transform-origin: center center;
    will-change: transform;
}

.gear-tl {
    top: -60px;
    left: -60px;
    width: 280px;
    height: 280px;
    animation: rotateGearCW 40s linear infinite;
}

.gear-tr {
    top: -40px;
    right: -40px;
    width: 220px;
    height: 220px;
    animation: rotateGearCCW 32s linear infinite;
}

.gear-br {
    bottom: -80px;
    right: -60px;
    width: 320px;
    height: 320px;
    animation: rotateGearCW 50s linear infinite;
}

.gear-bl {
    bottom: -50px;
    left: -50px;
    width: 200px;
    height: 200px;
    animation: rotateGearCCW 28s linear infinite;
}

@keyframes rotateGearCW {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateGearCCW {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Main Container Layout */
.dispatcher-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Steampunk Frame & Panel */
.steampunk-panel {
    background: var(--bg-card);
    border: 2px solid var(--brass-dark);
    border-radius: var(--radius-lg);
    position: relative;
    padding: 30px 24px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.7),
        inset 0 0 0 1px rgba(243, 212, 120, 0.2),
        inset 0 2px 8px rgba(255, 255, 255, 0.08),
        var(--shadow-brass);
}

/* Brass Corner Rivets */
.steampunk-panel::before,
.steampunk-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #f3d478 30%, #8c6d1f 90%);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.5);
}
.steampunk-panel::before { top: 10px; left: 10px; }
.steampunk-panel::after { top: 10px; right: 10px; }

.rivet-bottom-left, .rivet-bottom-right {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #f3d478 30%, #8c6d1f 90%);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.5);
    bottom: 10px;
}
.rivet-bottom-left { left: 10px; }
.rivet-bottom-right { right: 10px; }

/* Top Header */
.portal-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(140, 109, 31, 0.2);
    border: 1px solid var(--brass-dark);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--brass-light);
    font-family: var(--font-mono);
    margin-bottom: 12px;
}

.brand-badge .gear-icon {
    width: 14px;
    height: 14px;
    animation: rotateGearCW 8s linear infinite;
}

.portal-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.4);
    background: linear-gradient(180deg, #ffffff 20%, #f3d478 70%, #c5832b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.portal-subtitle {
    font-size: 0.85rem;
    color: #b8a68d;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

/* Nixie Vacuum Tubes Bar */
.nixie-tube-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.nixie-tube {
    background: rgba(20, 15, 10, 0.9);
    border: 1px solid var(--brass-dark);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8), 0 2px 5px rgba(0,0,0,0.5);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #c9bda8;
}

.nixie-lamp {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amber-glow);
    box-shadow: 0 0 10px var(--amber-glow), 0 0 20px var(--amber-light);
    animation: nixiePulse 2s ease-in-out infinite;
}

.nixie-lamp.active {
    background: var(--emerald-glow);
    box-shadow: 0 0 10px var(--emerald-glow), 0 0 20px #6ee7b7;
}

@keyframes nixiePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; filter: brightness(1.3); }
}

/* Steampunk Manometer / Pressure Gauge */
.gauge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 10px 0 24px;
    position: relative;
}

.manometer {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, #2a2016 0%, #120e09 75%, #050403 100%);
    border: 6px solid var(--brass-main);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.9),
        inset 0 0 20px rgba(0, 0, 0, 0.95),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        0 0 15px rgba(212, 175, 55, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manometer-dial {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #f9f5ea 0%, #e6ddc5 60%, #c9ba95 100%);
    border: 1px solid #785a28;
    overflow: hidden;
}

/* Dial Tick Marks via SVG */
.dial-svg {
    width: 100%;
    height: 100%;
}

/* Manometer Needle */
.manometer-needle {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 4px;
    height: 62px;
    background: linear-gradient(to top, #b91c1c, #dc2626 70%, #ef4444);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-120deg);
    transition: transform 0.1s linear;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    z-index: 5;
}

.needle-pivot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    background: radial-gradient(circle, #f3d478 20%, #8c6d1f 80%);
    border: 2px solid #3a2210;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.8);
    z-index: 6;
}

.manometer-label {
    position: absolute;
    bottom: 22px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: #4a3821;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.gauge-readout {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--brass-light);
}

.gauge-value {
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 0 8px var(--amber-glow);
}

/* Live Status Display Banner */
.status-display {
    background: var(--bg-card-inner);
    border: 1px solid var(--brass-dark);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.7);
    position: relative;
    overflow: hidden;
}

.status-message {
    font-size: 0.95rem;
    font-weight: 500;
    color: #f5eedf;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-top-color: var(--brass-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Progress bar */
.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(140, 109, 31, 0.4);
    position: relative;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c5832b, #d4af37, #ffd180);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
    transition: width 0.05s linear;
    border-radius: 4px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-steampunk-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(180deg, #f3d478 0%, #d4af37 40%, #a87e1a 100%);
    border: 2px solid #ffd180;
    border-radius: var(--radius-md);
    color: #1a1005;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.5),
        0 0 25px rgba(212, 175, 55, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.6);
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.btn-steampunk-primary * {
    pointer-events: none;
}

.btn-steampunk-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-25deg);
    animation: buttonGleam 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes buttonGleam {
    0% { left: -100%; }
    40%, 100% { left: 200%; }
}

.btn-steampunk-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.6),
        0 0 35px rgba(212, 175, 55, 0.7);
    filter: brightness(1.08);
}

.btn-steampunk-primary:active,
.btn-steampunk-primary.loading {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 153, 0, 0.9);
    filter: brightness(1.2);
}

.btn-steampunk-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    background: rgba(30, 22, 15, 0.7);
    border: 1px solid var(--brass-dark);
    border-radius: var(--radius-md);
    color: #e5dac9;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-steampunk-secondary:hover {
    background: rgba(45, 33, 22, 0.9);
    border-color: var(--brass-main);
    color: var(--brass-light);
}

/* Secondary Panel: Mirrors & Emergency Telegram Hub */
.drawer-panel {
    background: var(--bg-card);
    border: 1px solid var(--brass-dark);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--brass-light);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(140, 109, 31, 0.3);
}

.badge-live {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--emerald-glow);
    color: #34d399;
    padding: 2px 8px;
    border-radius: 12px;
}

/* Mirrors List */
.mirrors-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.mirror-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card-inner);
    border: 1px solid rgba(140, 109, 31, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.mirror-card:hover {
    border-color: var(--brass-main);
    transform: translateX(4px);
    background: rgba(28, 21, 14, 0.95);
}

.mirror-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mirror-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

.mirror-url {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #9c8a74;
}

.mirror-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(197, 131, 43, 0.2);
    border: 1px solid var(--copper-main);
    color: var(--brass-light);
}

.mirror-badge.primary {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--brass-main);
    color: #fff;
}

/* Telegram Channels Grid */
.tg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.tg-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card-inner);
    border: 1px solid rgba(140, 109, 31, 0.3);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.tg-card:hover {
    border-color: #229ed9;
    box-shadow: 0 0 15px rgba(34, 158, 217, 0.2);
    transform: translateY(-2px);
}

.tg-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #229ed9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.tg-details {
    display: flex;
    flex-direction: column;
}

.tg-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.tg-user {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #64b5f6;
}

.tg-sub {
    font-size: 0.7rem;
    color: #8c7f6f;
}

/* Footer & Help */
.dispatcher-footer {
    text-align: center;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #786b59;
}

.footer-link {
    color: var(--brass-main);
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    body {
        padding: 12px 10px 30px;
    }
    
    .steampunk-panel {
        padding: 22px 14px;
    }
    
    .portal-title {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }
    
    .manometer {
        width: 140px;
        height: 140px;
    }
    
    .manometer-needle {
        height: 50px;
    }
    
    .btn-steampunk-primary {
        font-size: 0.95rem;
        padding: 14px 18px;
    }
    
    .tg-grid {
        grid-template-columns: 1fr;
    }
}
