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

/* Wrapper hry – herní plocha v normálním toku dokumentu pod menu */
.iq-wrapper {
    position: relative;
    margin-top: 56px; /* výška Bootstrap fixed-top navbar */
    min-height: calc(100vh - 56px);
    width: 100%;
    background-color: #000000;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    font-family: 'Arial', sans-serif;
}

/* Herní oblast */
.game-area {
    flex: 1;
    position: relative;
    overflow: hidden; /* overlay nepřetéká ven z herního pole */
    min-height: 300px;
}

/* Kritická linie */
.critical-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #cc0000;
    z-index: 1000;
}

/* Header – nad vodou (1001), pod Bootstrap navbarem (1030) */
.game-header {
    position: relative;
    z-index: 1020;
    padding: 50px 20px 15px 20px;
    text-align: center;
    background: transparent;
}

.game-title {
    font-size: 2.6rem;
    font-weight: bold;
    letter-spacing: 8px;
    margin-bottom: 15px;
    margin-top: 2rem;
    color: #ffffff;
    opacity: 0;
    animation: titleReveal 2s ease forwards;
}

@keyframes titleReveal {
    0%   { opacity: 0; transform: translateY(-20px) scale(0.85); letter-spacing: 2px; }
    60%  { opacity: 1; transform: translateY(4px) scale(1.04); letter-spacing: 10px; }
    100% { opacity: 1; transform: translateY(0) scale(1); letter-spacing: 8px; }
}

.stats {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 15px;
}

/* Přihlašovací formulář na úvodní obrazovce */
.iq-login-form {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
}

.iq-login-title {
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 3px;
    color: #aaaaaa;
    margin-bottom: 16px;
}

.iq-login-body {
    background: rgba(0, 97, 255, 0.15);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #cccccc;
}

.iq-input-wrap {
    margin: 10px 0 0;
}

.iq-input-wrap input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(138, 43, 226, 0.4);
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    font-size: 1rem;
    outline: none;
}

.iq-input-wrap input::placeholder {
    color: #888;
}

.iq-sex-btn {
    background: #4CAF50;
    border: none;
    color: white;
    padding: 4px 12px;
    font-size: 1.2rem;
    border-radius: 6px;
    margin: 8px 4px 0;
    cursor: pointer;
}

.iq-sex-btn:hover {
    background: #3d9140;
}

.iq-login-footer {
    margin-top: 4px;
    margin-bottom: 12px;
}

.iq-random-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaaaaa;
    font-size: 0.8rem;
}

.iq-bottom-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.iq-link-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(138, 43, 226, 0.35);
    border-radius: 8px;
    color: #cccccc;
    font-size: 0.82rem;
    padding: 5px 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    display: inline-block;
}

.iq-link-btn:hover {
    background: rgba(138, 43, 226, 0.25);
    color: #ffffff;
    text-decoration: none;
}

/* Nápověda – modální popup nad vším */
.iq-help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.iq-help-modal.open {
    display: flex;
}

.iq-help-inner {
    background: linear-gradient(135deg, rgba(18, 5, 40, 0.98) 0%, rgba(35, 15, 65, 0.98) 100%);
    border: 1px solid rgba(138, 43, 226, 0.5);
    border-radius: 16px;
    padding: 28px 28px 22px;
    max-width: 400px;
    width: 90%;
    color: #cccccc;
    font-size: 0.9rem;
    line-height: 1.65;
    text-align: left;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8), 0 0 30px rgba(138, 43, 226, 0.2);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.iq-help-inner h3 {
    font-size: 1.05rem;
    color: #ffffff;
    margin-bottom: 14px;
    letter-spacing: 1px;
    padding-right: 24px;
}

.iq-help-inner p {
    margin-bottom: 10px;
}

.iq-help-inner strong {
    color: #FFD700;
}

.iq-help-close-x {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}

.iq-help-close-x:hover {
    color: #ffffff;
}

.iq-help-close {
    display: block;
    margin: 14px auto 0;
    background: rgba(138, 43, 226, 0.3);
    border: 1px solid rgba(138, 43, 226, 0.5);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.85rem;
    padding: 7px 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.iq-help-close:hover {
    background: rgba(138, 43, 226, 0.55);
}

#startButtonWrap {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
}

