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

:root {
    --bg-dark: #0a0a0f;
    --bg-panel: #151520;
    --bg-panel-hover: #1a1a2a;
    --border: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent: #4a9eff;
    --accent-glow: rgba(74, 158, 255, 0.3);
    --cell-size: 30px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    background-image: url('../images/eosnight.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    opacity: 0.7;
    z-index: -1;
}

/* 右上角用户名显示 */
.user-display {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(21, 21, 32, 0.9);
    border: 1px solid var(--border);
    border-radius: 20px;
    z-index: 100;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.user-display:hover {
    background: rgba(26, 26, 42, 0.95);
    border-color: var(--accent);
    box-shadow: 0 2px 16px var(--accent-glow);
}

.user-icon {
    font-size: 14px;
    opacity: 0.8;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-wrapper {
    display: grid;
    grid-template-columns: minmax(min-content, max-content) 1fr minmax(min-content, max-content);
    gap: 20px;
    width: auto;
    height: auto;
    padding: 20px;
    max-width: 95vw;
    max-height: 95vh;
    align-items: stretch;
}

/* 侧边栏 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    min-width: fit-content;
    width: max-content;
    max-width: 100%;
}

/* 确保侧边栏内容有最小宽度保护 */
.left-sidebar .hold-box,
.left-sidebar .stats-panel,
.right-sidebar .preview-panel {
    min-width: 100px;
    width: max-content;
}

.left-sidebar {
    align-items: flex-end;
    justify-self: end;
    justify-content: flex-start;
    align-self: stretch;
}

.left-sidebar .stats-panel {
    margin-top: auto;
}

.right-sidebar {
    align-items: flex-start;
    justify-self: start;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* 统计面板 */
.stats-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 8px var(--accent-glow);
    transition: all 0.3s ease;
}

.stat-value.updated {
    animation: pulse 0.4s ease;
    color: #6bb6ff;
}

/* 预览面板 */
.preview-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.next-preview-panel {
    flex-direction: column;
    gap: 10px;
}

.next-preview-panel .preview-title {
    margin-bottom: 3px;
}

.next-preview-panel .preview-box {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.preview-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hold-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.preview-title {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    text-align: center;
}

#holdCanvas,
#nextCanvas1,
#nextCanvas2,
#nextCanvas3 {
    width: 100%;
    height: 80px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: block;
}

/* ============================================
   左侧回放/排行榜面板 - 固定在屏幕左侧
   ============================================ */
.replay-panel-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    transition: transform 0.3s ease;
}

.replay-panel-wrapper.hidden {
    transform: translateX(calc(-100% + 40px));
}

.replay-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 16px;
    width: 220px;
    height: 100%;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.replay-panel::-webkit-scrollbar {
    width: 5px;
}

.replay-panel::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.replay-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.replay-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.replay-toggle-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    padding: 16px 8px;
    cursor: pointer;
    color: var(--accent);
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    align-self: center;
}

.replay-toggle-btn:hover {
    background: var(--bg-panel-hover);
    box-shadow: 2px 0 15px var(--accent-glow);
}

.replay-panel-wrapper .toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.replay-panel-wrapper.hidden .toggle-icon {
    transform: rotate(180deg);
}

.panel-section-title {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* 排行榜区域 */
.leaderboard-section {
    flex: 0 0 auto;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(74, 158, 255, 0.1);
}

.leaderboard-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    min-width: 20px;
    text-align: center;
    font-family: 'Orbitron', 'Courier New', monospace;
}

.leaderboard-rank.rank-1 { color: #ffd700; }
.leaderboard-rank.rank-2 { color: #c0c0c0; }
.leaderboard-rank.rank-3 { color: #cd7f32; }

.leaderboard-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.leaderboard-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
}

.leaderboard-details {
    font-size: 9px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

.leaderboard-replay-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.leaderboard-replay-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
}

.leaderboard-replay-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 我的回放区域 */
.my-replays-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.my-replays-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: 300px;
}

.my-replays-list::-webkit-scrollbar {
    width: 4px;
}

.my-replays-list::-webkit-scrollbar-track {
    background: transparent;
}

.my-replays-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.replay-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.replay-item:hover {
    background: rgba(74, 158, 255, 0.1);
}

.replay-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.replay-item-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.replay-item-details {
    font-size: 9px;
    color: var(--text-secondary);
    display: flex;
    gap: 6px;
}

.replay-item-actions {
    display: flex;
    gap: 4px;
}

.replay-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 6px;
    font-size: 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.replay-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
}

.replay-action-btn.delete-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.no-replays-hint {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    padding: 16px;
    opacity: 0.7;
}

/* ============================================
   回放播放器覆盖层
   ============================================ */
.replay-player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.replay-player-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.replay-player-container {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.replay-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.replay-player-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.replay-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.2s ease;
}

.replay-close-btn:hover {
    color: #ff6b6b;
}

.replay-player-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

#replayCanvas {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border);
    border-radius: 6px;
    width: 300px;
    height: 600px;
}

