body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    text-align: center;
    background: linear-gradient(135deg, #f5e6df 0%, #e8d5cc 100%);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    transition: background 0.5s ease;
    color: #2c2c2c;
    letter-spacing: -0.3px;
    display: flex;
    flex-direction: column;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 17px 20px;
    background: #A590D7;
    border-bottom: 2px solid #A590D7;
    position: relative;
    z-index: 1000;
    gap: 15px;
}

.back-button {
    background: rgba(255, 255, 255, 0.5);
    color: #2c2c2c;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(-2px);
}

.user-profile-btn {
    background: rgba(255, 255, 255, 0.5);
    color: #2c2c2c;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 15px;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

/* Orientation Lock Warning */
.orientation-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: auto;
}

.orientation-warning.hidden {
    display: none;
}

.orientation-content {
    text-align: center;
    color: white;
    font-size: 1.5em;
}

.orientation-content h2 {
    margin: 20px 0;
    font-size: 2em;
}

.orientation-content p {
    margin: 20px 0;
    font-size: 1.2em;
    color: #ccc;
}

.rotation-icon {
    font-size: 4em;
    margin: 30px 0;
    animation: rotate 2s infinite linear;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

* {
    box-sizing: border-box;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    margin-top: clamp(30px, 5vh, 60px);
    background-color: transparent;
    padding: clamp(4px, 2vw, 12px);
    border-radius: 0;
    box-shadow: none;
    animation: slideDown 0.5s ease-out;
    display: flex;
    gap: clamp(8px, 2vw, 15px);
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
    flex: 1;
    align-content: flex-start;
    margin-bottom: 0;
    justify-content: center;
    align-items: stretch;
}

.game-wrapper {
    flex: 0 1 auto;
    min-width: clamp(280px, 50vw, 800px);
    max-width: 100%;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #2c2c2c;
    padding: clamp(8px, 2vw, 16px);
    border-radius: clamp(12px, 3vw, 20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.game-wrapper:hover {
    transform: translateY(-2px);
}

.leaderboard-wrapper {
    flex: 0 1 clamp(280px, 41.4vw, 552px);
    min-width: clamp(280px, 41.4vw, 552px);
    max-width: 552px;
    display: flex;
    flex-direction: column;
    background: #2c2c2c;
    padding: clamp(8px, 2vw, 12px);
    border-radius: clamp(12px, 3vw, 20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    height: 100%;
}

h1 {
    color: #2c2c2c;
    margin-bottom: 0;
    margin-top: 0;
    font-size: clamp(1.8em, 6vw, 3.5em);
    font-weight: 700;
}

.game-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    margin-top: -20px;
    color: #2c2c2c;
    font-size: clamp(1.6em, 5vw, 3em);
    font-weight: 700;
    white-space: nowrap;
}
    font-weight: 800;
    text-shadow: none;
    width: 100%;
    order: -2;
    letter-spacing: -1px;
    flex-basis: 100%;
    line-height: 1.1;
}

h2 {
    color: #ffffff;
    margin-top: 0;
    margin-bottom: clamp(10px, 2vh, 15px);
    transition: all 0.3s ease;
    font-size: clamp(1.3em, 4vw, 1.8em);
    font-weight: 600;
    line-height: 1.2;
}

#board {
    background-color: #b8b8b8;
    border: clamp(2px, 0.5vw, 3px) solid #555;
    border-radius: clamp(10px, 2vw, 16px);
    display: block;
    margin: 0;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 750 / 400;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#board:hover {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.game-section {
    margin-bottom: 0;
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Desktop: Keep canvas at full size */
@media (min-width: 1200px) {
    #board {
        width: auto;
        height: 450px;
        aspect-ratio: auto;
        border-radius: 16px;
        max-width: 90vw;
        max-height: 85vh;
    }
}

#board {
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 80%;
    max-width: 100%;
    position: relative;
}

.mobile-controls {
    position: absolute;
    bottom: clamp(12px, 3vh, 20px);
    right: clamp(12px, 3vw, 20px);
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
    z-index: 101;
    pointer-events: auto;
    --control-scale: 1;
}

.control-btn {
    width: clamp(80px, 24vw, 120px);
    height: clamp(80px, 24vw, 120px);
    border-radius: clamp(8px, 2vw, 12px);
    border: none;
    font-size: clamp(36px, 8vw, 56px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    opacity: 0.6;
}

.control-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.control-btn:active {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn .arrow {
    display: block;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.jump-btn {
    background: linear-gradient(135deg, #6db3ff 0%, #5a9fe0 100%);
}

.jump-btn:active {
    background: linear-gradient(135deg, #5a9fe0 0%, #4a8fce 100%);
}

.duck-btn {
    background: linear-gradient(135deg, #ff9a6b 0%, #ff7f50 100%);
}

.duck-btn:active {
    background: linear-gradient(135deg, #ff7f50 0%, #ff6640 100%);
}

.game-footer {
    text-align: center;
    padding: 18px 24px;
    font-size: 29px;
    color: #ffffff;
    font-weight: 500;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 16px 16px;
    transition: all 0.3s ease;
}

.game-footer a {
    color: #6db3ff;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-footer a:hover {
    color: #a8d5ff;
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(109, 179, 255, 0.4);
}

.username-display {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #aaa;
    font-weight: 500;
}

.username-display.new-user {
    color: #6db3ff;
    font-weight: bold;
}

/* Username Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.4);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #F5E5DF 0%, #F5EDE7 100%);
    padding: 80px 60px;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(232, 215, 209, 0.4);
    text-align: center;
    max-width: 600px;
    width: 90%;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(225, 155, 230, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content h2 {
    color: #1A1A1A;
    margin-top: 0;
    font-size: 40px;
    margin-bottom: 15px;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.modal-content p {
    color: #222222;
    font-size: 18px;
    margin-bottom: 30px;
    font-weight: 400;
    line-height: 1.6;
}

#usernameInput {
    width: 100%;
    max-width: 450px;
    padding: 16px 18px;
    font-size: 16px;
    border: 2px solid #E8D7D1;
    border-radius: 10px;
    margin-bottom: 20px;
    box-sizing: border-box;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #FAFAF8;
    color: #222222;
}

#usernameInput::placeholder {
    color: #BFBFBF;
}

#usernameInput:focus {
    outline: none;
    border-color: #E19BE6;
    background: #FFFFFF;
    box-shadow: 0 0 20px rgba(225, 155, 230, 0.3), inset 0 0 4px rgba(225, 155, 230, 0.1);
}

#submitUsernameBtn {
    width: 100%;
    max-width: 450px;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #F5D36B 0%, #FFE799 100%);
    color: #1A1A1A;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(245, 211, 107, 0.35);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#submitUsernameBtn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(225, 155, 230, 0.35);
    background: linear-gradient(135deg, #FFE799 0%, #FFF0B8 100%);
}

#submitUsernameBtn:active {
    transform: translateY(-1px);
}

/* Start Screen Styles */
.start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
    animation: fadeIn 0.4s ease-in;
    backdrop-filter: blur(2px);
}

.start-screen.hidden {
    display: none;
}

.start-screen-content {
    text-align: center;
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.start-screen-content h2 {
    color: white;
    font-size: 104px;
    margin: 0 0 40px 0;
    text-shadow: 4px 4px 12px rgba(0, 0, 0, 0.7);
    letter-spacing: -1px;
    font-weight: 800;
}

.start-screen-content p {
    color: #e0e0e0;
    font-size: 36px;
    margin-bottom: 70px;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6);
    font-weight: 400;
    letter-spacing: 0.3px;
}

.start-btn {
    display: block;
    margin: 0 auto;
    padding: 36px 100px;
    font-size: 40px;
    background: linear-gradient(135deg, #4a7aff 0%, #6db3ff 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(109, 179, 255, 0.5);
    letter-spacing: 0.5px;
}

.start-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(109, 179, 255, 0.6);
}

.start-btn:active {
    transform: translateY(-1px);
}

.start-settings-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid white;
    background: rgba(255, 255, 255, 0.1);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: white;
}

.start-settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.start-settings-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.twitter-section {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 30px;
}

#twitterHandle {
    padding: 10px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    width: 250px;
}

#twitterHandle:focus {
    outline: none;
    border-color: #1DA1F2;
    box-shadow: 0 0 5px rgba(29, 161, 242, 0.3);
}

#saveScoreBtn {
    padding: 10px 20px;
    font-size: 14px;
    background-color: #1DA1F2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

#saveScoreBtn:hover {
    background-color: #1a91da;
}

#saveScoreBtn:active {
    transform: scale(0.98);
}

#scoreMessage {
    margin-top: 10px;
    font-weight: bold;
    min-height: 20px;
}

