@font-face {
    font-family: 'TechnoRace';
    src: url('TechnoRaceItalic-eZRWe.otf') format('opentype'),
         url('TechnoRaceItalic-eZRWe.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'TechnoRace', cursive, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

#gameCanvas {
    display: block;
    background: #000;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    color: white;
    z-index: 10;
}

#gameplayHeader {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    padding: 0 15px;
    display: none;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 60;
}

#gameplayHeader.visible {
    display: grid;
}

#levelNameContainer {
    margin-top: 8px;
    text-align: center;
}

#currentScoreDisplay {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 16px;
    border-radius: 20px;
}

#headerLeftColumn {
    justify-self: start;
    min-width: 50px;
}

#bestContainer {
    justify-self: end;
}

#directionArrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
}

#directionArrow.arrow-left {
    left: 70%;
    transform: translateY(-50%) translateX(-50%) scaleX(-1);
}

#directionArrow.arrow-right {
    left: 30%;
    transform: translateY(-50%) translateX(-50%) scaleX(1);
}

#directionArrow svg {
    width: 100%;
    height: 100%;
}

#themeName {
    font-size: clamp(12px, 3vw, 16px);
    font-weight: bold;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 1px;
    -webkit-text-stroke: 0.5px #000;
}

#flapsContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#coinsContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#bestContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 20px;
}

#coinsIcon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

#coinsDisplay {
    font-size: clamp(20px, 6vw, 32px);
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px #000;
}

#flapsIcon {
    width: clamp(36px, 11.25vw, 54px); /* Another 50% larger: 24px -> 36px, 36px -> 54px */
    height: clamp(36px, 11.25vw, 54px); /* Another 50% larger: 24px -> 36px, 36px -> 54px */
    object-fit: contain;
}

#flapsDisplay {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    color: #FFB6C1;
    text-shadow: 1px 1px 2px #000;
}

#bestIcon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#highScore {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px #000;
}

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

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

@keyframes panelBackgroundMove {
    0% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
    100% {
        background-position: 0% center;
    }
}

#gameOver {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 90%;
    background: rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 3vh 5vw;
    z-index: 200;
    box-sizing: border-box;
    overflow: hidden;
}

@media (orientation: landscape) {
    #gameOver {
        justify-content: flex-start;
        padding-top: 8vh;
        gap: 2vh;
    }
}

@media (max-width: 768px) {
    #gameOver {
        height: 80%;
    }
}

#gameOverLogo {
    width: 70%;
    max-width: 350px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

@media (orientation: landscape) {
    #gameOverLogo {
        width: 20%;
        max-width: 200px;
    }
}

#ui:has(#gameOver[style*="display: flex"]) #scoreContainer {
    display: none !important;
}

#gameOverContent {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    min-width: 300px;
    flex-shrink: 0;
}

#gameOver h1 {
    display: none;
}

#gameOver p {
    display: none;
}

#congratsText p {
    display: block !important;
}

#scoreBox {
    background: rgba(0, 0, 0, 1);
    border-radius: 25px;
    padding: 2vh 2vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    border: 3px solid #FFD700;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 
        0 0 0 6px #CC7000,
        0 0 0 9px #995500,
        0 0 0 12px #663300,
        0 4px 20px rgba(0, 0, 0, 0.5);
}

#scoreGif {
    width: 100%;
    max-width: 256px;
    max-height: 180px;
    height: auto;
    object-fit: contain;
}

@keyframes rotateLeftRight {
    0%, 100% {
        transform: rotate(-15deg);
    }
    50% {
        transform: rotate(15deg);
    }
}

#scoreBoxScores {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.scoreSeparator {
    font-size: clamp(24px, 8vw, 40px);
    color: #FFD700;
    opacity: 0.6;
}

#flapsScoreCardContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0.5vh;
    padding: 4px 8px;
    background: transparent;
    border-radius: 0;
    border: none;
}

.flapsScoreCardIcon {
    width: clamp(21px, 6vw, 30px); /* 50% larger: 14px -> 21px, 20px -> 30px */
    height: clamp(21px, 6vw, 30px); /* 50% larger: 14px -> 21px, 20px -> 30px */
    object-fit: contain;
}

