@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Orbitron:wght@500;700;900&display=swap');

:root {
    --bg-main: #0a0c14;
    --bg-surface: #121624;
    --bg-dark: #07090f;
    --accent: #00ffcc;
    --accent-glow: rgba(0, 255, 204, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    
    /* Kolory Stanów Logicznych */
    --high-color: #10b981;
    --high-glow: rgba(16, 185, 129, 0.4);
    --low-color: #ef4444;
}

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

body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 30px 15px;
}

.app-container {
    max-width: 1250px;
    margin: 0 auto;
}

/* NAGŁÓWEK */
.app-header {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 5px;
    color: var(--accent);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--accent);
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.text-glow {
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* UKŁAD GŁÓWNY */
.game-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 25px;
}

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

/* PANEL CELÓW I TABELI PRAWDY */
.control-panel {
    background-color: var(--bg-surface);
    border: 1px solid #23293e;
    border-radius: 14px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.level-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-dark);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #1e2538;
}

.level-selector button {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.level-selector button:hover {
    transform: scale(1.2);
}

#level-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1rem;
}

.objective-card h3, .truth-table-container h3 {
    font-size: 0.8rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.objective-card p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #cbd5e1;
}

/* TABELA PRAWDY */
.table-wrapper {
    background-color: var(--bg-dark);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1e2538;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: center;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #1e2538;
}

th {
    background-color: #0e111a;
    color: var(--text-secondary);
    font-weight: 500;
}

.row-match {
    background-color: rgba(16, 185, 129, 0.08);
    color: #34d399;
}

.row-mismatch {
    color: #f87171;
}

.success-banner {
    background-color: var(--high-color);
    color: white;
    padding: 14px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 20px var(--high-glow);
    animation: pulse-banner 2s infinite;
}

/* PLANSZA ELEKTRONICZNA (CIRCUIT BOARD) */
.circuit-board {
    background-color: var(--bg-surface);
    border: 1px solid #23293e;
    border-radius: 14px;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    overflow-x: auto;
}

.circuit-column {
    display: flex;
    flex-direction: column;
    gap: 45px;
    align-items: center;
    min-width: 150px;
}

.column-title {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: -15px;
    text-align: center;
}

/* WĘZŁY WEJŚCIOWE */
.node {
    background-color: var(--bg-dark);
    border: 2px solid #2e3754;
    border-radius: 10px;
    padding: 14px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.node:hover {
    border-color: var(--accent);
}

.node-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.switch-display {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: bold;
    background-color: #1a1f32;
    padding: 5px 0;
    border-radius: 6px;
    color: var(--low-color);
    transition: all 0.2s;
}

/* Stan aktywny węzła (LOGIC HIGH) */
.node.logic-1 {
    border-color: var(--high-color);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.node.logic-1 .switch-display {
    background-color: var(--high-color);
    color: white;
}

/* KARTY BRAMEK LOGICZNYCH */
.gate-card {
    background-color: #181d30;
    border: 2px dashed #414f76;
    border-radius: 12px;
    width: 130px;
    height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gate-card:hover {
    border-style: solid;
    border-color: var(--accent);
    background-color: #1e253d;
    transform: translateY(-3px);
}

.gate-meta {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
}

.gate-symbol {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 5px rgba(255,255,255,0.1);
}

.gate-hint {
    font-size: 0.6rem;
    color: var(--accent);
    opacity: 0.8;
}

/* DIODA LED */
.led-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#led-bulb {
    font-size: 4.5rem;
    color: #2e3754;
    transition: all 0.25s ease;
}

/* Stany świecenia LED */
#led-bulb.lit {
    color: #eab308;
    filter: drop-shadow(0 0 20px rgba(234, 179, 8, 0.7));
}

#led-status {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ANIMACJE */
@keyframes pulse-banner {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   DODATEK: NOWOCZESNY RETUSZ MOBILNY PRZYCISKU POWROTU (MAX 480px)
   ========================================================================== */
@media (max-width: 480px) {
    .app-header {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 25px;
    }

    .back-btn {
        position: static;                     /* Usunięcie absolutnego pozycjonowania */
        display: flex;                        /* Pełny flex-box */
        width: 100%;                          /* Na całą szerokość ekranu smartfona */
        box-sizing: border-box;
        justify-content: center;              /* Środkowanie zawartości */
        align-items: center;
        padding: 14px 20px;                   /* Komfortowa strefa kliku dla kciuka */
        font-size: 0.95rem;
        background: rgba(18, 22, 36, 0.7);     /* Przezroczyste tło bazujące na var(--bg-surface) */
        backdrop-filter: blur(10px);          /* Efekt rozmycia tła za przyciskiem */
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(0, 255, 204, 0.3); /* Delikatny zarys koloru akcentu */
        border-radius: 8px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    /* Efekt natychmiastowego kliknięcia / dotknięcia palcem ekranu */
    .back-btn:active {
        background: var(--accent-glow);
        border-color: var(--accent);
        color: #ffffff;
        text-shadow: 0 0 10px var(--accent);
        box-shadow: 0 0 15px var(--accent-glow);
    }
}