* {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#gameArea {
    /* Force 2:1 Aspect Ratio */
    aspect-ratio: 2 / 1;

    /* Constraints to fit screen */
    width: 100%;
    height: auto;
    max-width: 100vw;
    max-height: 60svh;
    /* Dynamic viewport height for iOS */

    /* Centering & Object Fit */
    display: block;
    margin: auto;
    object-fit: contain;

    /* Visuals */
    background-color: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* 橫向時允許更大的高度 */
@media (orientation: landscape) {
    #gameArea {
        max-height: 100svh;
    }
}

/* 直立模式：縮短高度讓按鈕有空間 */
@media (orientation: portrait) {
    #gameArea {
        max-height: 45svh;
        width: 100%;
    }

    #gameUI {
        top: 8px;
        padding: 6px 12px;
        gap: 8px;
        font-size: 14px;
        width: 98%;
        justify-content: space-around;
    }

    #score,
    #highScore {
        font-size: 13px;
    }

    #gameUI button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    #controlButtons {
        bottom: 20px;
        gap: 25px;
    }

    .controlButton {
        width: 75px;
        height: 75px;
        font-size: 30px;
    }

    #jumpButton {
        width: 88px;
        height: 88px;
        font-size: 34px;
    }
}

/* ========== START SCREEN ========== */
#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #98D8C8 50%, #7BC67E 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#gameTitle {
    font-size: 48px;
    font-weight: 900;
    color: #FF0000;
    text-shadow: 3px 3px 0 #000, -1px -1px 0 #FFD700;
    margin-bottom: 10px;
    animation: bounce 1s ease-in-out infinite;
    text-align: center;
    padding: 0 20px;
}

#gameSubtitle {
    font-size: 20px;
    color: #333;
    margin-bottom: 30px;
    font-weight: bold;
}

#startInstructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    max-width: 90%;
}

#startInstructions p {
    margin: 8px 0;
    font-size: 16px;
    color: #333;
}

#startButton {
    padding: 18px 60px;
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(180deg, #FF6B6B 0%, #FF0000 100%);
    color: white;
    border: 4px solid #8B0000;
    border-radius: 50px;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 6px 0 #8B0000, 0 10px 10px rgba(0, 0, 0, 0.2);
}

#startButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #8B0000, 0 15px 20px rgba(0, 0, 0, 0.3);
}

#startButton:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #8B0000, 0 5px 5px rgba(0, 0, 0, 0.2);
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ========== GAME UI ========== */
#gameUI {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 25px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-left: max(25px, env(safe-area-inset-left));
    padding-right: max(25px, env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    z-index: 100;
    transition: all 0.3s ease;
}

#score,
#highScore {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

#gameUI button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#gameUI button:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

#gameUI button:active {
    transform: scale(0.95);
}

/* ========== PAUSE OVERLAY ========== */
#pauseOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 20, 40, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.3s ease;
}

#pauseText {
    font-size: 64px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
    letter-spacing: 2px;
}

#resumeButton {
    padding: 15px 60px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

#resumeButton:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.3);
}

#pauseActions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.pauseSecondaryBtn {
    padding: 10px 28px;
    font-size: 15px;
    color: #ddd;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.pauseSecondaryBtn:hover {
    border-color: #FFD700;
    color: #FFD700;
}

/* ========== GAME OVER OVERLAY ========== */
#gameOverOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.5s ease;
}

#gameOver {
    font-size: 60px;
    font-weight: 900;
    color: #FF6B6B;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    text-align: center;
}

#finalScore {
    font-size: 32px;
    color: #FFD700;
    margin-bottom: 20px;
    font-weight: bold;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

#finalHighScore {
    font-size: 24px;
    color: #fff;
    margin-bottom: 30px;
    font-weight: bold;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    transition: transform 0.5s ease;
}

#restartButton {
    padding: 18px 50px;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF0000 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 0, 0, 0.3);
    transition: all 0.2s;
}

#restartButton:hover {
    transform: scale(1.05) translateY(-2px);
}

/* ========== TOUCH CONTROLS ========== */
#controlButtons {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    display: none;
    justify-content: center;
    gap: 40px;
    z-index: 100;
    padding: 0 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    pointer-events: none;
}

