* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

#gameCanvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: filter 0.2s ease;
    touch-action: none;
}

#gameCanvas.inverted {
    filter: invert(1) hue-rotate(180deg);
}

#ui {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top, 0px));
    left: calc(20px + env(safe-area-inset-left, 0px));
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
    z-index: 10;
    pointer-events: none;
}

.ui-value {
    color: yellow;
}

#highScoreVal {
    color: #00ff00;
}

#speedVal {
    color: #00ffff;
}

.powerup-text {
    display: none;
    color: #ff00de;
    font-size: 30px;
    animation: shake 0.2s infinite;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 20;
    touch-action: pan-y;
}

.start-screen {
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.8);
    color: yellow;
}

.leaderboard-screen {
    background: rgba(0,0,0,0.9);
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 20px;
    padding-bottom: 100px; /* Space for fixed button */
    overscroll-behavior: contain;
    /* Override overlay centering to allow scrolling */
    align-items: flex-start;
    justify-content: flex-start;
}

.leaderboard-screen .panel {
    max-width: 100%;
    width: 100%;
    min-height: min-content;
}

#closeLeaderboardBtn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
}

.highlight-row {
    background-color: #ff00de !important;
    color: #000 !important;
    font-weight: bold;
    animation: crazy-jump 0.15s ease-in-out infinite;
    position: relative;
    /* GPU-accelerated glow (v2.9.155 perf) */
    filter: drop-shadow(0 0 20px #ff00de) drop-shadow(0 0 40px #ff00de);
}

.highlight-row td {
    animation: color-cycle 0.3s linear infinite;
}

/* Offline scores - dimmed to show they're local only */
.offline-row {
    opacity: 0.6;
}

.offline-badge {
    color: #888;
    font-size: 0.8em;
    font-style: italic;
}

/* Player device hash - small and subtle */
.player-hash {
    font-size: 0.7em;
    color: #666;
    opacity: 0.7;
    margin-left: 2px;
}

/* Last game score display */
.last-score {
    font-size: 0.75em;
    color: #ff00de;
    margin-left: 6px;
    opacity: 0.8;
}

/* Mobile: last score on own line, hash wraps naturally */
@media (max-width: 500px) {
    .last-score {
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
}

/* Highlight current player's row - subtle but noticeable */
.my-row {
    background: linear-gradient(90deg, rgba(255, 0, 222, 0.2), rgba(0, 255, 255, 0.15), rgba(255, 0, 222, 0.2));
    background-size: 200% 100%;
    animation: my-row-pulse 3s ease-in-out infinite;
    box-shadow: inset 0 0 10px rgba(255, 0, 222, 0.3);
}

.my-row td {
    text-shadow: 0 0 8px rgba(255, 0, 222, 0.5);
}

@keyframes my-row-pulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ============================================
   GAME OVER SCREEN - NEON BANANA STYLE
   ============================================ */

.game-over-panel {
    gap: 12px;
}

.game-over-header {
    text-align: center;
}

.game-over-header h1 {
    margin-bottom: 5px;
}

/* Score Section - the star of the show */
.score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 30px;
    margin: 5px 0;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 0, 0.3);
    border-radius: 12px;
    position: relative;
}

/* NEW RECORD badge - appears above score */
.new-record-badge {
    font-size: 14px;
    font-weight: bold;
    color: #000;
    background: linear-gradient(90deg, #ffff00, #ff00de, #ffff00);
    background-size: 200% 100%;
    padding: 4px 16px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: badge-shimmer 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 0, 222, 0.6), 0 0 40px rgba(255, 255, 0, 0.4);
}

@keyframes badge-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* The main score display */
.final-score-display {
    font-size: 48px;
    font-weight: bold;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    line-height: 1;
}

/* Animated score for new records */
.score-section.new-record .final-score-display {
    animation: score-celebrate 0.6s ease-in-out infinite;
    color: #ffff00;
    text-shadow:
        0 0 10px #ffff00,
        0 0 20px #ff00de,
        0 0 40px #ff00de,
        0 0 60px rgba(255, 0, 222, 0.5);
}

@keyframes score-celebrate {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

/* Glowing border for new records */
.score-section.new-record {
    border-color: #ff00de;
    box-shadow:
        0 0 15px rgba(255, 0, 222, 0.5),
        0 0 30px rgba(255, 255, 0, 0.3),
        inset 0 0 20px rgba(255, 0, 222, 0.1);
    animation: border-glow 2s ease-in-out infinite;
}

@keyframes border-glow {
    0%, 100% {
        border-color: #ff00de;
        box-shadow:
            0 0 15px rgba(255, 0, 222, 0.5),
            0 0 30px rgba(255, 255, 0, 0.3),
            inset 0 0 20px rgba(255, 0, 222, 0.1);
    }
    50% {
        border-color: #ffff00;
        box-shadow:
            0 0 20px rgba(255, 255, 0, 0.6),
            0 0 40px rgba(255, 0, 222, 0.4),
            inset 0 0 25px rgba(255, 255, 0, 0.1);
    }
}

/* Previous best / your best label */
.score-comparison {
    margin-top: 10px;
    font-size: 13px;
    color: #888;
}

.score-comparison #yourBestLabel {
    color: #888;
    text-transform: lowercase;
}

.score-comparison #yourBestScore {
    color: #ff00de;
    font-weight: bold;
    margin-left: 6px;
}

/* When it's a new record, show "beat your previous" */
.score-section.new-record .score-comparison #yourBestLabel {
    color: #aaa;
}

.score-section.new-record .score-comparison #yourBestScore {
    color: #888;
    text-decoration: line-through;
    opacity: 0.7;
}