#flapsScoreCard {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: normal;
    color: #01edf4;
    text-shadow: 1px 1px 2px #000;
}

.flapsLabel {
    font-size: clamp(11px, 2.5vw, 14px);
    color: #01edf4;
    opacity: 0.7;
    text-transform: none;
    letter-spacing: 1px;
}

.scoreColumn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5vh;
}

.scoreRow {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.scoreValue {
    font-size: clamp(32px, 10vw, 56px);
    font-weight: bold;
    background: linear-gradient(180deg, #FFD700 0%, #FF8C00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    line-height: 1;
}

.starRating {
    display: flex;
    gap: 0.15em;
    align-items: center;
}

.starIcon {
    width: clamp(16px, 4vw, 24px);
    height: clamp(16px, 4vw, 24px);
    fill: #444;
    transition: fill 0.3s ease, transform 0.2s ease;
}

.starIcon.active {
    fill: #FFD700;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
}

.starIcon.active:nth-child(1) { animation: starPop 0.3s ease 0.0s both; }
.starIcon.active:nth-child(2) { animation: starPop 0.3s ease 0.1s both; }
.starIcon.active:nth-child(3) { animation: starPop 0.3s ease 0.2s both; }
.starIcon.active:nth-child(4) { animation: starPop 0.3s ease 0.3s both; }
.starIcon.active:nth-child(5) { animation: starPop 0.3s ease 0.4s both; }

@keyframes starPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.trophyIcon {
    width: clamp(20px, 6vw, 48px);
    height: clamp(20px, 6vw, 48px);
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
    flex-shrink: 0;
}

.scoreColumnIcon {
    width: clamp(28px, 8vw, 48px);
    height: clamp(28px, 8vw, 48px);
    object-fit: contain;
    margin-bottom: 4px;
}

.scoreColumnLabel {
    font-size: clamp(10px, 2.5vw, 14px);
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

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

#congratsSection {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    width: 100%;
    max-width: 600px;
    flex-shrink: 1;
    min-height: 0;
}

#congratsSection.show {
    display: flex;
}

#congratsGif {
    width: 100%;
    max-height: 30vh;
    height: auto;
    border-radius: 15px;
    flex-shrink: 1;
    object-fit: cover;
}

#congratsText {
    text-align: center;
    background: rgba(0, 0, 0, 1);
    padding: 3vh 5vw;
    border-radius: 25px;
    width: 100%;
    box-sizing: border-box;
    border: 3px solid #FFD700;
    box-shadow: 
        0 0 0 6px #CC7000,
        0 0 0 9px #995500,
        0 0 0 12px #663300,
        0 4px 20px rgba(0, 0, 0, 0.5);
}

#congratsText .line1 {
    font-size: clamp(24px, 6vw, 40px);
    font-weight: bold;
    color: #FFD700 !important;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#congratsText .star {
    color: #FFD700;
    font-size: 1.2em;
    display: inline-block;
    animation: sparkle 1.5s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8),
                 0 0 25px rgba(255, 215, 0, 0.6);
}

#congratsText .star:first-child {
    animation-delay: 0s;
}

#congratsText .star:last-child {
    animation-delay: 0.75s;
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
        opacity: 0.8;
    }
}

#congratsText .line2 {
    font-size: clamp(32px, 8vw, 56px);
    font-weight: bold;
    color: #FFD700 !important;
    margin: 1vh 0 0 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#gameLevelChoice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    flex-shrink: 0;
}

#chooseLevelText {
    font-size: clamp(18px, 8vw, 32px);
    font-weight: bold;
    /*background: linear-gradient(180deg, #C77DFF 0%, #7B2CBF 100%);*/
    background: white;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-text-stroke: 0.5px black;
    margin: 0;
    text-align: center;
}

#gameOverButtons {
    display: flex;
    gap: 4vw;
    align-items: center;
    justify-content: center;
}