.replay-info-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    min-width: 100px;
}

.replay-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.replay-stat-label {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.replay-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'Courier New', monospace;
}

/* 回放控制条 */
.replay-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.replay-control-btn {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.replay-control-btn:hover {
    background: var(--bg-panel-hover);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.replay-progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.replay-progress-bar {
    position: relative;
    height: 20px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    overflow: visible;
}

.replay-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #6bb6ff);
    border-radius: 3px;
    transition: width 0.1s linear;
    z-index: 1;
}

.replay-progress-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.replay-level-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%);
}

.replay-level-marker.major {
    background: rgba(255, 215, 0, 0.8);
    width: 3px;
}

.replay-level-marker .marker-label {
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.replay-level-marker.major .marker-label {
    color: #ffd700;
    font-weight: 600;
}

.replay-time-display {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    text-align: center;
}

.replay-speed-select {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.replay-speed-select:hover {
    border-color: var(--accent);
}

.replay-speed-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ============================================
   用户名输入对话框
   ============================================ */
.username-dialog,
.username-confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.username-dialog.hidden,
.username-confirm-dialog.hidden {
    opacity: 0;
    pointer-events: none;
}

.username-dialog-content {
    background: linear-gradient(135deg, var(--bg-panel) 0%, rgba(30, 30, 50, 0.95) 100%);
    border: 2px solid var(--accent);
    border-radius: 16px;
    padding: 32px 40px;
    min-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 0 60px rgba(74, 158, 255, 0.3),
                0 0 120px rgba(74, 158, 255, 0.1);
    animation: dialogAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialogAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.username-dialog-title {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 20px var(--accent-glow);
}

.username-dialog-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

.username-input {
    background: var(--bg-dark);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    font-family: inherit;
}

.username-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.username-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.username-error {
    color: #ff6b6b;
    font-size: 12px;
    text-align: center;
    padding: 8px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.username-error.hidden {
    display: none;
}

.username-dialog-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
}

.username-btn {
    padding: 12px 32px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
}

.username-btn.confirm-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #2d6fcf 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.username-btn.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--accent-glow);
}

.username-btn.cancel-btn {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

.username-btn.cancel-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.username-rules {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    opacity: 0.7;
}

.username-confirm-name {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #ffd700;
    text-align: center;
    padding: 12px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* ============================================
   上榜提示对话框
   ============================================ */
.ranking-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.ranking-dialog.hidden {
    opacity: 0;
    pointer-events: none;
}

.ranking-dialog-content {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.95) 0%, rgba(20, 40, 60, 0.95) 100%);
    border: 2px solid #ffd700;
    border-radius: 16px;
    padding: 40px 50px;
    min-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.3),
                0 0 120px rgba(255, 215, 0, 0.1);
    animation: rankingAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rankingAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    50% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.ranking-dialog-title {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(90deg, #ffd700, #ffaa00, #ffd700);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: titleShine 2s linear infinite;
}

@keyframes titleShine {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.ranking-message {
    font-size: 18px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 600;
}

.ranking-number {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 36px;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: numberPulse 1s ease-in-out infinite alternate;
}

@keyframes numberPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.ranking-submessage {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

.ranking-dialog-buttons {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.ranking-btn {
    padding: 14px 48px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%);
    border: none;
    color: #1a1a2e;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.ranking-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.6);
}

/* ============================================
   排行榜新样式 - 用户名和日期显示
   ============================================ */
.leaderboard-username {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.leaderboard-date {
    font-size: 8px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ============================================
   保存回放对话框
   ============================================ */
.save-replay-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.save-replay-dialog.hidden {
    opacity: 0;
    pointer-events: none;
}

.save-replay-content {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.save-replay-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.save-replay-info {
    display: flex;
    justify-content: space-around;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.save-replay-info span {
    color: var(--accent);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.save-replay-name-input {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s ease;
}

.save-replay-name-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.save-replay-name-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.save-replay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.save-replay-btn {
    padding: 10px 24px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.save-replay-btn.save-btn {
    background: var(--accent);
    border: none;
    color: var(--bg-dark);
}

.save-replay-btn.save-btn:hover {
    background: #6bb6ff;
    box-shadow: 0 0 15px var(--accent-glow);
}

.save-replay-btn.cancel-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.save-replay-btn.cancel-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* 控制面板 - 固定在屏幕右侧 */
.controls-panel-wrapper {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.controls-panel-wrapper.hidden {
    transform: translateY(-50%) translateX(calc(100% - 40px));
}

.controls-toggle-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 16px 8px;
    cursor: pointer;
    color: var(--accent);
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.controls-toggle-btn:hover {
    background: var(--bg-panel-hover);
    box-shadow: -2px 0 15px var(--accent-glow);
}

.toggle-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.controls-panel-wrapper.hidden .toggle-icon {
    transform: rotate(180deg);
}

.controls-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px 0 0 10px;
    padding: 16px;
    width: 220px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.5);
}

.controls-panel::-webkit-scrollbar {
    width: 5px;
}

.controls-panel::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.controls-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.controls-title {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 13px;
}

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transition: all 0.2s ease;
}

.control-row:hover {
    background: rgba(74, 158, 255, 0.1);
    transform: translateX(3px);
}

.control-row span {
    font-size: 10px;
    color: var(--text-secondary);
}

.key {
    display: inline-block;
    padding: 3px 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    min-width: 36px;
    text-align: center;
    box-shadow: 0 0 6px var(--accent-glow);
}

/* 可修改的按键样式 */
.key-rebindable {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.key-rebindable:hover {
    background: var(--bg-panel-hover);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: scale(1.05);
}

.key-rebindable:active {
    transform: scale(0.95);
}

/* 正在修改按键状态 */
.key-rebindable.rebinding {
    animation: rebindPulse 0.8s ease-in-out infinite;
    border-color: #ff6b6b;
    color: #ff6b6b;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

@keyframes rebindPulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 25px rgba(255, 107, 107, 0.8);
    }
}

/* 控制面板提示文字 */
.controls-hint {
    font-size: 7px;
    color: var(--text-secondary);
    opacity: 0.7;
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

/* 重置按键行 */
.control-reset-row {
    justify-content: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* 重置按钮 */
.reset-keys-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 16px;
    font-size: 9px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reset-keys-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 10px var(--accent-glow);
}

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

/* ============================================
   DAS/ARR 灵敏度设置样式
   ============================================ */
.handling-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.handling-title {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
}

.handling-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.handling-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.handling-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.handling-value {
    font-size: 10px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    background: var(--bg-dark);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
    min-width: 45px;
    text-align: center;
}

.handling-hint {
    font-size: 8px;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: right;
}

/* 滑块样式 */
.handling-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.handling-slider:hover {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* 滑块轨道 - Webkit */
.handling-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
    border-radius: 2px;
}

/* 滑块拇指 - Webkit */
.handling-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: all 0.2s ease;
    border: 2px solid var(--bg-panel);
}

.handling-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--accent-glow);
}

.handling-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
    background: #6bb6ff;
}

/* 滑块轨道 - Firefox */
.handling-slider::-moz-range-track {
    height: 4px;
    background: transparent;
    border-radius: 2px;
}

/* 滑块拇指 - Firefox */
.handling-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: all 0.2s ease;
    border: 2px solid var(--bg-panel);
}

.handling-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* 重置灵敏度按钮行 */
.handling-reset-row {
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

/* 重置灵敏度按钮 */
.reset-handling-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 5px 12px;
    font-size: 8px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reset-handling-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
    box-shadow: 0 0 8px var(--accent-glow);
}

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

/* 游戏区域 */
.game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    width: 100%;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
}

#gameCanvas {
    display: block;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* 游戏覆盖层 */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: 32px;
}

.overlay-content h2 {
    font-size: 38px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 13px;
    text-shadow: 0 0 16px var(--accent-glow);
}

.overlay-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 26px;
}

.overlay-controls {
    display: flex;
    gap: 13px;
    justify-content: center;
}

.game-btn {
    background: var(--bg-panel);
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 10px 26px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 0 16px var(--accent-glow);
}

.game-btn:hover {
    background: rgba(74, 158, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 0 24px var(--accent-glow);
}

.game-btn:active {
    transform: translateY(0);
}

/* 动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

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

.game-wrapper {
    animation: fadeIn 0.5s ease-out;
}

/* ============================================
   消行提示样式
   ============================================ */
.action-notifications {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 60px;
    align-items: flex-end;
}

.action-notif {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transform: translateX(-20px) scale(0.8);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    text-shadow: 0 0 10px currentColor;
    position: relative;
    overflow: hidden;
}

.action-notif::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.action-notif.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.action-notif.fade-out {
    opacity: 0;
    transform: translateX(20px) scale(0.8);
}

/* 普通消行 - Single/Double/Triple */
.action-notif-normal {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2), rgba(74, 158, 255, 0.1));
    border: 1px solid rgba(74, 158, 255, 0.4);
    color: #7ab8ff;
}

.action-notif-normal.tier-1 {
    font-size: 11px;
    color: #93c5fd;
}

.action-notif-normal.tier-2 {
    font-size: 12px;
    color: #7ab8ff;
}

.action-notif-normal.tier-3 {
    font-size: 14px;
    color: #4ecdc4;
    border-color: rgba(78, 205, 196, 0.5);
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(78, 205, 196, 0.1));
}