/* Form section */
.game-over-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes crazy-jump {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    25% { transform: translateY(-8px) rotate(-2deg) scale(1.02); }
    50% { transform: translateY(0) rotate(0deg) scale(1); }
    75% { transform: translateY(-6px) rotate(2deg) scale(1.01); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes color-cycle {
    0% { background-color: #ff00de; color: #ffff00; }
    33% { background-color: #ffff00; color: #00ffff; }
    66% { background-color: #00ffff; color: #ff00de; }
    100% { background-color: #ff00de; color: #ffff00; }
}

.panel {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.start-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* Performance check indicator */
.perf-check {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0.8;
}

.perf-check.active {
    display: flex;
}

.perf-check-banana {
    font-size: 16px;
    animation: perfCheckBounce 0.6s ease-in-out infinite;
}

@keyframes perfCheckBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(10deg); }
}

.perf-check-text {
    font-size: 11px;
    color: #ffff00;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.perf-check-dots span {
    opacity: 0;
    font-size: 11px;
    color: #ffff00;
    animation: dotFade 1.5s infinite;
}

.perf-check-dots span:nth-child(1) { animation-delay: 0s; }
.perf-check-dots span:nth-child(2) { animation-delay: 0.3s; }
.perf-check-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes dotFade {
    0%, 20% { opacity: 0; }
    40%, 100% { opacity: 1; }
}

h1 {
    font-size: 60px;
    color: yellow;
    text-shadow: 4px 4px #ff00de;
    margin: 0;
    animation: shake 0.5s infinite;
}

/* Animated smiley dot for BANANA.BIKE */
.smiley-dot {
    display: inline-block;
    width: 28px;
    height: 28px;
    background: yellow;
    border-radius: 50%;
    position: relative;
    margin: 0;  /* Spacing controlled by .title-space */
    vertical-align: middle;
    animation: smiley-rotate 8s linear infinite;
    box-shadow: 2px 2px #ff00de;
}

.smiley-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.smiley-dot .eye {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #000;
    border-radius: 50%;
    top: 8px;
}

.smiley-dot .eye.left { left: 6px; }
.smiley-dot .eye.right { right: 6px; }

.smiley-dot .mouth {
    position: absolute;
    width: 12px;
    height: 6px;
    border: 2px solid #000;
    border-top: none;
    border-radius: 0 0 12px 12px;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: transparent;
}

.smiley-dot .tongue {
    position: absolute;
    width: 6px;
    height: 0;
    background: #ff6699;
    border-radius: 0 0 3px 3px;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    animation: tongue-out 6s ease-in-out infinite;
}

@keyframes smiley-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes tongue-out {
    0%, 70%, 100% { height: 0; }
    75%, 95% { height: 8px; }
}

/* Title spacing between BANANA . BIKE */
.title-space {
    display: inline-block;
    width: 8px;  /* Same as thin space */
}

/* Mobile: BIKE wraps to next line, adjust spacing */
@media (max-width: 500px) {
    .start-content h1 .smiley-dot {
        margin: 0;  /* Remove margin, use title-space instead */
    }
    .start-content h1 .title-space {
        width: 4px;  /* Half spacing before smiley */
    }
    .start-content h1 .title-space.after {
        display: none;  /* No space after smiley (BIKE on next line) */
    }
}

.subtitle {
    font-size: 20px;
}

.killer-line {
    font-size: 18px;
    color: #ff4444;
    text-transform: uppercase;
    animation: pulse-red 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-red {
    from { color: #ff4444; text-shadow: 0 0 10px #ff0000; }
    to { color: #ff8888; text-shadow: 0 0 20px #ff0000; }
}

.no-name-hint {
    font-size: 14px;
    color: #ff4444;
    margin: 8px 0 12px 0;
    padding: 8px 12px;
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid #ff4444;
    border-radius: 5px;
    animation: hint-pulse 1.5s ease-in-out infinite;
}

.no-name-hint.hidden {
    display: none;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

button {
    background: #ff00de;
    color: yellow;
    border: 4px solid yellow;
    padding: 15px 30px;
    font-size: 24px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    margin-top: 10px;
    text-transform: uppercase;
    box-shadow: 4px 4px 0px #fff;
    transition: transform 0.1s;
    touch-action: manipulation;
}

button:hover {
    background: yellow;
    color: #ff00de;
    border-color: #ff00de;
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

button.selected {
    background: yellow;
    color: #ff00de;
    border-color: #fff;
    transform: scale(1.05);
}

button.inline {
    margin-top: 0;
}

input {
    padding: 10px;
    font-size: 20px;
    font-family: 'Courier New', Courier, monospace;
    border: 2px solid #ff00de;
    background: #000;
    color: yellow;
    text-align: center;
    width: 200px;
    margin: 20px 0 10px;
}

#leaderboardScreen table {
    border-collapse: collapse;
    width: 80%;
    max-width: 600px;
    margin-top: 20px;
    font-size: 18px;
}

#leaderboardScreen th,
#leaderboardScreen td {
    border: 1px solid #ff00de;
    padding: 10px;
    text-align: left;
}

#leaderboardScreen th {
    background-color: #ff00de;
    color: yellow;
}

#leaderboardScreen tr:nth-child(even) {
    background-color: #1a0010;
}

.version-badge {
    position: absolute;
    right: 20px;
    bottom: 20px;
    padding: 8px 12px;
    font-size: 14px;
    background: yellow;
    color: #ff00de;
    border: 3px solid #ff00de;
    border-radius: 10px;
    box-shadow: 3px 3px 0px #fff;
    text-shadow: 1px 1px #000;
}

/* Daily Teaser (centered, aligned with version badge bottom) */
.daily-teaser {
    position: absolute;
    left: 50%;
    bottom: -5px;
    transform: translateX(-50%);
    z-index: 10;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.daily-teaser-canvas {
    width: 90px;
    height: 90px;
    border: none;
    border-radius: 8px;
    background: transparent;
    display: block;
}

.daily-speech-bubble {
    position: absolute;
    left: 70px;
    bottom: 60px;
    background: yellow;
    color: #ff00de;
    font-family: inherit;
    font-size: 10px;
    font-weight: bold;
    padding: 5px 8px;
    border: none;
    border-radius: 0;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 3px 3px 0 0 #ff00de;
    white-space: nowrap;
}


/* Hide daily teaser on very small screens */
@media (max-width: 400px) {
    .daily-teaser {
        display: none;
    }
}

/* Info Button (left side) */
.info-badge {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    font-size: 28px;
    background: #ff00de;
    color: yellow;
    border: 3px solid yellow;
    border-radius: 50%;
    box-shadow: 3px 3px 0px #fff, 0 0 15px rgba(255, 0, 222, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

.info-badge:hover {
    transform: scale(1.1);
    box-shadow: 3px 3px 0px #fff, 0 0 25px rgba(255, 0, 222, 0.8);
}

/* Settings Modal */
.settings-modal {
    background: rgba(0, 0, 0, 0.95);
    z-index: 150;
}

.settings-panel {
    position: relative;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #1a0020 0%, #0a0010 100%);
    border: 3px solid #ff00de;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 0 40px rgba(255, 0, 222, 0.5);
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.settings-panel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.settings-panel .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff00de;
    border: 2px solid yellow;
    color: yellow;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.settings-panel .close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.8);
}

.settings-panel h2 {
    text-align: center;
    color: yellow;
    font-size: 28px;
    margin: 0 0 25px 0;
    text-shadow: 0 0 10px yellow;
}

.settings-panel h3 {
    color: #ff00de;
    font-size: 16px;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 0, 222, 0.3);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

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

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

.toggle-btn {
    padding: 8px 20px;
    font-size: 14px;
    font-family: inherit;
    font-weight: bold;
    background: #333;
    color: #888;
    border: 2px solid #666;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn.active {
    background: yellow;
    color: #000;
    border-color: #ff00de;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
}

.setting-hint {
    color: #888;
    font-size: 12px;
    margin: 5px 0 0 0;
    font-style: italic;
}

.disclaimer-text {
    color: #aaa;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}

.credits-text {
    color: #666;
    font-size: 12px;
    text-align: center;
    margin: 0;
}

.credits-text a {
    color: #ff00de;
    text-decoration: none;
    transition: color 0.2s ease;
}

.credits-text a:hover {
    color: yellow;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

/* Help Button in Settings */
.help-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-family: inherit;
    font-weight: bold;
    background: linear-gradient(180deg, #ff00de 0%, #aa0099 100%);
    color: yellow;
    border: 3px solid yellow;
    border-radius: 8px;
    cursor: pointer;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.5);
    transition: all 0.2s ease;
}

.help-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(255, 0, 222, 0.8);
}

.help-credit {
    color: #666;
    font-size: 11px;
    text-align: center;
    margin: 8px 0 0 0;
    font-style: italic;
}

/* Performance Tip Modal */
.perf-tip-modal {
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
}

.perf-tip-panel {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 3px solid #ffff00;
    border-radius: 20px;
    padding: 30px;
    max-width: 320px;
    width: 85%;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 255, 0, 0.4), inset 0 0 20px rgba(255, 255, 0, 0.1);
    animation: tipPulse 2s ease-in-out infinite;
}

@keyframes tipPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(255, 255, 0, 0.4), inset 0 0 20px rgba(255, 255, 0, 0.1); }
    50% { box-shadow: 0 0 60px rgba(255, 255, 0, 0.6), inset 0 0 30px rgba(255, 255, 0, 0.15); }
}

.perf-tip-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: iconBounce 1s ease-in-out infinite;
}

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

.perf-tip-panel h2 {
    color: #ffff00;
    margin: 0 0 15px 0;
    font-size: 22px;
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
    letter-spacing: 3px;
}

.perf-tip-panel p {
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.perf-tip-panel strong {
    color: #ffff00;
}

.perf-tip-hint {
    color: #aaa !important;
    font-size: 12px !important;
    font-style: italic;
}

.perf-tip-btn {
    background: linear-gradient(180deg, #ffff00 0%, #ccaa00 100%);
    color: #000;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
    transition: all 0.2s;
}

.perf-tip-btn:hover, .perf-tip-btn:active {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.8);
}

/* Help Screen */
.help-screen {
    background: rgba(0, 0, 0, 0.95);
    overflow-y: auto;
}

.help-panel {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 3px solid #ff00de;
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 0, 222, 0.3);
    /* Hide scrollbar but keep scrolling */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.help-panel::-webkit-scrollbar {
    display: none;
}

.help-panel .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff00de;
    border: 2px solid yellow;
    color: yellow;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.help-panel .close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.8);
}

.help-panel h2 {
    color: yellow;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 24px;
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
}

.help-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.help-section:last-of-type {
    border-bottom: none;
}

.help-section h3 {
    color: #ff00de;
    font-size: 14px;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.help-section p {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
    margin: 5px 0;
}

/* Help Items */
.help-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
}

.item-canvas {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.item-info {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    flex: 1;
}

.item-name {
    color: yellow;
    font-size: 14px;
    font-weight: bold;
    min-width: 55px;
    flex-shrink: 0;
}

.item-desc {
    color: #aaa;
    font-size: 12px;
    line-height: 1.4;
}

.help-close-btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    background: #ff00de;
    color: yellow;
    border: 3px solid yellow;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.help-close-btn:hover {
    box-shadow: 0 0 20px rgba(255, 0, 222, 0.8);
    transform: scale(1.02);
}

/* Legal Modal Styles */
.legal-modal {
    display: none;
    z-index: 1100;
}

.legal-panel {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 3px solid #ff00de;
    border-radius: 15px;
    padding: 25px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 30px rgba(255, 0, 222, 0.3);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.legal-panel::-webkit-scrollbar {
    display: none;
}

.legal-panel .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff00de;
    border: 2px solid yellow;
    color: yellow;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.legal-panel .close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.8);
}

.legal-panel h2 {
    color: yellow;
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 24px;
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.8);
}

.legal-content {
    font-size: 13px;
    line-height: 1.6;
    color: #ccc;
}

.legal-content h3 {
    color: #ff00de;
    font-size: 14px;
    margin: 20px 0 10px 0;
}

.legal-content h3:first-of-type {
    margin-top: 10px;
}

.legal-content p {
    margin: 8px 0;
}

.legal-content strong {
    color: #fff;
}

.legal-content a {
    color: #ff00de;
    text-decoration: none;
    transition: color 0.2s ease;
}

.legal-content a:hover {
    color: yellow;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
}

.legal-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.legal-link {
    flex: 1;
    min-width: 120px;
    padding: 12px 15px;
    font-size: 14px;
    font-family: inherit;
    font-weight: bold;
    background: linear-gradient(180deg, #ff00de 0%, #aa0099 100%);
    color: yellow;
    border: 3px solid yellow;
    border-radius: 8px;
    cursor: pointer;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.5);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.legal-link:hover {
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(255, 0, 222, 0.8);
}

.legal-close-btn {
    width: 100%;
    padding: 12px 20px;
    margin-top: 20px;
    font-size: 16px;
    font-family: inherit;
    font-weight: bold;
    background: #ff00de;
    color: yellow;
    border: 3px solid yellow;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.legal-close-btn:hover {
    box-shadow: 0 0 20px rgba(255, 0, 222, 0.8);
    transform: scale(1.02);
}

@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); }
}