.database-choice {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    justify-content: center;
}

.choice-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #ff9a6b 0%, #ff7f50 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.choice-btn.skilled-choice {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.choice-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.choice-btn.active {
    opacity: 1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.choice-btn:not(.active) {
    opacity: 0.5;
}

.time-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    justify-content: center;
}

.filter-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 11px;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.filter-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.filter-btn.active {
    opacity: 1;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.filter-btn:not(.active) {
    opacity: 0.5;
}

.leaderboard-wrapper h2 {
    margin: 0 0 4px 0;
    font-size: 1.1em;
}

/* Auth Container */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(58, 58, 58, 0.5);
    border-radius: 8px;
    margin-bottom: 12px;
}

.auth-container.hidden {
    display: none;
}

.username-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(109, 179, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.username-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.username-input:focus {
    outline: none;
    border-color: #6db3ff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 12px rgba(109, 179, 255, 0.2);
}

.submit-username-btn {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, #6db3ff 0%, #5a9fe0 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.submit-username-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(109, 179, 255, 0.4);
}

.submit-username-btn:active {
    transform: translateY(0);
}

.auth-status {
    font-size: 12px;
    color: #6db3ff;
    margin: 0;
}

.leaderboard-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-top: 0;
    box-shadow: none;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

/* Leaderboard Container */
.leaderboard-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: visible;
    gap: 4px;
    border: 2px solid #6db3ff;
    border-radius: 12px;
    padding: 1.5rem;
    background: rgba(15, 15, 30, 0.6);
    box-shadow: 0 0 20px rgba(109, 179, 255, 0.2), inset 0 0 20px rgba(109, 179, 255, 0.05);
    height: auto;
}

.leaderboard-container.hidden {
    display: none;
}

.leaderboard-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: visible;
    flex: 1;
    min-height: 0;
    height: auto;
}

.leaderboard-display.hidden {
    display: none;
}

.db-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    flex-shrink: 0;
}

.db-btn {
    padding: 8px 12px;
    background: rgba(109, 179, 255, 0.2);
    color: #6db3ff;
    border: 1px solid #6db3ff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
}

.db-btn.active {
    background: #6db3ff;
    color: #1a1a1a;
    border-color: #6db3ff;
}

.db-btn:hover:not(.active) {
    background: rgba(109, 179, 255, 0.3);
}

.time-filter {
    display: flex;
    gap: 6px;
    padding: 4px 0;
    flex-shrink: 0;
}

.time-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(109, 179, 255, 0.1);
    color: #6db3ff;
    border: 1px solid rgba(109, 179, 255, 0.3);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.time-btn.active {
    background: #6db3ff;
    color: #1a1a1a;
    border-color: #6db3ff;
}

.time-btn:hover:not(.active) {
    background: rgba(109, 179, 255, 0.2);
    border-color: #6db3ff;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    flex: 1;
    overflow: hidden;
    font-size: 13px;
}