.gameOverBtn {
    pointer-events: all;
    padding: 2vh 4vw;
    min-width: 100px;
    min-height: 50px;
    background: linear-gradient(145deg, #7B2CBF 0%, #9D4EDD 50%, #C77DFF 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 4px 0 #5A1E99,
                0 8px 15px rgba(0, 0, 0, 0.3);
    font-size: clamp(16px, 4vw, 24px);
    font-weight: bold;
}

.gameOverBtn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 6px 0 #5A1E99,
                0 12px 20px rgba(0, 0, 0, 0.4);
}

.gameOverBtn:active {
    transform: translateY(4px);
    box-shadow: inset 0 8px 15px rgba(0, 0, 0, 0.5),
                inset 0 -1px 3px rgba(255, 255, 255, 0.2),
                0 1px 0 #5A1E99,
                0 2px 5px rgba(0, 0, 0, 0.3);
}

#repeatBtn::after {
    content: 'REPLAY';
    font-family: 'TechnoRace', cursive, sans-serif;
}

#randomBtn::after {
    content: 'CHANGE';
    font-family: 'TechnoRace', cursive, sans-serif;
}

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

#startScreen * {
    pointer-events: all;
}

#platformBackground {
    position: absolute;
    bottom: 20%;
    left: 0;
    width: 100%;
    height: 20px;
    background-image: url('platform/bricks-greyscale.png');
    background-repeat: repeat-x;
    background-size: auto 20px;
    background-position: 0 0;
    z-index: 49;
    display: none;
    animation: platformScroll 2s linear infinite;
}

@keyframes platformScroll {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -64px 0;
    }
}

#collisionFlash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
}

@media (orientation: landscape) {
    #platformBackground {
        bottom: 15%;
    }
}

#bottomPanel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15%;
    background: rgb(13 13 13);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: 5px 20px;
    box-sizing: border-box;
    z-index: 5;
    overflow: hidden;
}

#bottomPanel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.5;
    animation: panelBackgroundMove 20s ease-in-out infinite;
    z-index: -1;
}

#bottomPanel > * {
    position: relative;
    z-index: 1;
}

.bottomRow {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 10px;
}

#levelRow {
    justify-content: center;
}

#themeNamePanel {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    color: #fff;
    text-align: center;
}

#controlsRow {
    justify-content: space-between;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    flex: 1;
}

.panelColumn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#difficultyColumn {
    flex: 0 0 20%;
    min-width: 70px;
    justify-content: center;
    height: 100%;
}

#gifColumn {
    flex: 0 0 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 60%;
    padding-top: 10px;
}

#panelGif {
    max-height: 100%;
    max-width: 80%;
    object-fit: contain;
    height: auto;
}

#panelStatusText {
    font-size: clamp(14.4px, 5vw, 24px); /* 20% larger: 12px -> 14.4px, 16px -> 19.2px */
    font-weight: bold;
    color: #01edf4;
    text-align: center;
    text-shadow: 1px 1px 2px #000, 0 0 10px rgba(1, 237, 244, 0.51);
    line-height: 1.3;
}

.pauseButton {
    display: none;
    pointer-events: all;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    padding: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pauseButton:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #FFD700;
}

.pauseButton:active {
    transform: scale(0.95);
}

.pauseButton svg {
    display: block;
}

.pauseButton.paused .pauseIcon {
    display: none;
}

.pauseButton.paused .playIcon {
    display: block !important;
}

#soundColumn {
    flex: 0 0 20%;
}

#socialRow {
    justify-content: center;
    gap: 15px;
    padding: 5px 0;
    flex-shrink: 0;
}

.socialLink {
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #9370DB;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'TechnoRace', cursive, sans-serif;
}

.socialLink:hover {
    color: #BA55D3;
    transform: translateY(-2px);
}

.socialLink svg {
    display: block;
}

.soundToggle {
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #9370DB;
    cursor: pointer;
    transition: all 0.2s ease;
}

.soundToggle:hover {
    color: #BA55D3;
    transform: translateY(-2px);
}

.soundIcon {
    display: block;
}

#difficultyLabel {
    font-size: clamp(10px, 2.5vw, 14px);
    font-weight: bold;
    color: #fff;
    text-align: center;
}

