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

        body {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            min-height: 100svh;
            padding: 12px 12px calc(78px + env(safe-area-inset-bottom, 0));
            background: linear-gradient(135deg, #ffb3d9 0%, #ff99cc 50%, #ffccee 100%);
            font-family: 'Comic Sans MS', 'Arial', sans-serif;
            position: relative;
            overflow-x: hidden;
        }

        body::before {
            content: '🎀';
            position: absolute;
            font-size: 80px;
            opacity: 0.2;
            top: 10%;
            left: 10%;
            animation: float 6s ease-in-out infinite;
            pointer-events: none;
        }

        body::after {
            content: '🎀';
            position: absolute;
            font-size: 60px;
            opacity: 0.2;
            bottom: 15%;
            right: 15%;
            animation: float 8s ease-in-out infinite;
            pointer-events: none;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-20px); }
        }

        .hearts {
            position: absolute;
            font-size: 40px;
            opacity: 0.15;
            pointer-events: none;
        }

        .heart1 { top: 20%; right: 20%; animation: pulse 3s infinite; }
        .heart2 { bottom: 25%; left: 15%; animation: pulse 4s infinite; }
        .heart3 { top: 60%; right: 10%; animation: pulse 3.5s infinite; }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.2); }
        }

        /* ===== PC布局 ===== */
        .container {
            text-align: center;
            background: white;
            padding: 20px 20px 15px;
            border-radius: 30px;
            box-shadow: 0 15px 50px rgba(255, 105, 180, 0.4);
            border: 5px solid #ff69b4;
            position: relative;
            z-index: 1;
            width: 95%;
            max-width: 520px;
            margin: 10px auto;
        }

        h1 {
            color: #ff1493;
            margin-bottom: 12px;
            font-size: 22px;
            text-shadow: 2px 2px 4px rgba(255, 105, 180, 0.3);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .kitty-face {
            font-size: 30px;
            animation: bounce 2s infinite;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        .score-board {
            display: flex;
            justify-content: space-around;
            margin-bottom: 12px;
            gap: 8px;
        }

        .score-item {
            padding: 6px 12px;
            background: linear-gradient(135deg, #ffccee 0%, #ffb3d9 100%);
            border-radius: 20px;
            border: 3px solid #ff69b4;
            font-size: 14px;
            color: #ff1493;
            font-weight: bold;
            box-shadow: 0 4px 10px rgba(255, 105, 180, 0.2);
            flex: 1;
        }

        canvas {
            border: 5px solid #ff69b4;
            border-radius: 20px;
            background: #fff0f5;
            display: block;
            margin: 0 auto;
            box-shadow: 0 8px 20px rgba(255, 105, 180, 0.3);
            max-width: min(100%, calc(100vw - 48px));
            height: auto;
            aspect-ratio: 1 / 1;
            touch-action: none;
        }

        .game-status {
            margin-top: 8px;
            font-size: 13px;
            color: #ff1493;
            font-weight: bold;
            min-height: 20px;
        }

        .btn {
            padding: 7px 14px;
            font-size: 13px;
            background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-weight: bold;
            box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
            transition: all 0.3s;
            margin: 4px;
            touch-action: manipulation;
        }

        .btn:hover { transform: translateY(-2px); }
        .btn:active { transform: translateY(0); }
        .btn-secondary {
            background: linear-gradient(135deg, #ffb3d9 0%, #ff99cc 100%);
        }

        /* ===== 速度控制条 ===== */
        .speed-control {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 8px 0 4px;
            font-size: 13px;
            color: #ff1493;
            font-weight: bold;
        }

        .speed-control input[type="range"] {
            -webkit-appearance: none;
            width: 120px;
            height: 6px;
            border-radius: 3px;
            background: linear-gradient(to right, #ff69b4, #ff1493);
            outline: none;
            cursor: pointer;
        }

        .speed-control input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #ff1493;
            border: 2px solid white;
            box-shadow: 0 2px 6px rgba(255,20,147,0.4);
            cursor: pointer;
        }

        .speed-label {
            min-width: 30px;
            text-align: left;
            font-size: 12px;
        }

        /* ===== PC专用：键盘提示 ===== */
        .controls-text {
            margin-top: 8px;
            color: #ff1493;
            font-size: 12px;
            display: none;
        }

        /* ===== 手机专用：虚拟方向键 ===== */
        .mobile-controls-area {
            display: none; /* 默认隐藏，手机才显示 */
            margin: 12px auto 0;
            position: relative;
            width: 160px;
            height: 160px;
        }

        .d-pad-btn {
            width: 52px;
            height: 52px;
            background: linear-gradient(145deg, #ffffff, #ffe4f0);
            border: 2px solid #ff69b4;
            border-radius: 50%;
            font-size: 22px;
            color: #ff1493;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
            user-select: none;
            touch-action: none;
            transition: background 0.1s, transform 0.1s;
            position: absolute;
        }

        .d-pad-btn:active {
            background: #ffebf5;
            transform: scale(0.92);
        }

        /* 上下左右位置（手机十字键布局） */
        .d-pad-up    { top: 0;    left: 50%; transform: translateX(-50%); }
        .d-pad-up:active { transform: translateX(-50%) scale(0.92); }
        .d-pad-down  { bottom: 0; left: 50%; transform: translateX(-50%); }
        .d-pad-down:active { transform: translateX(-50%) scale(0.92); }
        .d-pad-left  { top: 50%;  left: 0;   transform: translateY(-50%); }
        .d-pad-left:active { transform: translateY(-50%) scale(0.92); }
        .d-pad-right { top: 50%;  right: 0;  transform: translateY(-50%); }
        .d-pad-right:active { transform: translateY(-50%) scale(0.92); }

        /* 触摸中心圆装饰 */
        .d-pad-center {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #ffccee, #ffb3d9);
            border: 2px solid #ff69b4;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
        }

        /* ===== 响应式断点 ===== */
        /* 手机（竖屏，宽度 < 600px）：显示虚拟方向键，隐藏键盘提示 */
        @media (max-width: 599px) {
            body { justify-content: flex-start; }
            .container {
                width: min(100%, 420px);
                padding: 14px 12px 12px;
                border-width: 4px;
                border-radius: 24px;
            }
            h1 { font-size: 19px; }
            .score-board {
                gap: 6px;
                margin-bottom: 8px;
            }
            .score-item {
                padding: 6px 8px;
                font-size: 12px;
            }
            canvas { max-width: min(340px, calc(100vw - 48px)); }
            .mobile-controls-area { display: block; }
            .controls-text { display: none !important; }
            .button-group { margin-top: 10px !important; }
        }

        /* PC / 平板（宽度 >= 600px）：隐藏虚拟方向键，显示键盘提示 */
        @media (min-width: 600px) {
            .mobile-controls-area { display: none !important; }
            .controls-text { display: block; }
        }

        /* ===== 弹窗 ===== */
        .overlay {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(255, 182, 193, 0.85);
            z-index: 999;
            animation: fadeIn 0.3s;
        }

        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        @keyframes slideUp {
            from { opacity: 0; transform: translate(-50%, -40%); }
            to   { opacity: 1; transform: translate(-50%, -50%); }
        }

        .modal {
            display: none;
            position: fixed;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 25px;
            border-radius: 30px;
            box-shadow: 0 15px 60px rgba(255, 105, 180, 0.5);
            z-index: 1000;
            border: 5px solid #ff69b4;
            animation: slideUp 0.4s ease-out;
            width: 90%;
            max-width: 380px;
        }

        .game-over-modal { text-align: center; }
        .game-over-modal h2 { color: #ff1493; margin-bottom: 12px; font-size: 22px; }
        .game-over-modal .score-display { font-size: 40px; color: #ff69b4; margin: 12px 0; font-weight: bold; }
        .game-over-modal .message { color: #666; font-size: 14px; margin: 8px 0; }

        /* 死后继续游戏的提示 */
        .continue-hint {
            font-size: 12px;
            color: #ff99cc;
            margin-top: 4px;
        }

        .leaderboard-modal { max-height: 70vh; overflow-y: auto; }
        .leaderboard-modal h2 { color: #ff1493; margin-bottom: 15px; font-size: 20px; text-align: center; }

        .leaderboard-list { list-style: none; padding: 0; margin: 0 0 15px 0; }

        .leaderboard-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 12px;
            margin-bottom: 7px;
            background: linear-gradient(135deg, #fff0f5 0%, #ffe4f0 100%);
            border-radius: 15px;
            border: 2px solid #ffb3d9;
        }

        .leaderboard-item.rank-1 { background: linear-gradient(135deg, #ffd700, #ffed4e); border-color: #ffa500; }
        .leaderboard-item.rank-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); border-color: #a9a9a9; }
        .leaderboard-item.rank-3 { background: linear-gradient(135deg, #cd7f32, #e9b872); border-color: #b8860b; }

        .player-rank { font-size: 18px; font-weight: bold; color: #ff1493; min-width: 36px; }
        .player-info { flex: 1; margin-left: 8px; text-align: left; }
        .player-name { font-size: 15px; font-weight: bold; color: #333; }
        .player-date { font-size: 11px; color: #999; }
        .player-score { font-size: 16px; font-weight: bold; color: #ff1493; }

        .name-input-modal { text-align: center; }
        .name-input-modal h3 { color: #ff1493; margin-bottom: 8px; font-size: 18px; }
        .name-input-modal .congrats { font-size: 36px; margin: 8px 0; }
        .name-input-modal input {
            width: 100%;
            padding: 10px;
            font-size: 15px;
            border: 3px solid #ff69b4;
            border-radius: 15px;
            margin: 12px 0;
            text-align: center;
            outline: none;
            font-family: inherit;
        }
        .name-input-error {
            min-height: 20px;
            margin: 8px 0 0;
            color: #b94769;
            font-size: 13px;
        }
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        .empty-leaderboard { text-align: center; color: #ff69b4; padding: 20px; font-size: 14px; }
        .cute-emoji { font-size: 36px; margin: 8px 0; }

        .start-hint { color: #ff69b4; font-size: 15px; animation: blink 2s infinite; }
        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }

        .button-group {
            display: flex;
            gap: 8px;
            justify-content: center;
            margin-top: 12px;
            flex-wrap: wrap;
        }

.primary-controls { margin-top: 12px; }
.name-score-line { color: #ff69b4; }
