* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
#game-container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
}

/* --- Header --- */

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);
}

#star-area {
    font-size: 1.8rem;
}

/* --- Title --- */

#title {
    color: white;
    font-size: 1.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    text-align: center;
}

/* --- Clocks row --- */

#clocks-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: nowrap;
}

.clock-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.clock-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.operator {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    user-select: none;
    flex-shrink: 0;
}

/* --- Clock canvases --- */

#clock1-canvas,
#clock2-canvas {
    display: block;
    width: 200px;
    height: 200px;
}

#alarm-canvas {
    display: block;
    width: 230px;
    height: 230px;
    cursor: grab;
}
#alarm-canvas:active {
    cursor: grabbing;
}

/* --- Clock labels --- */

.clock-label {
    color: white;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 4px 10px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 180px;
}

/* --- Alarm clock wrapper --- */

#alarm-clock-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Alarm bells --- */

#alarm-bells {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: -6px;
    z-index: 2;
}

.bell {
    width: 36px;
    height: 22px;
    border-radius: 50% 50% 0 0;
    background: #c0c0c0;
    border: 2px solid #a0a0a0;
    border-bottom: none;
}

.bell-left {
    transform: rotate(-15deg);
}

.bell-right {
    transform: rotate(15deg);
}

.bell-hammer {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #a0a0a0;
    border: 2px solid #909090;
    margin-bottom: 4px;
    flex-shrink: 0;
}

/* --- Alarm feet --- */

#alarm-feet {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: -6px;
    z-index: 2;
}

.foot {
    width: 14px;
    height: 18px;
    background: #607d8b;
    border-radius: 0 0 4px 4px;
}

.foot-left {
    transform: rotate(-10deg);
}

.foot-right {
    transform: rotate(10deg);
}

/* --- Alarm ringing animation --- */

@keyframes alarm-ring-anim {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-8deg); }
    20% { transform: rotate(8deg); }
    30% { transform: rotate(-6deg); }
    40% { transform: rotate(6deg); }
    50% { transform: rotate(-4deg); }
    60% { transform: rotate(4deg); }
    70% { transform: rotate(-2deg); }
    80% { transform: rotate(2deg); }
}
.alarm-ringing {
    animation: alarm-ring-anim 0.3s ease-in-out infinite;
}

/* --- Evaluating pulse animation --- */

@keyframes evaluate-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3) drop-shadow(0 0 15px rgba(255,215,0,0.6)); }
}
.evaluating {
    animation: evaluate-pulse 0.5s ease-in-out 2;
}

/* --- Tutorial clock pulse --- */

@keyframes knob-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.tutorial-active #alarm-canvas {
    animation: knob-pulse 1s ease-in-out infinite;
}

/* --- Animal area --- */

#animal-area {
    position: relative;
    text-align: center;
    min-height: 100px;
}

#animal {
    font-size: 4rem;
    transition: transform 0.3s;
}
.animal-sleeping {
    animation: breathing 2s ease-in-out infinite;
}
.animal-awake {
    animation: bounce-up 0.5s ease-out;
}
@keyframes breathing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes bounce-up {
    0% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0); }
}

/* --- Zzz --- */

#zzz-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.zzz {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    opacity: 0;
    animation: zzz-float 2s ease-out forwards;
}
@keyframes zzz-float {
    0% { opacity: 1; transform: translateY(0) scale(0.5); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

/* --- Prompt --- */

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

/* --- Shared overlay classes --- */

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.overlay-card {
    background: white;
    border-radius: 30px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.25);
}

/* --- Celebration overlay --- */

#overlay {
    z-index: 100;
    background: rgba(0,0,0,0.3);
}

#overlay-content {
    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 {
    z-index: 200;
    background: rgba(0,0,0,0.4);
}

#break-content {
    max-width: 350px;
}

/* --- Responsive --- */

@media (max-width: 600px) {
    #clocks-row {
        gap: 6px;
    }
    #clock1-canvas,
    #clock2-canvas {
        width: 150px;
        height: 150px;
    }
    #alarm-canvas {
        width: 170px;
        height: 170px;
    }
    .operator {
        font-size: 1.8rem;
    }
    .clock-label {
        font-size: 0.75rem;
        max-width: 130px;
    }
    #title {
        font-size: 1.2rem;
    }
    #prompt {
        font-size: 1.1rem;
    }
    .bell {
        width: 28px;
        height: 18px;
    }
    .bell-hammer {
        width: 10px;
        height: 10px;
    }
    #alarm-feet {
        gap: 40px;
    }
}

@media (max-width: 400px) {
    #clock1-canvas,
    #clock2-canvas {
        width: 120px;
        height: 120px;
    }
    #alarm-canvas {
        width: 150px;
        height: 150px;
    }
    .operator {
        font-size: 1.5rem;
    }
    .clock-label {
        font-size: 0.7rem;
        max-width: 110px;
    }
}
