/* --- Podstawowe style, fonty i zmienne kolorów --- */
:root {
    --primary-font: 'Poppins', sans-serif;
    --text-color: #f0f0f0;
    --panel-bg: rgba(30, 30, 45, 0.5);
    --panel-border: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.25);
    --correct-color: #39e1a9;
    --incorrect-color: #ff6b6b;
    --accent-color-1: #4facfe;
    --accent-color-2: #00f2fe;
    --dark-bg: #111827;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--primary-font);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--dark-bg);
    color: var(--text-color);
    padding: 20px;
    overflow: hidden;
}

/* --- Animowane tło "Aurora" - POPRAWIONE --- */
.background-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(
        45deg,
        rgba(79, 172, 254, 0.3) 0%,
        rgba(138, 43, 226, 0.2) 25%,
        rgba(0, 242, 254, 0.3) 50%,
        rgba(79, 172, 254, 0.2) 75%,
        rgba(138, 43, 226, 0.3) 100%
    );
    background-size: 400% 400%;
    animation: moveAurora 20s ease infinite;
}

@keyframes moveAurora {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}


/* --- Główny kontener aplikacji - POPRAWKI --- */
#app-container.glass-panel {
    width: 100%;
    max-width: 700px;
    background: var(--panel-bg);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-radius: 24px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 40px var(--shadow-color);
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    /* Dodano scroll i maksymalną wysokość, aby uniknąć ucinania */
    max-height: 95vh;
    overflow-y: auto;
}

/* --- Nagłówek aplikacji - POPRAWKI --- */
.app-header {
    display: flex;
    flex-direction: row; /* Domyślnie w rzędzie */
    align-items: center;
    justify-content: space-between; /* Rozkłada elementy */
    gap: 20px;
    width: 100%;
    flex-wrap: wrap; /* Zezwala na zawijanie */
}

/* Na mniejszych ekranach wyśrodkuj elementy w nagłówku */
@media (max-width: 600px) {
    .app-header {
        justify-content: center;
    }
}


.progress-section, .app-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

h1 {
    font-size: 2.2rem;
    font-weight: 600;
    text-align: center;
    background: linear-gradient(90deg, var(--accent-color-1), var(--accent-color-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0; /* Zapobiega kurczeniu się tytułu */
}

h2 {
    font-size: 1.2rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 10px;
    width: 100%;
    text-align: center;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* Pozwala zawijać label i select */
    justify-content: center;
}

/* --- POPRAWKI DROPDOWN --- */
select {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 12px 40px 12px 20px;
    font-size: 1rem;
    font-family: var(--primary-font);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f0f0f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

select:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Kolor tła dla opcji w drop-down */
select option {
    background: var(--dark-bg);
    color: var(--text-color);
}

/* --- Sekcja postępu --- */
#stats-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 12px;
    font-size: 1rem;
    flex-wrap: wrap;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color-1), var(--accent-color-2));
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

/* --- Kontener fiszki --- */
#flashcard-container {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}
#flashcard-placeholder.active { display: block; }
#flashcard-placeholder { text-align: center; color: rgba(255, 255, 255, 0.6); }
#flashcard-content { width: 100%; display: flex; flex-direction: column; gap: 15px; }

#question-category { font-style: italic; color: rgba(255, 255, 255, 0.6); }
#question-text { font-size: 1.3rem; font-weight: 400; text-align: center; }

/* --- Opcje odpowiedzi --- */
#answer-options { display: flex; flex-direction: column; gap: 10px; }

.option-container {
    display: block;
    position: relative;
    cursor: pointer;
    font-size: 1rem;
    user-select: none;
    background: rgba(0,0,0,0.2);
    padding: 15px 20px 15px 50px;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.option-container:hover {
    background: rgba(0,0,0,0.3);
    border-color: var(--panel-border);
}
.option-container.correct { background: rgba(57, 225, 169, 0.2); border-color: var(--correct-color); }
.option-container.incorrect { background: rgba(255, 107, 107, 0.2); border-color: var(--incorrect-color); }
.option-container.disabled { pointer-events: none; opacity: 0.8; }

.option-container input { position: absolute; opacity: 0; }
.checkmark {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    transition: background-color 0.3s;
}
.option-container input:checked ~ .checkmark { background: linear-gradient(45deg, var(--accent-color-1), var(--accent-color-2)); }

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 11px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}
.option-container input:checked ~ .checkmark:after { display: block; }


/* --- Feedback i Przyciski --- */
.feedback-message { text-align: center; font-size: 1.2rem; font-weight: 600; min-height: 25px; }
.feedback-message.correct { color: var(--correct-color); }
.feedback-message.incorrect { color: var(--incorrect-color); }

.app-footer {
    border-top: 1px solid var(--panel-border);
    padding-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
    display: flex;
    flex-direction: row;
    gap: 15px;
}

button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 15px 25px;
    font-size: 1rem;
    font-family: var(--primary-font);
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

button.subtle-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    padding: 5px;
    box-shadow: none;
}
button.subtle-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.1);
}

.hidden { display: none !important; }
.active { display: block !important; }

