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

body {
    background: #1a1a2e;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Arial', 'PingFang SC', sans-serif;
    overflow: hidden;
    touch-action: manipulation;
}

.game-wrapper {
    width: 100%;
    max-width: 500px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.game-title {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    flex-shrink: 0;
}

.header-scores {
    display: flex;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.header-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.header-score-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

.header-score-value {
    font-size: 18px;
    font-weight: 700;
    color: #00ff88;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

#game-canvas {
    background: #0a0a1a;
    border-radius: 12px;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: -10px;
    margin-bottom: 30px;
}

.control-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.control-btn {
    width: 55px;
    height: 55px;
    background: linear-gradient(145deg, #2a1a3a, #0a0a2a);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-btn:active {
    transform: scale(0.92);
    background: linear-gradient(145deg, #2a2a4a, #1a1a3a);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-placeholder {
    width: 55px;
    height: 55px;
}

.arrow-up,
.arrow-down,
.arrow-left,
.arrow-right {
    display: block;
    width: 0;
    height: 0;
}

.arrow-up {
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 12px solid #00ff88;
}

.arrow-down {
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 12px solid #00ff88;
}

.arrow-left {
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-right: 12px solid #00ff88;
}

.arrow-right {
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 12px solid #00ff88;
}

.game-over-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 26, 0.95);
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-over-title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.final-score-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

.final-score-value {
    font-size: 36px;
    font-weight: 700;
    color: #00ff88;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.back-to-start-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 14px 35px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.2s ease;
}

.back-to-start-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.retry-btn {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    border: none;
    color: #0a0a1a;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 5px 25px rgba(0, 255, 136, 0.4);
    transition: all 0.2s ease;
}

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