/* Prevent iOS context menu and improve touch handling */
* {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

canvas {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    /* Prevent iOS Safari zoom on double-tap */
    touch-action: manipulation;
}

.game-canvas {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loading-fill {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s ease-out;
    border-radius: 4px;
}

.loading-text {
    font-size: 1.1rem;
    opacity: 0.9;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #f97316;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --cell-size: 50px;
    --glow-color: #60a5fa;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    color: var(--text-primary);
    overflow: hidden;
    user-select: none;
}

#gameContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    overflow: hidden;
}

#vfxCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#gameLayer {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    height: 100vh;
    height: 100%;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
}

/* Game Header */
#gameHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    padding: 14px 22px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    min-height: 70px;
    width: 100%;
    max-width: 750px;
    gap: 20px;
    position: relative;
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.score-group {
    display: flex;
    gap: 16px;
    align-items: center;
    flex: 1;
    justify-content: center;
    padding: 0 8px;
}

.difficulty-badge {
    background: rgba(99, 102, 241, 0.3);
    color: var(--primary-color);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid rgba(99, 102, 241, 0.4);
    white-space: nowrap;
    flex-shrink: 0;
}

.score-container, .combo-container, .streak-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 0;
}

.score-label, .combo-label, .streak-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1;
    white-space: nowrap;
}

.score-value {
    font-size: 26px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.streak-value {
    font-size: 22px;
    font-weight: bold;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
    line-height: 1.2;
}

.combo-meter {
    width: 80px;
    height: 6px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 3px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.combo-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--secondary-color), var(--error-color));
    transition: width 0.3s ease;
}

.combo-multiplier {
    font-size: 20px;
    font-weight: bold;
    color: var(--secondary-color);
    line-height: 1.2;
    white-space: nowrap;
}

/* Sudoku Grid */
#sudokuContainer {
    position: relative;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(51, 65, 85, 0.7);
    width: min(680px, calc(100vw - 40px), calc(100vh - 280px));
    height: min(680px, calc(100vw - 40px), calc(100vh - 280px));
    flex-shrink: 0;
    aspect-ratio: 1/1;
}

#gridCanvas {
    display: block;
    cursor: pointer;
    width: 100% !important;
    height: 100% !important;
    max-width: 680px;
    max-height: 680px;
    image-rendering: crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
}

#gridOverlay {
    position: absolute;
    top: 10px;
    left: 10px;
    pointer-events: none;
}

/* Menu Popup */
.menu-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-out;
}

.menu-popup.hidden {
    display: none;
}

.menu-popup-content {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
                0 0 120px rgba(99, 102, 241, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1),
                inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    min-width: 320px;
    max-width: 90%;
}

.menu-popup-option {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    padding: 24px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 15px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 15px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.menu-popup-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
    transition: left 0.5s ease;
}

.menu-popup-option:hover {
    background: rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(15px) saturate(200%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
}

.menu-popup-option:hover::before {
    left: 100%;
}

.menu-popup-option:active {
    transform: translateY(-1px) scale(1.01);
}

.menu-popup-option svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.menu-popup-option span {
    flex: 1;
    text-align: left;
}

/* New Game button - green accent */
.menu-popup-option:first-child {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(16, 185, 129, 0.1));
}

.menu-popup-option:first-child:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(16, 185, 129, 0.2));
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Pause button - yellow accent */
.menu-popup-option:nth-child(2) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(245, 158, 11, 0.1));
}

.menu-popup-option:nth-child(2):hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.2));
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Settings button - purple accent */
.menu-popup-option:nth-child(3) {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(139, 92, 246, 0.1));
}

.menu-popup-option:nth-child(3):hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(139, 92, 246, 0.2));
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.menu-popup-option.cancel {
    background: rgba(30, 41, 59, 0.2);
    color: var(--text-secondary);
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.1);
    margin-top: 20px;
    padding: 18px;
    font-size: 16px;
    font-weight: 500;
}

.menu-popup-option.cancel:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

/* Control Panel */
#controlPanel {
    display: flex;
    flex-direction: row;
    gap: 15px;
    justify-content: center;
    align-items: center;
    max-width: 500px;
    flex-shrink: 0;
}

.side-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.icon-btn {
    width: 60px;
    height: 60px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.icon-btn.active {
    background: rgba(99, 102, 241, 0.5);
    border-color: var(--primary-color);
}

/* Number Pad */
#numberPad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
}

.num-btn {
    width: 95px;
    height: 95px;
    font-size: 32px;
    font-weight: bold;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.num-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.num-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.num-btn.focused {
    background: rgba(99, 102, 241, 0.4);
    border-color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

.num-btn.completed {
    opacity: 0.3;
    background: rgba(16, 185, 129, 0.2);
}

.num-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.complete-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    color: var(--success-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.num-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(10px) saturate(200%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

.action-btn:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.4);
    backdrop-filter: blur(10px) saturate(200%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(99, 102, 241, 0.6);
}

.num-btn.focused {
    background: var(--success-color) !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-2px);
}

.num-btn:active:not(:disabled), .action-btn:active:not(:disabled) {
    transform: translateY(0);
}

.num-btn:disabled, .action-btn:disabled, .num-btn.disabled, .action-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--bg-secondary);
    transform: none !important;
    box-shadow: none !important;
}

/* Completed number styles */
.num-btn.completed {
    position: relative;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.2)) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: rgba(16, 185, 129, 0.6) !important;
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.num-btn.completed .complete-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 14px;
    color: var(--success-color);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
    animation: pulse 2s infinite;
}

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


/* Game Controls */
#gameControls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px auto;
}