#difficultyControls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.difficultyBtn {
    pointer-events: all;
    padding: 8px 16px;
    min-width: 60px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(12px, 3vw, 16px);
    font-weight: bold;
    font-family: 'TechnoRace', cursive, sans-serif;
}

.difficultyBtn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.difficultyBtn.active {
    background: linear-gradient(145deg, #FF8C00 0%, #FFA500 50%, #FFD700 100%);
    color: #000;
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#difficultyToggle {
    pointer-events: all;
    cursor: pointer;
    padding: 4px 8px;
    background: transparent;
    border: none;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

#difficultyGear {
    font-size: clamp(12px, 3vw, 16.8px); /* 20% larger: 10px -> 12px, 14px -> 16.8px */
    transition: opacity 0.2s ease;
}

#difficultyToggle.disabled {
    cursor: default;
    pointer-events: none;
}

#difficultyToggle.disabled #difficultyGear {
    visibility: hidden;
    width: 0;
    margin: 0;
}

#difficultyToggle.disabled #currentDifficulty {
    color: #9370DB !important;
    background: none !important;
    -webkit-text-fill-color: #9370DB !important;
}

#difficultyToggle:not(.disabled):hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

#difficultyToggle:not(.disabled):active {
    transform: scale(0.95);
}

#currentDifficulty {
    font-size: clamp(14.4px, 3.6vw, 19.2px); /* 20% larger: 12px -> 14.4px, 16px -> 19.2px */
    font-weight: bold;
    background: linear-gradient(180deg, #01edf4 0%, #02a0a5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'TechnoRace', cursive, sans-serif;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: 2000;
    padding: 5vh 5vw;
    box-sizing: border-box;
    pointer-events: all;
    overflow: hidden;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 40px;
    max-width: min(800px, 90vw);
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    box-sizing: border-box;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #FFD700;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    pointer-events: all;
}

.modal-close:hover {
    color: #FFA500;
    transform: scale(1.2);
}

.modal-content h1 {
    font-size: clamp(28px, 6vw, 42px);
    color: #FFD700;
    margin: 0 0 30px 0;
    text-align: center;
    font-family: 'TechnoRace', cursive, sans-serif;
}

.modal-section {
    margin-bottom: 30px;
}

.modal-section h2 {
    font-size: clamp(20px, 4vw, 28px);
    color: #FFA500;
    margin: 0 0 15px 0;
    font-family: 'TechnoRace', cursive, sans-serif;
}

.modal-section p {
    font-size: clamp(14px, 3vw, 18px);
    color: #fff;
    line-height: 1.6;
    margin: 0;
}

#levelSelectContent {
    max-height: 80vh;
    overflow-y: auto;
}

#levelSelectContent h2 {
    font-size: clamp(20px, 4vw, 28px);
    color: #FFD700;
    margin: 0 0 20px 0;
    text-align: center;
    font-family: 'TechnoRace', cursive, sans-serif;
}

#levelList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px 0;
}

.levelItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.levelItem:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
}

.levelThumbnail {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}

.levelName {
    color: #fff;
    font-size: clamp(10px, 2vw, 12px);
    font-family: 'TechnoRace', cursive, sans-serif;
    line-height: 1.2;
    word-break: break-word;
}

.levelItem:hover .levelName {
    color: #FFD700;
}

.modalCloseBtn {
    margin-top: 20px;
    padding: 10px 30px;
    background: linear-gradient(145deg, #FF8C00 0%, #FFA500 50%, #FFD700 100%);
    border: none;
    border-radius: 10px;
    color: #000;
    font-size: clamp(14px, 3vw, 18px);
    font-weight: bold;
    font-family: 'TechnoRace', cursive, sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modalCloseBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

#selectBtn {
    font-size: clamp(16px, 4vw, 24px);
}

@media (max-width: 768px) {
    #bottomPanel {
        height: 20%;
    }
    
    .difficultyBtn {
        padding: 6px 12px;
        min-width: 50px;
    }
    
    .socialLink {
        padding: 6px 10px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
}

@media (orientation: portrait) {
    #gameOverContent {
        width: 80%;
    }
}

#ui:has(#startScreen[style*="display: block"]) #themeName {
    display: none;
}


