:root {
    --cell-size: 60px;
    --grid-cols: 5;
    --grid-rows: 9;
    --color-bg-1: #1a1a2e;
    --color-bg-2: #16213e;
    --color-accent: #4a90e2;
    --color-danger: #ff4757;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    /* Removed margin: 0; as it's now in html, body */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Removed min-height: 100vh; as height: 100% is set on html, body */
    font-family: 'Poppins', sans-serif;
    color: white;
    /* Removed overflow: hidden; as it's now in html, body */
    touch-action: none;
    position: relative;
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- Layout Structure --- */
#app-root {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* --- Main Menu & Modes --- */
.screen {
    position: fixed;
    /* Changed from absolute to fixed */
    inset: 0;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 80px;
    /* Space for bottom nav */
    z-index: 100;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    width: 100%;
    height: 100%;
}

/* Main Game Area */
.game-layout {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

/* Game Board Container */
.board-container {
    position: relative;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 2px solid var(--color-accent);
    box-shadow: 0 0 50px rgba(74, 144, 226, 0.4),
                0 0 100px rgba(74, 144, 226, 0.15),
                inset 0 0 30px rgba(255, 255, 255, 0.08);
    animation: boardGlow 3s ease-in-out infinite;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.board-container:hover {
    transform: perspective(1000px) rotateX(2deg) scale(1.01);
    box-shadow: 0 0 70px rgba(74, 144, 226, 0.6),
                0 0 120px rgba(74, 144, 226, 0.2),
                inset 0 0 40px rgba(255, 255, 255, 0.1);
}

@keyframes boardGlow {

    0%,
    100% {
        box-shadow: 0 0 40px rgba(74, 144, 226, 0.3), 0 0 80px rgba(74, 144, 226, 0.1), inset 0 0 20px rgba(255, 255, 255, 0.05);
    }

    50% {
        box-shadow: 0 0 60px rgba(74, 144, 226, 0.5), 0 0 100px rgba(74, 144, 226, 0.2), inset 0 0 30px rgba(255, 255, 255, 0.08);
    }
}

canvas {
    display: block;
    border-radius: 12px;
    background: rgba(20, 20, 30, 0.9);
}

/* Side Panel */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 175px;
}

/* Side Logo Styling (Updated) */
.side-logo-container {
    width: 100%;
    height: 160px;
    /* Significantly larger */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    border-radius: 12px;
    overflow: hidden;
}

.side-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transform: scale(1.5);
    /* Much larger zoom */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.panel-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 14px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.2s ease, 
                border-color 0.2s ease;
}

.panel-box:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.panel-title {
    font-size: 12px;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 600;
}

.score-val {
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    color: #fff;
}

/* Progress Bar */
.level-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.level-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a90e2, #66d9e8);
    transition: width 0.3s ease-out;
}

/* Tutorial Styling */
.tutorial-content {
    text-align: left;
    font-size: 11px;
    color: #ccc;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.t-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.key-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: #fff;
    font-size: 10px;
}

.t-icon {
    display: inline-block;
    width: 12px;
    text-align: center;
}

/* Next Piece Preview */
#preview-canvas {
    margin: 0 auto;
    background: transparent;
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    border-radius: 12px;
    transition: opacity 0.3s;
}

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