.control-btn {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(10px) saturate(200%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.overlay.hidden {
    display: none;
}

.overlay-content, .modal-content, .finish-content {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
                0 0 120px rgba(99, 102, 241, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1),
                inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Modal Specific */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal.hidden {
    display: none;
}


.modal-content h2, .finish-content h1 {
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 30px;
    text-align: center;
}

/* Difficulty Modal */
.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}

.difficulty-btn {
    padding: 24px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

.difficulty-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(15px) saturate(200%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
}

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

.difficulty-name {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.difficulty-desc {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.difficulty-btn:hover .difficulty-desc {
    opacity: 1;
    color: rgba(255, 255, 255, 0.9);
}

/* Pause Menu Styles - Vertical like difficulty picker */
.pause-menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px 0;
}

.pause-menu-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 24px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

.pause-menu-btn svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    stroke: var(--primary-color);
    opacity: 0.9;
    transition: all 0.3s ease;
}

.pause-menu-text {
    flex-grow: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

.pause-menu-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(15px) saturate(200%);
    transform: translateX(5px) scale(1.02);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
}

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

.pause-menu-btn:hover svg {
    stroke: #ffffff;
    opacity: 1;
    transform: scale(1.1);
}

.pause-menu-btn:active {
    transform: translateX(3px) scale(0.98);
}

/* Highlight the resume button */
#resumeBtn {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
}

#resumeBtn svg {
    stroke: #22c55e;
}

#resumeBtn:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Difficulty indicator icons */
.difficulty-btn[data-difficulty="beginner"] .difficulty-name::before {
    content: '⭐';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="easy"] .difficulty-name::before {
    content: '⭐⭐';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="medium"] .difficulty-name::before {
    content: '⭐⭐⭐';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="hard"] .difficulty-name::before {
    content: '⭐⭐⭐⭐';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="expert"] .difficulty-name::before {
    content: '⭐⭐⭐⭐⭐';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="extreme"] .difficulty-name::before {
    content: '💀';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="diabolical"] .difficulty-name::before {
    content: '👹';
    margin-right: 10px;
}

.difficulty-btn[data-difficulty="nightmare"] .difficulty-name::before {
    content: '😈';
    margin-right: 10px;
}

/* Harder Modes Button Special Styling */
.harder-modes-btn {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.3), rgba(139, 92, 246, 0.3));
    border: 1px solid rgba(220, 38, 38, 0.4);
    position: relative;
    overflow: hidden;
}

.harder-modes-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(220, 38, 38, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.harder-modes-btn:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.5), rgba(139, 92, 246, 0.5));
    border-color: rgba(220, 38, 38, 0.6);
    box-shadow: 0 8px 30px rgba(220, 38, 38, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Back Button */
.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 12px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.back-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

/* Difficulty Warning */
.difficulty-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    margin: 20px 0;
    color: rgba(248, 113, 113, 1);
    font-size: 14px;
    line-height: 1.5;
}

.difficulty-warning svg {
    flex-shrink: 0;
    color: rgba(239, 68, 68, 1);
}

/* Premium Settings Modal Styles */
.settings-modal-content {
    background: rgba(30, 41, 59, 0.5) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
                0 0 120px rgba(99, 102, 241, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1),
                inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.settings-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(135deg, #ffffff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.settings-section {
    margin: 25px 0;
    padding: 20px;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.settings-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
}

.settings-section.collapsible .settings-section-header {
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.settings-section.collapsible .settings-section-header:hover {
    opacity: 0.8;
}

.collapse-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
    stroke: var(--primary-color);
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.settings-section.collapsible .settings-items.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.settings-section.collapsible .settings-items:not(.collapsed) {
    max-height: 500px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.settings-section.collapsible .settings-section-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

.settings-section-header svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary-color);
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.3));
}

.settings-section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Toggle Switch Items */
.settings-toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(30, 41, 59, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.settings-toggle-item:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateX(3px);
}

.settings-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-toggle-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-toggle-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

/* Custom Toggle Switch */
.settings-toggle {
    position: relative;
    width: 56px;
    height: 28px;
    cursor: pointer;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(71, 85, 105, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.settings-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.settings-toggle input:checked + .settings-toggle-slider {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: rgba(139, 92, 246, 0.5);
}

.settings-toggle input:checked + .settings-toggle-slider:before {
    transform: translateX(28px);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.5);
}

/* Disabled toggle state */
.settings-toggle input:disabled + .settings-toggle-slider {
    background: rgba(71, 85, 105, 0.2);
    border-color: rgba(99, 102, 241, 0.1);
    cursor: not-allowed;
}

.settings-toggle input:disabled + .settings-toggle-slider:before {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.settings-toggle-item.disabled {
    opacity: 0.5;
}

.settings-toggle-item.disabled .settings-toggle {
    cursor: not-allowed;
}

/* Slider Items */
.settings-slider-item {
    padding: 15px;
    background: rgba(30, 41, 59, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.settings-slider-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.settings-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.settings-slider-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-slider-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    min-width: 50px;
    text-align: center;
}

/* Custom Range Slider */
.settings-slider {
    width: 100%;
    height: 6px;
    border-radius: 10px;
    background: rgba(71, 85, 105, 0.3);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.7);
}

.settings-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
}

.settings-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.7);
}

/* Account Section Styles */
.settings-account-card {
    padding: 20px;
    background: rgba(30, 41, 59, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-account-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-account-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-account-email {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.settings-btn-signout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #ff6b6b;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-btn-signout:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.settings-btn-signout svg {
    width: 18px;
    height: 18px;
}

/* Login Card Styles */
.settings-login-card {
    padding: 20px;
    background: rgba(30, 41, 59, 0.2);
    border-radius: 12px;
}

.settings-login-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    text-align: center;
    line-height: 1.5;
}

.settings-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

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

.settings-auth-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.settings-auth-btn span {
    white-space: nowrap;
}

.google-settings {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.google-settings:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
    border-color: rgba(66, 133, 244, 0.5);
}

.twitter-settings {
    background: rgba(29, 161, 242, 0.1);
    border: 1px solid rgba(29, 161, 242, 0.2);
    color: white;
}

.twitter-settings:hover {
    background: rgba(29, 161, 242, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(29, 161, 242, 0.3);
    border-color: rgba(29, 161, 242, 0.5);
}

/* Settings Close Button */
.settings-close-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.settings-close-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;
}

.settings-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

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

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

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 5px;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.2);
    backdrop-filter: blur(15px);
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Cancel button styling */
#cancelDifficulty {
    margin-top: 10px;
    width: 100%;
}

