/* utility/bomb-busters/style.css */

:root {
    /* Action Theme Palette */
    --bb-bg: #1e1e24;
    /* Dark charcoal */
    --bb-panel: #2b2b36;
    /* Lighter charcoal for panels */
    --bb-text: #e2e8f0;
    --bb-accent-red: #ef4444;
    --bb-accent-green: #4ade80;
    --bb-accent-blue: #3b82f6;
    --bb-accent-yellow: #eab308;
    --bb-accent-orange: #f97316;
    --bb-accent-purple: #a855f7;

    --bb-border: #475569;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
    margin: 0;
    user-select: none;
    -webkit-user-select: none;
    background: var(--bb-bg);
    color: var(--bb-text);
    font-family: 'Inter', sans-serif;
}

/* Overriding global styles for this specific game */
.site-header {
    background: #0f172a !important;
    /* Extremely dark blue */
    border-bottom: 2px solid var(--bb-border);
}

.brand-text .t-illogico,
.brand-text .t-matematico,
.brand-text .t-section {
    color: #f8fafc !important;
}

.app-container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    align-items: center;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    text-align: center;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Start Screen */
.game-title {
    font-size: 3rem;
    color: var(--bb-accent-red);
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.game-desc {
    color: #94a3b8;
    font-size: 1.3rem;
    max-width: 600px;
    line-height: 1.5;
}

.mt-10 {
    margin-top: 2rem;
}

/* Action Header */
.action-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    background: var(--bb-panel);
    padding: 15px 30px;
    border-radius: 10px;
    border: 1px solid var(--bb-border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.mission-info {
    color: var(--bb-accent-yellow);
}

.mission-status {
    color: #94a3b8;
}

/* Game Area Layout */
.game-area {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 20px;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
    }
}

/* Clues Panel */
.clues-panel {
    flex: 1;
    background: var(--bb-panel);
    border: 2px solid var(--bb-border);
    border-radius: 12px;
    padding: 20px;
    height: 100%;
    min-height: 400px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.panel-header h3 {
    margin: 0 0 15px 0;
    color: var(--bb-accent-blue);
    font-family: 'JetBrains Mono', monospace;
    border-bottom: 1px solid var(--bb-border);
    padding-bottom: 10px;
    text-align: left;
}

.clues-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.clues-list li {
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    padding: 12px 15px;
    border-left: 4px solid var(--bb-accent-blue);
    border-radius: 0 6px 6px 0;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #cbd5e1;
}

/* Bomb Panel */
.bomb-panel {
    flex: 1.5;
    background: #111115;
    border: 4px solid #334155;
    border-radius: 20px;
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.9);
    position: relative;
    overflow: hidden;
    min-height: 400px;
}

.bomb-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.timer-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4rem;
    color: var(--bb-accent-red);
    background: #000;
    padding: 10px 30px;
    border-radius: 8px;
    border: 2px solid #550000;
    margin-bottom: 40px;
    text-shadow: 0 0 15px var(--bb-accent-red);
    letter-spacing: 5px;
}

/* Wires Container */
.wires-container {
    display: flex;
    flex-direction: column;
    gap: 6px;   /* 6 + i 14 di riempimento del filo = i 20 di prima */
    width: 80%;
}

/* Single Wire */
/* IL FILO E' SPESSO 30px, MA SI TOCCA SU 44.
   Misurato col touch emulato a 390px: il filo era 225x30, cioe' sotto la
   soglia dei 44 — ed e' il comando principale di tutto il gioco, quello che
   un bambino di otto anni centra col pollice mentre un orologio scende.
   Sbagliare bersaglio qui non e' un fastidio: fa esplodere la bomba e
   ricominciare il livello.

   Il colore resta spesso 30 (`background-clip: content-box` lo dipinge solo
   dentro il riempimento); l'elemento ne misura 44 e li rende tutti
   toccabili. Il `gap` scende da 20 a 6 perche' i 14px in piu' del bersaglio
   stanno proprio li' in mezzo: la distanza fra un filo e l'altro resta
   quella di prima e la bomba non si allunga.

   L'ASPETTO PERO' CAMBIA, e va detto: le ombre di questa regola dipingono
   sui 44, non sui 30, quindi attorno al colore compare una guaina scura.
   Guardata a 390px sta bene — sembra la calza di un cavo, e i due
   connettori ci si appoggiano — ma non e' la stessa immagine di prima, e
   chi legge questo commento deve saperlo invece di scoprirlo. */