/* Villain Designer */
.villain-designer {
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    padding: 10px;
    gap: 6px;
    touch-action: none;
}

.villain-designer .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff00de;
    border: 2px solid yellow;
    color: yellow;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100;
}

.villain-designer .close-btn:hover,
.villain-designer .close-btn.selected {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.8);
}

/* Designer layout - arrows on sides */
.designer-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

/* Side arrows container */
.side-arrows {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
}

/* Side arrow buttons */
.side-arrow {
    width: 44px;
    height: 44px;
    background: yellow;
    border: 3px solid #ff00de;
    color: #ff00de;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
    transition: all 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.side-arrow:hover {
    background: #ff00de;
    color: yellow;
    transform: scale(1.15);
}

.side-arrow.selected {
    background: #ff00de;
    color: yellow;
    box-shadow: 0 0 15px #ff00de, 3px 3px 0px rgba(0,0,0,0.5);
}

.side-arrow:active,
.side-arrow.flash {
    background: #fff;
    color: #ff00de;
    transform: scale(0.9);
}

/* Villain frame */
.villain-frame {
    position: relative;
    width: min(55vw, 55vh);
    height: min(55vw, 55vh);
    min-width: 200px;
    min-height: 200px;
    background: linear-gradient(to bottom, #1a0010 0%, #2a001a 100%);
    border: 5px solid #ff00de;
    border-radius: 20px;
    box-shadow: 0 0 40px #ff00de;
}

#villainPreview {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 15px;
}

/* Villain name input */
.villain-name-input {
    margin-bottom: 0;
    text-align: center;
}

.villain-name-input.selected input {
    border-color: #ff00de;
    box-shadow: 0 0 20px #ff00de;
}

.villain-name-input input {
    width: 85%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 18px;
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #ff00de;
    color: #fff;
    outline: none;
}

.villain-name-input input::placeholder {
    color: #888;
}

.villain-name-input input:focus {
    border-color: yellow;
    box-shadow: 0 0 15px yellow;
}

.villain-name-input input.highlight-crazy {
    animation: crazy-input 0.15s ease-in-out infinite;
    border-color: #ff00de;
    box-shadow: 0 0 30px #ff00de, 0 0 60px #ff00de;
}

@keyframes crazy-input {
    0% { transform: translateX(0) scale(1); background-color: #ff00de; color: #000; }
    25% { transform: translateX(-5px) scale(1.02); background-color: yellow; color: #ff00de; }
    50% { transform: translateX(5px) scale(1); background-color: #00ffff; color: #000; }
    75% { transform: translateX(-3px) scale(1.01); background-color: #ff00de; color: yellow; }
    100% { transform: translateX(0) scale(1); background-color: #ff00de; color: #000; }
}

/* Alias input (creator name) */
.villain-alias-input {
    margin-bottom: 0;
    text-align: center;
}

.villain-alias-input input {
    width: 85%;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 18px;
    font-family: inherit;
    text-align: center;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid #ff00de;
    color: #fff;
    outline: none;
}

.villain-alias-input.selected input {
    border-color: #ff00de;
    box-shadow: 0 0 20px #ff00de;
}

.villain-alias-input input::placeholder {
    color: #888;
}

.villain-alias-input input:focus {
    border-color: yellow;
    box-shadow: 0 0 15px yellow;
}

/* Bottom buttons */
.designer-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.designer-buttons button {
    padding: 15px 40px;
    font-size: 22px;
}

.designer-buttons button.selected {
    transform: scale(1.1);
    box-shadow: 0 0 20px yellow;
}

#cancelVillainBtn {
    background: #333;
    border-color: #666;
}

#cancelVillainBtn:hover,
#cancelVillainBtn.selected {
    background: #666;
    color: yellow;
}

#randomVillainBtn {
    background: #1a1a2e;
    border-color: #00ffff;
    color: #00ffff;
}

#randomVillainBtn:hover,
#randomVillainBtn.flash {
    background: #00ffff;
    color: #000;
    box-shadow: 0 0 20px #00ffff;
}

/* Price section */
.villain-price-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-bottom: 0;
}

.price-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255, 0, 222, 0.15) 0%, rgba(255, 0, 222, 0.25) 100%);
    border: 3px solid #ff00de;
    padding: 12px 25px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(255, 0, 222, 0.4), inset 0 0 15px rgba(255, 0, 222, 0.1);
}

