/* ==========================================================================
   MATRIX NEWS DECODER - STILI CYBERPUNK (ANSA.IT LIVE FEED)
   ========================================================================== */

:root {
    --matrix-bg: #030804;
    --matrix-green-bright: #00ff41;
    --matrix-green-glow: #00ff88;
    --matrix-green-mid: #008f11;
    --matrix-green-dark: #003b00;
    --matrix-green-panel: rgba(2, 18, 6, 0.82);
    --matrix-border: rgba(0, 255, 65, 0.35);
    --matrix-border-hover: #00ff66;
    --matrix-white: #e9ffe9;
    --matrix-text-dim: #73ba86;
    --font-mono: 'Share Tech Mono', 'Courier New', Courier, monospace;
    --font-display: 'VT323', monospace;
    --neon-shadow: 0 0 10px rgba(0, 255, 65, 0.45);
    --neon-glow-heavy: 0 0 20px rgba(0, 255, 100, 0.7), 0 0 35px rgba(0, 255, 65, 0.4);
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--matrix-bg);
    color: var(--matrix-green-bright);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.4;
}

/* ==========================================================================
   CANVAS SFONDO PIOGGIA MATRIX
   ========================================================================== */
#matrixCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
    background-color: #020603;
}

/* ==========================================================================
   EFFETTI CRT SCANLINES & VIGNETTE
   ========================================================================== */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.28) 50%
    ), linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.02),
        rgba(0, 255, 0, 0.01),
        rgba(0, 0, 255, 0.02)
    );
    background-size: 100% 3px, 6px 100%;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.crt-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(
        circle at center,
        transparent 55%,
        rgba(0, 10, 2, 0.75) 100%
    );
}

/* ==========================================================================
   INTERFACCIA UI PRINCIPALE (HUD & CONTROLS)
   ========================================================================== */
.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 20px;
    pointer-events: none; /* Lascia passare click al canvas se necessario */
}

.interactive {
    pointer-events: auto; /* Riattiva click su elementi UI */
}

/* ==========================================================================
   BARRA SUPERIORE: STATUS & CATEGORIE
   ========================================================================== */
.top-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--matrix-green-panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--matrix-border);
    border-radius: 4px;
    padding: 10px 16px;
    box-shadow: var(--neon-shadow);
}

.system-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(0, 255, 65, 0.25);
    padding-bottom: 8px;
    font-size: 13px;
    letter-spacing: 1px;
}

.node-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: var(--matrix-white);
    text-shadow: 0 0 8px var(--matrix-green-bright);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--matrix-green-bright);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--matrix-green-bright);
    animation: pulseGlow 1.4s infinite alternate ease-in-out;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.pulse-dot.alert {
    background-color: #ff3344;
    box-shadow: 0 0 10px #ff3344;
    animation: pulseAlert 0.8s infinite alternate ease-in-out;
}

.pulse-dot.warning {
    background-color: #ffaa00;
    box-shadow: 0 0 10px #ffaa00;
    animation: pulseAlert 1.1s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    from { opacity: 0.4; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.3); box-shadow: 0 0 12px var(--matrix-green-bright); }
}

@keyframes pulseAlert {
    from { opacity: 0.5; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.4); box-shadow: 0 0 14px #ff3344; }
}

.status-stats {
    display: flex;
    gap: 16px;
    color: var(--matrix-text-dim);
    font-size: 12px;
}

.status-item span {
    color: var(--matrix-white);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.text-alert {
    color: #ff3344 !important;
    text-shadow: 0 0 8px #ff3344 !important;
}

.text-warning {
    color: #ffaa00 !important;
    text-shadow: 0 0 8px #ffaa00 !important;
}

/* Selettore Fonti Giornalistiche (Multi-Source Feed) */
.source-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(0, 255, 65, 0.2);
}

.source-label {
    font-size: 11px;
    font-weight: bold;
    color: var(--matrix-white);
    text-shadow: 0 0 6px var(--matrix-green-bright);
    text-transform: uppercase;
    margin-right: 4px;
    letter-spacing: 0.5px;
}

