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;
}

/* 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: 1;
    min-width: clamp(280px, 90vw, none);
    max-width: 100%;
    width: 100%;
    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 0 clamp(300px, 30vw, 670px);
    min-width: clamp(300px, 30vw, 563px);
    max-width: 670px;
    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: 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.revives-choice {
    background: linear-gradient(135deg, #ff9a6b 0%, #ff7f50 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;
}

.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;
}

.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;
}

.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);
    }
}

/* Tablet Portrait / Large Mobile (768px - 1199px) */
@media (max-width: 1199px) {
    .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 Adjustments */
@media (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;
    }
}

.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: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.game-over-screen.hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.game-over-board {
    background: linear-gradient(135deg, #0a0a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 1px 20px;
    border-radius: 20px;
    box-shadow: 
        0 0 40px rgba(255, 0, 127, 0.8),
        0 0 80px rgba(0, 255, 200, 0.6),
        0 20px 60px rgba(0, 0, 0, 0.95),
        inset 0 0 20px rgba(255, 0, 127, 0.15),
        inset 0 0 40px rgba(0, 255, 200, 0.1);
    text-align: center;
    max-width: 480px;
    max-height: 90vh;
    width: 85%;
    border: 3px solid;
    border-image: linear-gradient(135deg, #ff007f, #00ffc8, #ff007f) 1;
    animation: neonPulse 3s ease-in-out infinite, boardRumble 0.4s ease-out, cyberGlitch 4s ease-in-out infinite;
    pointer-events: auto;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.close-game-over-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: #00ffc8;
    font-size: 1.8em;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    line-height: 1;
    font-weight: 300;
    opacity: 0.8;
}

.close-game-over-btn:hover {
    opacity: 1;
    text-shadow: 0 0 10px #00ffc8, 0 0 20px #00ffc8;
    transform: scale(1.1);
}

.close-game-over-btn:active {
    transform: scale(0.95);
}

@keyframes cyberGlitch {
    0%, 100% { transform: translate(0, 0); filter: drop-shadow(0 0 0 transparent); }
    20% { transform: translate(-2px, 1px); filter: drop-shadow(2px 0 0 rgba(255, 0, 127, 0.3)); }
    40% { transform: translate(2px, -1px); filter: drop-shadow(-2px 0 0 rgba(0, 255, 200, 0.3)); }
    60% { transform: translate(-1px, 2px); filter: drop-shadow(0 2px 0 rgba(255, 0, 127, 0.2)); }
    80% { transform: translate(1px, -2px); filter: drop-shadow(0 -2px 0 rgba(0, 255, 200, 0.2)); }
}

@keyframes neonPulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(255, 0, 127, 0.6),
            0 0 60px rgba(0, 255, 200, 0.4),
            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;
}

.play-again-btn,
.share-btn {
    flex: 1;
}

.play-again-btn {
    background: linear-gradient(135deg, #00ffc8 0%, #00d4aa 100%);
    color: #0a0a2e;
    box-shadow: 0 0 20px rgba(0, 255, 200, 0.6), 0 8px 20px rgba(0, 255, 200, 0.4);
    font-weight: 800;
}

.play-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(0, 255, 200, 0.7), 0 8px 25px rgba(0, 255, 200, 0.5);
}

.play-again-btn:active {
    transform: translateY(-1px);
}

.share-btn {
    background: linear-gradient(135deg, #ff007f 0%, #ff1493 100%);
    color: white;
    box-shadow: 0 0 20px rgba(255, 0, 127, 0.6), 0 8px 20px rgba(255, 0, 127, 0.4);
    font-weight: 800;
}

.share-btn:hover {
    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;
}

/* Revive Popup Styles */
.revive-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 700px;
    height: 280px;
    margin: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: auto;
}

.revive-popup.hidden {
    display: none;
}

.revive-popup-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #00d4ff;
    border-radius: 20px;
    padding: 18px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    animation: popupSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.revive-popup-content h2 {
    font-size: 1.8em;
    color: #00d4ff;
    margin: 0 0 15px 0;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

/* Circular Timer */
.revive-timer-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 12px auto;
}

.revive-timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-background {
    fill: none;
    stroke: rgba(0, 212, 255, 0.2);
    stroke-width: 4;
}

.timer-progress {
    fill: none;
    stroke: #00d4ff;
    stroke-width: 4;
    stroke-dasharray: 565.48; /* 2 * π * 90 */
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 5px rgba(0, 212, 255, 0.6));
}

.revive-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}

/* Revive Stats */
.revive-stats {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    padding: 12px;
    margin: 12px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    font-size: 1.1em;
}

.stat-label {
    color: #aaa;
}

.stat-value {
    color: #00d4ff;
    font-weight: bold;
    font-size: 1.2em;
}

/* Revive Buttons */
.revive-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.revive-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.revive-use {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

.revive-use:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
}

.revive-use:active {
    transform: translateY(0);
}

.revive-skip {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.revive-skip:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

@keyframes popupSlideIn {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 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: 75vh;
        padding: 1px 12px;
        width: 90vw;
    }
    
    .leaderboard-entry {
        font-size: 0.9em;
        padding: 8px;
    }
    
    .pagination-btn {
        font-size: 0.85em;
        padding: 6px 10px;
    }
}