.price-amount {
    font-size: 36px;
    font-weight: bold;
    color: yellow;
    text-shadow: 0 0 10px yellow, 0 0 20px rgba(255, 255, 0, 0.5);
}

.currency-select {
    background: #000;
    border: 2px solid #ff00de;
    border-radius: 8px;
    color: #ff00de;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    padding: 8px 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.currency-select:hover {
    background: #ff00de;
    color: #000;
    box-shadow: 0 0 15px #ff00de;
}

.currency-select:focus {
    outline: none;
    box-shadow: 0 0 20px #ff00de;
}

.currency-select.flash {
    background: yellow;
    color: #000;
    transform: scale(1.1);
}

/* Price section keyboard selection */
.villain-price-section.selected .price-tag {
    border-color: yellow;
    box-shadow: 0 0 30px yellow, 0 0 60px rgba(255, 255, 0, 0.5);
    animation: price-selected-pulse 0.5s ease-in-out infinite;
}

.villain-price-section.selected .currency-select {
    border-color: yellow;
    box-shadow: 0 0 15px yellow;
}

@keyframes price-selected-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.price-info {
    font-size: 14px;
    color: #ff00de;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 0, 222, 0.5);
    animation: price-pulse 2s ease-in-out infinite;
}

@keyframes price-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; text-shadow: 0 0 15px #ff00de, 0 0 30px rgba(255, 0, 222, 0.5); }
}

/* Confirm Purchase Dialog */
.confirm-purchase-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 150;
    align-items: center;
    justify-content: center;
}

.confirm-purchase-dialog.active {
    display: flex;
}

