:root {
    --bg-color: #0a0a1a;
    --hud-bg: rgba(15, 15, 35, 0.85);
    --text-color: #f0f0f5;
    --accent-color: #7c4dff;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

body {
    margin: 0;
    padding: 0;
    background: linear-gradient(145deg, #0a0a1a 0%, #1a0a2e 40%, #0d1b2a 70%, #0a0a1a 100%);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    position: relative;
}

#hud {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--hud-bg);
    border-bottom: 1px solid rgba(124, 77, 255, 0.15);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    min-width: 60px;
}

.hud-item.center {
    align-items: center;
    flex: 1;
}

.hud-item.right {
    align-items: flex-end;
}

.label {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

#score-value {
    font-size: 20px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

#pressure-bar {
    width: 100px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    margin-bottom: 4px;
    overflow: hidden;
}

#pressure-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
    transition: width 0.3s ease;
}

#pressure-value {
    font-size: 12px;
    color: #aaa;
}

#game-container {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Construct from top */
    background: rgba(5, 5, 15, 0.9);
    overflow: hidden;
}

canvas {
    display: block;
}

#next-canvas {
    background: transparent;
}

/* Overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-content {
    text-align: center;
}

h1 {
    font-size: 32px;
    margin: 0 0 10px 0;
    letter-spacing: 2px;
}

p {
    color: #ccc;
    font-size: 14px;
}

button {
    margin-top: 20px;
    padding: 12px 24px;
    background: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: #000;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
}

/* Romantic Overlay */
#love-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 0, 10, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 25;
    backdrop-filter: blur(2px);
    pointer-events: none;
    transition: opacity 0.5s;
}

.love-content {
    text-align: center;
    animation: float 2s ease-in-out infinite;
}

#love-message {
    font-size: 24px;
    font-weight: bold;
    color: #ff69b4;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.8);
    margin: 20px 0;
    padding: 0 20px;
    line-height: 1.4;
}

.hearts,
.kisses {
    font-size: 30px;
    animation: pulse 1s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

button:active {
    transform: scale(0.95);
}

/* Password Screen */
#password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #0a0a1a 0%, #1a0a2e 40%, #0d1b2a 70%, #0a0a1a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#password-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.password-container {
    text-align: center;
    padding: 40px 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(124, 77, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    width: 90%;
    max-width: 360px;
}

.lock-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.password-title {
    font-size: 28px;
    margin: 0 0 6px 0;
    background: linear-gradient(135deg, #ff69b4, #7c4dff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.password-subtitle {
    color: #999;
    font-size: 14px;
    margin: 0 0 24px 0;
}

#password-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 1px solid rgba(124, 77, 255, 0.3);
    border-radius: 12px;
    background: rgba(10, 10, 30, 0.6);
    color: #f0f0f5;
    outline: none;
    text-align: center;
    transition: border-color 0.3s;
    font-family: var(--font-family);
}

#password-input:focus {
    border-color: #7c4dff;
    box-shadow: 0 0 15px rgba(124, 77, 255, 0.2);
}

#password-btn {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    font-size: 16px;
    background: linear-gradient(135deg, #7c4dff, #ff69b4);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.15s, box-shadow 0.3s;
}

#password-btn:hover {
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.4);
}

#password-btn:active {
    transform: scale(0.97);
}

.password-error {
    color: #ff69b4;
    font-size: 13px;
    margin: 12px 0 0 0;
    min-height: 20px;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

.shake {
    animation: shake 0.5s ease;
}