/* Tetris (四行) - 最高级 */
.action-notif-tetris {
    font-size: 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.6);
    color: #ffd700;
    animation: tetrisGlow 0.5s ease-out;
}

@keyframes tetrisGlow {
    0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    100% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
}

/* T-spin Regular */
.action-notif-tspin {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.3), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(147, 51, 234, 0.6);
    color: #c084fc;
}

.action-notif-tspin.tier-1 {
    font-size: 12px;
}

.action-notif-tspin.tier-2 {
    font-size: 13px;
    color: #d8b4fe;
}

.action-notif-tspin.tier-3 {
    font-size: 15px;
    color: #e879f9;
    animation: tspinPulse 0.4s ease-out;
}

.action-notif-tspin.tier-4 {
    font-size: 16px;
    color: #f0abfc;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(147, 51, 234, 0.2));
    border-color: rgba(236, 72, 153, 0.6);
    animation: tspinPulse 0.4s ease-out;
}

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

/* Mini T-spin */
.action-notif-tspin-mini {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(192, 132, 252, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #a78bfa;
    font-size: 11px;
}

.action-notif-tspin-mini.tier-1 {
    font-size: 10px;
    color: #a78bfa;
}

.action-notif-tspin-mini.tier-2 {
    font-size: 11px;
    color: #c4b5fd;
}

/* B2B (Back-to-Back) */
.action-notif-b2b {
    font-size: 10px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(6, 182, 212, 0.15));
    border: 1px solid rgba(34, 211, 238, 0.5);
    color: #67e8f9;
    letter-spacing: 1.5px;
    animation: b2bGlow 0.6s ease-out;
}

