* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

.container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 6px 12px;
    border-radius: 8px;
    color: white;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.header h1 {
    font-size: 16px;
    text-align: center;
    margin-bottom: 4px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: bold;
}

.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.game-area canvas {
    display: block;
}

/* 覆盖层 */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 10;
    color: white;
}

.overlay.hidden {
    display: none;
}

.overlay h2 {
    font-size: 28px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.overlay p {
    font-size: 16px;
    opacity: 0.9;
}

.ranking-result {
    font-size: 15px;
    color: #ffd700;
    font-weight: bold;
}

.difficulty-btns {
    display: flex;
    gap: 10px;
}

.diff-btn {
    padding: 8px 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-btn.active {
    background: rgba(255,255,255,0.25);
    border-color: white;
}

.main-btn {
    padding: 12px 36px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: transform 0.1s;
}

.main-btn:active {
    transform: scale(0.95);
}

.secondary-btn {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.4);
    font-size: 15px;
    padding: 10px 30px;
}

.bottom-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 4px 0;
}

.game-btn {
    padding: 10px 40px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}

.game-btn:active {
    transform: scale(0.95);
}

button {
    touch-action: manipulation;
}

@supports (padding: env(safe-area-inset-bottom)) {
    .container {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        padding-top: calc(8px + env(safe-area-inset-top));
    }
}