.controlButton {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    color: white;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    pointer-events: auto;
    transition: transform 0.08s, background 0.1s, box-shadow 0.1s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.controlButton:active {
    transform: scale(0.88);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 2px 8px rgba(255, 255, 255, 0.4), 0 0 20px rgba(255, 255, 255, 0.3);
}

#jumpButton {
    width: 105px;
    height: 105px;
    background: rgba(255, 80, 80, 0.45);
    border-color: rgba(255, 120, 120, 0.7);
    font-size: 40px;
}

#jumpButton:active {
    background: rgba(255, 100, 100, 0.7);
    box-shadow: 0 4px 10px rgba(255, 0, 0, 0.3), inset 0 2px 8px rgba(255, 255, 255, 0.3), 0 0 25px rgba(255, 100, 100, 0.5);
}

/* ========== ORIENTATION WARNING ========== */
#orientationWarning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.rotate-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: rotatePhone 2s infinite ease-in-out;
    display: block;
}

#orientationWarning p {
    font-size: 24px;
    line-height: 1.5;
    font-weight: bold;
    color: #fff;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes rotatePhone {

    0%,
    10% {
        transform: rotate(0deg);
    }

    40%,
    60% {
        transform: rotate(-90deg);
    }

    90%,
    100% {
        transform: rotate(0deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 850px) {
    #gameArea {
        /* Remove forced width/height to let aspect-ratio work globally */
        border: none;
        border-radius: 0;
    }

    #gameUI {
        top: 10px;
        padding: 8px 15px;
        gap: 10px;
        width: 95%;
        justify-content: space-around;
    }

    #score,
    #highScore {
        font-size: 16px;
    }

    #gameUI button {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    #gameTitle {
        font-size: 32px;
    }

    #pauseText {
        font-size: 40px;
    }

    #gameOver {
        font-size: 40px;
    }
}

/* 觸控裝置（含直立與橫向）均顯示觸控按鈕 */
@media (pointer: coarse) {
    #controlButtons {
        display: flex !important;
    }
}

/* 小螢幕也顯示觸控按鈕 */
@media (max-width: 850px) {
    #controlButtons {
        display: flex !important;
    }
}

/* 橫向時按鈕隱藏（鍵盤玩家不需要） */
@media (pointer: fine) and (orientation: landscape) {
    #controlButtons {
        display: none !important;
    }
}

/* ========== Audio Settings Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.95), rgba(50, 50, 80, 0.95));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 25px 35px;
    min-width: 300px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    font-size: 24px;
    color: #FFD700;
    margin: 0 0 20px 0;
    text-align: center;
}

.volume-control {
    margin: 15px 0;
}

.volume-control label {
    display: block;
    color: #FFF;
    font-size: 14px;
    margin-bottom: 8px;
}

.volume-control input[type=range] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
}

.volume-control span {
    display: block;
    text-align: right;
    color: #AAA;
    font-size: 12px;
    margin-top: 4px;
}

#closeSettingsBtn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    font-size: 16px;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

#settingsButton {
    font-size: 18px;
}

/* ========== PAUSE STATS & GUIDE ========== */
#pauseContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 10px;
    width: 100%;
}

#pauseStats,
#controlGuide {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 15px 25px;
    width: 90%;
    max-width: 300px;
}

.stat-row,
.guide-row {
    display: flex;
    justify-content: space-between;
    color: white;
    font-size: 16px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child,
.guide-row:last-child {
    border-bottom: none;
}

.stat-row span:first-child,
.guide-row span:first-child {
    color: #CCC;
}

.stat-row span:last-child,
.guide-row span:last-child {
    font-weight: bold;
    color: #FFD700;
}

.guide-title {
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.guide-row span:first-child {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.guide-row span:last-child {
    color: #FFF;
}

/* Landscape Layout for Pause Menu */
@media (orientation: landscape) and (max-height: 600px) {
    #pauseContent {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
    }

    #pauseText {
        font-size: 32px;
        margin-bottom: 10px;
        width: 100%;
        text-align: center;
    }

    #pauseStats,
    #controlGuide {
        width: 45%;
        margin: 0;
    }
}

/* Mobile Portrait Adjustments */
@media (max-width: 480px) {
    #pauseText {
        font-size: 36px;
        margin-bottom: 20px;
    }

    #pauseStats,
    #controlGuide {
        padding: 12px 20px;
    }

    .stat-row,
    .guide-row {
        font-size: 14px;
    }
}