@keyframes b2bGlow {
    0% { 
        box-shadow: 0 0 15px rgba(34, 211, 238, 0.6);
        text-shadow: 0 0 15px rgba(34, 211, 238, 0.8);
    }
    100% { 
        box-shadow: 0 0 5px rgba(34, 211, 238, 0.2);
        text-shadow: 0 0 10px currentColor;
    }
}

/* Combo */
.action-notif-combo {
    font-size: 11px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 107, 107, 0.1));
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #ff8a8a;
}

.action-notif-combo.tier-2 { font-size: 10px; color: #ff8a8a; }
.action-notif-combo.tier-3 { font-size: 11px; color: #ff7a7a; }
.action-notif-combo.tier-4 { font-size: 11px; color: #ff6b6b; }
.action-notif-combo.tier-5 { font-size: 12px; color: #ff5252; }
.action-notif-combo.tier-6 { font-size: 12px; color: #ff4444; }
.action-notif-combo.tier-7 { font-size: 13px; color: #ff3333; }
.action-notif-combo.tier-8 { font-size: 13px; color: #ff2222; }
.action-notif-combo.tier-9 { font-size: 14px; color: #ff1111; }
.action-notif-combo.tier-10 {
    font-size: 14px;
    color: #ff0000;
    border-color: rgba(255, 0, 0, 0.6);
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.3), rgba(255, 50, 50, 0.2));
    animation: comboMax 0.3s ease-out;
}

@keyframes comboMax {
    0% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ============================================
   Level Up 提示样式
   ============================================ */
.level-up-notification {
    position: relative;
    text-align: center;
    padding: 10px 16px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.level-up-notification.hidden {
    display: none;
}

.level-up-notification.show {
    opacity: 1;
    transform: scale(1);
}

.level-up-notification.fade-out {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
}

.level-up-text {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    background: linear-gradient(90deg, #ffd700, #ffaa00, #ffd700);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: levelUpShine 0.8s ease-in-out infinite alternate;
    text-shadow: none;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

@keyframes levelUpShine {
    0% { 
        background-position: 0% 50%;
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    }
    100% { 
        background-position: 100% 50%;
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
    }
}

/* Level Up 闪烁效果 */
.level-up-notification.show .level-up-text {
    animation: levelUpShine 0.8s ease-in-out infinite alternate, levelUpBlink 0.15s ease-in-out 4;
}

@keyframes levelUpBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================================
   Perfect Clear 提示样式（canvas内部显示）
   ============================================ */
.perfect-clear-notification {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translateX(-50%) scale(0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.perfect-clear-notification.hidden {
    display: none;
}

.perfect-clear-notification.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.perfect-clear-notification.fade-out {
    opacity: 0;
    transform: translateX(-50%) scale(1.2);
    transition: all 0.6s ease-out;
}

.pc-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 24px;
    background: linear-gradient(135deg, 
        rgba(0, 255, 136, 0.15), 
        rgba(0, 255, 200, 0.1),
        rgba(50, 255, 180, 0.15));
    border: 2px solid rgba(0, 255, 136, 0.6);
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(0, 255, 136, 0.4),
        0 0 80px rgba(0, 255, 136, 0.2),
        inset 0 0 30px rgba(0, 255, 136, 0.1);
    animation: pcPulse 1s ease-in-out infinite alternate;
}

.pc-text {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 28px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 6px;
    color: transparent;
    background: linear-gradient(90deg, 
        #00ff88, 
        #00ffcc, 
        #00ff88, 
        #88ffcc,
        #00ff88);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: pcTextShine 1.5s linear infinite;
    filter: drop-shadow(0 0 15px rgba(0, 255, 136, 0.8));
}

.pc-text-clear {
    font-size: 22px;
    letter-spacing: 8px;
    background: linear-gradient(90deg, 
        #88ffcc,
        #00ffcc, 
        #00ff88, 
        #00ffcc,
        #88ffcc);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: pcTextShine 1.5s linear infinite reverse;
    filter: drop-shadow(0 0 12px rgba(0, 255, 200, 0.7));
}

@keyframes pcTextShine {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@keyframes pcPulse {
    0% { 
        box-shadow: 
            0 0 40px rgba(0, 255, 136, 0.4),
            0 0 80px rgba(0, 255, 136, 0.2),
            inset 0 0 30px rgba(0, 255, 136, 0.1);
    }
    100% { 
        box-shadow: 
            0 0 60px rgba(0, 255, 136, 0.6),
            0 0 100px rgba(0, 255, 136, 0.3),
            inset 0 0 40px rgba(0, 255, 136, 0.15);
    }
}

/* PC 屏幕震动效果 */
.canvas-wrapper.pc-shake {
    animation: pcShake 0.5s ease-out;
}

@keyframes pcShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-4px) rotate(-0.5deg); }
    20% { transform: translateX(4px) rotate(0.5deg); }
    30% { transform: translateX(-3px) rotate(-0.3deg); }
    40% { transform: translateX(3px) rotate(0.3deg); }
    50% { transform: translateX(-2px) rotate(-0.2deg); }
    60% { transform: translateX(2px) rotate(0.2deg); }
    70% { transform: translateX(-1px); }
    80% { transform: translateX(1px); }
}

/* PC 闪光粒子效果 */
.perfect-clear-notification.show::before,
.perfect-clear-notification.show::after {
    content: '✦';
    position: absolute;
    font-size: 16px;
    color: #00ff88;
    animation: pcSparkle 0.8s ease-out infinite;
    filter: drop-shadow(0 0 8px #00ff88);
}

.perfect-clear-notification.show::before {
    top: -10px;
    left: 10%;
    animation-delay: 0s;
}

.perfect-clear-notification.show::after {
    top: -5px;
    right: 10%;
    animation-delay: 0.4s;
}

@keyframes pcSparkle {
    0% { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% { 
        opacity: 0;
        transform: translateY(-20px) scale(0.5);
    }
}

/* 响应式 */
@media (max-width: 1400px) {
    .game-wrapper {
        gap: 16px;
        padding: 16px;
    }
    
    .stat-value {
        font-size: 22px;
    }
    
    .left-sidebar .hold-box,
    .left-sidebar .stats-panel,
    .right-sidebar .preview-panel {
        min-width: 90px;
    }
}

@media (max-width: 1200px) {
    .game-wrapper {
        gap: 12px;
        padding: 12px;
    }
    
    .stat-value {
        font-size: 19px;
    }
    
    #holdCanvas,
    #nextCanvas1,
    #nextCanvas2,
    #nextCanvas3 {
        height: 64px;
    }
    
    .left-sidebar .hold-box,
    .left-sidebar .stats-panel,
    .right-sidebar .preview-panel {
        min-width: 85px;
    }
}

@media (max-width: 1024px) {
    .game-wrapper {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 12px;
        padding: 12px;
        max-height: 95vh;
    }
    
    .sidebar {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        justify-content: center;
    }
    
    .left-sidebar {
        justify-self: center;
    }
    
    .right-sidebar {
        justify-self: center;
    }
    
    .stats-panel {
        flex-direction: row;
        min-width: fit-content;
    }
    
    .preview-panel {
        flex-direction: row;
        min-width: fit-content;
    }
    
    .controls-panel {
        min-width: fit-content;
    }
    
    .controls-grid {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .control-row {
        min-width: 96px;
    }
    
    /* 移动端消行提示调整 */
    .action-notifications {
        flex-direction: row;
        min-height: auto;
        align-items: center;
    }
    
    .action-notif {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .level-up-notification {
        padding: 6px 10px;
    }
    
    .level-up-text {
        font-size: 14px;
        letter-spacing: 2px;
    }
    
    /* 移动端PC提示调整 */
    .pc-text-wrapper {
        padding: 10px 16px;
    }
    
    .pc-text {
        font-size: 20px;
        letter-spacing: 4px;
    }
    
    .pc-text-clear {
        font-size: 16px;
        letter-spacing: 5px;
    }
    
    /* 移动端DAS/ARR调整 */
    .handling-section {
        margin-top: 12px;
        padding-top: 10px;
    }
    
    .handling-row {
        padding: 6px 8px;
        margin-bottom: 8px;
    }
    
    .handling-name {
        font-size: 10px;
    }
    
    .handling-value {
        font-size: 9px;
        min-width: 40px;
    }
    
    /* 移动端回放面板调整 */
    .replay-panel-wrapper {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        max-height: 50vh;
        flex-direction: column-reverse;
    }
    
    .replay-panel-wrapper.hidden {
        transform: translateY(calc(100% - 40px));
    }
    
    .replay-panel {
        width: 100%;
        height: auto;
        max-height: 45vh;
        border-radius: 10px 10px 0 0;
        border: 1px solid var(--border);
        border-bottom: none;
    }
    
    .replay-toggle-btn {
        border-radius: 8px 8px 0 0;
        border: 1px solid var(--border);
        border-bottom: none;
        min-height: 40px;
        width: 60px;
        align-self: center;
    }
    
    .replay-panel-wrapper .toggle-icon {
        transform: rotate(-90deg);
    }
    
    .replay-panel-wrapper.hidden .toggle-icon {
        transform: rotate(90deg);
    }
    
    /* 移动端回放播放器调整 */
    .replay-player-content {
        flex-direction: column;
        align-items: center;
    }
    
    #replayCanvas {
        width: 200px;
        height: 400px;
    }
    
    .replay-info-panel {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
    }
    
    .replay-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ========================================
   音乐播放器样式
   ======================================== */
.music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(20, 20, 35, 0.95) 0%, rgba(30, 30, 50, 0.9) 100%);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 50px;
    padding: 8px 16px 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(74, 158, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
}

.music-player:hover {
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(74, 158, 255, 0.2);
    transform: translateY(-2px);
}

/* 碟片图标 */
.music-disc {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 50%, #1a1a2e 100%);
    border: 2px solid rgba(74, 158, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5),
                0 0 10px rgba(74, 158, 255, 0.2);
    transition: transform 0.3s ease;
}

.music-disc::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle at center,
        transparent 0px,
        transparent 3px,
        rgba(74, 158, 255, 0.1) 4px,
        transparent 5px
    );
}

.disc-inner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a9eff 0%, #2d6fcf 100%);
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.6);
    z-index: 1;
}

/* 碟片旋转动画 */
.music-disc.spinning {
    animation: discSpin 3s linear infinite;
}

@keyframes discSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 音乐信息区域 */
.music-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 100px;
}

.music-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    text-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

/* 音乐控制按钮 */
.music-controls {
    display: flex;
    gap: 4px;
}

.music-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(74, 158, 255, 0.15);
    color: var(--text-primary);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.music-btn:hover {
    background: rgba(74, 158, 255, 0.3);
    transform: scale(1.1);
}

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

.music-play-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.3) 0%, rgba(74, 158, 255, 0.15) 100%);
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.music-play-btn:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.5) 0%, rgba(74, 158, 255, 0.3) 100%);
    border-color: rgba(74, 158, 255, 0.5);
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .music-player {
        bottom: 10px;
        right: 10px;
        padding: 6px 12px 6px 6px;
        gap: 8px;
    }
    
    .music-disc {
        width: 36px;
        height: 36px;
    }
    
    .disc-inner {
        width: 10px;
        height: 10px;
    }
    
    .music-title {
        font-size: 11px;
        max-width: 80px;
    }
    
    .music-btn {
        width: 22px;
        height: 22px;
        font-size: 9px;
    }
    
    .music-play-btn {
        width: 26px;
        height: 26px;
        font-size: 10px;
    }
}