.leaderboard-table thead {
    background: rgba(109, 179, 255, 0.15);
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table th {
    padding: 8px 6px;
    color: #6db3ff;
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid rgba(109, 179, 255, 0.3);
}

.leaderboard-table td {
    padding: 8px 6px;
    border-bottom: 1px solid rgba(109, 179, 255, 0.1);
    color: #ffffff;
}

.leaderboard-table tbody tr {
    transition: background 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(109, 179, 255, 0.08);
}

.rank-col {
    width: 35px;
    text-align: center;
    color: #6db3ff;
    font-weight: 700;
}

.name-col {
    flex: 1;
}

.score-col {
    width: 70px;
    text-align: right;
}

.games-col {
    width: 50px;
    text-align: right;
}

.loading-cell {
    text-align: center;
    color: #6db3ff;
    padding: 20px !important;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    flex-shrink: 0;
    border-top: 1px solid rgba(109, 179, 255, 0.2);
}

.pagination-btn {
    padding: 6px 10px;
    background: rgba(109, 179, 255, 0.2);
    color: #6db3ff;
    border: 1px solid #6db3ff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.pagination-btn:hover:not(:disabled) {
    background: #6db3ff;
    color: #1a1a1a;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 12px;
    color: #6db3ff;
    min-width: 60px;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    overflow-x: auto;
}

.tab-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #6db3ff 0%, #5a9fe0 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    white-space: nowrap;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tab-btn:nth-child(2) {
    background: linear-gradient(135deg, #ff9a6b 0%, #ff7f50 100%);
}

.tab-btn:nth-child(3) {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.tab-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tab-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.tab-btn.active {
    opacity: 1;
}

.tab-btn:not(.active) {
    opacity: 0.6;
}

.leaderboard-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.leaderboard-tab-content.active {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    background-color: #3a3a3a;
    margin-bottom: 4px;
    border-radius: 6px;
    border-left: 3px solid #6db3ff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    align-items: center;
    flex-shrink: 0;
    min-height: 36px;
    font-size: 1.25em;
    text-decoration: none;
    color: inherit;
}

.leaderboard-rank {
    font-weight: 700;
    color: #6db3ff;
    margin-right: 16px;
    min-width: 50px;
    text-align: center;
    font-size: 1.4em;
}

.leaderboard-handle {
    flex-grow: 1;
    text-align: left;
    font-weight: 600;
    color: #ffffff;
    font-size: 1.3em;
}

.leaderboard-handle-link {
    flex-grow: 1;
    text-align: left;
    font-weight: 600;
    color: #6db3ff;
    text-decoration: none;
    font-size: 1.3em;
}

/* NEW: Table Format Leaderboard Styles */
.leaderboard-cards-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 0;
    gap: 6px;
    overflow: visible;
    padding: 0;
    height: auto;
}

.leaderboard-card {
    display: grid;
    grid-template-columns: 50px 50px 1fr 100px;
    gap: 3px;
    align-items: center;
    padding: 8px 16px;
    background: rgba(109, 179, 255, 0.08);
    border: 1px solid rgba(109, 179, 255, 0.3);
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-height: 25px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.leaderboard-card:hover {
    background: rgba(109, 179, 255, 0.15);
    border-color: #6db3ff;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(109, 179, 255, 0.2);
}

.leaderboard-card.current-user {
    background: rgba(109, 179, 255, 0.15);
    border-color: #6db3ff;
    box-shadow: inset 0 0 12px rgba(109, 179, 255, 0.1);
}

.leaderboard-card.rank-top-1 {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.5);
}

.leaderboard-card.rank-top-1:hover {
    background: rgba(255, 215, 0, 0.18);
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.leaderboard-card.rank-top-2 {
    background: rgba(192, 192, 192, 0.12);
    border-color: rgba(192, 192, 192, 0.5);
}

.leaderboard-card.rank-top-2:hover {
    background: rgba(192, 192, 192, 0.18);
    border-color: rgba(192, 192, 192, 0.8);
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.3);
}

.leaderboard-card.rank-top-3 {
    background: rgba(205, 127, 50, 0.12);
    border-color: rgba(205, 127, 50, 0.5);
}

.leaderboard-card.rank-top-3:hover {
    background: rgba(205, 127, 50, 0.18);
    border-color: rgba(205, 127, 50, 0.8);
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.3);
}

.card-emoji-space {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    height: 25px;
    min-width: 50px;
}

.card-rank {
    font-weight: 700;
    color: #6db3ff;
    font-size: 20px;
    text-align: center;
    min-width: 50px;
}

.card-handle {
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    word-break: break-word;
    flex: 1;
    overflow-wrap: break-word;
}

.card-score {
    text-align: right;
    font-size: 18px;
    font-weight: 700;
    color: #6db3ff;
    min-width: 100px;
}

@media (max-width: 768px) {
    .leaderboard-card {
        grid-template-columns: 45px 45px 1fr 90px;
        gap: 2px;
        padding: 6px 12px;
        min-height: 22px;
    }
    
    .card-emoji-space {
        font-size: 18px;
        height: 22px;
        min-width: 45px;
    }
    
    .card-rank {
        font-size: 16px;
        min-width: 45px;
    }
    
    .card-handle {
        font-size: 15px;
    }
    
    .card-score {
        font-size: 15px;
        min-width: 90px;
    }
}

.leaderboard-score {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: #6db3ff;
    font-size: 1.4em;
}

.leaderboard-score .score-value {
    margin-left: auto;
    min-width: 110px;
    text-align: right;
}

.leaderboard-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.pagination-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #6db3ff 0%, #5a9fe0 100%);
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.3em;
    white-space: nowrap;
}

.pagination-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(109, 179, 255, 0.4);
}

.pagination-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    color: #6db3ff;
    font-weight: 600;
    font-size: 0.85em;
    min-width: 60px;
    text-align: center;
}

#leaderboard {
    text-align: left;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

/* Responsive Design */
/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Desktop Large (1440px+) */
@media (min-width: 1440px) {
    .container {
        gap: clamp(15px, 3vw, 20px);
        margin-top: clamp(50px, 8vh, 80px);
    }

    h1 {
        font-size: 3.5em;
    }

    .leaderboard-wrapper {
        flex: 0 0 700px;
        max-width: 700px;
    }
}

/* Tablet Landscape (1200px - 1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .container {
        flex-direction: row;
        gap: clamp(10px, 2vw, 15px);
    }

    .game-wrapper {
        flex: 1;
        min-width: 50%;
    }

    .leaderboard-wrapper {
        flex: 0 0 clamp(300px, 35vw, 650px);
    }
}

/* Mobile Device - Always stack vertically (fill entire screen) */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: auto;
        overflow-y: auto;
        margin-top: clamp(20px, 3vh, 30px);
        gap: clamp(8px, 2vh, 12px);
        padding: clamp(4px, 2vw, 12px);
    }

    .game-wrapper {
        min-width: 100%;
        width: 100%;
        flex: 1;
        min-height: clamp(280px, 65vh, 450px);
    }

    .leaderboard-wrapper {
        min-width: 100%;
        width: 100%;
        min-height: clamp(180px, 30vh, 350px);
        flex: 0 0 auto;
    }

    .leaderboard-section {
        max-height: clamp(180px, 30vh, 350px);
    }

    .game-title {
        font-size: clamp(1.5em, 5vw, 2em);
        margin-top: -20px;
    }

    .back-button,
    .user-profile-btn {
        padding: 10px 18px;
        font-size: 15px;
    }
}

@media (max-width: 1599px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        margin-top: clamp(30px, 4vh, 50px);
        gap: clamp(10px, 2vh, 15px);
    }

    body {
        overflow: auto;
    }

    h1 {
        font-size: clamp(2em, 7vw, 3em);
        margin-bottom: clamp(10px, 2vh, 20px);
    }

    .game-wrapper {
        min-width: 100%;
        width: 100%;
        flex: 1;
        min-height: clamp(300px, 60vh, 500px);
    }

    .leaderboard-wrapper {
        min-width: 100%;
        width: 100%;
        min-height: clamp(200px, 30vh, 400px);
        flex: 0 0 auto;
    }

    .leaderboard-section {
        max-height: clamp(200px, 30vh, 400px);
    }
}