.startScreenTop {
    position: absolute;
    top: 5vh;
    left: 0;
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

#startScreen .gameNameImage {
    width: 80%;
    max-width: 600px;
    height: auto;
    display: block;
}

.startScreenMiddle {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

/* Move closer to game name on portrait */
@media (max-width: 768px) and (orientation: portrait) {
    .startScreenMiddle {
        top: 40%;
    }
}

.characterImage {
    width: clamp(200px, 35vw, 500px);
    max-width: 500px;
    max-height: 500px;
    height: auto;
    object-fit: contain;
    display: block;
    animation: jumpParabola 6s ease-in-out infinite;
}

/* Increase size by 30% on portrait/smaller screens (20% + 10%) */
@media (max-width: 768px) and (orientation: portrait) {
    .characterImage {
        width: clamp(260px, 45.5vw, 500px);
    }
}

@keyframes jumpParabola {
    0% {
        transform: translateX(-80px) translateY(20px) scale(0.85) rotate(-15deg);
    }
    25% {
        transform: translateX(0px) translateY(-40px) scale(1.1) rotate(0deg);
    }
    50% {
        transform: translateX(80px) translateY(20px) scale(0.85) rotate(15deg);
    }
    75% {
        transform: translateX(0px) translateY(-40px) scale(1.1) rotate(0deg);
    }
    100% {
        transform: translateX(-80px) translateY(20px) scale(0.85) rotate(-15deg);
    }
}

.startScreenBottom {
    position: absolute;
    bottom: calc(10% + 10vh);
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 150;
    pointer-events: none;
}

/* Portrait mode - more space for bottom panel */
@media (max-width: 768px) {
    .startScreenBottom {
        bottom: calc(20% + 8vh);
    }
    
    #levelStartScreen {
        bottom: calc(20% + 8vh + 20px);
    }
}

/* Landscape mode - ensure button doesn't overlap bottom panel */
@media (min-aspect-ratio: 1/1) {
    .startScreenBottom {
        bottom: calc(10% + 12vh);
    }
    
    #levelStartScreen {
        bottom: calc(15% + 12vh);
    }
}

#startScreen p {
    font-size: clamp(16px, 5vw, 24px);
    margin: 0;
    color: #fff;
    -webkit-text-stroke: 1px #FFD700;
    text-stroke: 1px #FFD700;
}

#startPlayBtn {
    pointer-events: all;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    padding: 12px 24px;
    min-width: 120px;
    height: 50px;
    background: linear-gradient(145deg, #7B2CBF 0%, #9D4EDD 50%, #C77DFF 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 4px 0 #5A1E99,
                0 8px 15px rgba(0, 0, 0, 0.3);
    font-size: clamp(20px, 5vw, 32px);
    font-weight: bold;
}

#startPlayBtn::after {
    content: 'BEGIN';
    position: relative;
    z-index: 1;
    font-family: 'TechnoRace', cursive, sans-serif;
}

#startPlayBtn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 6px 0 #5A1E99,
                0 12px 20px rgba(0, 0, 0, 0.4);
}

#startPlayBtn:active {
    transform: translateY(4px);
    box-shadow: inset 0 8px 15px rgba(0, 0, 0, 0.5),
                inset 0 -1px 3px rgba(255, 255, 255, 0.2),
                0 1px 0 #5A1E99,
                0 2px 5px rgba(0, 0, 0, 0.3);
}

.startButtonRow {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.startButtonRow .gameOverBtn {
    height: 50px;
    width: 50px;
    min-width: 50px;
    padding: 0;
}

.startButtonRow .gameOverBtn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

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

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

#loadingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loadingLogo {
    width: 70%;
    max-width: 400px;
    height: auto;
    margin-bottom: 30px;
    object-fit: contain;
}

#loadingBar {
    width: 300px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

#loadingProgress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    transition: width 0.3s ease;
}

#loadingText {
    font-size: clamp(14px, 4vw, 18px);
    color: #FFA500;
}

#levelStartScreen {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    z-index: 500;
    cursor: pointer;
}