/* Game Messages */
.game-message {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.9), rgba(255, 183, 0, 0.9));
    backdrop-filter: blur(10px);
    color: #000;
    font-size: 20px;
    font-weight: bold;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.5),
                0 0 60px rgba(255, 215, 0, 0.3);
    z-index: 1000;
    animation: slideDown 0.5s ease-out, fadeOut 0.5s ease-out 1.5s forwards;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Premium Game Over Screen */
.gameover-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(13, 17, 23, 0.98) 50%, rgba(30, 41, 59, 0.95) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.gameover-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.gameover-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Animated Background Effect */
.gameover-bg-effect {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(220, 38, 38, 0.1) 0%, transparent 70%);
    animation: gameoverPulse 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes gameoverPulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.gameover-content-wrapper {
    position: relative;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
                0 0 140px rgba(220, 38, 38, 0.08),
                inset 0 2px 2px rgba(255, 255, 255, 0.1),
                inset 0 -2px 2px rgba(0, 0, 0, 0.3);
    padding: 3rem;
    animation: gameoverSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes gameoverSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Header Section */
.gameover-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.gameover-icon-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
}

.gameover-icon-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.4) 0%, transparent 70%);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 0.3; }
}

.gameover-icon {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-radius: 50%;
    border: 2px solid rgba(220, 38, 38, 0.3);
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.2),
                inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.gameover-icon svg {
    color: #ef4444;
    filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.4));
}

.gameover-title {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ef4444 0%, #f87171 50%, #fca5a5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
}

.gameover-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Stats Section */
.gameover-stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.gameover-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gameover-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.4), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

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

.gameover-stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.stat-icon svg {
    color: #f87171;
    width: 20px;
    height: 20px;
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
}

/* Action Buttons */
.gameover-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.gameover-action-btn {
    flex: 1;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
}

.gameover-action-btn .btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.gameover-action-btn .btn-hint {
    display: block;
    font-size: 0.8rem;
    padding: 0.5rem;
    opacity: 0.6;
    font-weight: 400;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Primary Button (Undo) */
.gameover-action-btn.primary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    color: white;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.gameover-action-btn.primary::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;
}

.gameover-action-btn.primary:hover::before {
    left: 100%;
}

.gameover-action-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.gameover-action-btn.primary:active {
    transform: translateY(-1px);
}

/* Secondary Button (New Game) */
.gameover-action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.gameover-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.gameover-action-btn.secondary:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 640px) {
    .gameover-container {
        padding: 1rem;
    }
    
    .gameover-content-wrapper {
        padding: 2rem 1.5rem;
    }
    
    .gameover-title {
        font-size: 2.2rem;
    }
    
    .gameover-stats-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .gameover-stat-card {
        flex-direction: row;
        justify-content: space-between;
        padding: 1rem 1.25rem;
    }
    
    .stat-content {
        flex-direction: row;
        gap: 1rem;
        align-items: center;
    }
    
    .gameover-actions {
        flex-direction: column;
    }
    
    .gameover-action-btn .btn-content {
        padding: 1rem 1.25rem;
    }
}

/* Finish Screen */
.finish-content h1 {
    text-align: center;
    font-size: 42px;
    margin-bottom: 35px;
    font-weight: 700;
    animation: celebrateText 0.6s ease-out;
}

