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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
}

header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#back-btn {
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 12px;
    transition: background 0.2s;
}

#back-btn:hover {
    background: rgba(255,255,255,0.35);
}

#score {
    font-size: 1.8rem;
}

#clock-area {
    background: white;
    border-radius: 50%;
    padding: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

#clock-canvas {
    display: block;
    width: 260px;
    height: 260px;
}

#prompt {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    text-align: center;
    transition: opacity 0.3s;
}

/* Answer buttons */

#buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
}

.answer-btn {
    font-size: 2.2rem;
    font-weight: 700;
    padding: 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    color: white;
    min-height: 80px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.4s;
    -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.answer-btn:active {
    transform: scale(0.97);
}

.answer-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-color-0 { background: #e17055; }
.btn-color-1 { background: #00b894; }
.btn-color-2 { background: #6c5ce7; }
.btn-color-3 { background: #fdcb6e; color: #333; }

/* Wrong answer: gentle fade instead of shake */

.wrong-fade {
    opacity: 0.4;
    transition: opacity 0.4s;
}

/* Hint glow for correct answer after 2 wrong */

@keyframes hint-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
    50% { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
}

.hint-glow {
    animation: hint-pulse 1s ease-in-out infinite;
}

/* Correct answer reveal after frustration intervention */

.correct-reveal {
    box-shadow: 0 0 0 6px rgba(255,255,255,0.8), 0 6px 20px rgba(0,0,0,0.2);
    transform: scale(1.08);
}

/* Celebration overlay */

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: rgba(0,0,0,0.3);
}

#overlay.hidden {
    display: none;
}

#overlay-content {
    background: white;
    border-radius: 30px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
    animation: bounce-in 0.4s ease-out;
    z-index: 101;
}

#overlay-message {
    font-size: 2.5rem;
    font-weight: 700;
    color: #6c5ce7;
}

@keyframes bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

/* Confetti */

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

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    border-radius: 3px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Session break overlay */

#break-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    background: rgba(0,0,0,0.4);
}

#break-overlay.hidden {
    display: none;
}

#break-content {
    background: white;
    border-radius: 30px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
    animation: bounce-in 0.4s ease-out;
    max-width: 350px;
}

.break-character {
    font-size: 4rem;
    margin-bottom: 10px;
}

.break-message {
    font-size: 1.5rem;
    font-weight: 600;
    color: #6c5ce7;
    margin-bottom: 20px;
    line-height: 1.4;
}

#break-dismiss {
    font-size: 1.3rem;
    padding: 12px 30px;
    min-height: auto;
}

/* Responsive */

@media (max-width: 400px) {
    #clock-canvas {
        width: 200px;
        height: 200px;
    }
    #clock-area {
        padding: 15px;
    }
    .answer-btn {
        font-size: 1.8rem;
        padding: 16px;
        min-height: 70px;
    }
    #prompt {
        font-size: 1.5rem;
    }
}
