@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Roboto:wght@400;500&display=swap');

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --background-color: #ecf0f1;
    --surface-color: #ffffff;
    --text-color: #34495e;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --font-main: 'Montserrat', sans-serif;
    --font-text: 'Roboto', sans-serif;
}

body {
    font-family: var(--font-text);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.main-header, .main-footer {
    text-align: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.main-header h1 {
    font-family: var(--font-main);
    color: var(--primary-color);
}

/* --- Opis kategorii --- */
.category-description {
    background-color: var(--surface-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 20px 30px;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    line-height: 1.6;
}

.category-description h2,
.category-description h3,
.category-description h4 {
    color: var(--primary-color);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.category-description p {
    margin-bottom: 1em;
}

.category-description ul,
.category-description ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.category-description a {
    color: var(--secondary-color);
    text-decoration: none;
}

.category-description a:hover {
    text-decoration: underline;
}

.riddle-app {
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    width: 100%;
    max-width: 800px;
    margin: 20px 0;
}

/* --- Panel Gamifikacji --- */
.gamification-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}
.panel-item {
    text-align: center;
    font-size: 0.9em;
}
.panel-item strong {
    font-family: var(--font-main);
}
#score-counter, #timer {
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 1.2em;
}
.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    flex-basis: 100%;
}
#progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--success-color);
    border-radius: 6px;
    transition: width 0.3s ease-in-out;
}

/* --- Kontener Zagadek --- */
#riddles-container {
    text-align: center;
    padding: 20px 0;
    min-height: 150px; /* Zapobiega skakaniu layoutu */
}

.riddle-wrapper {
    display: none; /* Ukrycie wszystkich zagadek */
    animation: fadeIn 0.5s ease-in-out;
}

.riddle-wrapper.active {
    display: block; /* Pokazanie tylko aktywnej zagadki */
}

.riddle-content p {
    font-size: 1.5em;
    line-height: 1.6;
    font-family: var(--font-main);
    color: var(--primary-color);
}

.answer-content {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 5px solid var(--secondary-color);
    animation: slideIn 0.4s ease-out;
}
.answer-content p {
    font-size: 1.2em;
    color: var(--secondary-color);
    font-weight: 500;
    margin: 0;
}

/* --- Panel Interakcji i Przyciski --- */
.interaction-panel {
    text-align: center;
    margin-top: 20px;
}

button {
    font-family: var(--font-main);
    font-size: 1em;
    font-weight: 700;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px;
}

#show-answer-btn {
    background-color: var(--secondary-color);
    color: white;
}
#show-answer-btn:hover {
    background-color: #2980b9;
}

.navigation-buttons {
    margin-top: 15px;
}

#prev-btn, #next-btn, #restart-btn {
    background-color: var(--primary-color);
    color: white;
}
#prev-btn:hover, #next-btn:hover, #restart-btn:hover {
    background-color: #2c3e50e0;
}
button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* --- Reklamy --- */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
    margin: 20px auto;
    min-height: 90px; /* Ważne dla CLS (Cumulative Layout Shift) */
    width: 100%;
    max-width: 728px;
    border-radius: 8px;
    font-size: 0.8em;
    color: #7f8c8d;
}

/* --- Ekran Końcowy --- */
.end-screen {
    text-align: center;
    padding: 40px 20px;
    animation: fadeIn 0.5s;
}
.end-screen h2 {
    color: var(--success-color);
    font-family: var(--font-main);
}

/* --- Animacje --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Responsywność --- */
@media (max-width: 600px) {
    .riddle-app {
        padding: 15px;
    }
    .gamification-panel {
        flex-direction: column;
        gap: 10px;
    }
    .riddle-content p {
        font-size: 1.2em;
    }
    .answer-content p {
        font-size: 1.1em;
    }
    button {
        width: 100%;
        box-sizing: border-box;
    }
    .navigation-buttons {
        display: flex;
        gap: 10px;
    }
}

/* === NOWE STYLE DLA PRZEŁĄCZNIKA I WIDOKU KLASYCZNEGO === */

/* --- Przełącznik Widoku --- */
.view-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    font-family: var(--font-main);
}
.view-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin: 0 10px;
}
.view-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(22px);
}

/* --- Widok Klasyczny --- */
#classic-view-container {
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    width: 100%;
    max-width: 800px;
    margin: 20px 0;
}
.classic-riddle {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}
.classic-riddle:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.classic-riddle h3 {
    font-family: var(--font-main);
    color: var(--primary-color);
    font-size: 1.4em;
}
.classic-riddle p {
    font-size: 1.1em;
    line-height: 1.6;
}
.classic-riddle .classic-answer {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-left: 4px solid var(--secondary-color);
    color: var(--secondary-color);
    font-weight: 500;
}

/* --- Logika Przełączania Widoków --- */
body.classic-mode .riddle-app {
    display: none;
}
body.interactive-mode #classic-view-container {
    display: none;
}
/* Domyślnie tryb interaktywny jest aktywny, więc nie trzeba nic więcej */