#levelDisplay {
    font-size: clamp(28px, 7vw, 56px);
    font-weight: bold;
    color: #FFD700;
    -webkit-text-stroke: 0.5px #000;
    text-stroke: 1px #000;
    letter-spacing: 1px;
    white-space: nowrap;
    text-align: center;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}

#levelName {
    color: #FFA500;
    -webkit-text-stroke: 0.5px #000;
    text-stroke: 1px #000;
    display: inline-block;
}

#directionInfoBox {
    background: rgba(0, 0, 0, 0.5);
    padding: 19.5px 32.5px; /* 30% larger: 15px * 1.3 = 19.5px, 25px * 1.3 = 32.5px */
    border-radius: 13px; /* 30% larger: 10px * 1.3 = 13px */
    display: flex;
    flex-direction: column;
    gap: 13px; /* 30% larger: 10px * 1.3 = 13px */
    margin: 19.5px 0; /* 30% larger: 15px * 1.3 = 19.5px */
    min-width: 300px; /* Increase width to prevent text wrapping */
    border: 4px solid #01edf473; /* Thick lighter border matching background */
}

.directionRow {
    display: flex;
    align-items: center;
    gap: 13px; /* 30% larger: 10px * 1.3 = 13px */
    justify-content: center;
}

.directionLabel {
    color: #fff;
    font-size: clamp(15.6px, 3.9vw, 23.4px); /* 30% larger: 12px * 1.3 = 15.6px, 18px * 1.3 = 23.4px */
    animation: growPulse 2s ease-in-out infinite;
}

.directionValue {
    color: #FFD700;
    font-weight: bold;
    font-size: clamp(15.6px, 3.9vw, 23.4px); /* 30% larger: 12px * 1.3 = 15.6px, 18px * 1.3 = 23.4px */
    animation: growPulse 2s ease-in-out infinite;
}

.directionArrowIcon {
    width: 31.2px; /* 30% larger: 24px * 1.3 = 31.2px */
    height: 24px;
}

#tapText {
    font-size: clamp(24px, 6vw, 48px);
    font-weight: bold;
    color: #FFD700;
    -webkit-text-stroke: 1px #000;
    text-stroke: 1px #000;
    text-align: center;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

#levelStartBtn {
    font-family: 'TechnoRace', cursive, sans-serif;
    pointer-events: all;
    padding: 2vh 6vw;
    min-width: 150px;
    min-height: 60px;
    background: linear-gradient(145deg, #FF8C00 0%, #FFA500 50%, #FFD700 100%);
    color: #000;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 4px 0 #CC7000,
                0 8px 15px rgba(0, 0, 0, 0.3);
    font-size: clamp(18px, 4.5vw, 32px);
    font-weight: bold;
    animation: pulse 1.5s ease-in-out infinite;
    white-space: nowrap;
}

#levelStartBtn:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.4),
                inset 0 -2px 6px rgba(255, 255, 255, 0.3),
                0 6px 0 #CC7000,
                0 12px 20px rgba(0, 0, 0, 0.4);
}

#levelStartBtn:active {
    transform: translateY(4px);
    box-shadow: inset 0 8px 15px rgba(0, 0, 0, 0.5),
                inset 0 -1px 3px rgba(255, 255, 255, 0.2),
                0 1px 0 #CC7000,
                0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Hide old button styles but keep for compatibility */
#levelStartBtn {
    display: none;
}

/* ==================== TWERK MODE STYLES ==================== */

#twerkBarContainer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    pointer-events: none;
    visibility: hidden;
}

#twerkBarContainer.visible {
    visibility: visible;
}

#twerkBarLabel {
    font-size: clamp(10px, 2.5vw, 14px);
    font-weight: bold;
    color: #FFB6C1;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 1px;
}

#twerkBarOuter {
    width: clamp(120px, 30vw, 200px);
    height: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    border: 2px solid #FFB6C1;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(255, 182, 193, 0.3);
}

#twerkBarFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF69B4 0%, #FF1493 50%, #FFD700 100%);
    border-radius: 4px;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

#twerkBarFill.full {
    animation: twerkBarPulse 0.3s ease-in-out infinite;
}

@keyframes twerkBarPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 105, 180, 0.6);
    }
}