.confirm-purchase-content {
    background: linear-gradient(180deg, #1a0020 0%, #0a0010 100%);
    border: 3px solid #ff00de;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 40px rgba(255, 0, 222, 0.5);
}

.confirm-title {
    color: #ffff00;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 2px 2px #ff00de;
}

.confirm-field {
    margin-bottom: 25px;
}

.confirm-field label {
    display: block;
    color: #ff00de;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.creator-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.creator-input-row input {
    flex: 1;
    background: #000;
    border: 2px solid #ff00de;
    color: #ffff00;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 1.1rem;
    padding: 12px 15px;
    border-radius: 10px;
    text-transform: uppercase;
}

.creator-input-row input::placeholder {
    color: #666;
    text-transform: uppercase;
}

.creator-input-row input:focus {
    outline: none;
    border-color: #ffff00;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
}

.device-hash {
    color: #666;
    font-family: monospace;
    font-size: 0.75rem;
    white-space: nowrap;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
}

.confirm-buttons button {
    flex: 1;
    padding: 15px 20px;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

#confirmPayBtn {
    background: #ff00de;
    border: 2px solid #ffff00;
    color: #ffff00;
}

#confirmPayBtn:hover {
    background: #ffff00;
    color: #ff00de;
    transform: scale(1.05);
}

#confirmCancelBtn {
    background: transparent;
    border: 2px solid #ff00de;
    color: #ff00de;
}

#confirmCancelBtn:hover {
    background: #ff00de;
    color: #000;
}

/* Payment Container */
.payment-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 200;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.payment-container.active {
    display: flex;
}

#checkoutElement {
    width: 100%;
    max-width: 450px;
    min-height: 400px;
    margin: 40px 0;
    background: linear-gradient(180deg, #1a0020 0%, #0a0010 100%);
    border: 3px solid #ff00de;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 0 40px rgba(255, 0, 222, 0.5), 0 0 80px rgba(255, 0, 222, 0.3);
    flex-shrink: 0;
}

.payment-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 210;
}

/* Payment loading state */
#saveVillainBtn.loading {
    background: linear-gradient(90deg, #ff00de, yellow, #ff00de);
    background-size: 200% 100%;
    animation: loading-gradient 1.5s ease infinite;
    pointer-events: none;
}

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

/* Success toast */
.villain-success-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, yellow 0%, #ffcc00 100%);
    color: #000;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 1000;
    animation: toast-bounce-in 0.5s ease-out;
    box-shadow: 0 0 30px yellow, 0 0 60px rgba(255, 255, 0, 0.5);
    border: 3px solid #ff00de;
}

@keyframes toast-bounce-in {
    0% { opacity: 0; transform: translateX(-50%) translateY(-50px) scale(0.8); }
    50% { transform: translateX(-50%) translateY(10px) scale(1.05); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Mobile adjustments */
@media (max-width: 500px) {
    .designer-layout {
        gap: 8px;
    }

    .villain-frame {
        width: 60vw;
        height: 60vw;
        min-width: 150px;
        min-height: 150px;
    }

    .side-arrows {
        gap: 12px;
        padding: 10px 0;
    }

    .side-arrow {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .designer-buttons button {
        padding: 10px 25px;
        font-size: 18px;
    }

    .price-tag {
        padding: 10px 20px;
    }

    .price-amount {
        font-size: 28px;
    }

    .currency-select {
        font-size: 14px;
        padding: 6px 10px;
    }

    .price-info {
        font-size: 12px;
    }

    #checkoutElement {
        padding: 15px;
        max-width: 100%;
    }

    .villain-success-toast {
        font-size: 16px;
        padding: 15px 25px;
    }
}

/* ============================================
   WANTED POSTER - Neo-Future Steckbrief
   ============================================ */

.villain-poster {
    background: transparent;
    z-index: 100;
}

/* CRASHED BY - Neon Disco Header */
.crashed-by-header {
    text-align: center;
    margin-bottom: 10px;
}

.crashed-by-text {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 8px;
    background: linear-gradient(90deg, #ff00de, #00ffff, #ffff00, #ff00de);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: crashed-by-rainbow 1.5s linear infinite, crashed-by-shake 0.15s ease-in-out infinite;
    filter: drop-shadow(0 0 10px #ff00de) drop-shadow(0 0 20px #00ffff) drop-shadow(0 0 30px #ffff00);
    position: relative;
}

.crashed-by-text::before,
.crashed-by-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    background-size: inherit;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crashed-by-text::before {
    animation: crashed-glitch-1 0.2s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 40%, 0 40%);
}

.crashed-by-text::after {
    animation: crashed-glitch-2 0.2s infinite;
    clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
}

@keyframes crashed-by-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

@keyframes crashed-by-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px) skewX(-2deg); }
    50% { transform: translateX(3px) skewX(2deg); }
    75% { transform: translateX(-2px) skewX(-1deg); }
}

@keyframes crashed-glitch-1 {
    0%, 100% { transform: translate(0); opacity: 0.8; }
    33% { transform: translate(-4px, -2px); opacity: 1; }
    66% { transform: translate(4px, 2px); opacity: 0.6; }
}

@keyframes crashed-glitch-2 {
    0%, 100% { transform: translate(0); opacity: 0.8; }
    33% { transform: translate(4px, 2px); opacity: 1; }
    66% { transform: translate(-4px, -2px); opacity: 0.6; }
}

/* WANTED Header (for Bully detail view) */
.wanted-header {
    text-align: center;
    margin-bottom: 15px;
}

.wanted-text {
    font-size: 42px;
    font-weight: bold;
    letter-spacing: 12px;
    color: #ff3333;
    text-shadow:
        0 0 10px #ff0000,
        0 0 20px #ff0000,
        0 0 40px #ff0000,
        3px 3px 0 #000;
    animation: wanted-pulse 1s ease-in-out infinite;
}

@keyframes wanted-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.02); filter: brightness(1.2); }
}

.poster-frame {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: linear-gradient(135deg, #0a0015 0%, #1a0030 50%, #0a0015 100%);
    border: 3px solid #ff00de;
    border-radius: 20px;
    padding: 25px;
    box-shadow:
        0 0 30px rgba(255, 0, 222, 0.5),
        0 0 60px rgba(255, 0, 222, 0.3),
        inset 0 0 30px rgba(255, 0, 222, 0.1);
    animation: poster-pulse 2s ease-in-out infinite;
}

.poster-frame .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    margin: 0;
    background: #ff00de;
    border: 2px solid yellow;
    color: yellow;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.poster-frame .close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.8);
}