/* Tablet Portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: clamp(8px, 2vw, 15px);
        gap: clamp(8px, 2vw, 12px);
    }

    h1 {
        font-size: clamp(2em, 6vw, 2.5em);
    }

    #board {
        aspect-ratio: 750 / 400;
    }

    .modal-content {
        max-width: 85%;
        padding: clamp(30px, 5vw, 60px);
    }

    .start-btn {
        max-width: 90%;
        font-size: clamp(16px, 3vw, 18px);
        padding: clamp(10px, 2vh, 14px) clamp(25px, 5vw, 35px);
    }

    .leaderboard-item {
        min-width: 100%;
        padding: clamp(10px, 2vh, 14px) clamp(12px, 2vw, 16px);
        font-size: clamp(13px, 2vw, 15px);
    }
}

/* Mobile Large (480px - 767px) */
@media (max-width: 767px) and (min-width: 480px) {
    body {
        padding: clamp(4px, 2vw, 8px);
    }

    .container {
        flex-direction: column;
        padding: clamp(8px, 2vw, 12px);
        gap: clamp(8px, 2vh, 12px);
        margin-top: clamp(30px, 5vh, 40px);
    }

    h1 {
        font-size: clamp(1.8em, 5vw, 2.2em);
        line-height: 1;
    }

    h2 {
        font-size: clamp(1.2em, 3.5vw, 1.5em);
        margin-bottom: clamp(8px, 2vh, 12px);
    }

    .game-wrapper {
        min-width: 100%;
        width: 100%;
        padding: clamp(6px, 2vw, 10px);
        border-radius: clamp(10px, 2vw, 16px);
        min-height: clamp(280px, 50vh, 400px);
    }

    .leaderboard-wrapper {
        min-width: 100%;
        width: 100%;
        min-height: clamp(200px, 35vh, 350px);
    }

    .leaderboard-section {
        max-height: clamp(150px, 30vh, 300px);
    }

    .start-screen-content h2 {
        font-size: clamp(1.5em, 4vw, 2em);
    }

    .start-btn {
        display: block;
        margin: 0 auto;
        padding: clamp(10px, 2.5vh, 14px) clamp(20px, 4vw, 30px);
        font-size: clamp(15px, 3vw, 18px);
        max-width: 90%;
    }
    
    .start-settings-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    .modal-content {
        padding: clamp(20px, 4vh, 40px) clamp(20px, 4vw, 35px);
        max-width: 95%;
        border-radius: clamp(8px, 2vw, 12px);
    }

    .modal-content input,
    .modal-content button {
        max-width: 100%;
        font-size: clamp(14px, 2.5vw, 16px);
        padding: clamp(8px, 2vh, 12px) clamp(12px, 3vw, 16px);
    }

    .leaderboard-item {
        min-width: 100%;
        padding: clamp(8px, 1.5vh, 12px) clamp(10px, 2vw, 14px);
        font-size: clamp(12px, 2vw, 14px);
    }
}

/* Mobile Small (375px - 479px) */
@media (max-width: 479px) {
    body {
        padding: 2px;
    }

    .container {
        flex-direction: column;
        padding: 4px;
        gap: 6px;
        margin-top: clamp(25px, 4vh, 35px);
    }

    h1 {
        font-size: clamp(1.5em, 5vw, 1.8em);
        line-height: 1;
        margin-bottom: 5px;
    }

    h2 {
        font-size: clamp(1em, 3.5vw, 1.3em);
        margin-bottom: 6px;
    }

    .game-wrapper {
        min-width: 100%;
        width: 100%;
        padding: 4px;
        border-radius: 10px;
        min-height: clamp(240px, 45vh, 350px);
    }

    .game-over-board {
        max-width: 95vw;
        max-height: 80vh;
        padding: 1px 12px;
        width: 95vw;
    }

    .leaderboard-wrapper {
        min-width: 100%;
        width: 100%;
        min-height: clamp(150px, 30vh, 280px);
        padding: 6px;
    }

    .leaderboard-section {
        max-height: clamp(120px, 25vh, 250px);
    }

    #board {
        border-width: 2px;
    }

    .start-screen-content h2 {
        font-size: clamp(1.3em, 4vw, 1.6em);
    }

    .start-btn {
        display: block;
        margin: 0 auto;
        padding: 8px 16px;
        font-size: clamp(13px, 2.5vw, 15px);
        max-width: 95%;
    }

    .modal-content {
        padding: 16px 20px;
        max-width: 98%;
        border-radius: 8px;
    }

    .modal-content input,
    .modal-content button {
        max-width: 100%;
        font-size: clamp(12px, 2.5vw, 14px);
        padding: 6px 10px;
    }

    .leaderboard-item {
        min-width: 100%;
        padding: 6px 8px;
        font-size: clamp(11px, 2vw, 12px);
    }

    .control-btn {
        width: 80px;
        height: 80px;
        font-size: 36px;
    }
}

/* Ultra-Small Mobile (320px - 374px) */
@media (max-width: 374px) {
    body {
        padding: 0;
    }

    .container {
        flex-direction: column;
        padding: 2px;
        gap: 4px;
        margin-top: 20px;
    }

    h1 {
        font-size: 1.4em;
        line-height: 1;
        margin-bottom: 4px;
    }

    h2 {
        font-size: 1em;
        margin-bottom: 4px;
    }

    .game-wrapper {
        min-width: 100%;
        width: 100%;
        padding: 2px;
        border-radius: 8px;
        min-height: 220px;
    }

    .leaderboard-wrapper {
        min-width: 100%;
        width: 100%;
        min-height: 140px;
        padding: 4px;
    }

    .leaderboard-section {
        max-height: 120px;
    }

    #board {
        border-width: 2px;
    }

    .start-btn {
        padding: 6px 12px;
        font-size: 12px;
        max-width: 98%;
    }

    .modal-content {
        padding: 12px 16px;
        max-width: 99%;
    }

    .modal-content input,
    .modal-content button {
        font-size: 12px;
        padding: 4px 8px;
    }

    .leaderboard-item {
        padding: 4px 6px;
        font-size: 11px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* Landscape Mode - Desktop/Tablet only (wide screens) */
@media (min-width: 769px) and (max-height: 600px) and (orientation: landscape) {
    .container {
        margin-top: clamp(10px, 2vh, 20px);
    }

    h1 {
        font-size: clamp(1.3em, 4vw, 2em);
        margin-bottom: 0;
    }

    .game-wrapper {
        min-height: clamp(200px, 80vh, 400px);
    }

    .leaderboard-wrapper {
        min-height: clamp(180px, 70vh, 350px);
    }
}

@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    body {
        overflow: auto;
    }

    .game-wrapper {
        min-width: 100%;
        background: #2c2c2c;
    }

    .leaderboard-wrapper {
        min-width: 100%;
        background: #2c2c2c;
    }

    .leaderboard-section {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        gap: 10px;
    }

    h1 {
        font-size: 2em;
    }

    #board {
        margin: 15px auto;
    }

    .start-screen-content h2 {
        font-size: 36px;
    }

    .start-btn {
        display: block;
        margin: 0 auto;
        padding: 14px 35px;
        font-size: 18px;
    }

    .modal-content {
        padding: 30px;
        max-width: 90%;
    }

    .leaderboard-item {
        min-width: 100%;
        padding: 12px 14px;
    }

    #leaderboard {
        min-width: 100%;
    }

    .leaderboard-section {
        max-height: 300px;
    }

    /* Game Over Board Responsive */
    .game-over-board {
        max-width: 85vw;
        max-height: 320px;
        padding: 20px 24px;
    }

    .game-over-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    .stat-card {
        min-height: 120px;
        padding: 12px 8px;
    }

    .game-over-actions {
        gap: 10px;
    }

    .game-over-btn {
        padding: 10px 16px;
        font-size: 0.85em;
        max-width: 180px;
    }
}