/* ========== iOS Safari Landscape Fix ========== */
/* Use svh (smallest viewport height) which accounts for browser UI */
@media (pointer: coarse) and (orientation: landscape) {
    body {
        /* Remove padding that might cause issues */
        padding: 0;
        margin: 0;
        /* Use flex to center game area properly */
        min-height: 100svh;
        min-height: -webkit-fill-available;
    }

    #gameArea {
        /* Use svh which is the smallest possible viewport (accounts for all browser chrome) */
        max-height: 85svh;
        max-height: min(85svh, calc(100svh - 60px));
        /* Fallback for browsers that don't support svh */
        max-height: calc(100vh - 80px);
        width: auto;
        /* Let width be calculated from height via aspect-ratio */
    }

    #gameUI {
        top: 5px;
        padding-top: 5px;
    }
}

/* ============================================================ */
/* Level Select Screen — NES retro style text menu (v2.27.0)    */
/* ============================================================ */

#levelSelectScreen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    font-family: 'Courier New', 'Consolas', monospace;
    padding: 20px;
    box-sizing: border-box;
}

#levelSelectScreen.active {
    display: flex;
}

#levelSelectScreen .lsTitle {
    font-size: 36px;
    font-weight: 900;
    color: #FFD700;
    letter-spacing: 4px;
    text-shadow: 3px 3px 0 #FF0000;
    margin-bottom: 8px;
    text-align: center;
}

#levelSelectScreen .lsSubtitle {
    font-size: 13px;
    color: #888;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

#levelSelectList {
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    width: min(420px, 90vw);
}

#levelSelectList li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    margin: 6px 0;
    border: 2px solid #333;
    background: #111;
    color: #ccc;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.1s, transform 0.1s, border-color 0.1s;
    user-select: none;
}

#levelSelectList li.unlocked:hover,
#levelSelectList li.unlocked.selected {
    background: #FFD700;
    color: #000;
    border-color: #FF0000;
    transform: translateX(8px);
}

#levelSelectList li.unlocked.selected::before {
    content: '▶';
    color: #FF0000;
    font-weight: 900;
    margin-right: 4px;
}

#levelSelectList li.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

#levelSelectList li .lsEmoji {
    font-size: 26px;
    flex-shrink: 0;
}

#levelSelectList li .lsName {
    font-weight: 900;
    flex: 1;
}

#levelSelectList li .lsSub {
    font-size: 14px;
    color: #888;
}

#levelSelectList li.unlocked.selected .lsSub,
#levelSelectList li.unlocked:hover .lsSub {
    color: #444;
}

#levelSelectList li .lsLock {
    font-size: 16px;
    color: #666;
}

#levelSelectList li.endless {
    border-top: 4px double #555;
    margin-top: 18px;
    padding-top: 18px;
    color: #4CAF50;
}

#levelSelectList li.endless .lsName {
    color: #4CAF50;
}

#levelSelectList li.endless.selected,
#levelSelectList li.endless:hover {
    background: #4CAF50;
    color: #000;
}

#levelSelectList li.endless.selected .lsName,
#levelSelectList li.endless:hover .lsName {
    color: #000;
}

#levelSelectScreen .lsBack {
    padding: 10px 28px;
    font-size: 14px;
    background: transparent;
    color: #888;
    border: 2px solid #444;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 1px;
}

#levelSelectScreen .lsBack:hover {
    color: #fff;
    border-color: #fff;
}

/* ============================================================ */
/* Level Cleared Overlay (v2.27.0)                              */
/* ============================================================ */

#levelClearedOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    animation: fadeIn 0.5s ease;
    font-family: 'Courier New', 'Consolas', monospace;
}

#levelClearedOverlay.active {
    display: flex;
}

#levelClearedOverlay .lcTitle {
    font-size: 44px;
    font-weight: 900;
    color: #FFD700;
    letter-spacing: 6px;
    text-shadow: 3px 3px 0 #FF0000, 0 0 20px rgba(255, 215, 0, 0.6);
    margin-bottom: 24px;
    animation: bounce 1.2s ease-in-out infinite;
    text-align: center;
}

#levelClearedOverlay .lcLevelName {
    font-size: 28px;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

