:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #3a86ff;
    --accent-color: #bb86fc;
    --border-color: #333;
    --correct-color: #06d6a0; /* Zelená */
    --wrong-color: #ef476f;   /* Červená */
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

/* --- STARTOVACÍ OBRAZOVKA --- */
#start-screen {
    text-align: center;
    max-width: 1000px;
    margin: 100px auto;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.menu-buttons button {
    padding: 20px;
    font-size: 18px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.menu-buttons button:hover {
    transform: scale(1.02);
    background: #2a2a2a;
}

/* --- TEST ROZHRANÍ --- */
.hidden { display: none !important; }

#test-interface {
    max-width: 800px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
}

.timer {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    font-family: monospace;
}

.danger-btn {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- NAVIGACE (ČÍSLA) --- */
.nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
}

.nav-item {
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #333;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    border: 2px solid transparent;
}

.nav-item.active {
    border-color: var(--primary-color);
    background: #2c2c2c;
    color: white;
}

.nav-item.answered {
    background: #444; /* Tmavší šedá pro zodpovězené */
}

/* --- KARTA OTÁZKY --- */
.question-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    /* Důležité: Ve výchozím stavu skryjeme všechny, JS zobrazí aktivní */
    display: none; 
}

.question-card.active-card {
    display: block; /* Zobrazí jen tu aktivní */
}

.question-card img {
    max-width: 100%;
    border-radius: 4px;
    margin-bottom: 15px;
}

.context-image {
    border: 2px solid var(--primary-color);
    margin-bottom: 15px;
}

/* --- ODPOVĚDI A INPUTY (Dark Mode) --- */
input[type="text"] {
    background: #333;
    border: 1px solid #555;
    color: white;
    padding: 8px;
    border-radius: 4px;
}

.answers label {
    display: block;
    margin: 8px 0;
    cursor: pointer;
}

/* --- TLAČÍTKA DALŠÍ / PŘEDCHOZÍ --- */
#controls {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

#controls button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

#controls button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

/* --- MODAL --- */
#result-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.modal-actions button {
    margin: 5px;
    padding: 10px 20px;
    cursor: pointer;
}
/* --- Tlačítka v modalu --- */
.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}
/* --- STYLY PRO TLAČÍTKA V MODÁLNÍM OKNĚ (VÝSLEDKY) --- */

.modal-buttons {
    display: flex;
    justify-content: center; /* Vycentrování tlačítek */
    gap: 20px; /* Mezera mezi nimi */
    margin-top: 30px;
}

.modal-buttons button {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: transform 0.2s, filter 0.2s;
}

.modal-buttons button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Tlačítko "Projít chyby" */
.modal-buttons .primary-btn {
    background-color: var(--primary-color);
    color: white;
}

/* Tlačítko "Zavřít test" */
.modal-buttons .secondary-btn {
    background-color: #333;
    color: #ccc;
    border: 1px solid #555;
}

.modal-buttons .secondary-btn:hover {
    background-color: #444;
    color: white;
}
.review-btn {
    background-color: #3a86ff; /* Modrá */
}

.menu-btn {
    background-color: #555; /* Šedá */
}

.menu-btn:hover {
    background-color: #777;
}
/* --- STYL PRO TLAČÍTKO ZPĚT DO MENU --- */
#exit-review-btn {
    background-color: #ff9f1c; /* Oranžová pro odlišení */
    color: white;
    font-weight: bold;
    margin: 0 10px; /* Odstup od ostatních */
}

#exit-review-btn:hover {
    background-color: #e08e18;
}
/* Výsledky po vyhodnocení */
.correct { background-color: rgba(6, 214, 160, 0.2) !important; border: 1px solid var(--correct-color); }
.incorrect { background-color: rgba(239, 71, 111, 0.2) !important; border: 1px solid var(--wrong-color); }

/* --- ÚPRAVA VZHLEDU SEŘAZOVACÍCH KARTIČEK --- */
.draggable-item {
    background-color: #2c2c2c; /* Světlejší než pozadí stránky */
    border: 2px solid #555;    /* Výrazný rámeček (Outline) */
    color: white;
    padding: 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3); /* Stín pro 3D efekt */
    transition: transform 0.1s, border-color 0.2s;
}

.draggable-item:hover {
    border-color: #3a86ff; /* Modré ohraničení po najetí myší */
}

.draggable-item.dragging {
    opacity: 0.5;
    border: 2px dashed #3a86ff; /* Čárkovaně při tažení */
    background: #1f1f1f;
}

/* Úspěšné/Chybné seřazení po vyhodnocení */
.draggable-item.correct-order {
    border: 2px solid #06d6a0; /* Zelená */
    background-color: rgba(6, 214, 160, 0.1);
}
.draggable-item.wrong-order {
    border: 2px solid #ef476f; /* Červená */
    background-color: rgba(239, 71, 111, 0.1);
}

/* --- HLAVIČKA A PATIČKA --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--card-bg); /* Důležité: musí mít barvu pozadí, jinak by přes ni prosvítal text pod ní */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
    
    /* NOVÉ: Sticky efekt */
    position: sticky;
    top: 0;
    z-index: 1000; /* Zajistí, že hlavička bude vždy nad otázkami */
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.main-nav a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.2s;
}

.main-nav a:hover {
    color: var(--primary-color);
}

.main-footer {
    text-align: center;
    padding: 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    color: #888;
}

/* --- HERO SEKCE --- */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px; /* Zvětšeno, aby bylo dost místa */
    width: 95%;        /* Aby to využilo šířku obrazovky */
    margin: 40px auto 60px auto;
    gap: 40px;
}

.hero-left {
    flex: 1; /* Text zabere 1 díl */
}