.footer {
    text-align: center;
    padding: 18px 27px;
    font-size: 29px;
    color: #ffffff;
    font-weight: 500;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    flex-shrink: 0;
    width: 100%;
    transition: all 0.3s ease;
    border-top: 2px solid #a78bfa;
    box-shadow: 0 -4px 12px rgba(139, 92, 246, 0.2);
}

.footer a {
    color: #fbbf24;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer a:hover {
    color: #fcd34d;
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(252, 211, 77, 0.4);
}

/* Game Over Screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.game-over-screen.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.game-over-board {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 24px 32px 24px 32px;
    border-radius: 20px;
    box-shadow: 
        0 0 50px rgba(109, 179, 255, 0.5),
        0 0 100px rgba(225, 155, 230, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.9),
        inset 0 0 20px rgba(109, 179, 255, 0.1);
    text-align: center;
    max-width: 462px;
    width: 95%;
    max-height: none;
    border: 2px solid rgba(109, 179, 255, 0.5);
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), neonPulse 3s ease-in-out infinite;
    pointer-events: auto;
    overflow: visible;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.close-game-over-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #a0d8ff;
    font-size: 1.2em;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    line-height: 1;
    font-weight: 300;
    opacity: 0.3;
    padding: 0;
}

.close-game-over-btn:hover {
    opacity: 0.6;
    color: #6db3ff;
    text-shadow: 0 0 10px #6db3ff, 0 0 20px rgba(109, 179, 255, 0.4);
    transform: scale(1.1);
}

.close-game-over-btn:active {
    transform: scale(0.95);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(109, 179, 255, 0.3),
            0 0 60px rgba(225, 155, 230, 0.1),
            0 20px 60px rgba(0, 0, 0, 0.8),
            inset 0 0 20px rgba(109, 179, 255, 0.08);
    }
    50% {
        box-shadow:
            0 0 50px rgba(109, 179, 255, 0.5),
            0 0 100px rgba(225, 155, 230, 0.2),
            0 20px 60px rgba(0, 0, 0, 0.8),
            inset 0 0 20px rgba(109, 179, 255, 0.12);
    }
}

.game-over-header {
    margin-bottom: 16px;
    position: relative;
}

.game-over-title {
    color: #ffffff;
    font-size: clamp(1.6em, 4vw, 2.2em);
    margin: 0;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 0 25px rgba(109, 179, 255, 0.5), 0 0 10px rgba(225, 155, 230, 0.3);
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(109, 179, 255, 0.4), 0 0 10px rgba(225, 155, 230, 0.2);
    }
    50% {
        text-shadow: 0 0 30px rgba(109, 179, 255, 0.6), 0 0 20px rgba(225, 155, 230, 0.3);
    }
}

.title-accent {
    height: 2px;
    background: linear-gradient(90deg, transparent, #6db3ff, #e19be6, transparent);
    margin-top: 8px;
    border-radius: 1px;
}

.game-over-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(109, 179, 255, 0.15) 0%, rgba(225, 155, 230, 0.08) 100%);
    border: 2px solid rgba(109, 179, 255, 0.4);
    border-radius: 14px;
    padding: 16px 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    border-color: rgba(109, 179, 255, 0.6);
    background: linear-gradient(135deg, rgba(109, 179, 255, 0.2) 0%, rgba(225, 155, 230, 0.12) 100%);
    box-shadow: 0 0 25px rgba(109, 179, 255, 0.3);
}

.stat-card.best {
    border-color: rgba(225, 155, 230, 0.6);
    background: linear-gradient(135deg, rgba(225, 155, 230, 0.2) 0%, rgba(109, 179, 255, 0.12) 100%);
    box-shadow: 0 0 20px rgba(225, 155, 230, 0.25);
}

.stat-card.best:hover {
    border-color: rgba(225, 155, 230, 0.8);
    box-shadow: 0 0 30px rgba(225, 155, 230, 0.4);
}

.stat-card-label {
    font-size: clamp(0.75em, 1.8vw, 0.95em);
    color: #a0d8ff;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-card.best .stat-card-label {
    color: #e19be6;
}

.stat-card-value {
    font-size: clamp(1.5em, 5vw, 2.2em);
    color: #ffffff;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.stat-card-accent {
    height: 1px;
    background: linear-gradient(90deg, transparent, #6db3ff, transparent);
    margin-top: 8px;
}

.stat-card.best .stat-card-accent {
    background: linear-gradient(90deg, transparent, #e19be6, transparent);
}

.mode-options {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-option {
    background: rgba(58, 58, 58, 0.5);
    border: 1px solid rgba(109, 179, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #ffffff;
    font-size: clamp(0.9em, 2vw, 1em);
    text-align: center;
    transition: all 0.2s ease;
}

.mode-option:hover {
    background: rgba(109, 179, 255, 0.1);
    border-color: rgba(109, 179, 255, 0.4);
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.game-over-btn {
    position: relative;
    padding: 14px 24px;
    font-size: clamp(0.85em, 1.8vw, 0.95em);
    font-weight: 800;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    font-family: inherit;
    width: 100%;
    white-space: nowrap;
}

.game-over-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.4s ease;
    z-index: 0;
}

.game-over-btn:hover::before {
    left: 100%;
}

.btn-text {
    position: relative;
    z-index: 1;
    display: block;
}

.play-again {
    background: linear-gradient(135deg, #6db3ff 0%, #5a9fe0 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(109, 179, 255, 0.5);
    border: 2px solid rgba(109, 179, 255, 0.6);
    font-weight: 900;
    letter-spacing: 1.5px;
    padding: 16px 28px;
}

.play-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(109, 179, 255, 0.7);
    border-color: rgba(109, 179, 255, 0.9);
    background: linear-gradient(135deg, #7ec4ff 0%, #6aafff 100%);
}

.play-again:active {
    transform: translateY(0);
}

.close-game-over-btn:hover {
    opacity: 1;
    color: #6db3ff;
    text-shadow: 0 0 10px #6db3ff, 0 0 20px rgba(109, 179, 255, 0.4);
    transform: scale(1.15);
}

.close-game-over-btn:active {
    transform: scale(0.95);
}

.back-to-hub {
    background: linear-gradient(135deg, rgba(225, 155, 230, 0.8) 0%, rgba(168, 85, 247, 0.8) 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(225, 155, 230, 0.2);
    border: 1px solid rgba(225, 155, 230, 0.3);
}

.back-to-hub:hover {
    background: linear-gradient(135deg, rgba(225, 155, 230, 1) 0%, rgba(168, 85, 247, 1) 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(225, 155, 230, 0.4);
}

.back-to-hub:active {
    transform: translateY(-1px);
}

.share-to-x {
    background: transparent;
    color: #00aeff;
    box-shadow: none;
    border: 2px solid rgba(0, 174, 255, 0.4);
    opacity: 0.8;
    font-size: 0.85em;
    padding: 10px 16px;
}

.share-to-x:hover {
    background: rgba(0, 174, 255, 0.1);
    color: #00d9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 174, 255, 0.3);
    border-color: rgba(0, 174, 255, 0.7);
    opacity: 1;
}

.share-to-x:active {
    transform: translateY(0);
}

.btn-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

/* Personal Best Celebration Styles */
.personal-best-achieved {
    grid-column: 1 / -1 !important;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.15) 100%) !important;
    border: 2px solid rgba(255, 215, 0, 0.6) !important;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.4),
        0 0 40px rgba(255, 165, 0, 0.2),
        inset 0 0 15px rgba(255, 215, 0, 0.1) !important;
    animation: celebratePulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), confettiShimmer 2s ease-in-out infinite !important;
}