#levelClearedOverlay .lcScore {
    font-size: 22px;
    color: #FFD700;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

#levelClearedOverlay .lcUnlock {
    font-size: 16px;
    color: #4CAF50;
    margin-bottom: 36px;
    min-height: 24px;
    text-align: center;
    padding: 0 20px;
}

#levelClearedOverlay .lcButtons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

#levelClearedOverlay .lcButtons button {
    padding: 14px 32px;
    font-size: 18px;
    font-weight: 900;
    border: 3px solid;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 1px;
}

#lcNextLevelBtn {
    background: #FFD700;
    color: #000;
    border-color: #FF0000;
}

#lcNextLevelBtn:hover {
    background: #FFA500;
    transform: translateY(-2px);
}

#lcNextLevelBtn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

#lcMenuBtn {
    background: transparent;
    color: #fff;
    border-color: #888;
}

#lcMenuBtn:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    #levelSelectScreen .lsTitle {
        font-size: 28px;
    }
    #levelSelectList li {
        font-size: 16px;
        padding: 12px 14px;
    }
    #levelClearedOverlay .lcTitle {
        font-size: 32px;
        letter-spacing: 4px;
    }
    #levelClearedOverlay .lcLevelName {
        font-size: 22px;
    }
}

/* ============================================================ */
/* Update Banner — PWA new-version detection (v2.27.1)           */
/* ============================================================ */

#updateBanner {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 14px 20px;
    border: 2px solid #FFD700;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    gap: 12px;
    font-family: 'Courier New', monospace;
    animation: slideUp 0.4s ease;
    max-width: 92vw;
}

#updateBanner.active {
    display: flex;
}

#updateBannerText {
    font-size: 14px;
    color: #FFD700;
    letter-spacing: 0.5px;
}

#updateBannerBtn {
    padding: 8px 18px;
    background: #FFD700;
    color: #000;
    border: none;
    border-radius: 4px;
    font-weight: 900;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 1px;
}

#updateBannerBtn:hover {
    background: #FFA500;
}

#updateBannerDismiss {
    background: transparent;
    color: #888;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    line-height: 1;
}

#updateBannerDismiss:hover {
    color: #fff;
}

@keyframes slideUp {
    from { transform: translate(-50%, 100px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@media (max-width: 600px) {
    #updateBanner {
        bottom: 10px;
        padding: 10px 14px;
        font-size: 12px;
    }
    #updateBannerText { font-size: 12px; }
    #updateBannerBtn { padding: 6px 12px; font-size: 12px; }
}

/* ============================================================ */
/* Achievements Modal (v2.29.0)                                 */
/* ============================================================ */

#achievementsModal .achievementsContent {
    width: min(560px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

#achievementsHeaderRate {
    font-size: 16px;
    color: #4CAF50;
    font-weight: 600;
}

#achievementsList {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin: 12px 0 18px 0;
    max-height: 56vh;
}

.achievementItem {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    margin: 6px 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.05);
    transition: border-color 0.15s;
}

.achievementItem.unlocked {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.15));
    border-color: rgba(255, 215, 0, 0.5);
}

.achievementItem.locked {
    opacity: 0.55;
}

.achievementItem .achIcon {
    font-size: 32px;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}

.achievementItem.unlocked .achIcon {
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.6));
}

.achievementItem .achText {
    flex: 1;
    min-width: 0;
}

.achievementItem .achName {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.achievementItem.unlocked .achName {
    color: #FFD700;
}

.achievementItem.locked .achName {
    color: #888;
}

.achievementItem .achDesc {
    font-size: 13px;
    color: #aaa;
    line-height: 1.3;
}

.achievementItem .achReward {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    display: inline-block;
}

.achievementItem .achReward.achRewardActive {
    color: #FFD700;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.achievementItem .achStatus {
    font-size: 14px;
    flex-shrink: 0;
    color: #4CAF50;
    font-weight: 700;
}

#closeAchievementsBtn {
    align-self: center;
    padding: 10px 36px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

#closeAchievementsBtn:hover {
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    #achievementsModal .achievementsContent {
        padding: 18px 18px;
    }
    .achievementItem .achIcon { font-size: 26px; width: 36px; }
    .achievementItem .achName { font-size: 14px; }
    .achievementItem .achDesc { font-size: 12px; }
}