@keyframes celebrateText {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.score-breakdown {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
                inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 18px;
    transition: all 0.3s ease;
}

.score-row span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.score-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.score-row.total {
    border-top: 2px solid rgba(99, 102, 241, 0.3);
    margin-top: 15px;
    padding-top: 20px;
    font-size: 28px;
    font-weight: bold;
}

.score-row.total span:last-child {
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.finish-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.primary-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.btn-large {
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.btn-small {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
}

.btn-submit-score {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-submit-score:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(167, 139, 250, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Leaderboard Section */
.leaderboard-section {
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.leaderboard-section.compact {
    padding: 18px;
    margin-top: 20px;
}

.leaderboard-title {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.leaderboard-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.leaderboard-item:hover::before {
    transform: translateX(100%);
}

.leaderboard-item:hover {
    background: rgba(30, 41, 59, 0.6);
    transform: translateX(5px);
}

.rank-badge {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    color: #a78bfa;
    margin-right: 12px;
    flex-shrink: 0;
}

.leaderboard-item.rank-1 .rank-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e293b;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.leaderboard-item.rank-2 .rank-badge {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #1e293b;
    box-shadow: 0 0 15px rgba(203, 213, 225, 0.3);
}

.leaderboard-item.rank-3 .rank-badge {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
}

.player-name {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
    color: #e2e8f0;
}

.player-score {
    font-weight: 700;
    font-size: 15px;
    color: #60a5fa;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.leaderboard-item.rank-1 .player-score {
    color: #fbbf24;
    font-size: 16px;
}

.leaderboard-item.rank-2 .player-score {
    color: #cbd5e1;
}

.leaderboard-item.rank-3 .player-score {
    color: #f97316;
}

/* Sign Up Section (placeholder) */
.signup-section {
    background: rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.signup-section h3 {
    color: #e2e8f0;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

.signup-section p {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.signup-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.signup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

/* Tactics Overlay */
.tactics-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

#techniqueName {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 24px;
}

#techniqueDescription {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px var(--glow-color); }
    50% { box-shadow: 0 0 20px var(--glow-color), 0 0 30px var(--glow-color); }
    100% { box-shadow: 0 0 5px var(--glow-color); }
}

.cell-highlight {
    animation: glow 1s ease-in-out infinite;
}

.score-pop {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: var(--success-color);
    pointer-events: none;
    animation: scoreFloat 1s ease-out forwards;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 4px rgba(16, 185, 129, 0.4);
}

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

/* Keep desktop at default sizes - no media query needed since base styles are for desktop */

/* Tablet/Mid-size screens */
@media (min-width: 769px) and (max-width: 1024px) {
    #gameLayer {
        max-width: 800px;
        padding: 30px 20px;
        gap: 25px;
    }
    
    #sudokuContainer {
        width: min(550px, calc(100vw - 40px));
        height: min(550px, calc(100vh - 250px));
    }
    
    #gridCanvas {
        max-width: 520px;
        max-height: 520px;
    }
    
    .num-btn {
        width: 80px;
        height: 80px;
    }
    
    #controlPanel {
        max-width: 420px;
    }
}

/* Desktop screens - optimized to keep everything above fold */
@media (min-width: 1025px) {
    #gameLayer {
        max-width: 1000px;
        padding: 15px 20px;
        gap: 15px;
        justify-content: center;
    }
    
    #gameHeader {
        margin-bottom: 0;
        max-width: 650px;
        min-height: 60px;
        padding: 12px 20px;
    }
    
    #sudokuContainer {
        width: min(540px, calc(100vh - 320px));
        height: min(540px, calc(100vh - 320px));
        padding: 12px;
    }
    
    #gridCanvas {
        max-width: 500px;
        max-height: 500px;
    }
    
    #controlPanel {
        max-width: 450px;
        gap: 12px;
        margin-top: 5px;
    }
    
    #numberPad {
        gap: 8px;
    }
    
    .num-btn {
        width: 75px;
        height: 75px;
        font-size: 28px;
    }
    
    .icon-btn {
        width: 55px;
        height: 55px;
    }
    
    .side-actions {
        gap: 6px;
    }
}

/* Large desktop screens */
@media (min-width: 1400px) {
    #gameLayer {
        padding: 20px;
        gap: 18px;
    }
    
    #sudokuContainer {
        width: min(580px, calc(100vh - 300px));
        height: min(580px, calc(100vh - 300px));
    }
    
    #gridCanvas {
        max-width: 550px;
        max-height: 550px;
    }
    
    .num-btn {
        width: 80px;
        height: 80px;
        font-size: 30px;
    }
    
    .icon-btn {
        width: 58px;
        height: 58px;
    }
}

/* Very small height screens (laptops with limited height) */
@media (min-width: 1025px) and (max-height: 800px) {
    #gameLayer {
        padding: 10px 20px;
        gap: 10px;
    }
    
    #gameHeader {
        min-height: 50px;
        padding: 10px 18px;
    }
    
    #sudokuContainer {
        width: min(480px, calc(100vh - 280px));
        height: min(480px, calc(100vh - 280px));
        padding: 10px;
    }
    
    #gridCanvas {
        max-width: 450px;
        max-height: 450px;
    }
    
    .num-btn {
        width: 70px;
        height: 70px;
        font-size: 26px;
    }
    
    .icon-btn {
        width: 50px;
        height: 50px;
    }
    
    #controlPanel {
        gap: 10px;
    }
    
    #numberPad {
        gap: 6px;
    }
}

/* Mobile Specific Styles */
@media (max-width: 768px) {
    /* Fix for iOS Safari viewport - use available height */
    #gameContainer {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100); /* Use JS-calculated viewport height */
        padding: 0;
        overflow: hidden;
    }
    
    #gameLayer {
        width: 100%;
        height: 100%;
        padding: 5px 0 0 0;
        gap: 5px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        overflow: hidden;
        padding-top: max(5px, env(safe-area-inset-top, 5px));
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    #gameHeader {
        padding: 6px 10px;
        min-height: 40px;
        max-height: 40px;
        width: 100%;
        gap: 6px;
        flex-shrink: 0;
        z-index: 10;
    }
    
    .score-group {
        gap: 6px;
        padding: 0;
    }
    
    .score-label, .combo-label, .streak-label {
        font-size: 8px;
    }
    
    .score-value {
        font-size: 14px;
    }
    
    .streak-value {
        font-size: 12px;
    }
    
    .combo-multiplier {
        font-size: 11px;
    }
    
    .combo-meter {
        width: 45px;
        height: 3px;
    }
    
    .difficulty-badge {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    #sudokuContainer {
        padding: 0;
        width: 100%;
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        min-height: 0; /* Important for flexbox */
        background: transparent;
        border: none;
        box-shadow: none;
        border-radius: 0;
    }
    
    #gridCanvas {
        width: min(95vw, calc(100vh - 180px)) !important;
        height: min(95vw, calc(100vh - 180px)) !important;
        max-width: 600px !important;
        max-height: 600px !important;
    }
    
    #controlPanel {
        width: 100%;
        padding: 10px 10px;
        padding-bottom: max(25px, calc(15px + env(safe-area-inset-bottom, 10px)));
        gap: 10px;
        flex-shrink: 0;
        background: transparent;
        border-top: none;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        max-height: 130px; /* Limit control panel height */
    }
    
    .side-actions {
        display: flex;
        flex-direction: column;
        gap: 5px;
        margin: 0 5px;
        flex-shrink: 0;
    }
    
    .icon-btn {
        width: 40px;
        height: 40px;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    #numberPad {
        gap: 5px;
        grid-template-columns: repeat(3, 1fr);
        display: grid;
        flex: 0 0 auto;
        width: 240px;
        max-width: 240px;
    }
    
    .num-btn {
        width: 100%;
        height: 42px;
        padding: 0;
        font-size: 18px;
        min-width: 0;
    }
    
    /* Fix modal centering on mobile */
    .modal, .overlay {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
    
    .modal-content, .finish-content {
        width: 100%;
        max-width: 400px;
        max-height: 90vh;
        overflow-y: auto;
        margin: 0 auto;
        padding: 30px 20px;
    }
    
    .difficulty-options {
        gap: 10px;
    }
    
    .difficulty-btn {
        padding: 18px;
        font-size: 14px;
    }
    
    .difficulty-name {
        font-size: 18px;
    }
    
    .difficulty-desc {
        font-size: 12px;
    }
    
    .finish-content h1 {
        font-size: 32px;
    }
    
    .signup-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .signup-section h3 {
        font-size: 16px;
    }
    
    .signup-section p {
        font-size: 13px;
    }
    
    .finish-buttons {
        width: 100%;
    }
    
    .primary-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        margin: 5px 0;
    }
    
    .btn-large {
        width: 100%;
    }
    
    .btn-small {
        width: 100%;
    }
    
    .leaderboard-section {
        padding: 20px 15px;
    }
    
    .leaderboard-item {
        padding: 10px 12px;
    }
    
    .player-name {
        font-size: 14px;
    }
    
    .player-score {
        font-size: 15px;
    }
    
    .user-email-victory {
        max-width: 120px;
    }
    
    .btn-submit-score-inline {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    #gameContainer {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
}