.pb-celebrate {
    color: #ffd700 !important;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 25px rgba(255, 165, 0, 0.5) !important;
    font-size: 0.95em !important;
    letter-spacing: 0.5px !important;
}

.pb-value {
    color: #ffed4e !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 165, 0, 0.4) !important;
    font-size: 2.8em !important;
    animation: valueGlow 1.5s ease-in-out infinite !important;
}

.pb-accent {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0), rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0)) !important;
    height: 3px !important;
}

@keyframes celebratePulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes valueGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 0 20px rgba(255, 165, 0, 0.4);
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 165, 0, 0.6);
    }
}

@keyframes confettiShimmer {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 215, 0, 0.4),
            0 0 40px rgba(255, 165, 0, 0.2),
            inset 0 0 15px rgba(255, 215, 0, 0.1);
    }
    50% {
        box-shadow: 
            0 0 30px rgba(255, 215, 0, 0.6),
            0 0 50px rgba(255, 165, 0, 0.4),
            inset 0 0 20px rgba(255, 215, 0, 0.15);
    }
}

/* Delta/Improvement Feedback */
.delta-feedback {
    grid-column: 1 / -1;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.4);
    text-align: center;
}

.delta-text {
    color: #4caf50;
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.delta-feedback.hidden {
    display: none;
}

.personal-best-achieved.hidden {
    display: none;
}
            0 20px 60px rgba(0, 0, 0, 0.9),
            inset 0 0 20px rgba(255, 0, 127, 0.1);
    }
    50% {
        box-shadow:
            0 0 50px rgba(255, 0, 127, 0.8),
            0 0 80px rgba(0, 255, 200, 0.6),
            0 20px 60px rgba(0, 0, 0, 0.9),
            inset 0 0 30px rgba(255, 0, 127, 0.2);
    }
}

@keyframes boardRumble {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-4px, -4px) rotate(-0.5deg); }
    20% { transform: translate(4px, -4px) rotate(0.5deg); }
    30% { transform: translate(-3px, 3px) rotate(-0.5deg); }
    40% { transform: translate(3px, 3px) rotate(0.5deg); }
    50% { transform: translate(-2px, -2px) rotate(-0.3deg); }
    60% { transform: translate(2px, -2px) rotate(0.3deg); }
    70% { transform: translate(-1px, 1px) rotate(-0.2deg); }
    80% { transform: translate(1px, 1px) rotate(0.2deg); }
}

@keyframes canvasShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, -2px); }
    50% { transform: translate(2px, 2px); }
    75% { transform: translate(-2px, 2px); }
}

.game-over-board h2 {
    background: linear-gradient(90deg, #ff007f, #00ffc8, #ff007f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(1.4em, 5vw, 2em);
    margin: 0 0 clamp(6px, 1.5vh, 10px) 0;
    text-shadow: 0 0 20px rgba(255, 0, 127, 0.5);
    letter-spacing: 2px;
    font-weight: 900;
    animation: titleGlow 2s ease-in-out infinite, titleFlicker 5s ease-in-out infinite;
}

@keyframes titleFlicker {
    0%, 100% { opacity: 1; }
    45% { opacity: 1; }
    46% { opacity: 0.95; }
    47% { opacity: 1; }
    48% { opacity: 0.98; }
}

@keyframes titleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(255, 0, 127, 0.6)) drop-shadow(0 0 10px rgba(0, 255, 200, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(255, 0, 127, 0.8)) drop-shadow(0 0 20px rgba(0, 255, 200, 0.5));
    }
}

.score-display {
    margin: clamp(4px, 1vh, 11px) 0;
    padding: clamp(8px, 2vh, 11px);
    background: linear-gradient(135deg, rgba(255, 0, 127, 0.2), rgba(0, 255, 200, 0.1));
    border-radius: 12px;
    border: 2px solid rgba(255, 0, 127, 0.8);
    box-shadow: 0 0 30px rgba(255, 0, 127, 0.5), inset 0 0 20px rgba(0, 255, 200, 0.2);
    animation: scoreFloat 3s ease-in-out infinite;
}

@keyframes scoreFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.current-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.current-score .label {
    color: #00ffc8;
    font-size: clamp(0.9em, 2.5vw, 1.2em);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(0, 255, 200, 0.3);
}

.score-number {
    font-size: clamp(2em, 6vw, 2.8em);
    font-weight: 900;
    background: linear-gradient(90deg, #ff007f, #ffd700, #ff007f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    text-shadow: 0 0 20px rgba(255, 0, 127, 0.6);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 5px rgba(255, 0, 127, 0.5));
    animation: scorePulse 2s ease-in-out infinite;
}

@keyframes scorePulse {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)) drop-shadow(0 0 5px rgba(255, 0, 127, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.7)) drop-shadow(0 0 15px rgba(255, 0, 127, 0.6));
    }
}

.stats-info {
    margin: clamp(6px, 1vh, 11px) 0;
    padding: clamp(6px, 1.5vh, 8px);
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.12), rgba(255, 0, 127, 0.08));
    border-radius: 12px;
    border: 1.5px solid rgba(0, 255, 200, 0.5);
    box-shadow: inset 0 0 25px rgba(0, 255, 200, 0.2), 0 0 20px rgba(0, 255, 200, 0.25);
}

.best-scores-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 0 6px 0;
    border-bottom: 2px solid rgba(0, 255, 200, 0.3);
    gap: clamp(8px, 2vw, 16px);
}

.best-score-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    font-size: clamp(1.2em, 3vw, 1.8em);
}