@keyframes poster-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 222, 0.5), 0 0 60px rgba(255, 0, 222, 0.3), inset 0 0 30px rgba(255, 0, 222, 0.1); }
    50% { box-shadow: 0 0 50px rgba(255, 0, 222, 0.7), 0 0 100px rgba(255, 0, 222, 0.4), inset 0 0 50px rgba(255, 0, 222, 0.2); }
}

/* Corner decorations */
.poster-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #00ffff;
}

.poster-corner.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.poster-corner.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.poster-corner.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.poster-corner.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* Header */
.poster-header {
    text-align: center;
    margin-bottom: 20px;
}

.poster-glitch {
    font-size: clamp(24px, 8vw, 48px);
    font-weight: bold;
    color: #ff00de;
    text-shadow:
        0 0 10px #ff00de,
        0 0 20px #ff00de,
        0 0 40px #ff00de;
    letter-spacing: clamp(3px, 1.5vw, 10px);
    animation: glitch 3s infinite;
    position: relative;
    max-width: 100%;
    overflow: hidden;
    word-break: break-all;
}

/* Dynamic sizing for long villain names */
.poster-glitch.long-name {
    font-size: clamp(20px, 6vw, 36px);
    letter-spacing: clamp(2px, 1vw, 6px);
}

.poster-glitch.very-long-name {
    font-size: clamp(16px, 5vw, 28px);
    letter-spacing: clamp(1px, 0.5vw, 4px);
}

.poster-glitch::before,
.poster-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.poster-glitch::before {
    color: #00ffff;
    animation: glitch-1 2s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.poster-glitch::after {
    color: #ffff00;
    animation: glitch-2 2s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
}

@keyframes glitch-1 {
    0%, 100% { transform: translate(0); opacity: 0.8; }
    20% { transform: translate(3px, 0); }
    40% { transform: translate(-3px, 0); }
    60% { transform: translate(3px, 0); }
    80% { transform: translate(-3px, 0); }
}

@keyframes glitch-2 {
    0%, 100% { transform: translate(0); opacity: 0.8; }
    20% { transform: translate(-3px, 0); }
    40% { transform: translate(3px, 0); }
    60% { transform: translate(-3px, 0); }
    80% { transform: translate(3px, 0); }
}

.poster-subtitle {
    font-size: 12px;
    color: #00ffff;
    letter-spacing: 5px;
    margin-top: 5px;
    text-shadow: 0 0 10px #00ffff;
}

/* Villain container */
.poster-villain-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    background: linear-gradient(45deg, #1a0030 0%, #2a0040 100%);
    border: 2px solid #ff00de;
    border-radius: 10px;
    overflow: visible;  /* Allow accessories (wings) to extend beyond the box */
    box-shadow: inset 0 0 30px rgba(255, 0, 222, 0.3);
}

#villainPosterCanvas {
    display: block;
    /* Size set dynamically in JS to allow accessories to overflow */
}

.poster-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    animation: scanline-move 0.1s linear infinite;
}

@keyframes scanline-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(3px); }
}