/* Bottom Flap Meter */
#flapMeterBottom {
    position: absolute;
    bottom: calc(20% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5px;
    pointer-events: none;
    visibility: hidden;
    z-index: 100;
}

#flapMeterBottom.visible {
    visibility: visible;
}

#flapMeterLabel {
    font-size: clamp(10px, 4vw, 18px);
    font-weight: bold;
    color: #FF6600;
    text-shadow: 
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 0 10px rgba(255, 69, 0, 0.8);
    letter-spacing: 1px;
}

#flapMeterBarWrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
}

#flapMeterIcon {
    width: auto;
    height:72px;
    margin-right: -10px;
    z-index: 2;
    filter: drop-shadow(0 0 8px rgba(255, 69, 0, 0.8));
}

#flapMeterOuter {
    width: clamp(150px, 40vw, 250px);
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    border: 2px solid #8500f8;
    outline: 2px solid #FF6600;
    outline-offset: 0px;
    overflow: hidden;
    box-shadow: 
        0 0 0 4px #FFB347,
        0 0 0 6px #FF8C00,
        0 0 15px rgba(255, 69, 0, 0.6),
        0 0 30px rgba(255, 165, 0, 0.4);
}

#flapMeterFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF4500 0%, #FF6600 30%, #FFD700 60%, #FF4500 100%);
    border-radius: 8px;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.6);
}

#flapMeterFill.full {
    animation: flapMeterPulse 0.3s ease-in-out infinite;
}

@keyframes fireBorder {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 69, 0, 0.6), 0 0 40px rgba(255, 165, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 69, 0, 0.9), 0 0 50px rgba(255, 165, 0, 0.7);
    }
}

@keyframes flapMeterPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), 0 0 35px rgba(255, 105, 180, 0.7);
    }
}

/* Twerk Mode Overlay */
#twerkOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    pointer-events: none;
}

#twerkOverlay.active {
    display: flex;
}

#twerkGif {
    width: 384px;
    height: 384px;
    object-fit: contain;
    z-index: 501;
}

#twerkTextTop, #twerkTextBottom {
    font-size: clamp(28px, 8vw, 48px);
    font-weight: bold;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.6),
        3px 3px 6px #000;
    z-index: 501;
    animation: twerkTextPulse 0.5s ease-in-out infinite;
}

#twerkTextTop {
    margin-bottom: clamp(-60px, -5vh, -30px); /* Responsive: min -60px, max -30px */
}

#twerkTextBottom {
    margin-top: clamp(-60px, -5vh, -30px); /* Responsive: min -60px, max -30px */
}

@keyframes twerkTextPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

#twerkCountdown {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 502;
    animation: countdownPop 0.5s ease-out;
}

.countdownLabel {
    font-size: clamp(24px, 6vw, 36px);
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 5px;
}

.countdownNumber {
    font-size: clamp(48px, 15vw, 96px);
    font-weight: bold;
    color: #FFD700;
    text-shadow: 
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 40px rgba(255, 215, 0, 0.6),
        2px 2px 4px #000;
}

@keyframes countdownPop {
    0% {
        transform: scale(2);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Shock Effect Overlay */
#shockOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 499;
    pointer-events: none;
    overflow: hidden;
}

#shockOverlay.active {
    display: flex;
}

#shockImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: shockWave 0.5s ease-out infinite;
}

@keyframes shockWave {
    0% {
        transform: scale(0.8);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Canvas and background shake effect during twerk mode */
#gameCanvas.twerk-shake,
#gameContainer.twerk-shake {
    animation: canvasShake 0.5s ease-in-out infinite;
}

/* Grayscale effect during twerk mode */
#gameCanvas.twerk-grayscale {
    filter: grayscale(60%);
    transition: filter 0.3s ease-out;
}

/* Gradual color restoration during countdown */
#gameCanvas.twerk-color-restore {
    transition: filter 0.5s ease-in;
    filter: grayscale(0%);
}

@keyframes canvasShake {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-2px, 1px) scale(1.01);
    }
    50% {
        transform: translate(0, -2px) scale(1.02);
    }
    75% {
        transform: translate(2px, 1px) scale(1.01);
    }
}
