* {
    box-sizing: border-box;
}

body {
    background-color: rgb(71,71,71);
    color: white;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 24px;
    transition: background-color 0.2s ease;
}

h2 {
    text-align: center;
    font-size: 1rem;
    font-weight: normal;
    color: rgb(200, 200, 200);
    margin-top: -10px;
    margin-bottom: 10px;
}

.quiz-container {
    max-width: 720px;
    margin: 0 auto;
    background-color: rgb(45, 45, 45);
    border-radius: 12px;
    padding: 24px;
    transition: background-color 0.2s ease;
    overflow: hidden;
}

#quiz {
    position: relative;
}

.section-slide-out-left {
    animation: slideOutLeft 0.3s ease-in forwards;
}

.section-slide-in-right {
    animation: slideInRight 0.3s ease-out forwards;
}

@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

h1 {
    text-align: center;
    margin-top: 0;
    background: linear-gradient(
        90deg,
        #b8860b, #ffd700, #fff8a0, #ffd700, #b8860b
    );
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: gold-shimmer 3s ease-in-out infinite;
}

@keyframes gold-shimmer {
    0% { background-position: -100% 50%; }
    100% { background-position: 200% 50%; }
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 9000;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateX(0) rotateZ(0deg) rotateY(0deg);
        opacity: 1;
    }
    75% {
        opacity: 1;
    }
    100% {
        transform: translateX(var(--drift)) rotateZ(720deg) rotateY(360deg);
        top: 105%;
        opacity: 0;
    }
}

.intro {
    text-align: center;
    margin-bottom: 24px;
}

.home-screen {
    text-align: center;
    padding: 24px 0;
}

.home-warning {
    color: rgb(255, 193, 7);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.pseudo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.pseudo-overlay.hidden {
    display: none;
}

.pseudo-modal {
    background: rgb(45, 45, 45);
    border-radius: 14px;
    padding: 32px 28px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: modalPop 0.3s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.pseudo-modal h2 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #ffd700;
    font-size: 1.3rem;
}

.pseudo-modal p {
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: rgb(200, 200, 200);
}

.pseudo-modal input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgb(80, 80, 80);
    border-radius: 8px;
    background: rgb(58, 58, 58);
    color: white;
    font-size: 1rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.pseudo-modal input:focus {
    border-color: #4a90d9;
}

.pseudo-input-wrap {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.pseudo-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    background: rgb(50, 50, 50);
    border: 1px solid rgb(80, 80, 80);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.pseudo-suggestions.visible {
    display: block;
}

.pseudo-suggestions li {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    color: rgb(220, 220, 220);
    transition: background 0.15s;
}

.pseudo-suggestions li:hover,
.pseudo-suggestions li.active {
    background: rgb(70, 70, 70);
    color: white;
}

.pseudo-error {
    color: #ff4757;
    font-size: 0.85rem;
    min-height: 20px;
    margin-bottom: 8px;
}

.pseudo-confirm-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.pseudo-confirm-btn:hover {
    transform: scale(1.03);
}

.admin-link {
    display: inline-block;
    margin-top: 16px;
    font-size: 0.7rem;
    color: rgb(120, 120, 120);
    text-decoration: none;
    transition: color 0.2s;
}

.admin-link:hover {
    color: rgb(180, 180, 180);
}

.start-btn {
    font-size: 1.2rem;
    padding: 14px 32px;
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(74, 144, 217, 0.5);
}

.music-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: rgba(230, 80, 80, 0.92);
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: transform 0.15s ease, background 0.15s ease;
}

.music-toggle-btn:hover {
    transform: scale(1.1);
    background: rgba(240, 100, 100, 0.95);
}

.music-toggle-btn.paused {
    opacity: 0.7;
}

.quiz-screen .intro {
    margin-bottom: 16px;
}

.question {
    margin-bottom: 18px;
    padding: 14px;
    background-color: rgb(58, 58, 58);
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.question-title {
    margin: 0 0 10px;
    font-weight: bold;
}

label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.actions {
    display: flex;
    gap: 10px;
}

#progress {
    margin: 0 0 14px;
    text-align: center;
    color: rgb(210, 210, 210);
}

#feedback {
    min-height: 24px;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

#restartBtn {
    background-color: rgb(95, 95, 95);
    color: white;
}

#skipBtn {
    background-color: rgb(130, 112, 59);
    color: white;
}

