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

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#score-display {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 72px;
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.8),
        3px 3px 0 #333,
        -1px -1px 0 #333,
        1px -1px 0 #333,
        -1px 1px 0 #333;
    z-index: 10;
    pointer-events: none;
    transition: transform 0.1s;
}

#score-display.pop {
    transform: translateX(-50%) scale(1.3);
}

#best-score-display {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
}

#hand-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 10;
    pointer-events: none;
}

#hand-status {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

#flap-bar-container {
    width: 200px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

#flap-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b, #ff5722);
    border-radius: 4px;
    transition: width 0.05s;
}

#camera-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 200px;
    height: 150px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

#webcam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#cameraCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

#start-screen, #game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 20;
    backdrop-filter: blur(6px);
}

#start-screen h1, #game-over-screen h2 {
    font-size: 64px;
    color: #fff;
    text-shadow:
        0 0 20px rgba(255, 200, 0, 0.8),
        0 0 40px rgba(255, 150, 0, 0.4);
    margin-bottom: 20px;
}

#start-screen p, #game-over-screen p {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
}

#start-screen .hint {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 40px;
}

#game-over-screen p {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
}

button {
    padding: 16px 48px;
    font-size: 24px;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #ff6b35, #f7c948);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}

button:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6);
}

button:active {
    transform: scale(0.96);
}

.hidden {
    display: none !important;
}

#speed-control {
    position: absolute;
    top: 10px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.35);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

#speed-control label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

#speed-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #f7c948, #ff6b35);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

#speed-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #f7c948, #ff6b35);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

#speedValue {
    font-size: 14px;
    font-weight: 700;
    color: #f7c948;
    min-width: 36px;
    text-align: center;
}