/* Safari specific fixes (desktop and mobile) */
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
    #gameLayer {
        display: -webkit-flex;
        display: flex;
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-justify-content: space-between;
        justify-content: space-between;
        -webkit-align-items: center;
        align-items: center;
        height: 100vh;
        padding: 20px;
        box-sizing: border-box;
    }
    
    #gameHeader {
        -webkit-flex-shrink: 0;
        flex-shrink: 0;
    }
    
    #sudokuContainer {
        -webkit-flex-shrink: 0;
        flex-shrink: 0;
        width: min(520px, calc(100vw - 40px), calc(100vh - 240px));
        height: min(520px, calc(100vw - 40px), calc(100vh - 240px));
    }
    
    #controlPanel {
        -webkit-flex-shrink: 0;
        flex-shrink: 0;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    #gameLayer {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    #gameHeader {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    #sudokuContainer {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    
    #gridCanvas {
        -webkit-backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        backface-visibility: hidden;
        transform: translateZ(0);
    }
}

/* Even smaller screens */
@media (max-width: 400px) {
    #gameHeader {
        padding: 5px 8px;
    }
    
    .score-value {
        font-size: 16px;
    }
    
    .streak-value {
        font-size: 14px;
    }
    
    #numberPad {
        width: 220px;
        max-width: 220px;
    }
    
    .num-btn {
        height: 38px;
        font-size: 16px;
    }
    
    .icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Contextual Erase Button */
.contextual-erase {
    position: absolute;
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(239, 68, 68, 0.3);
    animation: popIn 0.2s ease-out;
}

.contextual-erase:hover {
    transform: scale(1.1);
    background: rgba(239, 68, 68, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4),
                0 0 30px rgba(239, 68, 68, 0.5);
}

.contextual-erase:active {
    transform: scale(0.95);
}

.contextual-erase.hidden {
    display: none;
}

.contextual-erase svg {
    width: 16px;
    height: 16px;
    stroke-width: 3;
}

/* Erase Popup */
.erase-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease-out;
}

.erase-popup.hidden {
    display: none;
}

.erase-popup-content {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popIn 0.3s ease-out;
    min-width: 200px;
}

/* Mobile improvements for erase popup */
@media (max-width: 768px) {
    .erase-popup-content {
        padding: 15px;
        min-width: 250px;
    }
    
    .erase-option {
        min-height: 50px;
        padding: 12px 20px;
        font-size: 16px;
    }
}

.erase-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin: 5px 0;
}

.erase-option:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateX(5px);
}

.erase-option svg {
    width: 20px;
    height: 20px;
}

.erase-option.cancel {
    color: var(--text-secondary);
    justify-content: center;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    margin-top: 10px;
    padding-top: 20px;
}

.erase-option.cancel:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: none;
}

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

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Combo meter penalty animations */
@keyframes comboPulseError {
    0%, 100% {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.8),
                    inset 0 0 10px rgba(239, 68, 68, 0.4);
        transform: scale(1.05);
    }
}

@keyframes comboPulseWarning {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

.combo-pulse-error {
    animation: comboPulseError 0.5s ease-out;
}

.combo-pulse-warning {
    animation: comboPulseWarning 0.5s ease-out;
}

.combo-multiplier.combo-pulse-error {
    animation: comboPulseError 0.5s ease-out;
    color: var(--error-color) !important;
}

.combo-multiplier.combo-pulse-warning {
    animation: comboPulseWarning 0.5s ease-out;
    color: var(--secondary-color) !important;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* High Contrast Theme */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #ffffff;
        --text-primary: #ffffff;
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --border-color: #ffffff;
    }
}

/* Note Limit Message Animation */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

/* Login and Authentication Styles */
.login-prompt {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border: 1px solid #667eea30;
    border-radius: 10px;
}