#checkBtn {
    background: linear-gradient(135deg, #66cc80, #4fbf67);
    color: white;
    font-weight: bold;
}

#checkBtn:hover {
    background: linear-gradient(135deg, #77dd90, #5fcf77);
}

#checkBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#nextBtn {
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: white;
    font-weight: bold;
}

#nextBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#result {
    margin-top: 16px;
    font-weight: bold;
    text-align: center;
}

.final-image {
    display: block;
    max-width: 280px;
    width: 100%;
    margin: 16px auto 0;
    border-radius: 10px;
}

.score-form {
    margin-top: 20px;
    text-align: center;
}

.score-form-label {
    margin-bottom: 10px;
    font-weight: bold;
}

.score-form-row {
    display: flex;
    gap: 8px;
    max-width: 360px;
    margin: 0 auto;
}

.score-form-row input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid rgb(80, 80, 80);
    border-radius: 8px;
    background: rgb(58, 58, 58);
    color: white;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.score-form-row input:focus {
    border-color: #4a90d9;
}

.score-form-row button {
    width: auto;
    padding: 10px 20px;
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: white;
    font-weight: bold;
    border-radius: 8px;
    white-space: nowrap;
}

.score-form-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#scoreStatus,
.score-status {
    margin-top: 12px;
    font-size: 0.9rem;
    color: #ffd700;
    text-align: center;
}

.leaderboard {
    margin-top: 24px;
    text-align: center;
}

.leaderboard h3 {
    margin-bottom: 12px;
    color: #ffd700;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}

.leaderboard-list li {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: rgb(58, 58, 58);
    border-radius: 6px;
    font-size: 0.95rem;
}

.leaderboard-list li:nth-child(-n+3) {
    background: rgb(68, 62, 42);
}

.leaderboard-empty {
    color: rgb(160, 160, 160);
    font-size: 0.9rem;
}

.score-date {
    color: rgb(140, 140, 140);
    font-size: 0.8rem;
}

#focusOverlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: black;
    font-size: clamp(42px, 12vw, 140px);
    font-weight: 700;
    letter-spacing: 6px;
    z-index: 9999;
}

#focusOverlay span {
    background-image: linear-gradient(
        90deg,
        #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff00ff, #ff0000
    );
    background-size: 300% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    animation: rainbow-move 2s linear infinite;
}

@keyframes rainbow-move {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

#focusOverlay.active {
    display: flex;
}

.key-game-intro {
    margin-bottom: 14px;
    text-align: center;
    color: rgb(224, 224, 224);
}

.key-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 520px;
    margin: 0 auto;
}

.key-grid.key-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 360px;
}

.key-card {
    border: none;
    border-radius: 10px;
    padding: 8px;
    background-color: rgb(58, 58, 58);
    transition: box-shadow 0.16s ease, filter 0.16s ease;
    will-change: transform;
}

.key-card img {
    display: block;
    width: 100%;
    height: 88px;
    object-fit: cover;
    border-radius: 8px;
}

.key-card.highlight {
    background-color: rgb(45, 146, 78);
}

.key-card.highlight img {
    filter: hue-rotate(65deg) saturate(1.8) brightness(1.15);
}

.key-grid.is-shuffling .key-card {
    box-shadow: none;
    filter: none;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .quiz-container {
        padding: 14px;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .intro {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }

    .question {
        padding: 10px;
        margin-bottom: 12px;
    }

    .question-title {
        font-size: 0.9rem;
    }

    label {
        font-size: 0.9rem;
        padding: 8px 6px;
    }

    .actions {
        flex-direction: column;
        gap: 8px;
    }

    button {
        padding: 10px;
        font-size: 14px;
    }

    .start-btn {
        font-size: 1rem;
        padding: 12px 24px;
        width: 100%;
    }

    .key-grid.key-grid-4 {
        max-width: 260px;
        gap: 8px;
    }

    .key-card img {
        height: 65px;
    }

    .final-image {
        max-width: 200px;
    }

    #feedback {
        font-size: 0.85rem;
    }

    #result {
        font-size: 0.95rem;
    }

    .music-toggle-btn {
        bottom: 12px;
        right: 12px;
        width: 54px;
        height: 54px;
        font-size: 1.5rem;
    }

    .home-warning {
        font-size: 0.85rem;
    }

    .score-form-row {
        flex-direction: column;
    }

    .score-form-row button {
        width: 100%;
    }

    .leaderboard-list li {
        font-size: 0.85rem;
    }
}