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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000011;
    color: #f8fafc;
    min-height: 100vh;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, #1a0033 0%, #000011 50%, #000000 100%);
    pointer-events: none;
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #fff, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(1px 1px at 90px 40px, #fff, transparent),
        radial-gradient(1px 1px at 130px 80px, #fff, transparent),
        radial-gradient(2px 2px at 160px 30px, #fff, transparent),
        radial-gradient(1px 1px at 200px 90px, #fff, transparent),
        radial-gradient(2px 2px at 240px 50px, #fff, transparent),
        radial-gradient(1px 1px at 280px 10px, #fff, transparent),
        radial-gradient(1px 1px at 320px 70px, #fff, transparent),
        radial-gradient(2px 2px at 360px 40px, #fff, transparent);
    background-repeat: repeat;
    background-size: 400px 200px;
    animation: twinkle 2s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: -1;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10;
}

.game-title {
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899, #06b6d4);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
    letter-spacing: -0.5px;
    text-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
}

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

.header-stats {
    display: flex;
    gap: 24px;
    font-size: 14px;
}

.stat {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 16px;
    border-radius: 12px;
    backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(168, 85, 247, 0.3),
        inset 0 1px 0 rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

.stat-label {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 2px;
    letter-spacing: -0.3px;
}

.game-container {
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr minmax(280px, 320px);
    gap: 20px;
    padding: 20px 20px 70px 20px;
    max-width: 100vw;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
    min-height: calc(100vh - 80px);
}

.left-dashboard, .right-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hold-section, .achievements, .leaderboard {
    background: rgba(0, 0, 17, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hold-section::before, .achievements::before, .leaderboard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle, rgba(168, 85, 247, 0.4) 2px, transparent 2px),
        radial-gradient(circle, rgba(168, 85, 247, 0.3) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(168, 85, 247, 0.2) 1px, transparent 1px);
    background-position: 20px 25px, 60px 45px, 100px 20px;
    background-size: 120px 90px, 150px 110px, 180px 130px;
    animation: twinkle-slow 1.5s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.hold-section > *, .achievements > *, .leaderboard > * {
    position: relative;
    z-index: 1;
}

.next-queue {
    background: rgba(0, 0, 17, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.next-queue::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle, rgba(168, 85, 247, 0.4) 2px, transparent 2px),
        radial-gradient(circle, rgba(168, 85, 247, 0.3) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(168, 85, 247, 0.2) 1px, transparent 1px);
    background-position: 22px 28px, 62px 48px, 102px 22px;
    background-size: 125px 95px, 155px 115px, 185px 135px;
    animation: twinkle-slow 1.6s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.next-queue > * {
    position: relative;
    z-index: 1;
}

@keyframes twinkle-slow {
    0%, 100% { opacity: 0.4; }
    25% { opacity: 1; }
    50% { opacity: 0.6; }
    75% { opacity: 1; }
}

.hold-section:hover, .next-queue:hover, .achievements:hover, .leaderboard:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(168, 85, 247, 0.2),
        inset 0 1px 0 rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
}

.hold-section h3, .next-queue h3, .achievements h3, .leaderboard h3 {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
    position: relative;
}

.hold-section h3::after, .next-queue h3::after, .achievements h3::after, .leaderboard h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-radius: 1px;
}

#holdCanvas, #next1Canvas, #next2Canvas, #next3Canvas, #next4Canvas, #next5Canvas {
    background: linear-gradient(135deg, #000011, #0f0f23);
    border: 2px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    display: block;
    margin: 0 auto 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(168, 85, 247, 0.1),
        inset 0 1px 0 rgba(168, 85, 247, 0.1);
}

#holdCanvas:hover, #next1Canvas:hover, #next2Canvas:hover, #next3Canvas:hover, #next4Canvas:hover, #next5Canvas:hover {
    transform: scale(1.05);
    border-color: rgba(168, 85, 247, 0.8);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(168, 85, 247, 0.4),
        inset 0 1px 0 rgba(168, 85, 247, 0.2);
}

.hold-hint {
    text-align: center;
    font-size: 10px;
    color: #a1a1aa;
    font-style: italic;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 17, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(168, 85, 247, 0.2);
}

.stat-card:hover::before {
    left: 100%;
}

.stat-icon {
    font-size: 24px;
    opacity: 0.8;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 10px;
    color: #a1a1aa;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #f8fafc, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 4px;
    letter-spacing: -0.5px;
}

.combo-section {
    background: rgba(0, 0, 17, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.combo-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle, rgba(168, 85, 247, 0.4) 2px, transparent 2px),
        radial-gradient(circle, rgba(168, 85, 247, 0.3) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(168, 85, 247, 0.2) 1px, transparent 1px);
    background-position: 25px 30px, 65px 50px, 105px 25px;
    background-size: 130px 100px, 160px 120px, 190px 140px;
    animation: twinkle-slow 1.8s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.combo-section > * {
    position: relative;
    z-index: 1;
}

.combo-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(236, 72, 153, 0.1), transparent);
    animation: rotate 8s linear infinite;
    pointer-events: none;
}

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

.combo-label {
    font-size: 12px;
    color: #fb923c;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.combo-value {
    font-size: 42px;
    font-weight: 900;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 12px 0;
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
    position: relative;
    z-index: 1;
}

.combo-multiplier {
    font-size: 14px;
    color: #f59e0b;
    font-weight: 600;
}

.game-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-area {
    position: relative;
    padding: 20px;
    background: rgba(0, 0, 17, 0.95);
    border-radius: 24px;
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
    overflow: hidden;
}

.game-area:hover {
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(124, 58, 237, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#gameCanvas {
    border: 3px solid;
    border-image: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899) 1;
    border-radius: 16px;
    background: linear-gradient(135deg, #000011, #0f0f23);
    box-shadow: 
        0 0 60px rgba(124, 58, 237, 0.4),
        0 0 100px rgba(168, 85, 247, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    max-width: 400px;
    max-height: 600px;
    width: auto;
    height: auto;
}

#gameCanvas:hover {
    box-shadow: 
        0 0 80px rgba(124, 58, 237, 0.6),
        0 0 120px rgba(168, 85, 247, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

.overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
}

.overlay-content h2 {
    font-size: 48px;
    background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-weight: 900;
    text-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.overlay-content p {
    font-size: 16px;
    color: #d1d5db;
    margin-bottom: 20px;
}

.game-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 14px 28px;
    border: 2px solid transparent;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.control-btn:hover::before {
    left: 100%;
}

.control-btn.primary {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
    color: white;
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 
        0 8px 25px rgba(124, 58, 237, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.control-btn.primary:hover {
    background: linear-gradient(135deg, #8b5cf6, #a855f7, #f472b6);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 12px 35px rgba(124, 58, 237, 0.4),
        0 0 20px rgba(168, 85, 247, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(168, 85, 247, 0.8);
}

.control-btn.secondary {
    background: rgba(0, 0, 0, 0.8);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.95);
    transform: translateY(-4px) scale(1.05);
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(168, 85, 247, 0.2),
        inset 0 1px 0 rgba(168, 85, 247, 0.15);
    color: #ffffff;
}

.next-pieces {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.achievement-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achievement {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 17, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.achievement::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.1), transparent);
    transition: left 0.5s ease;
}

.achievement.unlocked {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

.achievement.unlocked::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    color: #a855f7;
    font-weight: bold;
    font-size: 12px;
}

.achievement.locked {
    opacity: 0.5;
}

.achievement:hover {
    transform: translateX(8px) translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

.achievement:hover::before {
    left: 100%;
}

.achievement-icon {
    font-size: 16px;
}

.achievement-name {
    font-size: 12px;
    flex: 1;
    font-weight: 500;
}

.score-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(0, 0, 17, 0.8);
    border-radius: 12px;
    border-left: 4px solid;
    border-image: linear-gradient(135deg, #fbbf24, #f59e0b) 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.score-entry::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.1), transparent);
    transition: left 0.5s ease;
}

.score-entry:hover {
    background: rgba(15, 15, 35, 0.8);
    transform: translateX(8px) translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(251, 191, 36, 0.2);
}

.score-entry:hover::before {
    left: 100%;
}

.rank {
    font-size: 12px;
    color: #fbbf24;
    font-weight: 700;
}

.score-value {
    font-size: 14px;
    color: white;
    font-weight: 600;
}

.controls-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    z-index: 100;
}

.controls-footer.collapsed {
    transform: translateY(calc(100% - 50px));
}

.controls-toggle {
    width: 100%;
    padding: 15px;
    background: transparent;
    border: none;
    color: #a855f7;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.controls-toggle:hover {
    color: #ec4899;
    background: rgba(168, 85, 247, 0.1);
}

.controls-content {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 32px;
}

.controls-footer.collapsed .controls-content {
    display: none;
}

.control-section {
    text-align: center;
}

/* Focus Mode */
body.focus-mode .left-dashboard,
body.focus-mode .right-dashboard {
    display: none;
}

body.focus-mode .game-container {
    grid-template-columns: 1fr;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

body.focus-mode .game-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

body.focus-mode .game-area {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

body.focus-mode #gameCanvas {
    max-height: calc(100vh - 160px);
    max-width: calc(100vw - 40px);
    width: auto;
    height: auto;
}

body.focus-mode .game-controls {
    margin-top: 10px;
    flex-shrink: 0;
}

body.focus-mode .game-status {
    margin-top: 8px;
    flex-shrink: 0;
}

.control-section h4 {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
    position: relative;
}

.control-section h4::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-radius: 1px;
}

.control-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 15px;
    align-items: center;
}

.control-key {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    min-width: 45px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.control-key:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.6);
}

.control-desc {
    font-size: 11px;
    color: #d1d5db;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.5), transparent);
}

.modal-content h2 {
    background: linear-gradient(135deg, #7c3aed, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    margin-bottom: 32px;
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
    letter-spacing: -0.5px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
}

.settings-grid label {
    color: #d1d5db;
    font-size: 14px;
    font-weight: 500;
}

.settings-grid input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #a855f7;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.settings-grid input[type="checkbox"]:hover {
    transform: scale(1.1);
    accent-color: #ec4899;
}

.settings-grid input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.settings-grid input[type="range"] {
    width: 140px;
    accent-color: #a855f7;
    background: rgba(15, 15, 35, 0.6);
    border-radius: 8px;
    height: 6px;
    outline: none;
    transition: all 0.3s ease;
}

.settings-grid input[type="range"]:hover {
    accent-color: #ec4899;
    transform: scale(1.05);
}

.settings-grid input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
    transition: all 0.3s ease;
}

.settings-grid input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.6);
}

.level-progress {
    width: 100%;
    height: 8px;
    background: rgba(15, 15, 35, 0.8);
    border-radius: 4px;
    margin: 16px 0;
    overflow: hidden;
    border: 1px solid rgba(120, 119, 198, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.level-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #ec4899);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 0 15px rgba(124, 58, 237, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
}

.level-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Floating particles animation */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(120deg); }
    66% { transform: translateY(5px) rotate(240deg); }
}

/* Glow effect for active elements */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(168, 85, 247, 0.4); }
    to { box-shadow: 0 0 30px rgba(168, 85, 247, 0.6), 0 0 40px rgba(236, 72, 153, 0.4); }
}

/* Enhanced scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border-radius: 4px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a855f7, #ec4899);
}

/* Selection styling */
::selection {
    background: rgba(168, 85, 247, 0.3);
    color: #ffffff;
}

/* Focus styles for accessibility */
.control-btn:focus,
input:focus {
    outline: 2px solid rgba(168, 85, 247, 0.6);
    outline-offset: 2px;
}

/* Loading animation for canvases */
.canvas-loading {
    position: relative;
}

.canvas-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(168, 85, 247, 0.3);
    border-top: 2px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus mode responsive adjustments */
@media (max-width: 768px) {
    body.focus-mode #gameCanvas {
        max-height: calc(100vh - 140px);
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 1400px) {
    .game-container {
        grid-template-columns: minmax(260px, 280px) 1fr minmax(260px, 280px);
        gap: 16px;
        padding: 16px 16px 70px 16px;
    }
    
    .hold-section, .next-queue, .achievements, .leaderboard, .combo-section, .stats-compact {
        padding: 16px;
    }
    
    .game-area {
        padding: 16px;
    }
}

@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 16px;
        padding: 16px 16px 70px 16px;
        max-width: 100vw;
        min-height: calc(100vh - 100px);
    }
    
    .left-dashboard, .right-dashboard {
        flex-direction: row;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 8px;
    }
    
    .hold-section, .next-queue, .achievements, .leaderboard, .stats-compact {
        min-width: 250px;
        flex-shrink: 0;
        padding: 16px;
    }
    
    .game-center {
        order: -1;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }
    
    .controls-content {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .game-header {
        padding: 8px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .game-title {
        font-size: 20px;
    }
    
    .header-stats {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat {
        padding: 8px 12px;
        min-width: 80px;
    }
    
    .game-container {
        padding: 12px 12px 70px 12px;
        gap: 12px;
        max-width: 100vw;
        min-height: calc(100vh - 80px);
    }
    
    .game-area {
        padding: 12px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }
    
    .hold-section, .next-queue, .achievements, .leaderboard, .combo-section, .stats-compact {
        padding: 12px;
        min-width: 200px;
    }
    
    .controls-content {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    
    .control-section {
        text-align: center;
    }
    
    .modal-content {
        padding: 20px;
        margin: 16px;
        max-width: calc(100vw - 32px);
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 18px;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .stat {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .left-dashboard, .right-dashboard {
        flex-direction: column;
    }
    
    .hold-section, .next-queue, .achievements, .leaderboard, .stats-compact {
        min-width: auto;
        width: 100%;
        padding: 12px;
    }
    
    .game-container {
        padding: 8px 8px 70px 8px;
        gap: 8px;
        min-height: calc(100vh - 60px);
        max-width: 100vw;
    }
    
    .game-area {
        padding: 8px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    body {
        background: radial-gradient(ellipse at top, #1e1b4b 0%, #0f0f23 50%, #000000 100%);
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .combo-section::before {
        animation: none;
    }
    
    .level-progress-bar::after {
        animation: none;
    }
}

.stats-compact {
    background: rgba(0, 0, 17, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 16px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stats-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle, rgba(168, 85, 247, 0.4) 2px, transparent 2px),
        radial-gradient(circle, rgba(168, 85, 247, 0.3) 1.5px, transparent 1.5px),
        radial-gradient(circle, rgba(168, 85, 247, 0.2) 1px, transparent 1px);
    background-position: 20px 25px, 60px 45px, 100px 20px;
    background-size: 120px 90px, 150px 110px, 180px 130px;
    animation: twinkle-slow 1.5s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.stats-compact > * {
    position: relative;
    z-index: 1;
}

.stats-compact:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(168, 85, 247, 0.2),
        inset 0 1px 0 rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
}

.stats-compact h3 {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 16px;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.stat-item .stat-label {
    font-size: 9px;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.stat-item .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #a855f7;
}

.collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.collapsible-header:hover {
    color: #ec4899;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsed .collapsible-content {
    display: none;
}

.game-status {
    margin-top: 16px;
    text-align: center;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.status-indicator.playing {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-indicator.paused {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.status-indicator.game-over {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .stat, .hold-section, .next-queue, .achievements, .leaderboard {
        border-width: 2px;
        border-color: #ffffff;
    }
    
    .control-btn {
        border-width: 2px;
    }
}