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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a1a2e;
    font-family: 'Open Sans', sans-serif;
    color: #fff;
}

.hidden { display: none !important; }

/* --- Start screen --- */
.sendmessage {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 46, 0.97);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.sendmessage h1 { font-size: 32px; margin-bottom: 8px; }
.difficulty-buttons { display: flex; gap: 12px; }
.difficulty-buttons button {
    padding: 12px 28px;
    font-size: 16px;
    font-family: 'Open Sans', sans-serif;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.difficulty-buttons button:hover,
.difficulty-buttons button:active { background: rgba(255,255,255,0.2); }

/* --- Game area --- */
#game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 0;
    height: 100%;
}

#top-bar {
    display: flex;
    width: 100%;
    max-width: 400px;
    justify-content: space-between;
    padding: 0 8px 6px;
    font-size: 15px;
}
#difficulty-display { color: #4ade80; font-weight: bold; }
#timer-display { color: #e0e0e0; }
#score-display { color: #fbbf24; font-weight: bold; }

#mistake-display {
    font-size: 13px;
    color: #ef4444;
    margin-bottom: 6px;
}

/* --- Canvas --- */
#game-canvas {
    display: block;
    background: #16213e;
    border-radius: 6px;
    touch-action: manipulation;
}

/* --- Numpad --- */
#numpad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
    max-width: 400px;
    width: 100%;
    padding: 8px;
}
#numpad button {
    aspect-ratio: 1;
    font-size: 20px;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}
#numpad button:hover { background: rgba(255,255,255,0.18); }
#numpad button:active { transform: scale(0.92); }
#numpad button.completed {
    opacity: 0.3;
    pointer-events: none;
}

/* --- Action bar --- */
#action-bar {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}
#action-bar button {
    width: 48px; height: 48px;
    font-size: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
#action-bar button:active { background: rgba(255,255,255,0.25); }
#btn-notes.active {
    background: rgba(74,222,128,0.25);
    border-color: #4ade80;
}

/* --- Game over overlay --- */
#game-over-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 26, 46, 0.92);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    cursor: pointer;
}
.game-over-text {
    font-size: 32px;
    font-weight: bold;
    color: #4ade80;
    margin-bottom: 12px;
    text-shadow: 0 0 20px rgba(74,222,128,0.5);
}
.game-over-score {
    font-size: 20px;
    color: #fbbf24;
    margin-bottom: 20px;
}
.game-over-hint {
    font-size: 15px;
    color: #aaa;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@media (max-width: 420px) {
    #numpad button { font-size: 16px; }
    .difficulty-buttons button { padding: 10px 18px; font-size: 14px; }
}
