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

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

#page-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 900px;
    padding: 20px;
}

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

header {
    width: 100%;
    display: flex;
    justify-content: flex-start;
}

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

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

#status {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    min-height: 2.2em;
    text-align: center;
}

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

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

/* Clock shake during ringing */
@keyframes clock-ring-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(3deg); }
    75% { transform: rotate(-3deg); }
}

.ringing {
    animation: clock-ring-shake 0.15s ease-in-out;
}

/* Number buttons */
#buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}

.hour-btn {
    font-size: 1.8rem;
    font-weight: 700;
    padding: 14px 0;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    color: white;
    min-height: 65px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.hour-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.hour-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.hour-btn.selected {
    transform: scale(1.12);
    box-shadow: 0 0 0 4px white, 0 6px 20px rgba(0,0,0,0.25);
}

.btn-color-0 { background: #e17055; }
.btn-color-1 { background: #00b894; }
.btn-color-2 { background: #6c5ce7; }
.btn-color-3 { background: #0984e3; }
.btn-color-4 { background: #e84393; }
.btn-color-5 { background: #00cec9; }
.btn-color-6 { background: #fd79a8; }
.btn-color-7 { background: #636e72; }
.btn-color-8 { background: #d63031; }
.btn-color-9 { background: #a29bfe; }
.btn-color-10 { background: #ffeaa7; color: #333; }
.btn-color-11 { background: #55efc4; color: #333; }

/* === Characters panel (right side) === */

#characters {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    min-width: 180px;
    transition: opacity 0.3s;
}

#characters.hidden {
    opacity: 0;
    pointer-events: none;
}

#characters.visible {
    opacity: 1;
}

/* --- Unicorn --- */

#unicorn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#unicorn-body {
    font-size: 5rem;
    transform-origin: bottom center;
}

#unicorn-bell {
    font-size: 3rem;
    position: absolute;
    top: -10px;
    right: -30px;
    opacity: 0;
    transform-origin: top center;
}

#unicorn-laugh {
    font-size: 2rem;
    opacity: 0;
    margin-top: -5px;
}

/* Unicorn ringing animations */
@keyframes unicorn-rock {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

@keyframes bell-swing {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(25deg); }
    40% { transform: rotate(-25deg); }
    60% { transform: rotate(15deg); }
    80% { transform: rotate(-15deg); }
}

@keyframes laugh-pop {
    0% { transform: scale(0); opacity: 0; }
    30% { transform: scale(1.3); opacity: 1; }
    50% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.unicorn-ringing #unicorn-body {
    animation: unicorn-rock 0.5s ease-in-out infinite;
}

.unicorn-ringing #unicorn-bell {
    opacity: 1;
    animation: bell-swing 0.4s ease-in-out infinite;
}

.unicorn-laughing #unicorn-laugh {
    opacity: 1;
    animation: laugh-pop 0.6s ease-out forwards;
}

/* --- Penguins --- */

#penguins {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.penguin {
    font-size: 3.5rem;
    transform-origin: bottom center;
}

.penguin-laughs {
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
}

.ha {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    opacity: 0;
}

/* Penguin ringing animations */
@keyframes penguin-bounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(-5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-10px) rotate(5deg); }
}

@keyframes penguin-bounce-alt {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-18px) rotate(-5deg); }
}

@keyframes ha-float {
    0% { opacity: 0; transform: translateY(0) scale(0.5); }
    20% { opacity: 1; transform: translateY(-8px) scale(1.1); }
    80% { opacity: 1; transform: translateY(-8px) scale(1); }
    100% { opacity: 0; transform: translateY(-20px) scale(0.8); }
}

.penguins-laughing .p1 {
    animation: penguin-bounce 0.6s ease-in-out infinite;
}

.penguins-laughing .p2 {
    animation: penguin-bounce-alt 0.6s ease-in-out infinite 0.15s;
}

.penguins-laughing .p3 {
    animation: penguin-bounce 0.6s ease-in-out infinite 0.3s;
}

.penguins-laughing .ha1 {
    animation: ha-float 1s ease-out infinite;
}

.penguins-laughing .ha2 {
    animation: ha-float 1s ease-out infinite 0.3s;
}

.penguins-laughing .ha3 {
    animation: ha-float 1s ease-out infinite 0.6s;
}

/* 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);
    max-width: 350px;
}

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

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

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

/* Responsive */

@media (max-width: 700px) {
    #page-layout {
        flex-direction: column;
        gap: 20px;
    }
    #characters {
        flex-direction: row;
        gap: 40px;
    }
}

@media (max-width: 400px) {
    #clock-canvas {
        width: 190px;
        height: 190px;
    }
    #clock-area {
        padding: 15px;
    }
    .hour-btn {
        font-size: 1.5rem;
        padding: 10px 0;
        min-height: 55px;
    }
    #status {
        font-size: 1.4rem;
    }
    #buttons {
        gap: 8px;
    }
    #unicorn-body {
        font-size: 3.5rem;
    }
    .penguin {
        font-size: 2.5rem;
    }
}