/* Info section */
.poster-info {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.poster-info > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.poster-info > div:last-child {
    border-bottom: none;
}

.poster-label {
    font-size: 11px;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.poster-value {
    font-size: 16px;
    font-weight: bold;
}

.villain-name {
    color: #ff00de;
    text-shadow: 0 0 10px #ff00de;
    animation: name-pulse 1s ease-in-out infinite;
}

@keyframes name-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.creator-name {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.kill-count {
    color: #ff4444;
    text-shadow: 0 0 15px #ff0000;
    font-size: 20px;
    animation: kill-shake 0.5s ease-in-out infinite;
}

@keyframes kill-shake {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Rank container */
.poster-rank-container {
    text-align: center;
    padding: 15px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 0, 222, 0.2) 50%, transparent 100%);
    border-radius: 10px;
    margin-bottom: 15px;
}

.poster-rank-label {
    font-size: 10px;
    color: #888;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.poster-rank {
    font-size: 22px;
    font-weight: bold;
    color: #ffff00;
    text-shadow:
        0 0 10px #ffff00,
        0 0 20px #ffff00,
        0 0 40px #ff8800;
    letter-spacing: 3px;
    animation: rank-glow 1.5s ease-in-out infinite;
}

@keyframes rank-glow {
    0%, 100% {
        text-shadow: 0 0 10px #ffff00, 0 0 20px #ffff00, 0 0 40px #ff8800;
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 20px #ffff00, 0 0 40px #ffff00, 0 0 80px #ff8800;
        transform: scale(1.02);
    }
}

/* Rank tier colors */
.poster-rank.rare {
    color: #44aaff;
    text-shadow: 0 0 10px #44aaff, 0 0 20px #44aaff, 0 0 40px #0066ff;
}

.poster-rank.epic {
    color: #aa44ff;
    text-shadow: 0 0 10px #aa44ff, 0 0 20px #aa44ff, 0 0 40px #6600ff;
    animation: rank-glow-epic 1s ease-in-out infinite;
}

@keyframes rank-glow-epic {
    0%, 100% { text-shadow: 0 0 10px #aa44ff, 0 0 20px #aa44ff, 0 0 40px #6600ff; }
    50% { text-shadow: 0 0 20px #aa44ff, 0 0 40px #aa44ff, 0 0 80px #6600ff; }
}

.poster-rank.mythic {
    color: #ff8800;
    text-shadow: 0 0 10px #ff8800, 0 0 20px #ff8800, 0 0 40px #ff4400;
    animation: rank-glow-mythic 0.8s ease-in-out infinite;
}

@keyframes rank-glow-mythic {
    0%, 100% { text-shadow: 0 0 10px #ff8800, 0 0 20px #ff8800, 0 0 40px #ff4400; transform: scale(1); }
    50% { text-shadow: 0 0 30px #ff8800, 0 0 60px #ff8800, 0 0 100px #ff4400; transform: scale(1.05); }
}

.poster-rank.legendary {
    background: linear-gradient(90deg, #ff00de, #ffff00, #00ffff, #ff00de);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rank-rainbow 2s linear infinite, rank-shake-legendary 0.3s ease-in-out infinite;
    font-size: 24px;
    text-shadow: none;
    filter: drop-shadow(0 0 10px #ff00de) drop-shadow(0 0 20px #ffff00);
}

@keyframes rank-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

@keyframes rank-shake-legendary {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

/* Footer */
.poster-footer {
    text-align: center;
}

.poster-dismiss {
    font-size: 14px;
    color: #888;
    letter-spacing: 2px;
    animation: dismiss-blink 1s ease-in-out infinite;
}

@keyframes dismiss-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Mobile adjustments for wanted poster */
@media (max-width: 500px) {
    .crashed-by-text {
        font-size: 22px;
        letter-spacing: 5px;
    }

    .poster-frame {
        padding: 20px;
        max-width: 95%;
    }

    .poster-glitch {
        font-size: 36px;
        letter-spacing: 6px;
    }

    .poster-villain-container {
        width: 150px;
        height: 150px;
    }

    .poster-rank {
        font-size: 18px;
    }

    .poster-rank.legendary {
        font-size: 20px;
    }
}

/* ============================================
   PLAYER MEMORIAL - Sad Banana Death Notice
   ============================================ */

.memorial-overlay {
    background: radial-gradient(ellipse at center, rgba(0, 10, 30, 0.95) 0%, rgba(0, 0, 10, 0.98) 100%);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.memorial-frame {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: linear-gradient(135deg, #001020 0%, #002040 50%, #001020 100%);
    border: 3px solid #4488ff;
    border-radius: 20px;
    padding: 25px;
    box-shadow:
        0 0 30px rgba(68, 136, 255, 0.5),
        0 0 60px rgba(68, 136, 255, 0.3),
        inset 0 0 30px rgba(68, 136, 255, 0.1);
    animation: memorial-pulse 3s ease-in-out infinite;
}

.memorial-frame .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    margin: 0;
    background: #4488ff;
    border: 2px solid #aaddff;
    color: #aaddff;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.memorial-frame .close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(68, 136, 255, 0.8);
}

@keyframes memorial-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(68, 136, 255, 0.5), 0 0 60px rgba(68, 136, 255, 0.3), inset 0 0 30px rgba(68, 136, 255, 0.1); }
    50% { box-shadow: 0 0 50px rgba(68, 136, 255, 0.7), 0 0 100px rgba(68, 136, 255, 0.4), inset 0 0 50px rgba(68, 136, 255, 0.2); }
}

/* Corner decorations */
.memorial-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #88ccff;
}

.memorial-corner.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.memorial-corner.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.memorial-corner.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.memorial-corner.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

/* Header */
.memorial-header {
    text-align: center;
    margin-bottom: 15px;
}

.memorial-glitch {
    font-size: 36px;
    font-weight: bold;
    color: #4488ff;
    text-shadow:
        0 0 10px #4488ff,
        0 0 20px #4488ff,
        0 0 40px #4488ff;
    letter-spacing: 6px;
    animation: glitch 0.5s infinite;
    position: relative;
}

.memorial-glitch::before,
.memorial-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.memorial-glitch::before {
    color: #88ccff;
    animation: glitch-1 0.3s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.memorial-glitch::after {
    color: #aaddff;
    animation: glitch-2 0.3s infinite;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

.memorial-subtitle {
    font-size: 12px;
    color: #88ccff;
    letter-spacing: 5px;
    margin-top: 5px;
    text-shadow: 0 0 10px #88ccff;
}

/* Sad Banana container */
.memorial-banana-container {
    position: relative;
    width: 210px;
    height: 210px;
    margin: 0 auto 15px;
    background: linear-gradient(45deg, #001530 0%, #002050 100%);
    border: 2px solid #4488ff;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(68, 136, 255, 0.3);
}

#memorialBananaCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.memorial-tears {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        transparent 60%,
        rgba(68, 136, 255, 0.1) 70%,
        rgba(68, 136, 255, 0.2) 100%);
    pointer-events: none;
    animation: tears-flow 2s ease-in-out infinite;
}

@keyframes tears-flow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Info section */
.memorial-info {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #4488ff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.memorial-info > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(68, 136, 255, 0.2);
}

.memorial-info > div:last-child {
    border-bottom: none;
}

.memorial-label {
    font-size: 11px;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.memorial-value {
    font-size: 16px;
    font-weight: bold;
}

.player-name {
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700;
    animation: name-pulse 1s ease-in-out infinite;
}

.score-value {
    color: #ff00de;
    text-shadow: 0 0 10px #ff00de;
}

.time-value {
    color: #88ccff;
    text-shadow: 0 0 10px #88ccff;
}

/* Killer section */
.memorial-killer-section {
    text-align: center;
    padding: 12px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 0, 100, 0.15) 50%, transparent 100%);
    border-radius: 10px;
    margin-bottom: 12px;
}

.memorial-killer-label {
    font-size: 10px;
    color: #ff6688;
    letter-spacing: 3px;
    margin-bottom: 8px;
    text-shadow: 0 0 10px #ff4466;
}

.memorial-killer-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 8px;
    background: linear-gradient(45deg, #200020 0%, #300030 100%);
    border: 2px solid #ff00de;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(255, 0, 222, 0.4);
}

#memorialKillerCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.memorial-killer-name {
    font-size: 14px;
    font-weight: bold;
    color: #ff00de;
    text-shadow: 0 0 10px #ff00de;
    animation: killer-pulse 0.8s ease-in-out infinite;
}

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

.memorial-killer-creator {
    font-size: 10px;
    color: #888;
    margin-top: 4px;
}

/* Clickable killer section */
.memorial-killer-section.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.memorial-killer-section.clickable:hover,
.memorial-killer-section.focused {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 0, 222, 0.4) 50%, transparent 100%);
    transform: scale(1.02);
}

.memorial-killer-section.clickable:hover .memorial-killer-container,
.memorial-killer-section.focused .memorial-killer-container {
    box-shadow: 0 0 25px rgba(255, 0, 222, 0.8), 0 0 50px rgba(255, 0, 222, 0.4);
    border-color: #ff44ff;
}

.memorial-killer-section.clickable:hover .memorial-killer-name,
.memorial-killer-section.focused .memorial-killer-name {
    color: #ff44ff;
    text-shadow: 0 0 15px #ff00de, 0 0 30px #ff00de;
}

.memorial-killer-section.clickable::after {
    content: '[ VIEW WANTED POSTER ]';
    display: block;
    font-size: 10px;
    color: #666;
    margin-top: 8px;
    letter-spacing: 1px;
    transition: color 0.2s ease;
}

.memorial-killer-section.clickable:hover::after,
.memorial-killer-section.clickable.focused::after {
    color: #ff00de;
    animation: dismiss-blink 1s ease-in-out infinite;
}

/* Footer */
.memorial-footer {
    text-align: center;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memorial-footer:hover {
    background: rgba(68, 136, 255, 0.1);
}

.memorial-footer.focused {
    background: rgba(68, 136, 255, 0.2);
    border: 1px solid #4488ff;
    box-shadow: 0 0 15px rgba(68, 136, 255, 0.4);
}

.memorial-footer.focused .memorial-dismiss {
    color: #4488ff;
}

.memorial-dismiss {
    font-size: 14px;
    color: #888;
    letter-spacing: 2px;
    animation: dismiss-blink 1s ease-in-out infinite;
}

/* Mobile adjustments for memorial */
@media (max-width: 500px) {
    .memorial-frame {
        padding: 20px;
        max-width: 95%;
    }

    .memorial-glitch {
        font-size: 28px;
        letter-spacing: 4px;
    }

    .memorial-banana-container {
        width: 180px;
        height: 180px;
    }

    .memorial-killer-container {
        width: 70px;
        height: 70px;
    }
}

/* ============================================
   LEADERBOARD TABS
   ============================================ */

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    background: transparent;
    border: 2px solid #ff00de;
    color: #ff00de;
    padding: 10px 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    margin: 0;
}

.tab-btn:hover {
    background: rgba(255, 0, 222, 0.2);
    transform: none;
}

.tab-btn.active {
    background: #ff00de;
    color: yellow;
    box-shadow: 0 0 20px rgba(255, 0, 222, 0.5);
}

.tab-content {
    display: none;
    width: 100%;
    text-align: center;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================
   VILLAIN TABLE (matches score table)
   ============================================ */

#villainTable {
    border-collapse: collapse;
    width: 90%;
    max-width: 700px;
    margin-top: 20px;
    font-size: 18px;
}

.villain-preview-col {
    width: 50px;
    padding: 5px !important;
}

.villain-preview-cell {
    width: 50px;
    padding: 5px !important;
    text-align: center;
}

.villain-preview-canvas {
    width: 40px;
    height: 40px;
    display: block;
    margin: 0 auto;
}

#villainTable th,
#villainTable td {
    border: 1px solid #ff00de;
    padding: 10px;
    text-align: left;
}

#villainTable th {
    background-color: #ff00de;
    color: yellow;
}

#villainTable tr:nth-child(even) {
    background-color: #1a0010;
}

.villain-row {
    cursor: pointer;
    transition: all 0.15s ease;
}

.villain-row:hover,
.villain-row.selected {
    background-color: #ff00de !important;
    color: #000;
}

.villain-row:hover td,
.villain-row.selected td {
    color: yellow;
    text-shadow: 0 0 10px #000;
}

/* Keyboard selected row has cyan glow */
.villain-row.selected {
    box-shadow: 0 0 15px #00ffff, inset 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Score table row selection */
.score-row {
    cursor: pointer;
    transition: all 0.15s ease;
}

.score-row:hover {
    background-color: rgba(68, 136, 255, 0.3) !important;
}

.score-row:hover td {
    color: #88ccff;
}

#scoreBody tr.selected,
.score-row.selected {
    background-color: #ff00de !important;
    color: yellow;
    box-shadow: 0 0 15px #00ffff;
}

#scoreBody tr.selected td,
.score-row.selected td {
    color: yellow;
    text-shadow: 0 0 10px #000;
}

.villain-name-cell {
    color: #ff00de;
    font-weight: bold;
}

.villain-row:hover .villain-name-cell {
    color: yellow;
}

.villain-kills-cell {
    color: #ff4444;
    font-weight: bold;
}

.villain-row:hover .villain-kills-cell {
    color: yellow;
}

/* Own villain highlight (from localStorage) */
.villain-row.own-villain {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, transparent 100%);
    border-left: 3px solid gold;
}

.villain-row.own-villain .villain-name-cell {
    color: gold;
}

.villain-empty,
.villain-loading {
    text-align: center;
    color: #888;
    padding: 40px 20px;
    font-size: 16px;
}

.villain-loading {
    color: #ff00de;
    animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; text-shadow: 0 0 10px #ff00de; }
    50% { opacity: 0.5; text-shadow: 0 0 20px #ff00de; }
}

#villainSearch {
    margin-bottom: 15px;
}

/* Search field focus/selected state */
#leaderboardSearch:focus,
#villainSearch:focus {
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* Back button selected in leaderboard */
#closeLeaderboardBtn.selected {
    background: yellow;
    color: #ff00de;
    box-shadow: 0 0 20px yellow;
}