.score-divider {
    color: rgba(0, 255, 200, 0.4);
    font-size: 2em;
    font-weight: bold;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0, 255, 200, 0.25);
    font-size: clamp(0.9em, 2vw, 1.2em);
    animation: statFlicker 3s ease-in-out infinite;
}

.stat-row:nth-child(odd) {
    animation-delay: 0s;
}

.stat-row:nth-child(even) {
    animation-delay: 0.3s;
}

.stat-row:nth-child(3) {
    animation-delay: 0.6s;
}

.stat-row:nth-child(4) {
    animation-delay: 0.9s;
}

@keyframes statFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: #00ffc8;
    font-size: 1em;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(0, 255, 200, 0.4);
}

.stat-value {
    color: #ffd700;
    font-size: 1.2em;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7), 0 0 5px rgba(255, 0, 127, 0.3);
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 11px;
}

.top-buttons {
    display: flex;
    gap: 12px;
}

.game-over-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

/* Old button styles removed - using new game-over-btn styles */
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(255, 0, 127, 0.7), 0 8px 25px rgba(255, 0, 127, 0.5);
}

.share-btn:active {
    transform: translateY(-1px);
}

.continue-btn {
    width: 100%;
    min-height: 48px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #0a0a2e;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 15px rgba(255, 0, 127, 0.4), 0 6px 20px rgba(255, 215, 0, 0.5);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    animation: buttonPulse 2s ease-in-out infinite, buttonGlow 1.5s ease-in-out infinite;
    border: 2px solid #ffed4e;
}

.continue-btn:disabled,
.continue-btn.disabled {
    background: linear-gradient(135deg, #888888 0%, #aaaaaa 100%);
    color: #444444;
    box-shadow: 0 0 10px rgba(100, 100, 100, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: none;
    border-color: #999999;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none !important;
}

.continue-btn:disabled:hover,
.continue-btn.disabled:hover {
    transform: none;
    box-shadow: 0 0 10px rgba(100, 100, 100, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

.continue-btn:disabled::after,
.continue-btn.disabled::after {
    display: none;
}

.continue-btn:disabled::before,
.continue-btn.disabled::before {
    display: none;
}

@keyframes buttonGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 15px rgba(255, 0, 127, 0.4), 0 6px 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 25px rgba(255, 0, 127, 0.6), 0 8px 25px rgba(255, 215, 0, 0.7); }
}

@keyframes buttonPulse {\n    0%, 100% {\n        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 6px 20px rgba(255, 215, 0, 0.4);\n    }\n    50% {\n        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 8px 30px rgba(255, 215, 0, 0.6);\n    }\n}

.continue-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 0 50px rgba(255, 215, 0, 1), 0 0 35px rgba(255, 0, 127, 0.7), 0 12px 40px rgba(255, 215, 0, 0.8);
}

.continue-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff007f, #00ffc8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 12px;
    z-index: 1000;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.6), 0 0 10px rgba(0, 255, 200, 0.4);
}

.continue-btn:hover::before {
    content: '';
    position: absolute;
    bottom: 106%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ff007f;
    z-index: 1000;
    filter: drop-shadow(0 0 5px rgba(255, 0, 127, 0.6));
}

.continue-btn:active {
    transform: translateY(0);
}

/* Confetti */
@keyframes confetti-fall {
    to {
        transform: translateY(500px) rotate(360deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    pointer-events: none;
    animation: confetti-fall 3s ease-in forwards;
}
    }
}

/* Canvas shake on death */
#board.shake {
    animation: canvasShake 0.1s ease-in-out;
}

/* Settings Popup */
.settings-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.settings-popup.hidden {
    display: none;
    pointer-events: none;
}

.settings-popup-content {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(100, 150, 255, 0.3);
    max-width: 400px;
    width: 100%;
    border: 2px solid #6496ff;
    max-height: 80vh;
    overflow-y: auto;
    animation: popupSlideIn 0.5s ease-out;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #6496ff;
    padding-bottom: 12px;
}

.settings-header h2 {
    color: #6496ff;
    font-size: 1.5em;
    margin: 0;
    text-shadow: 0 0 20px rgba(100, 150, 255, 0.5);
    letter-spacing: 1.5px;
}

.close-settings-btn {
    background: none;
    border: none;
    color: #6496ff;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.close-settings-btn:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(100, 150, 255, 0.7);
}

#settingsContainer {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.settings-item {
    padding: 12px;
    background: rgba(100, 150, 255, 0.1);
    border: 1px solid rgba(100, 150, 255, 0.3);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-label {
    color: #aaa;
    font-size: 0.9em;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.settings-value {
    color: #6496ff;
    font-size: 0.9em;
    font-weight: 600;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    background: rgba(100, 150, 255, 0.2);
    border: 2px solid #6496ff;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: rgba(100, 150, 255, 0.4);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #6496ff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch.active::after {
    left: 27px;
}

/* ============ RESPONSIVE DESIGN ============ */

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    
    .container {
        flex-direction: row;
        height: 100%;
        padding: 12px;
        gap: 15px;
    }
    
    h1 {
        position: absolute;
        top: 8px;
        left: 0;
        right: 0;
        z-index: 10;
        margin: 0;
        padding: 8px 0;
    }
    
    .game-wrapper {
        flex: 1;
        min-width: 600px;
        max-width: none;
        height: calc(100% - 60px);
        margin-top: 50px;
    }
    
    .leaderboard-wrapper {
        flex: 0 0 320px;
        height: calc(100% - 60px);
        margin-top: 50px;
    }
    
    #board {
        height: 100%;
        max-height: 100%;
    }
}