.login-prompt-text {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.login-prompt-text svg {
    flex-shrink: 0;
    color: #667eea;
}

.login-link {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.login-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Auth Buttons in Victory Screen */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.signup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.google-btn {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
}

.google-btn:hover {
    background: #f8f8f8;
    border-color: #4285F4;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(66, 133, 244, 0.3);
}

.twitter-btn {
    background: #000;
    color: white;
}

.twitter-btn:hover {
    background: #111;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.auth-icon {
    width: 20px;
    height: 20px;
}

/* User welcome message - removed duplicate rules */


/* Quick Login Buttons in Difficulty Selector */
.quick-login-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.quick-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.quick-login-btn svg {
    width: 18px;
    height: 18px;
}

.google-mini {
    background: white;
    color: #333;
    border: 1px solid #dadce0;
}

.google-mini:hover {
    background: #f8f9fa;
    border-color: #4285f4;
    box-shadow: 0 1px 3px rgba(66, 133, 244, 0.3);
}

.twitter-mini {
    background: #000;
    color: white;
    border: 1px solid #000;
}

.twitter-mini:hover {
    background: #1a1a1a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}


/* Logged In User Display in Difficulty Selector */
.login-prompt.logged-in {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%);
    border-color: #10b981;
    background-color: rgba(255, 255, 255, 0.05); /* Add slight white background for better contrast */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.user-icon {
    color: #10b981;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-label {
    font-size: 0.75rem;
    color: #9ca3af;  /* Lighter gray for better visibility on dark backgrounds */
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.user-email {
    font-size: 0.95rem;
    color: #10b981;  /* Changed to green for better visibility */
    font-weight: 600;  /* Made bolder */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check-icon {
    color: #10b981;
    flex-shrink: 0;
}


/* Victory Screen Logged In Display */
.signup-section.logged-in-victory {
    background: linear-gradient(135deg, #10b98115 0%, #05966915 100%);
    border: 1px solid #10b98130;
    border-radius: 12px;
    padding: 20px;
}

/* Compact logged-in victory section */
.signup-section.logged-in-victory.compact {
    padding: 12px 16px;
    margin-top: 18px;
}

.user-status-victory {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-info-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.btn-submit-score-inline {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-submit-score-inline:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
    border-color: rgba(167, 139, 250, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.user-status-victory {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.user-icon-victory {
    color: #10b981;
    flex-shrink: 0;
}

.user-details-victory {
    display: flex;
    flex-direction: column;
}

.user-label-victory {
    font-size: 0.85rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.user-email-victory {
    font-size: 1.1rem;
    color: #e5e7eb;
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check-icon-victory {
    color: #10b981;
    flex-shrink: 0;
}

/* Menu Popup User Status */
.menu-user-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #667eea20;
}

.menu-user-icon {
    color: #667eea;
    flex-shrink: 0;
}

.menu-user-email {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Menu Login Prompt */
.menu-login-prompt {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.menu-login-text {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.menu-login-text svg {
    width: 16px;
    height: 16px;
    color: var(--primary-color);
}

.menu-quick-login {
    display: flex;
    gap: 8px;
}

.menu-login-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(30, 41, 59, 0.3);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.menu-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-login-btn svg {
    width: 16px;
    height: 16px;
}

.menu-login-btn.google-mini:hover {
    background: rgba(66, 133, 244, 0.2);
    border-color: rgba(66, 133, 244, 0.4);
}

.menu-login-btn.twitter-mini:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 70px;
    right: 20px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(239, 68, 68, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease-out;
}

.offline-indicator.hidden {
    display: none;
}

.offline-indicator.online {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2),
                0 0 20px rgba(34, 197, 94, 0.2);
}

.offline-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.offline-icon {
    font-size: 1rem;
}

.sync-status {
    font-size: 0.75rem;
    opacity: 0.9;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    margin-left: 4px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Settings Account Section */
.account-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

.account-label {
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.account-email {
    font-size: 1rem;
    color: #111827;
    font-weight: 500;
}

.btn-signout {
    width: 100%;
    padding: 10px 20px;
    background: white;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-signout:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}


/* Settings Login Section */
.settings-login-prompt {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
}

.settings-login-text {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 15px;
    text-align: center;
}

.settings-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.settings-login-btn svg {
    width: 20px;
    height: 20px;
}

.google-settings {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
}

.google-settings:hover {
    background: #f8f8f8;
    border-color: #4285F4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.twitter-settings {
    background: #000;
    color: white;
    border: 2px solid #000;
}

.twitter-settings:hover {
    background: #111;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Victory Screen Username Section */
.victory-username-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

/* When user has a username - single row layout */
.victory-username-section.has-username {
    gap: 0.5rem;
}

.victory-username-section.has-username .victory-username-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: auto;
    max-width: none;
}

.victory-username-section.has-username .user-icon-victory {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.victory-username-section.has-username .victory-username-feedback {
    display: none; /* Hide feedback when username is set */
}

.victory-username-section.has-username .btn-submit-score {
    margin: 0;
    width: auto;
    max-width: none;
    padding: 0.5rem 1.5rem;
    white-space: nowrap;
}

.victory-username-section.has-username .btn-submit-score:disabled {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.2));
    border-color: rgba(34, 197, 94, 0.3);
    color: #10b981;
}

.victory-username-section.has-username .victory-username-display {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Default row styling */
.victory-username-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
}

.victory-username-display {
    font-size: 1rem;
    color: var(--text-primary);
}

/* When user needs to input username - two row layout */
.victory-username-section.needs-username .victory-username-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
}

.victory-username-section.needs-username .victory-username-row .btn-submit-score {
    display: none; /* Hide button in row for needs-username mode */
}

.victory-username-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.victory-username-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.victory-username-feedback {
    font-size: 0.85rem;
    min-height: 1.2rem;
    text-align: center;
    width: 100%;
}

.victory-username-feedback.error {
    color: var(--error-color);
}

.victory-username-feedback.success {
    color: var(--success-color);
}

.victory-username-feedback.checking {
    color: var(--text-secondary);
}

.btn-submit-score {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 280px;
}

/* In single-row layout, button has auto width */
.victory-username-section.has-username .btn-submit-score {
    width: auto;
    max-width: none;
}

.btn-submit-score:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-submit-score:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .victory-username-section {
        padding: 0.75rem;
    }
    
    .victory-username-row {
        max-width: 100%;
    }
    
    .victory-username-section.has-username .victory-username-row {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 0.75rem;
    }
    
    .victory-username-section.has-username .victory-username-display {
        max-width: 120px;
        font-size: 0.9rem;
    }
    
    .victory-username-section.has-username .btn-submit-score {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .victory-username-section.needs-username .btn-submit-score {
        width: 100%;
        max-width: 100%;
    }
}


/* Leaderboard Screen Styles */
.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 17, 23, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(20px);
}

.leaderboard-modal.visible {
    display: block;
    opacity: 1;
}

.leaderboard-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: max(2rem, calc(1rem + env(safe-area-inset-top, 0px)));
    padding-bottom: max(2rem, calc(1rem + env(safe-area-inset-bottom, 0px)));
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
    position: relative;
}

.leaderboard-title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.leaderboard-main-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.3);
}

.leaderboard-title-decoration {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b, #dc2626);
    margin-top: 8px;
    border-radius: 2px;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 0.8; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(10px); }
}

.leaderboard-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.leaderboard-close-btn:hover {
    color: var(--text-primary);
}

.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
}

.leaderboard-tab {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-icon {
    font-size: 1.2rem;
    filter: brightness(0.8);
    transition: filter 0.3s ease;
}

.leaderboard-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.leaderboard-tab:hover .tab-icon {
    filter: brightness(1.2);
}

.leaderboard-tab.active {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.1));
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-weight: 600;
}

.leaderboard-tab.active .tab-icon {
    filter: brightness(1.3);
}

.leaderboard-tab.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    border-radius: 2px;
}

.leaderboard-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.leaderboard-info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.leaderboard-info {
    text-align: center;
    flex: 1;
}

.leaderboard-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.filter-dropdown {
    appearance: none;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 8px 40px 8px 15px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.filter-dropdown:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.filter-dropdown:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.filter-dropdown option {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px;
}

.filter-dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #a78bfa;
    transition: transform 0.3s ease;
}

.filter-dropdown:focus + .filter-dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.info-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    color: #a78bfa;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.leaderboard-table {
    width: 100%;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.leaderboard-row::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.6s ease;
}

.leaderboard-row:hover {
    background: rgba(30, 41, 59, 0.5);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.leaderboard-row:hover::before {
    left: 100%;
}

.leaderboard-row.header {
    font-size: 0.85rem;
    color: #94a3b8;
    border-bottom: 2px solid rgba(99, 102, 241, 0.1);
    margin-bottom: 1rem;
    background: transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    padding: 0.8rem 1.2rem;
}

.leaderboard-row.header:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

.leaderboard-rank {
    width: 60px;
    font-weight: bold;
    color: var(--text-secondary);
}

.leaderboard-row.rank-1 {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.leaderboard-row.rank-1 .leaderboard-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3rem;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.leaderboard-row.rank-2 {
    background: linear-gradient(135deg, rgba(203, 213, 225, 0.1), rgba(148, 163, 184, 0.08));
    border: 1px solid rgba(203, 213, 225, 0.2);
}

.leaderboard-row.rank-2 .leaderboard-rank {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2rem;
}

.leaderboard-row.rank-3 {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(234, 88, 12, 0.08));
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.leaderboard-row.rank-3 .leaderboard-rank {
    background: linear-gradient(135deg, #f97316, #ea580c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.1rem;
}

.leaderboard-username {
    flex: 1;
    font-weight: 600;
    font-size: 1.05rem;
    color: #e2e8f0;
}

.leaderboard-row.rank-1 .leaderboard-username {
    color: #fef3c7;
}

.leaderboard-row.rank-2 .leaderboard-username {
    color: #e0e7ff;
}

.leaderboard-row.rank-3 .leaderboard-username {
    color: #fed7aa;
}

.leaderboard-score {
    width: 120px;
    text-align: right;
    font-weight: bold;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.leaderboard-row.rank-1 .leaderboard-score {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.2rem;
}

.leaderboard-time,
.leaderboard-games,
.leaderboard-fastest-time {
    width: 100px;
    text-align: right;
    color: #94a3b8;
    font-size: 0.95rem;
}

.leaderboard-fastest-time {
    color: #10b981;
    font-weight: 700;
    font-size: 1.1rem;
    width: 120px;
}

.leaderboard-mode {
    width: 110px;
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.leaderboard-mode .mode-icon {
    font-size: 0.9rem;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

.leaderboard-mode .mode-text {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.leaderboard-mode::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer-mode 3s infinite;
}

@keyframes shimmer-mode {
    0%, 100% { transform: rotate(0deg) scale(1); opacity: 0; }
    50% { transform: rotate(180deg) scale(1.1); opacity: 1; }
}

/* Premium difficulty badge styles with gradients */
.leaderboard-mode.difficulty-beginner {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.leaderboard-mode.difficulty-easy {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    border: 1px solid rgba(96, 165, 250, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

.leaderboard-mode.difficulty-medium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: 1px solid rgba(251, 191, 36, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.leaderboard-mode.difficulty-hard {
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: 1px solid rgba(249, 115, 22, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.leaderboard-mode.difficulty-expert {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border: 1px solid rgba(220, 38, 38, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    animation: expert-pulse 2s infinite;
}

@keyframes expert-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(220, 38, 38, 0.6); }
}

.leaderboard-mode.difficulty-unknown {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.3);
}

.leaderboard-mode:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.leaderboard-streak {
    width: 80px;
    text-align: right;
    color: #f59e0b;
    font-weight: 600;
}

.leaderboard-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed rgba(99, 102, 241, 0.2);
}

.leaderboard-loading {
    text-align: center;
    padding: 4rem 2rem;
    color: #a78bfa;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
}

.leaderboard-loading::after {
    content: '...';
    position: absolute;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.leaderboard-current-user {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
    border: 2px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.4); }
}

/* Settings Username Section */
.settings-username-section {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-username-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.settings-username-display {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.settings-username-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.settings-username-input input {
    flex: 1;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
}

.settings-username-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.settings-username-btn:hover {
    background: #5558e3;
}

.settings-username-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Difficulty Modal Leaderboard Button */
.difficulty-leaderboard-section {
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.difficulty-leaderboard-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.difficulty-leaderboard-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.difficulty-leaderboard-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive Leaderboard Styles */
@media (max-width: 768px) {
    .leaderboard-container {
        padding: 1rem;
    }
    
    .leaderboard-main-title {
        font-size: 1.8rem;
    }
    
    .leaderboard-title-decoration {
        width: 60px;
        height: 2px;
    }
    
    .leaderboard-tabs {
        gap: 0.25rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .leaderboard-tab {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .tab-icon {
        font-size: 1rem;
    }
    
    .leaderboard-content {
        padding: 1rem;
    }
    
    .leaderboard-row {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .leaderboard-row.header {
        font-size: 0.75rem;
        padding: 0.5rem 0.8rem;
    }
    
    .leaderboard-rank {
        width: 40px;
    }
    
    .leaderboard-username {
        font-size: 0.95rem;
    }
    
    .leaderboard-score {
        width: 80px;
        font-size: 0.95rem;
    }
    
    .leaderboard-time,
    .leaderboard-games,
    .leaderboard-fastest-time {
        width: 60px;
        font-size: 0.85rem;
    }
    
    .leaderboard-mode {
        width: 85px;
        padding: 2px 6px;
        border-radius: 12px;
    }
    
    .leaderboard-mode .mode-icon {
        font-size: 0.8rem;
    }
    
    .leaderboard-mode .mode-text {
        font-size: 0.65rem;
        letter-spacing: 0.3px;
    }
    
    .leaderboard-streak {
        width: 50px;
        font-size: 0.85rem;
    }
    
    .info-badge {
        font-size: 0.8rem;
        padding: 0.4rem 1rem;
    }
    
    .leaderboard-info-container {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-dropdown-wrapper {
        width: 100%;
    }
    
    .filter-dropdown {
        width: 100%;
        font-size: 0.85rem;
        padding: 6px 35px 6px 12px;
        min-width: unset;
    }
    
    .filter-label {
        font-size: 0.8rem;
    }
    
    /* Hide less important columns on very small screens */
    @media (max-width: 480px) {
        .leaderboard-streak {
            display: none;
        }
        
        .leaderboard-main-title {
            font-size: 1.5rem;
        }
        
        .leaderboard-tab span:not(.tab-icon) {
            display: none;
        }
        
        .leaderboard-tab {
            padding: 0.7rem;
        }
        
        .leaderboard-mode {
            width: 65px;
            padding: 1px 3px;
            gap: 2px;
        }
        
        .leaderboard-mode .mode-icon {
            font-size: 0.7rem;
        }
        
        .leaderboard-mode .mode-text {
            display: none;
        }
        
        .leaderboard-score {
            width: 60px;
            font-size: 0.85rem;
        }
        
        .filter-dropdown {
            font-size: 0.8rem;
            padding: 5px 30px 5px 10px;
        }
    }
    
    /* iOS PWA Safe Area Adjustments for Leaderboard */
    .leaderboard-modal {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .leaderboard-container {
        padding: 1rem;
        padding-top: max(1.5rem, calc(1rem + env(safe-area-inset-top, 0px)));
        padding-bottom: max(1.5rem, calc(1rem + env(safe-area-inset-bottom, 0px)));
        height: 100%;
        height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
    
    .leaderboard-header {
        position: sticky;
        top: 0;
        background: rgba(13, 17, 23, 0.95);
        backdrop-filter: blur(10px);
        z-index: 10;
        padding-top: 0.5rem;
        margin-top: -0.5rem;
        margin-bottom: 1rem;
    }
    
    .leaderboard-close-btn {
        padding: 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Empty State Overlay Styles */
.empty-state-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 90%;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

.empty-state-overlay.hidden {
    display: none;
}

.empty-state-content {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(31, 41, 55, 0.95) 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 
                0 0 100px rgba(139, 92, 246, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(10px);
    width: 100%;
}

.empty-state-logo {
    margin-bottom: 2rem;
}

.empty-state-title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.02em;
    animation: shimmer 3s ease-in-out infinite;
}

.empty-state-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0.5rem 0 0 0;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.empty-state-message {
    margin-bottom: 2rem;
}

.empty-state-message p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-weight: 400;
}

.empty-state-new-game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4),
                0 0 40px rgba(245, 158, 11, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

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

.empty-state-new-game-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 30px rgba(245, 158, 11, 0.6),
                0 0 60px rgba(245, 158, 11, 0.3);
}

.empty-state-new-game-btn:hover::before {
    left: 100%;
}

.empty-state-new-game-btn:active {
    transform: translateY(0) scale(1.02);
}

.empty-state-new-game-btn .btn-icon {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.empty-state-stats {
    margin-top: 2rem;
}

.empty-state-secondary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(139, 92, 246, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.empty-state-secondary-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
    transform: translateY(-1px);
}

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

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

/* Mobile adjustments for empty state */
@media (max-width: 768px) {
    .empty-state-overlay {
        width: 85%;
    }
    
    .empty-state-content {
        padding: 1.5rem;
    }
    
    .empty-state-title {
        font-size: 2.5rem;
    }
    
    .empty-state-new-game-btn {
        padding: 0.875rem 2rem;
        font-size: 1.1rem;
    }
}