.stat-time {
    font-size: 3rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.9),
        0 0px 12px rgba(0,0,0,0.7);
    min-width: 80px;
    text-align: center;
    position: relative;
    z-index: 1020;
}

.stat-correct {
    font-size: 1.8rem;
    font-weight: bold;
    color: #00ff00;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.9),
        0 0px 12px rgba(0,0,0,0.7);
    min-width: 40px;
    text-align: center;
    position: relative;
    z-index: 1020;
}

.stat-incorrect {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff4444;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.9),
        0 0px 12px rgba(0,0,0,0.7);
    min-width: 40px;
    text-align: center;
    position: relative;
    z-index: 1020;
}

/* Úvodní obrazovka */
.start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.start-screen.visible {
    opacity: 1;
}

/* Kvízový kontejner */
.quiz-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin: 5px auto;
    z-index: 1002;
    background: linear-gradient(135deg, rgba(26, 10, 46, 0.85) 0%, rgba(45, 27, 78, 0.85) 50%, rgba(26, 10, 46, 0.85) 100%);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 20px;
    padding: 35px;
    transition: opacity 0.8s ease;
    backdrop-filter: blur(10px);
}

.quiz-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 20px 20px 0 0;
}

.question-box {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(17, 1, 19, 0.9);
    border-radius: 12px;
    border: 1px solid rgba(138, 43, 226, 0.2);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-text {
    font-size: 1.4rem;
    line-height: 1.6;
    text-align: center;
    color: #ffffff;
    margin-bottom: 0;
}

.question-text strong,
.answer-button strong {
    color: #FFD700;
    font-weight: 800;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.answer-button {
    background: linear-gradient(135deg, #0f0721 0%, #1a0f2e 100%);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 1.1rem;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.answer-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    border-radius: 12px 12px 0 0;
}

.answer-button:hover {
    background: linear-gradient(135deg, #1a0f2e 0%, #2d1b4e 100%);
    border-color: rgba(138, 43, 226, 0.6);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(138, 43, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scaleX(1.025);
    color: #ffffff;
}

.answer-button:active {
    transform: scaleX(1.01);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.answer-button.correct {
    background: linear-gradient(135deg, #00aa00 0%, #00ff00 100%);
    border-color: #00ff00;
    color: #ffffff;
}

.answer-button.incorrect {
    background: linear-gradient(135deg, #aa0000 0%, #ff0000 100%);
    border-color: #ff0000;
    animation: incorrect-shake 0.5s ease;
}

.answer-button:disabled {
    cursor: default;
}

@keyframes incorrect-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.start-button {
    background: linear-gradient(135deg, #6B46C1 0%, #8B5CF6 100%);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 20px 40px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow:
        0 6px 20px rgba(107, 70, 193, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: 100%;
}

.start-button:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
    box-shadow:
        0 10px 30px rgba(107, 70, 193, 0.6),
        0 0 20px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-3px) scale(1.03);
}

.start-button:active {
    transform: translateY(-1px) scale(1.01);
    box-shadow:
        0 4px 15px rgba(107, 70, 193, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Game Over overlay – pouze přes herní pole, ne přes reklamy; pod Bootstrap navbarem */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1025;
    display: none;
    justify-content: center;
    align-items: center;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    text-align: center;
    animation: fade-in 1s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.game-over-title {
    font-size: 3rem;
    color: #ff4444;
    margin-bottom: 40px;
    letter-spacing: 8px;
    font-weight: bold;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 800px;
}

.result-block {
    background: linear-gradient(135deg, rgba(26, 10, 46, 0.9) 0%, rgba(45, 27, 78, 0.9) 100%);
    border: 1px solid rgba(138, 43, 226, 0.4);
    border-radius: 15px;
    padding: 25px 20px;
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(138, 43, 226, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
}

.result-label {
    font-size: 0.85rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffffff;
}

#finalCorrect {
    color: #00ff00;
}

#finalIncorrect {
    color: #ff4444;
}

#finalTime {
    color: #00d4ff;
}

#finalRound {
    color: #FFD700;
}

.restart-button {
    background: linear-gradient(135deg, #6B46C1 0%, #8B5CF6 100%);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 12px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow:
        0 6px 20px rgba(107, 70, 193, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.restart-button:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
    box-shadow:
        0 10px 30px rgba(107, 70, 193, 0.6),
        0 0 20px rgba(139, 92, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-3px) scale(1.05);
}

/* Round overlay – pouze přes herní pole, ne přes reklamy; pod Bootstrap navbarem */
.round-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80%;
    background: rgba(0, 0, 0, 0.97);
    z-index: 1025;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: round-fade-in 0.5s ease;
}

.round-overlay.show {
    display: flex;
}

@keyframes round-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.round-number {
    font-size: 4rem;
    font-weight: bold;
    letter-spacing: 8px;
    color: #ffffff;
    text-shadow:
        0 0 20px rgba(138, 43, 226, 0.8),
        0 0 40px rgba(138, 43, 226, 0.4);
    margin-bottom: 20px;
    animation: round-pulse 1.5s ease-in-out infinite;
}

@keyframes round-pulse {
    0%, 100% { text-shadow: 0 0 20px rgba(138, 43, 226, 0.8), 0 0 40px rgba(138, 43, 226, 0.4); }
    50% { text-shadow: 0 0 30px rgba(138, 43, 226, 1), 0 0 60px rgba(138, 43, 226, 0.7); }
}

.round-category {
    font-size: 1.1rem;
    color: #aaaaaa;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Vodní hladina – absolutně v rámci .iq-wrapper (stoupá jen v herním poli) */
.water-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    z-index: 1001;
    transition: height 1s ease-out;
    background: #006EBC;
    overflow: visible;
}

.water-container.paused {
    transition: none;
}

.water-wave {
    position: absolute;
    top: -35px;
    left: 0;
    width: 100%;
    height: 50px;
    pointer-events: none;
    z-index: 2;
    animation: wave-float 4s ease-in-out infinite;
}

@keyframes wave-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.wave-path {
    fill: #006EBC;
}

/* Responzivita pro mobily */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
        letter-spacing: 5px;
    }

    .stats {
        gap: 20px;
    }

    .stat-time {
        font-size: 2.5rem;
    }

    .stat-correct,
    .stat-incorrect {
        font-size: 1.5rem;
    }

    .quiz-container {
        padding: 20px;
        width: 95%;
    }

    .question-text {
        font-size: 1.25rem;
    }

    .answer-button {
        font-size: 1.1rem;
        padding: 15px;
    }

    .start-button {
        font-size: 1.1rem;
        padding: 18px 30px;
    }

    .game-over-title {
        font-size: 2.2rem;
        letter-spacing: 5px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .result-block {
        padding: 20px 15px;
    }

    .result-value {
        font-size: 2rem;
    }
}

/* Horizontálně pod 770px – zmenšení game-header (časomíra) */
@media (max-width: 769px) {
    .game-header {
        padding: 15px 20px 8px 20px;
    }

    .stats {
        margin-top: 6px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.7rem;
        letter-spacing: 4px;
    }

    .stats {
        gap: 15px;
    }

    .stat-time {
        font-size: 2rem;
    }

    .stat-correct,
    .stat-incorrect {
        font-size: 1.3rem;
    }

    .quiz-container {
        padding: 15px;
    }

    .question-text {
        font-size: 1.15rem;
    }

    .answer-button {
        font-size: 1.05rem;
        padding: 14px;
    }

    .game-over-title {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }

    .result-label {
        font-size: 0.75rem;
    }

    .result-value {
        font-size: 1.8rem;
    }
}

/* Malá vertikální výška – notebooky, zmenšení kvízu aby se vešel */
@media (max-height: 750px) and (min-width: 769px) {
    .game-header {
        padding: 30px 20px 8px 20px;
    }

    .game-title {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .stats {
        margin-top: 8px;
    }

    .stat-time {
        font-size: 2.2rem;
    }

    .stat-correct,
    .stat-incorrect {
        font-size: 1.4rem;
    }

    .quiz-container {
        padding: 20px 24px;
        margin: 12px auto;
    }

    .question-box {
        margin-bottom: 14px;
        padding: 14px;
    }

    .question-text {
        font-size: 1.2rem;
        min-height: 40px;
    }

    .answers-grid {
        gap: 10px;
    }

    .answer-button {
        padding: 13px 20px;
        font-size: 1rem;
    }
}