/* Tablet & Small Desktop (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
    
    .container {
        flex-direction: column;
        height: 100%;
        padding: 10px;
        gap: 12px;
    }
    
    h1 {
        order: -1;
        margin-bottom: 10px;
        font-size: 1.8em;
    }
    
    .game-wrapper {
        flex: 1;
        min-width: 100%;
        max-width: 100%;
        height: 50%;
    }
    
    .leaderboard-wrapper {
        flex: 1;
        min-width: 100%;
        max-width: 100%;
        height: 50%;
    }
    
    #board {
        height: 100%;
        max-height: 100%;
        width: 100%;
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    body {
        height: 100vh;
        overflow: auto;
        padding: 0;
    }
    
    .container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 8px;
        gap: 10px;
    }
    
    h1 {
        order: -1;
        margin: 8px 0;
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .game-wrapper {
        flex: 0 1 auto;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        padding: 10px;
        min-height: 400px;
        height: auto;
    }
    
    .leaderboard-wrapper {
        flex: 0 1 auto;
        min-width: 100%;
        max-width: 100%;
        width: 100%;
        max-height: 400px;
        height: auto;
        overflow-y: auto;
    }
    
    #board {
        height: 350px;
        max-height: 350px;
        width: 100%;
    }
    
    .mobile-controls {
        bottom: 15px;
        right: 15px;
        gap: 10px;
    }
    
    .control-btn {
        width: 90px;
        height: 90px;
    }
}

/* Extra Small Mobile (up to 480px) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.3em;
        margin: 5px 0;
    }
    
    h2 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .game-wrapper {
        padding: 8px;
        border-radius: 15px;
        min-height: 350px;
    }
    
    .leaderboard-wrapper {
        padding: 8px;
        border-radius: 15px;
    }
    
    #board {
        height: 320px;
        max-height: 320px;
        border-radius: 10px;
    }
    
    .mobile-controls {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .control-btn {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }
    
    .game-over-board {
        max-width: 90vw;
        max-height: 280px;
        padding: 16px 16px;
        width: 90vw;
    }

    .game-over-stats {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 12px;
    }

    .stat-card {
        min-height: 100px;
        padding: 10px 8px;
    }

    .stat-card-label {
        font-size: 0.7em;
    }

    .stat-card-value {
        font-size: 1.5em;
    }

    .game-over-actions {
        gap: 8px;
        flex-direction: column;
    }

    .game-over-btn {
        padding: 10px 14px;
        font-size: 0.8em;
        max-width: 100%;
    }
    
    .leaderboard-entry {
        font-size: 0.9em;
        padding: 8px;
    }
    
    .pagination-btn {
        font-size: 0.85em;
        padding: 6px 10px;
    }
}

/* Score Card Share Modal */
.score-card-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.score-card-modal.hidden {
    display: none;
}

.score-card-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #6db3ff;
    border-radius: 20px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 0 40px rgba(109, 179, 255, 0.3), 0 0 80px rgba(225, 155, 230, 0.2);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-score-card-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(109, 179, 255, 0.2);
    border: 2px solid #6db3ff;
    color: #6db3ff;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.close-score-card-btn:hover {
    background: rgba(109, 179, 255, 0.4);
    transform: rotate(90deg);
}

.score-card-modal-title {
    color: #6db3ff;
    font-size: 28px;
    margin: 0 0 25px 0;
    text-shadow: 0 0 10px rgba(109, 179, 255, 0.5);
}

/* ============ MODERN LEADERBOARD STYLES ============ */

.leaderboard-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #A590D7;
}

.leaderboard-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Filter Tabs - New Grid Layout */
.filter-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
}

.filter-tab {
    padding: 0.875rem 1.25rem;
    background: rgba(109, 179, 255, 0.08);
    color: #6db3ff;
    border: 2px solid #6db3ff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.filter-tab:hover {
    background: rgba(109, 179, 255, 0.15);
    border-color: #6db3ff;
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(109, 179, 255, 0.2);
}

.filter-tab.active {
    background: #6db3ff;
    color: #0f0f1e;
    border-color: #6db3ff;
    box-shadow: 0 4px 16px rgba(109, 179, 255, 0.4);
}

/* Daily button spans full width */
.filter-tab:nth-child(3) {
    grid-column: 1 / -1;
}

/* Leaderboard List */
.leaderboard-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 0;
}

.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(109, 179, 255, 0.05);
    border-radius: 3px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(109, 179, 255, 0.2);
    border-radius: 3px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 179, 255, 0.3);
}

/* Leaderboard Row Card */
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(109, 179, 255, 0.08);
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.leaderboard-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(109, 179, 255, 0.1);
    transition: background 0.3s ease;
}

.leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(109, 179, 255, 0.15);
    transform: translateX(4px);
}

.leaderboard-row.rank-1::before {
    background: linear-gradient(180deg, #ffd700, #ffed4e);
}

.leaderboard-row.rank-2::before {
    background: linear-gradient(180deg, #c0c0c0, #e8e8e8);
}

.leaderboard-row.rank-3::before {
    background: linear-gradient(180deg, #cd7f32, #e6a961);
}

/* Rank Badge */
.rank-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(109, 179, 255, 0.15);
    border: 1px solid rgba(109, 179, 255, 0.2);
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    color: #6db3ff;
    flex-shrink: 0;
    position: relative;
}

.rank-badge.top-1 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a1a;
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.rank-badge.top-2 {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #1a1a1a;
    border-color: #c0c0c0;
}

.rank-badge.top-3 {
    background: linear-gradient(135deg, #cd7f32, #e6a961);
    color: #1a1a1a;
    border-color: #cd7f32;
}

/* Crown Badge for Top 3 */
.crown-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.25rem;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* User Info */
.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.username {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95rem;
    word-break: break-word;
}

.user-rank-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Score */
.score-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.score-value {
    font-weight: 700;
    color: #6db3ff;
    font-size: 1.125rem;
    font-variant-numeric: tabular-nums;
}

.score-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1.5rem;
    color: rgba(255, 255, 255, 0.5);
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-text {
    font-size: 0.95rem;
    text-align: center;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(109, 179, 255, 0.1);
}

.pagination-btn {
    padding: 0.625rem 1.25rem;
    background: rgba(109, 179, 255, 0.1);
    color: #6db3ff;
    border: 1px solid rgba(109, 179, 255, 0.2);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(109, 179, 255, 0.2);
    border-color: rgba(109, 179, 255, 0.4);
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .leaderboard-header {
        gap: 1rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .leaderboard-title {
        font-size: 1.25rem;
    }

    .filter-tabs {
        gap: 0.5rem;
    }

    .filter-tab {
        flex: 1;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .leaderboard-row {
        gap: 0.75rem;
        padding: 0.875rem;
    }

    .rank-badge {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.9rem;
    }

    .score-value {
        font-size: 1rem;
    }

    .pagination-controls {
        gap: 0.75rem;
        flex-wrap: wrap;
    }
}

.score-card-container {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #e19be6;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}

.score-card-display {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(225, 155, 230, 0.3);
}

.score-card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.share-action-btn {
    flex: 1;
    min-width: 150px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: linear-gradient(135deg, #6db3ff 0%, #4a8fd4 100%);
    box-shadow: 0 4px 15px rgba(109, 179, 255, 0.4);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(109, 179, 255, 0.6);
}

.download-btn {
    background: linear-gradient(135deg, #e19be6 0%, #c76fb8 100%);
    box-shadow: 0 4px 15px rgba(225, 155, 230, 0.4);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 155, 230, 0.6);
}

.twitter-btn {
    background: linear-gradient(135deg, #1da1f2 0%, #1a8cd8 100%);
    box-shadow: 0 4px 15px rgba(29, 161, 242, 0.4);
}

.twitter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(29, 161, 242, 0.6);
}

@media (max-width: 768px) {
    .score-card-modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .score-card-modal-title {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .score-card-actions {
        flex-direction: column;
    }
    
    .share-action-btn {
        width: 100%;
    }
}