.source-btn {
    background: rgba(0, 30, 10, 0.7);
    border: 1px solid rgba(0, 180, 50, 0.4);
    color: #99ee99;
    padding: 3px 9px;
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-btn:hover {
    background: rgba(0, 255, 65, 0.25);
    border-color: var(--matrix-green-bright);
    color: #ffffff;
    box-shadow: 0 0 8px var(--matrix-green-bright);
}

.source-btn.active {
    background: rgba(0, 255, 65, 0.25);
    color: var(--matrix-white);
    font-weight: bold;
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.7), inset 0 0 6px rgba(0, 255, 65, 0.4);
}

/* Selettore Categorie Feed */
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.cat-label {
    font-size: 11px;
    color: var(--matrix-text-dim);
    text-transform: uppercase;
    margin-right: 4px;
}

.cat-btn {
    background: rgba(0, 40, 10, 0.6);
    border: 1px solid var(--matrix-border);
    color: var(--matrix-green-bright);
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-btn:hover {
    background: rgba(0, 255, 65, 0.2);
    border-color: var(--matrix-border-hover);
    color: #ffffff;
    box-shadow: 0 0 8px var(--matrix-green-bright);
}

.cat-btn.active {
    background: var(--matrix-green-bright);
    color: #030804;
    font-weight: bold;
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 12px var(--matrix-green-bright);
}

/* ==========================================================================
   AREA CENTRALE: DECODER HUD NOTIZIE (HOLO-DECK CYBERPUNK TERMINAL)
   ========================================================================== */
.main-hud-area {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin: 10px 0;
}

.decoder-card {
    width: 100%;
    max-width: 840px;
    background: linear-gradient(145deg, rgba(2, 20, 8, 0.86) 0%, rgba(1, 14, 5, 0.92) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 255, 65, 0.45);
    border-radius: 4px;
    padding: 20px 26px;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.25), inset 0 0 20px rgba(0, 255, 65, 0.06);
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.decoder-card:hover {
    border-color: var(--matrix-green-bright);
    box-shadow: 0 0 35px rgba(0, 255, 65, 0.4), inset 0 0 25px rgba(0, 255, 65, 0.1);
}

/* Bordo Laser Animato (Laser Perimeter Trace) */
.holo-laser-border {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    padding: 1.5px;
    background: linear-gradient(
        90deg, 
        transparent 0%, 
        transparent 30%, 
        var(--matrix-green-bright) 48%, 
        #ffffff 50%, 
        var(--matrix-green-glow) 52%, 
        transparent 70%
    );
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: laserBorderTravel 6s linear infinite;
    opacity: 0.9;
    z-index: 2;
}

@keyframes laserBorderTravel {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* Texture Griglia Olografica */
.holo-grid-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: 
        linear-gradient(rgba(0, 255, 65, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 65, 0.05) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: 0.75;
    z-index: 0;
}

/* Fascio di Scansione Radar Periodico */
.holo-radar-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: linear-gradient(180deg, rgba(0, 255, 65, 0.15) 0%, rgba(0, 255, 65, 0.03) 65%, transparent 100%);
    pointer-events: none;
    animation: radarSweep 6s ease-in-out infinite;
    z-index: 0;
}

@keyframes radarSweep {
    0% { transform: translateY(-100%); opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    100% { transform: translateY(550%); opacity: 0; }
}

/* Bracket e Mirini Angolari HUD */
.corner-bracket {
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 3;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bracket-tl { top: 4px; left: 4px; border-top: 2px solid var(--matrix-green-bright); border-left: 2px solid var(--matrix-green-bright); }
.bracket-tr { top: 4px; right: 4px; border-top: 2px solid var(--matrix-green-bright); border-right: 2px solid var(--matrix-green-bright); }
.bracket-bl { bottom: 4px; left: 4px; border-bottom: 2px solid var(--matrix-green-bright); border-left: 2px solid var(--matrix-green-bright); }
.bracket-br { bottom: 4px; right: 4px; border-bottom: 2px solid var(--matrix-green-bright); border-right: 2px solid var(--matrix-green-bright); }

.decoder-card:hover .bracket-tl { transform: translate(-2px, -2px); border-color: #ffffff; }
.decoder-card:hover .bracket-tr { transform: translate(2px, -2px); border-color: #ffffff; }
.decoder-card:hover .bracket-bl { transform: translate(-2px, 2px); border-color: #ffffff; }
.decoder-card:hover .bracket-br { transform: translate(2px, 2px); border-color: #ffffff; }

/* Barra Diagnostica Olografica Superiore */
.holo-diag-header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 255, 65, 0.22);
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-size: 11px;
    letter-spacing: 1px;
}

.carrier-lock {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-icon {
    color: var(--matrix-green-bright);
    animation: pulseScale 1.2s infinite alternate ease-in-out;
}

@keyframes pulseScale {
    from { transform: scale(0.8); opacity: 0.6; }
    to { transform: scale(1.3); opacity: 1; text-shadow: 0 0 8px var(--matrix-green-bright); }
}

.lock-label {
    color: var(--matrix-text-dim);
}

.lock-val {
    color: var(--matrix-white);
    font-weight: bold;
    text-shadow: 0 0 6px var(--matrix-green-bright);
}

.led-signal-meter {
    display: inline-flex;
    gap: 3px;
    align-items: center;
    margin-left: 6px;
}

.led-bar {
    width: 4px;
    height: 10px;
    background: rgba(0, 60, 15, 0.8);
    border-radius: 1px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.led-bar.active {
    background: var(--matrix-green-bright);
    box-shadow: 0 0 6px var(--matrix-green-bright);
}

.led-bar.alert {
    background: #ff3344 !important;
    box-shadow: 0 0 8px #ff3344 !important;
}

.led-bar.warning {
    background: #ffaa00 !important;
    box-shadow: 0 0 8px #ffaa00 !important;
}

.holo-telemetry {
    display: flex;
    gap: 14px;
    color: var(--matrix-text-dim);
}

.text-bright {
    color: var(--matrix-green-bright);
    font-weight: bold;
    transition: color 0.3s ease;
}

/* Badge Allarme Diagnostica Offline / Parser Error */
.holo-alert-badge {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(60, 10, 15, 0.9);
    border: 1px solid rgba(255, 50, 70, 0.7);
    color: #ff99aa;
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 12px;
    box-shadow: 0 0 12px rgba(255, 50, 70, 0.35);
    animation: alertBadgePulse 2s infinite alternate ease-in-out;
}

.holo-alert-badge.warning {
    background: rgba(60, 45, 10, 0.9);
    border-color: rgba(255, 170, 0, 0.7);
    color: #ffdd88;
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.35);
}

@keyframes alertBadgePulse {
    0% { border-color: rgba(255, 50, 70, 0.5); box-shadow: 0 0 8px rgba(255, 50, 70, 0.2); }
    100% { border-color: rgba(255, 80, 100, 1); box-shadow: 0 0 16px rgba(255, 50, 70, 0.6); }
}

.holo-alert-badge .alert-icon {
    color: #ff3344;
    font-weight: bold;
    font-size: 13px;
}

.holo-alert-badge.warning .alert-icon {
    color: #ffaa00;
}

/* Metadati Notizia */
.decoder-meta {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--matrix-text-dim);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.decoder-badge {
    background: rgba(0, 255, 65, 0.15);
    border: 1px solid var(--matrix-border);
    padding: 3px 9px;
    border-radius: 2px;
    color: var(--matrix-white);
    text-shadow: 0 0 4px var(--matrix-green-bright);
}

/* Titolo Notizia Decodificato */
.decoder-title {
    position: relative;
    z-index: 1;
    font-size: 23px;
    line-height: 1.35;
    color: var(--matrix-white);
    text-shadow: 0 0 12px rgba(0, 255, 65, 0.75);
    margin-bottom: 12px;
    min-height: 58px;
    letter-spacing: 0.5px;
    word-break: break-word;
}

/* Descrizione Notizia */
.decoder-desc {
    position: relative;
    z-index: 1;
    font-size: 14px;
    color: #cdeecd;
    line-height: 1.5;
    margin-bottom: 18px;
    min-height: 42px;
}

/* Barra Azioni & Navigazione */
.decoder-actions {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px dashed rgba(0, 255, 65, 0.3);
    padding-top: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-buttons {
    display: flex;
    gap: 8px;
}

.hud-btn {
    background: rgba(0, 30, 8, 0.85);
    border: 1px solid var(--matrix-border);
    color: var(--matrix-green-bright);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.hud-btn:hover {
    background: rgba(0, 255, 65, 0.25);
    border-color: var(--matrix-green-bright);
    color: var(--matrix-white);
    box-shadow: 0 0 10px var(--matrix-green-bright);
}

.hud-btn.primary {
    border-color: var(--matrix-green-bright);
    background: rgba(0, 60, 20, 0.9);
    color: var(--matrix-white);
}

.hud-btn.primary:hover {
    background: var(--matrix-green-bright);
    color: #030804;
    font-weight: bold;
}

/* Sub-Footer Olografico */
.holo-card-subfoot {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 255, 65, 0.15);
    font-size: 10px;
    color: rgba(115, 186, 134, 0.75);
    letter-spacing: 1px;
}

/* Effetto Micro-Glitch Olografico al cambio notizia */
.decoder-card.holo-glitch {
    animation: holoCardGlitch 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes holoCardGlitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-3px, 2px);
        filter: drop-shadow(2px -2px 0px rgba(0, 255, 65, 0.8)) drop-shadow(-2px 2px 0px rgba(0, 150, 255, 0.7));
    }
    40% {
        transform: translate(3px, -1px);
        filter: drop-shadow(-2px 1px 0px rgba(255, 0, 80, 0.6)) drop-shadow(2px -1px 0px rgba(0, 255, 65, 0.9));
    }
    60% {
        transform: translate(-1px, -2px);
        filter: drop-shadow(1px 1px 0px rgba(0, 255, 65, 0.8));
    }
    80% {
        transform: translate(1px, 1px);
        filter: none;
    }
    100% {
        transform: translate(0);
        filter: none;
    }
}

/* ==========================================================================
   BARRA INFERIORE: LIVE TICKER & PANNELLO CONTROLLI
   ========================================================================== */
.bottom-dock {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-ticker-container {
    background: var(--matrix-green-panel);
    border: 1px solid var(--matrix-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    overflow: hidden;
    height: 36px;
    box-shadow: var(--neon-shadow);
}

.ticker-label {
    background: var(--matrix-green-dark);
    color: var(--matrix-green-bright);
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1.5px;
    border-right: 1px solid var(--matrix-border);
    white-space: nowrap;
}

.ticker-content {
    white-space: nowrap;
    overflow: hidden;
    padding-left: 100%;
    display: inline-block;
    animation: tickerAnim 45s linear infinite;
    color: var(--matrix-white);
    font-size: 13px;
}

.ticker-content:hover {
    animation-play-state: paused;
    cursor: pointer;
}

@keyframes tickerAnim {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

.ticker-item {
    display: inline-block;
    margin-right: 30px;
    cursor: pointer;
    transition: color 0.2s;
}

.ticker-item:hover {
    color: var(--matrix-green-bright);
    text-decoration: underline;
}

.ticker-item::after {
    content: " // ";
    color: var(--matrix-green-mid);
    margin-left: 15px;
}

/* Pannello Controlli Cyberpunk */
.control-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--matrix-green-panel);
    border: 1px solid var(--matrix-border);
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--matrix-text-dim);
}

.control-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: var(--matrix-green-dark);
    outline: none;
    border-radius: 2px;
    border: 1px solid var(--matrix-border);
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--matrix-green-bright);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 6px var(--matrix-green-bright);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--matrix-border);
    color: var(--matrix-green-bright);
    padding: 4px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 255, 65, 0.2);
    border-color: var(--matrix-border-hover);
    color: var(--matrix-white);
}

.icon-btn.active {
    background: var(--matrix-green-bright);
    color: #030804;
    font-weight: bold;
}

/* ==========================================================================
   MODALITÀ ZEN / FULLSCREEN RAIN (NASCONDE HUD)
   ========================================================================== */
.zen-mode .top-header,
.zen-mode .decoder-card,
.zen-mode .news-ticker-container {
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
}

.zen-mode .control-bar {
    background: rgba(3, 8, 4, 0.4);
    border-color: rgba(0, 255, 65, 0.15);
}

/* ==========================================================================
   EFFETTI GLITCH & LOADING SPINNER
   ========================================================================== */
.loading-glitch {
    display: inline-block;
    animation: textFlicker 0.15s infinite;
}

@keyframes textFlicker {
    0% { opacity: 0.8; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Responsive per schermi piccoli / smartphone */
@media (max-width: 768px) {
    /* Il contenuto HUD puo' superare l'altezza dello schermo (titoli lunghi, wrap su piu' righe):
       il canvas di sfondo resta fisso, ma il contenitore diventa scrollabile con scrollbar nascosta
       cross-browser, cosi' tutto resta raggiungibile senza una scrollbar visibile che rompa l'estetica HUD. */
    .app-container {
        padding: 8px;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        pointer-events: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .app-container::-webkit-scrollbar {
        display: none;
    }

    .decoder-card {
        padding: 14px 16px;
    }

    .holo-diag-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .holo-telemetry {
        font-size: 10px;
        gap: 8px;
    }

    .decoder-title {
        font-size: 17px;
        min-height: 48px;
    }

    .decoder-desc {
        font-size: 12px;
    }

    .system-status-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .control-bar {
        justify-content: center;
    }
}


/* ==========================================================================
   STATO LOCKED / ACCESSO CON PASSWORD (terminale bloccato fino al login)
   ========================================================================== */
.locked .top-header,
.locked .bottom-dock,
.locked .holo-diag-header,
.locked .holo-alert-badge,
.locked .decoder-meta,
.locked .decoder-title,
.locked .decoder-desc,
.locked .decoder-actions,
.locked .holo-card-subfoot {
    display: none;
}

/* Il blocco auth esiste solo in stato locked */
.auth-block {
    display: none;
}

.locked .auth-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 34px 12px;
    position: relative;
    z-index: 5;
    text-align: center;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 30px;
    letter-spacing: 3px;
    color: var(--matrix-white);
    text-shadow: var(--neon-shadow);
}

.auth-subtitle {
    font-size: 11px;
    color: var(--matrix-text-dim);
    letter-spacing: 1px;
}

.auth-input {
    width: 100%;
    max-width: 340px;
    background: rgba(2, 18, 6, 0.9);
    border: 1px solid var(--matrix-border);
    border-radius: 3px;
    color: var(--matrix-green-bright);
    font-family: var(--font-mono);
    font-size: 15px;
    letter-spacing: 2px;
    text-align: center;
    padding: 10px 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input::placeholder {
    color: var(--matrix-green-mid);
    letter-spacing: 3px;
}

/* Focus ben visibile da tastiera (l'audit segnalava outline rimosso altrove) */
.auth-input:focus-visible,
.auth-submit:focus-visible,
.icon-btn:focus-visible,
.hud-btn:focus-visible,
.source-btn:focus-visible,
.cat-btn:focus-visible,
.control-slider:focus-visible {
    outline: 2px solid var(--matrix-green-bright);
    outline-offset: 2px;
}

.auth-submit:disabled {
    opacity: 0.5;
    cursor: wait;
}

.auth-error {
    min-height: 16px;
    font-size: 11px;
    letter-spacing: 1px;
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
}

/* Shake + flash rosso su chiave errata */
.auth-block.denied {
    animation: accessDenied 0.4s ease;
}

@keyframes accessDenied {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}