/* Mobile adjustments */
@media (max-width: 500px) {
    #villainTable {
        width: 95%;
        font-size: 14px;
    }

    #villainTable th,
    #villainTable td {
        padding: 8px 5px;
    }

    .tab-btn {
        padding: 8px 15px;
        font-size: 14px;
    }
}

/* ============================================
   LOADING SCREEN (iOS only)
   ============================================ */

.loading-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    z-index: 1000;
}

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

#loadingBananaCanvas {
    display: block;
}

/* ============================================
   Server Offline Banner
   ============================================ */

.server-offline-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #ff00de 0%, #aa0099 100%);
    color: yellow;
    text-align: center;
    padding: 15px 20px;
    z-index: 9999;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 4px solid yellow;
    box-shadow: 0 4px 20px rgba(255, 0, 222, 0.5);
    animation: banner-shake 0.5s infinite;
}

.server-offline-banner.visible {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.server-offline-banner .banana-icon {
    font-size: 32px;
    animation: banana-spin 1s ease-in-out infinite;
}

.server-offline-banner .offline-text {
    font-size: 18px;
    letter-spacing: 2px;
    text-shadow: 2px 2px #000;
}

.server-offline-banner .offline-subtext {
    font-size: 12px;
    color: #fff;
    letter-spacing: 1px;
}

@keyframes banner-shake {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    75% { transform: translateY(2px); }
}

@keyframes banana-spin {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