.hero-right {
    flex: 1; /* Obrázek zabere 1 díl (50% šířky) */
    display: flex;
    justify-content: center; /* Vycentrování obrázku */
}

.hero-left h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: white;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.hero-buttons button {
    padding: 15px 25px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, filter 0.2s;
}

.hero-buttons button:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.primary-btn { background: var(--primary-color); color: white; }
.secondary-btn { background: #555; color: white; }


#hero-img-placeholder {
    width: 100%;         /* Roztáhne se na šířku kontejneru */
    max-width: 500px;    /* Maximální velikost */
    height: auto;        /* Výška se dopočítá automaticky (nedeformuje se) */
    object-fit: contain; /* Zachová poměr stran */
    border-radius: 12px;
    /* Ponecháme animaci, pokud ji tam máš */
    animation: float 6s ease-in-out infinite;
}

/* --- VÝBĚR DETAILŮ TESTU (KARTY) --- */

#subject-menu {
    max-width: 1200px; /* Musí být stejně široké jako hero, aby se tam karty vešly */
    width: 95%;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-in-out;
}
#subject-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--accent-color);
    font-size: 2em;
}

.subject-options-grid {
    display: grid;
    /* Na PC vždy 3 sloupce o stejné šířce */
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px;
    margin-top: 20px;
}
@media (max-width: 900px) {
    .subject-options-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}
.option-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.option-card h3 { margin-top: 0; color: white; }
.option-card p { color: #bbb; margin-bottom: 20px; flex-grow: 1; }

.action-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 12px;
    width: 100%;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
}

.styled-select, .styled-input {
    width: 100%;
    padding: 10px;
    background: #121212;
    color: white;
    border: 1px solid #555;
    border-radius: 6px;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
}

.subject-footer-text {
    text-align: center;
    margin-top: 30px;
    color: #888;
    font-style: italic;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responzivita pro mobily */
@media (max-width: 768px) {
    .hero { flex-direction: column; text-align: center; }
    .hero-right { display: none; } /* Na mobilu obrázek schováme pro úsporu místa */
    .hero-buttons { flex-direction: column; }
    .main-nav { display: none; } /* Zde bys pak udělal hamburger menu */
}

/* ====== INFORMAČNÍ SEKCE (Návod a O aplikaci) ====== */
.info-section {
    max-width: 1000px;
    margin: 80px auto;
    padding: 0 20px;
}

.info-section h2 {
    text-align: center;
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 40px;
}

/* --- Návod (Kroky) --- */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.step-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.step-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-size: 1.3em;
    font-weight: bold;
    margin: 0 auto 20px auto;
    box-shadow: 0 4px 10px rgba(58, 134, 255, 0.3);
}

.step-card h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.step-card p {
    color: #bbb;
    font-size: 0.95em;
    line-height: 1.5;
}

/* --- O aplikaci --- */
.about-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 12px;
    color: #bbb;
    line-height: 1.7;
    font-size: 1.05em;
}

.about-content strong {
    color: white;
}

.about-content ul {
    margin-top: 25px;
    padding-left: 0;
    list-style: none;
}

.about-content li {
    margin-bottom: 15px;
    background: #252525;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

/* --- DESIGN PRO SAMOSTATNOU STRÁNKU TESTU (test.html) --- */

/* Obal, který drží test uprostřed a dává mu šířku */
.test-wrapper {
    max-width: 800px; /* Ideální šířka na čtení otázek */
    margin: 40px auto; /* Vycentrování na střed */
    padding: 20px;
}

/* Horní lišta s časovačem a tlačítkem ukončit */
.test-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    
    /* Sticky efekt - aby byl časovač vidět i při scrollování */
    position: sticky;
    top: 10px;
    z-index: 100;
}

/* Styl pro časovač */
.timer-badge {
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: monospace; /* Aby čísla neposkakovala */
}

.timer-icon {
    font-size: 0.8em;
}

/* Navigace otázek (čísla) */
.navigation-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #1a1a1a; /* Tmavší pozadí pod čísly */
    border-radius: 12px;
}

/* Tlačítka Další/Předchozí */
.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.controls button {
    padding: 12px 25px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 1em;
    transition: 0.2s;
}

#prev-btn {
    background: #333;
    color: white;
}

#next-btn {
    background: var(--primary-color);
    color: white;
}

#prev-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Responzivita pro mobily */
@media (max-width: 600px) {
    .test-wrapper {
        margin: 0;
        padding: 10px;
        max-width: 100%;
    }
    
    .test-header-bar {
        position: sticky;
        top: 0;
        border-radius: 0 0 12px 12px; /* Zaoblení jen dole */
    }

    .timer-badge {
        font-size: 1.2em;
    }
}

/* --- STYLY PRO TLAČÍTKA V TESTU (test.html) --- */

/* 1. Tlačítko UKONČIT TEST (v horní liště) */
.finish-btn {
    background-color: #ef476f; /* Červená */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.finish-btn:hover {
    background-color: #d63d60; /* Tmavší červená při najetí */
    box-shadow: 0 0 10px rgba(239, 71, 111, 0.4);
}

/* 2. Tlačítko OPUSTIT TEST (Křížek po vyhodnocení) */
/* Toto tlačítko je defaultně skryté (.hidden) a ukáže se až nakonec */
.floating-exit-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #333;
    color: white;
    border: 2px solid #555;
    padding: 15px 25px;
    border-radius: 50px; /* Kulaté rohy */
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    z-index: 2000; /* Aby bylo nad vším */
    display: flex;
    align-items: center;
    gap: 10px;
}

.floating-exit-btn:hover {
    background-color: white;
    color: black;
    transform: translateY(-3px);
}