.btn-start {
    margin-top: 20px;
    padding: 12px 30px;
    background: var(--color-accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.btn-start:hover {
    transform: scale(1.05);
    background: #357abd;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    /* Hidden by default, shown only when buttons mode is selected */
    width: 100%;
    max-width: 400px;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.control-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    touch-action: manipulation;
    user-select: none;
}

.control-btn:active {
    background: rgba(74, 144, 226, 0.4);
    transform: scale(0.95);
}

.death-line-glow {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    box-shadow: 0 0 15px var(--color-danger);
    background: var(--color-danger);
    z-index: 10;
    opacity: 0.8;
    pointer-events: none;
}

/* Footer */
.footer {
    margin-top: 15px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s;
}

.footer img:hover {
    opacity: 1;
}

@keyframes flip {
    0% {
        transform: rotateY(0deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

.flip {
    animation: flip 0.6s ease-in-out;
}

@keyframes shake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake-subtle {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(0, 2px);
    }

    50% {
        transform: translate(0, -1px);
    }

    75% {
        transform: translate(0, 1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.shake-subtle {
    animation: shake-subtle 0.2s ease-out;
}

/* Media Queries */
@media (max-width: 768px) {
    :root {
        --cell-size: 38px;
    }

    #app-root {
        justify-content: flex-start;
        padding-top: env(safe-area-inset-top);
    }

    .game-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
        width: 100%;
        gap: 0;
        justify-content: space-between;
        align-items: center;
    }

    .board-container {
        margin-top: 10px;
        order: 1;
        flex: 0 0 auto;
    }

    .side-panel {
        order: 2;
        flex-direction: row;
        width: 100%;
        max-width: 500px;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 10px calc(env(safe-area-inset-bottom) + 10px) 10px;
        background: rgba(13, 17, 23, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: auto;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
    }

    .panel-box {
        padding: 6px;
        flex: 1 1 0;
        min-width: 0;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.03);
    }

    .hold-hint-mobile {
        display: block;
        font-size: 8px;
        opacity: 0.6;
    }

    /* Top Row Boxes (Score, Hold, Next) */
    .panel-box:not(.level-panel) {
        height: 72px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    /* Bottom Row (Level Bar) */
    .level-panel {
        flex: 1 1 100% !important;
        margin-top: 2px;
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 4px 12px !important;
        height: auto;
    }

    .level-panel .panel-title {
        margin-bottom: 0;
        margin-right: 10px;
        white-space: nowrap;
    }

    .level-panel .score-val {
        font-size: 16px;
        margin-right: 15px;
    }

    .level-bar-container {
        flex-grow: 1;
        margin-top: 0;
    }

    .tutorial-content, .side-logo-container {
        display: none !important;
    }
}

/* Settings Modal */
.settings-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 60;
    backdrop-filter: blur(5px);
}

.settings-modal.hidden {
    display: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 280px;
    margin-bottom: 15px;
}

.setting-label {
    color: #fff;
    font-size: 14px;
}

.setting-slider {
    width: 150px;
    accent-color: var(--color-accent);
}

.btn-close {
    margin-top: 20px;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    border-radius: 4px;
    cursor: pointer;
}

.btn-close:hover {
    background: rgba(74, 144, 226, 0.1);
}

.btn-settings {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    z-index: 40;
}

.btn-settings:hover {
    color: #fff;
}

/* --- Main Menu & Modes --- */
.screen {
    position: absolute;
    inset: 0;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 60px 20px;
    z-index: 100;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.menu-logo {
    width: 280px;
    margin-bottom: 40px;
    filter: drop-shadow(0 0 20px rgba(74, 144, 226, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.mode-cards-container {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 900px;
}

.mode-card {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(102, 217, 232, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px !important;
    padding: 20px;
    width: 160px;
    min-height: 140px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.mode-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(102, 217, 232, 0.1));
    border-color: var(--color-accent);
    box-shadow: 0 15px 40px rgba(74, 144, 226, 0.4), 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mode-card h3 {
    margin: 0 0 10px 0;
    color: var(--color-accent);
    font-size: 18px;
}

.mode-card p {
    font-size: 12px;
    color: #aaa;
    margin: 0;
    line-height: 1.4;
}

.mode-icon {
    font-size: 32px;
    margin-bottom: 15px;
    display: block;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
    /* Handle iPhone Home Bar */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: color 0.2s;
    flex: 1;
    height: 100%;
}

.nav-item.active,
.nav-item:hover {
    color: var(--color-accent);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

/* Ads Banner */
.ads-banner {
    width: 100%;
    max-width: 350px;
    background: linear-gradient(90deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    margin-top: 10px;
    margin-bottom: 80px;
    /* Space for bottom nav */
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    transition: transform 0.2s;
}

.ads-banner:active {
    transform: scale(0.98);
}

/* Mobile App Mode List Redesign */
@media (max-width: 768px) {
    .mode-cards-container {
        flex-direction: column !important;
        gap: 15px !important;
        width: 100%;
        padding-bottom: 20px;
    }

    .mode-card {
        width: 100% !important;
        max-width: 100% !important;
        min-height: auto !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 15px 20px !important;
        margin: 0 !important;
    }

    .mode-icon {
        font-size: 24px !important;
        margin-bottom: 0 !important;
        margin-right: 20px !important;
        background: rgba(255, 255, 255, 0.1);
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
    }

    .mode-card h3 {
        margin: 0 0 4px 0 !important;
        font-size: 16px !important;
    }

    .mode-card p {
        font-size: 11px !important;
        opacity: 0.7;
    }
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 100px;
    height: 32px;
}

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

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(74, 144, 226, 0.2);
    border: 2px solid var(--color-accent);
    border-radius: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-label:before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background: var(--color-accent);
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle-input:checked+.toggle-label {
    background: rgba(102, 217, 232, 0.2);
}

.toggle-input:checked+.toggle-label:before {
    transform: translateX(68px);
}

.toggle-text {
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    z-index: 1;
    letter-spacing: 0.5px;
}

.toggle-input:checked+.toggle-label .toggle-text::after {
    content: "MODERN";
}

.toggle-input:not(:checked)+.toggle-label .toggle-text::after {
    content: "CLASSIC";
}

/* Ad Banner Container */
.ad-banner-container {
    width: 100%;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .ad-banner-container {
        min-height: 50px;
        margin-top: 10px;
    }
}

/* Mission Grid */
.mission-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-width: 800px;
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.mission-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
}

.mission-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}

.mission-card.completed {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.mission-card.locked {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(1);
}

.mission-title {
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    font-size: 14px;
}

.mission-desc {
    font-size: 11px;
    color: #aaa;
}

.mission-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
}

/* In-Game Mission UI */
.mission-hud {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile Portrait (< 768px) */
@media (max-width: 767px) {
    .game-layout {
        flex-direction: column !important;
        padding: 10px;
    }

    .side-panel {
        width: 100% !important;
        max-width: 300px;
        margin: 0 auto;
        order: 2;
    }

    .board-container {
        order: 1;
        margin: 0 auto;
    }

    canvas {
        max-width: 95vw;
    }

    .mobile-controls {
        display: flex !important;
    }

    .menu-logo {
        max-width: 80%;
        height: auto;
    }

    .mode-cards-container {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .mode-card {
        width: 100% !important;
        max-width: 350px;
        margin: 0 auto;
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .game-layout {
        flex-direction: column !important;
        align-items: center;
        padding: 20px;
    }

    .side-panel {
        width: 100% !important;
        max-width: 500px;
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        order: 2;
        margin-top: 20px;
    }

    .panel-item {
        flex: 1 1 200px;
        max-width: 250px;
    }

    .board-container {
        order: 1;
    }

    .mobile-controls {
        display: none;
    }

    .mode-cards-container {
        gap: 20px !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    .mode-card {
        flex: 1 1 calc(50% - 20px);
        min-width: 280px;
        max-width: 350px;
    }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    .game-layout {
        flex-direction: row !important;
        align-items: flex-start;
    }

    .side-panel {
        width: 180px !important;
        flex-direction: column !important;
    }

    .mobile-controls {
        display: none !important;
    }

    .mode-cards-container {
        flex-direction: row !important;
        justify-content: center;
        gap: 25px !important;
    }

    .mode-card {
        flex: 1 1 calc(33.333% - 20px);
        max-width: 300px;
    }
}

/* Ultra-wide Desktop (> 1600px) */
@media (min-width: 1600px) {
    .game-layout {
        max-width: 1400px;
        margin: 0 auto;
    }

    .side-panel {
        width: 200px !important;
    }
}

/* Pause Button - Smaller and Rounder */
#btn-pause {
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    font-size: 18px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make Hold Panel Tappable (Blue Outline on Mobile) */
@media (max-width: 768px) {
    #hold-panel {
        border: 2px solid var(--color-accent) !important;
        box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
        cursor: pointer;
        transition: all 0.2s;
    }

    #hold-panel:active {
        transform: scale(0.95);
        box-shadow: 0 0 15px rgba(74, 144, 226, 0.8);
    }
}

/* Back to Menu Button */
.menu-btn {
    padding: 12px 30px;
    background: var(--color-accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
}

.menu-btn:hover {
    transform: translateY(-2px);
    background: #357abd;
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.6);
}

.menu-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(74, 144, 226, 0.4);
}

/* Countdown Overlay */
#countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: fadeIn 0.2s ease-out;
}

#countdown-overlay.hidden {
    display: none;
}

#countdown-number {
    font-family: 'Fredoka One', cursive;
    font-size: 120px;
    color: var(--color-accent);
    text-shadow: 0 0 40px rgba(74, 144, 226, 0.8),
        0 0 80px rgba(74, 144, 226, 0.4);
    animation: countdownPulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes countdownPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    #countdown-number {
        font-size: 80px;
    }
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

input:checked+.slider {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Remove Black Rectangle from Settings */
.htp-section {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 20px;
}

/* Enhanced Settings Modal Styling */
.settings-modal {
    background: rgba(30, 30, 35, 0.98);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    padding: 40px;
    min-width: 300px;
    /* Smaller min-width for mobile */
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    /* Ensure full width */
}

.setting-row:last-child {
    border-bottom: none;
}