.wire {
    height: 44px;
    padding: 7px 0;
    box-sizing: border-box;
    /* `background-color` e non `background` nelle regole dei colori qui
       sotto: la scorciatoia `background:` AZZERA background-clip, e vince per
       specificita' (.wire.red batte .wire). La riga c'era, il CSS era valido,
       e non faceva niente — il filo restava dipinto per tutti i 44. */
    background-clip: content-box;
    width: 100%;
    border-radius: 15px;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 5px 5px rgba(255, 255, 255, 0.2), inset 0 -5px 5px rgba(0, 0, 0, 0.4), 0 5px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s, opacity 0.3s;
}

.wire::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 12px;   /* 7 di riempimento + i 5 di prima: resta sul colore */
    width: 20px;
    height: 20px;
    background: #475569;
    border-radius: 4px;
}

.wire::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 12px;   /* come ::before: centrato sul colore, non sul bordo */
    width: 20px;
    height: 20px;
    background: #475569;
    border-radius: 4px;
}

.wire:hover {
    transform: scaleY(1.1);
    filter: brightness(1.2);
}

.wire.cut {
    opacity: 0.3;
    pointer-events: none;
    transform: scaleY(0.5);
    /* visually deflated */
}

/* Wire Colors */
.wire.red {
    background-color: var(--bb-accent-red);
}

.wire.blue {
    background-color: var(--bb-accent-blue);
}

.wire.green {
    background-color: var(--bb-accent-green);
}

.wire.yellow {
    background-color: var(--bb-accent-yellow);
}

.wire.orange {
    background-color: var(--bb-accent-orange);
}

.wire.purple {
    background-color: var(--bb-accent-purple);
}

.wire.pink {
    background-color: #ec4899;
}

.wire.cyan {
    background-color: #06b6d4;
}

.wire.teal {
    background-color: #14b8a6;
}

.wire.white {
    background-color: #f8fafc;
}

/* Buttons */
.btn.primary {
    background: var(--bb-accent-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    box-shadow: 0 4px 0 #991b1b;
    transition: transform 0.1s;
}

.btn.primary:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #991b1b;
}

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: var(--bb-panel);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid var(--bb-border);
    text-align: center;
    max-width: 90%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-content.danger h2 {
    color: var(--bb-accent-red);
    font-size: 3rem;
    margin-bottom: 10px;
}

.overlay-content.success h2 {
    color: var(--bb-accent-green);
    font-size: 2.5rem;
}

.overlay-content.super-success h2 {
    color: var(--bb-accent-yellow);
    font-size: 3rem;
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.overlay-content button {
    background: var(--bb-text);
    color: var(--bb-bg);
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
}

.overlay-content.danger button {
    background: var(--bb-accent-red);
    color: white;
}

.overlay-content.success button {
    background: var(--bb-accent-green);
    color: #000;
}

.overlay-content.super-success button {
    background: var(--bb-accent-yellow);
    color: #000;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bomb Shake on Error */
.shake-bomb {
    animation: urgentShake 0.4s cubic-bezier(.36, .07, .19, .97) both;
    border-color: var(--bb-accent-red) !important;
    background: #3a0000 !important;
}

@keyframes urgentShake {

    10%,
    90% {
        transform: translate3d(-3px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(6px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-12px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(12px, 0, 0);
    }
}

@keyframes fallBomb {
    0% {
        top: -50px;
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 110vh;
        opacity: 0;
    }
}

@keyframes spinBomb {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(720deg);
    }
}

/* Il pulsante del silenzio. `.hud-btn` non era definita da nessuna parte —
   ne' qui ne' nei CSS comuni — e senza regole il pulsante si stirava con il
   flex dell'intestazione: misurato 34x89, cioe' stretto sotto la soglia e
   alto il doppio del necessario. Le altre app kids la definiscono in casa
   propria, e qui si fa uguale: nessun foglio condiviso si tocca. */
.hud-btn {
    flex: 0 0 auto;
    align-self: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    line-height: 1;
    padding: 0;
    border: 1px solid var(--bb-border);
    border-radius: 10px;
    background: var(--bb-panel);
    color: inherit;
    cursor: pointer;
}

.hud-btn:focus-visible {
    outline: 3px solid var(--bb-accent-yellow, #facc15);
    outline-offset: 2px;
}

.hud-btn.spento {
    opacity: .65;
}
