* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    --ui-scale: 1;
}

/* Responsive UI Scaling - Use both width AND height to determine appropriate scale */
/* These rules cascade from largest to smallest, with more specific rules overriding general ones */

/* Very large screens (1440p, 4K and above) */
@media (min-width: 1921px) and (min-height: 1081px) {
    :root {
        --ui-scale: 1;
    }
}

/* Large screens (1080p) */
@media (min-width: 1601px) and (min-height: 901px) and (max-width: 1920px) and (max-height: 1080px) {
    :root {
        --ui-scale: 0.9;
    }
}

/* Medium-large screens (900p-1080p range) */
@media (min-width: 1281px) and (min-height: 801px) and (max-width: 1600px) and (max-height: 900px) {
    :root {
        --ui-scale: 0.75;
    }
}

/* Medium screens (768p-900p, like 1024x768, 1280x720, 1366x768) */
@media (min-width: 1000px) and (min-height: 700px) and (max-width: 1280px) and (max-height: 800px) {
    :root {
        --ui-scale: 0.6;
    }
}

/* Small-medium screens (tablets in landscape, 800x600-1024x600 range) */
@media (min-width: 800px) and (min-height: 500px) and (max-width: 999px) and (max-height: 699px) {
    :root {
        --ui-scale: 0.5;
    }
}

/* Small screens (small tablets, large phones in landscape) */
@media (min-width: 601px) and (min-height: 400px) and (max-width: 799px) and (max-height: 599px) {
    :root {
        --ui-scale: 0.45;
    }
}

/* Very small screens (phones in portrait or very small windows) */
@media (max-width: 600px) and (max-height: 800px) {
    :root {
        --ui-scale: 0.4;
    }
}

/* Ultra small screens (very small phones) */
@media (max-width: 400px), (max-height: 400px) {
    :root {
        --ui-scale: 0.35;
    }
}

body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: #0a0a0a;
    color: #d0d0d0;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    /* Prevent zoom */
    touch-action: manipulation;
    font-size: calc(16px * var(--ui-scale));
}

/* Allow input fields to be selectable */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

html {
    /* Prevent zoom on double-tap */
    touch-action: manipulation;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Screen Management */
.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.hidden {
    display: none;
}

/* Class Selection - Fills entire screen with responsive scaling */
#hero-selection {
    display: flex !important;
    flex-direction: row;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    z-index: 100;
    overflow: hidden;
}

#hero-selection.hidden {
    display: none !important;
}

#start-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: calc(2rem * var(--ui-scale)) calc(1rem * var(--ui-scale));
    position: relative;
    overflow-y: auto;
    max-height: 100vh; /* Fill viewport height */
}

.menu-mute-btn {
    position: absolute;
    top: calc(2rem * var(--ui-scale));
    right: calc(2rem * var(--ui-scale));
    background: transparent;
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    color: #fff;
    font-size: calc(2rem * var(--ui-scale));
    padding: calc(0.8rem * var(--ui-scale));
    cursor: pointer;
    border-radius: calc(8px * var(--ui-scale));
    transition: all 0.3s ease;
    width: calc(70px * var(--ui-scale));
    height: calc(70px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.menu-mute-btn:hover {
    border-color: #ffa500;
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
    transform: scale(1.05);
}

.menu-mute-btn.muted {
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
}

#menu-mute-icon {
    display: block;
    line-height: 1;
}

.start-top-controls {
    position: absolute;
    top: calc(2rem * var(--ui-scale));
    left: calc(2rem * var(--ui-scale));
    display: flex;
    gap: calc(1rem * var(--ui-scale));
    align-items: flex-start;
    z-index: 1000;
    flex-wrap: wrap;
    pointer-events: none;
}

.start-top-controls > * {
    pointer-events: auto;
}

.ui-scale-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(0.3rem * var(--ui-scale));
    pointer-events: auto;
}

.ui-scale-content {
    display: flex;
    align-items: center;
    gap: calc(0.8rem * var(--ui-scale));
}

.ui-scale-info {
    font-size: calc(0.5rem * var(--ui-scale));
    color: #aaa;
    margin: 0;
    font-style: italic;
    text-align: center;
}

.ui-scale-control label {
    font-size: calc(0.6rem * var(--ui-scale));
    color: #ffa500;
    font-weight: bold;
    white-space: nowrap;
}

.ui-scale-input {
    width: calc(70px * var(--ui-scale));
    padding: calc(0.5rem * var(--ui-scale));
    background: rgba(26, 26, 46, 0.8);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(4px * var(--ui-scale));
    color: #ffa500;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: calc(0.7rem * var(--ui-scale));
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    pointer-events: auto;
    cursor: text;
    z-index: 1001;
    position: relative;
}

.ui-scale-input:focus {
    outline: none;
    border-color: #ffa500;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

.ui-scale-input:hover {
    border-color: #ffb533;
}

.ui-scale-control span {
    font-size: calc(0.6rem * var(--ui-scale));
    color: #ffa500;
    font-weight: bold;
}

#game-statistics-panel {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(1rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    min-width: calc(280px * var(--ui-scale));
}

#game-statistics-panel h3 {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #ffa500;
    margin-bottom: calc(0.8rem * var(--ui-scale));
    text-align: center;
    letter-spacing: calc(2px * var(--ui-scale));
}

.stat-item.total-games {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(0.5rem * var(--ui-scale));
    background: rgba(255, 165, 0, 0.1);
    border-radius: calc(4px * var(--ui-scale));
    margin-bottom: calc(0.8rem * var(--ui-scale));
    border: calc(1px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
}

.stat-label-main {
    font-size: calc(0.55rem * var(--ui-scale));
    color: #d0d0d0;
}

.stat-value-main {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #ffa500;
    font-weight: bold;
}

.hero-stats-list {
    display: flex;
    flex-direction: column;
    gap: calc(0.4rem * var(--ui-scale));
}

.hero-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(0.4rem * var(--ui-scale)) calc(0.5rem * var(--ui-scale));
    background: rgba(255, 255, 255, 0.05);
    border-radius: calc(4px * var(--ui-scale));
    border: calc(1px * var(--ui-scale)) solid rgba(255, 165, 0, 0.2);
    transition: all 0.2s ease;
}

.hero-stat-item:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: rgba(255, 165, 0, 0.4);
}

.hero-stat-name {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #d0d0d0;
}

.hero-stat-count {
    font-size: calc(0.77rem * var(--ui-scale));
    color: #4aff4a;
}

.reset-stats-btn {
    background: linear-gradient(135deg, #ff3535 0%, #cc0000 100%);
    border: calc(2px * var(--ui-scale)) solid #ff0000;
    color: #fff;
    padding: calc(0.5rem * var(--ui-scale)) calc(1rem * var(--ui-scale));
    font-size: calc(0.5rem * var(--ui-scale));
    cursor: pointer;
    border-radius: calc(4px * var(--ui-scale));
    font-weight: bold;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: calc(0.8rem * var(--ui-scale));
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.reset-stats-btn:hover {
    background: linear-gradient(135deg, #ff0000 0%, #990000 100%);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
    transform: translateY(-2px);
}

.reset-stats-btn:active {
    transform: translateY(0);
}

.start-audio-controls {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(1rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: calc(0.8rem * var(--ui-scale));
}

/* Start Settings Panel - Unified */
.start-settings-panel {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(1rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    position: absolute;
    top: calc(2rem * var(--ui-scale));
    right: calc(2rem * var(--ui-scale));
    min-width: calc(250px * var(--ui-scale));
    z-index: 10000;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
}

.settings-panel-title {
    color: #FFD700;
    font-size: calc(0.9rem * var(--ui-scale));
    margin: 0;
    padding-bottom: calc(0.5rem * var(--ui-scale));
    border-bottom: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
    text-align: center;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: calc(0.6rem * var(--ui-scale));
}

.settings-section-title {
    color: #ffa500;
    font-size: calc(0.65rem * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(0.2rem * var(--ui-scale));
}

.settings-section .audio-setting {
    display: flex;
    align-items: center;
    gap: calc(0.5rem * var(--ui-scale));
    margin: 0;
    white-space: nowrap;
}

.settings-section .audio-setting label {
    min-width: calc(60px * var(--ui-scale));
    font-size: calc(0.6rem * var(--ui-scale));
}

.settings-section .audio-setting .volume-slider {
    width: calc(120px * var(--ui-scale));
}

.settings-section .audio-setting span {
    min-width: calc(40px * var(--ui-scale));
    font-size: calc(0.6rem * var(--ui-scale));
}

.auto-aim-setting {
    display: flex;
    align-items: center;
    gap: calc(1rem * var(--ui-scale));
    justify-content: space-between;
}

.start-audio-controls .audio-setting {
    display: flex;
    align-items: center;
    gap: calc(0.5rem * var(--ui-scale));
    margin: 0;
}

.start-audio-controls .audio-setting label {
    min-width: calc(60px * var(--ui-scale));
    font-size: calc(0.6rem * var(--ui-scale));
}

.start-audio-controls .audio-setting .volume-slider {
    width: calc(120px * var(--ui-scale));
}

.start-audio-controls .audio-setting span {
    min-width: calc(40px * var(--ui-scale));
    font-size: calc(0.6rem * var(--ui-scale));
}

.general-perks-button {
    padding: calc(0.5rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.3) 100%);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 215, 0, 0.5);
    border-radius: calc(6px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(0.65rem * var(--ui-scale));
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
    font-family: 'Press Start 2P', 'Courier New', monospace;
    white-space: nowrap;
    pointer-events: auto;
    display: inline-block;
    margin: 0;
}

.general-perks-button:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.4) 100%);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.info-buttons-container {
    display: flex;
    gap: calc(0.5rem * var(--ui-scale));
    justify-content: flex-start;
    margin-top: calc(0.5rem * var(--ui-scale));
}

.difficulty-info-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: calc(0.5rem * var(--ui-scale));
}

.difficulty-section {
    margin-bottom: calc(1.5rem * var(--ui-scale));
    padding-bottom: calc(1rem * var(--ui-scale));
    border-bottom: calc(1px * var(--ui-scale)) solid rgba(255, 215, 0, 0.2);
}

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

.difficulty-section h3 {
    color: #FFD700;
    font-size: calc(1.1rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
    font-weight: bold;
}

.difficulty-section p {
    margin-bottom: calc(0.5rem * var(--ui-scale));
    line-height: 1.4;
}

.difficulty-section ul {
    margin-left: calc(1rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
}

.difficulty-section li {
    margin-bottom: calc(0.3rem * var(--ui-scale));
    line-height: 1.3;
}

.difficulty-section .note-text {
    color: #FFA500;
    font-style: italic;
    padding: calc(0.5rem * var(--ui-scale));
    background: rgba(255, 165, 0, 0.1);
    border-left: calc(3px * var(--ui-scale)) solid #FFA500;
    border-radius: calc(4px * var(--ui-scale));
    margin-top: calc(0.5rem * var(--ui-scale));
    display: block;
}

.hero-perks-section {
    margin-top: calc(0.5rem * var(--ui-scale));
    padding: calc(0.6rem * var(--ui-scale));
    background: rgba(26, 26, 46, 0.4);
    border: calc(1px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    border-radius: calc(6px * var(--ui-scale));
    width: 100%;
    position: relative;
    z-index: 1;
}

.hero-perks-button {
    width: 100%;
    padding: calc(0.5rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.3) 100%);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 215, 0, 0.5);
    border-radius: calc(6px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(0.65rem * var(--ui-scale));
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.hero-perks-button:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.4) 100%);
    border-color: #FFD700;
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.hero-perks-modal-content {
    max-width: 80vw;
    width: 80vw;
    max-height: 85vh;
}

.hero-perks-modal-content .general-perk-category {
    margin-bottom: calc(3rem * var(--ui-scale));
}

.hero-perks-modal-content .general-perk-item {
    padding: calc(0.9rem * var(--ui-scale));
    border: calc(1.5px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    border-radius: calc(9px * var(--ui-scale));
}

.hero-perks-modal-content .general-perk-item .perk-name {
    font-size: calc(1.275rem * var(--ui-scale)) !important;
    margin-bottom: calc(0.45rem * var(--ui-scale));
}

.hero-perks-modal-content .general-perk-item .perk-desc {
    font-size: calc(1.02rem * var(--ui-scale)) !important;
    line-height: 1.3;
}

.hero-perks-modal-content .general-perk-item .perk-values {
    font-size: calc(0.93rem * var(--ui-scale)) !important;
    line-height: 1.3;
    padding-top: calc(0.525rem * var(--ui-scale));
    margin-top: calc(0.525rem * var(--ui-scale));
    border-top: calc(1.5px * var(--ui-scale)) solid rgba(255, 215, 0, 0.2);
}

.general-perks-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.general-perks-modal.active {
    display: flex;
}

.general-perks-content {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(12px * var(--ui-scale));
    padding: calc(2rem * var(--ui-scale));
    max-width: calc(1100px * var(--ui-scale));
    width: 85vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.general-perks-content::-webkit-scrollbar {
    width: 10px;
}

.general-perks-content::-webkit-scrollbar-track {
    background: rgba(255, 215, 0, 0.1);
    border-radius: 5px;
}

.general-perks-content::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 5px;
}

.general-perks-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.6);
}

.general-perks-content h2 {
    color: #FFD700;
    text-align: center;
    margin-bottom: calc(1.5rem * var(--ui-scale));
    font-size: calc(1.8rem * var(--ui-scale));
    text-shadow: 0 0 calc(15px * var(--ui-scale)) #FFD700;
}

.general-perks-close {
    position: absolute;
    top: calc(1rem * var(--ui-scale));
    right: calc(1rem * var(--ui-scale));
    background: rgba(255, 68, 68, 0.2);
    border: calc(2px * var(--ui-scale)) solid #FF4444;
    color: #FF4444;
    font-size: calc(1.5rem * var(--ui-scale));
    width: calc(40px * var(--ui-scale));
    height: calc(40px * var(--ui-scale));
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.general-perks-close:hover {
    background: rgba(255, 68, 68, 0.4);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

.general-perks-categories {
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
}

.general-perk-category {
    background: rgba(255, 215, 0, 0.08);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
}

.general-perk-category h3 {
    color: #FFD700;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 0.4rem;
}

.general-perk-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem;
}

.general-perk-item {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    padding: 0.6rem;
    transition: all 0.2s ease;
}

.general-perk-item:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.general-perk-item .perk-name {
    color: #FFD700;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.general-perk-item .perk-desc {
    color: #CCC;
    font-size: 0.68rem;
    line-height: 1.3;
}

.general-perk-item .perk-values {
    color: #4ade80;
    font-size: 0.62rem;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    line-height: 1.4;
}

#game-screen {
    display: none;
}

#game-screen.hidden {
    display: none !important;
}

.game-title {
    font-size: calc(3rem * var(--ui-scale));
    color: #ff6b35;
    text-shadow: 0 0 20px #ff6b35, 0 0 40px #ff3535;
    margin-bottom: calc(0.5rem * var(--ui-scale));
    margin-top: calc(1rem * var(--ui-scale));
    letter-spacing: calc(0.1rem * var(--ui-scale));
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 20px #ff6b35, 0 0 40px #ff3535; }
    50% { text-shadow: 0 0 30px #ff6b35, 0 0 60px #ff3535, 0 0 80px #ff6b35; }
}

.version-text {
    font-size: calc(0.9rem * var(--ui-scale));
    color: #FFFFFF;
    text-shadow: -1px -1px 0 #000,
                  1px -1px 0 #000,
                 -1px  1px 0 #000,
                  1px  1px 0 #000,
                  0 0 5px rgba(0, 0, 0, 0.8);
    margin: calc(0.3rem * var(--ui-scale)) 0 calc(0.8rem * var(--ui-scale)) 0;
    letter-spacing: calc(0.05rem * var(--ui-scale));
}

.subtitle {
    font-size: calc(1.8rem * var(--ui-scale));
    color: #ffa500;
    margin-top: calc(1.5rem * var(--ui-scale));
    margin-bottom: calc(1rem * var(--ui-scale));
    text-shadow: 0 0 10px #ffa500;
    line-height: 1.8;
}

.controls-info {
    background: rgba(0, 0, 0, 0.5);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(0.6rem * var(--ui-scale)) calc(1rem * var(--ui-scale));
    margin-bottom: calc(1rem * var(--ui-scale));
    max-width: calc(900px * var(--ui-scale));
    transition: all 0.3s ease;
}

.controls-info:hover {
    border-color: #ffa500;
    background: rgba(255, 165, 0, 0.1);
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.3);
}

.controls-info p {
    color: #d0d0d0;
    font-size: calc(0.75rem * var(--ui-scale));
    margin: calc(0.4rem * var(--ui-scale)) 0;
    line-height: 1.6;
}

.controls-info strong {
    color: #ffa500;
}

.controls-info .highscore-info {
    font-size: calc(0.75rem * var(--ui-scale));
    margin-top: calc(0.6rem * var(--ui-scale));
    padding-top: calc(0.5rem * var(--ui-scale));
    border-top: calc(1px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
    margin-bottom: calc(0.5rem * var(--ui-scale));
}

.controls-info .score-formula {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #aaa;
    font-style: italic;
    display: block;
    margin-top: calc(0.3rem * var(--ui-scale));
}

#start-highscore-panel {
    width: calc(220px * var(--ui-scale));
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border-right: calc(2px * var(--ui-scale)) solid #4a4a6e;
    padding: calc(0.8rem * var(--ui-scale));
    overflow-y: auto;
    overflow-x: visible;
    max-height: 100vh;
}

#start-highscore-panel h3 {
    color: #FFD700;
    text-align: center;
    margin-bottom: calc(0.8rem * var(--ui-scale));
    font-size: calc(1.7rem * var(--ui-scale));
    text-shadow: 0 0 calc(15px * var(--ui-scale)) #FFD700;
}

#start-highscore-list {
    font-size: calc(1.1rem * var(--ui-scale));
}

#start-highscore-list .highscore-entry {
    background: rgba(0, 0, 0, 0.3);
    border: calc(1px * var(--ui-scale)) solid #4a4a6e;
    padding: calc(0.4rem * var(--ui-scale)) calc(0.6rem * var(--ui-scale));
    margin-bottom: calc(0.35rem * var(--ui-scale));
    border-radius: calc(4px * var(--ui-scale));
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

#start-highscore-list .highscore-entry:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
    transform: translateX(5px);
}

#start-highscore-list .highscore-entry:hover .highscore-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Medal effects for top 3 on start screen */
#start-highscore-list .highscore-entry.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.1) 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
}

#start-highscore-list .highscore-entry.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(128, 128, 128, 0.1) 100%);
    border: calc(2px * var(--ui-scale)) solid #C0C0C0;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(192, 192, 192, 0.3);
}

#start-highscore-list .highscore-entry.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(184, 115, 51, 0.1) 100%);
    border: calc(2px * var(--ui-scale)) solid #CD7F32;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(205, 127, 50, 0.3);
}

#start-highscore-list .highscore-entry.rank-1 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 12px #FFD700;
}

#start-highscore-list .highscore-entry.rank-1 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
}

#start-highscore-list .highscore-entry.rank-2 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

#start-highscore-list .highscore-entry.rank-2 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

#start-highscore-list .highscore-entry.rank-3 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

#start-highscore-list .highscore-entry.rank-3 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(calc(200px * var(--ui-scale)), 1fr));
    gap: calc(1rem * var(--ui-scale));
    max-width: 100%;
    width: 100%;
}

/* Responsive - force 4 columns on large screens */
@media (min-width: 1200px) {
    .hero-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive - 2 columns on medium screens */
@media (max-width: 1199px) and (min-width: 768px) {
    .hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - 1 column on small screens */
@media (max-width: 767px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
}

/* Random Hero Button */
.random-hero-container {
    display: flex;
    justify-content: center;
    margin-top: calc(1rem * var(--ui-scale));
    margin-bottom: calc(1.5rem * var(--ui-scale));
}

.random-hero-btn {
    background: linear-gradient(135deg, #3a3a4e 0%, #2a2a3e 100%);
    border: calc(2px * var(--ui-scale)) solid #5a5a6e;
    padding: calc(0.6rem * var(--ui-scale)) calc(1.2rem * var(--ui-scale));
    font-size: calc(0.9rem * var(--ui-scale));
    font-weight: normal;
    color: #CCCCCC;
    cursor: pointer;
    border-radius: calc(6px * var(--ui-scale));
    transition: all 0.3s ease;
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
    text-shadow: 0 calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.5);
    position: relative;
}

.random-hero-btn:hover {
    transform: translateY(calc(-2px * var(--ui-scale)));
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.4);
    border-color: #6a6a7e;
    background: linear-gradient(135deg, #4a4a5e 0%, #3a3a4e 100%);
    color: #FFFFFF;
}

.random-hero-btn:active {
    transform: translateY(0);
    box-shadow: 0 calc(1px * var(--ui-scale)) calc(4px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
}

/* Random Hero Button Tooltip */
.random-hero-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    padding: calc(0.8rem * var(--ui-scale)) calc(1rem * var(--ui-scale));
    background: rgba(0, 0, 0, 0.95);
    color: #FFD700;
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(6px * var(--ui-scale));
    font-size: calc(0.85rem * var(--ui-scale));
    font-weight: normal;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.5);
}

.random-hero-btn[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    border: calc(8px * var(--ui-scale)) solid transparent;
    border-top-color: #FFD700;
    z-index: 1001;
    pointer-events: none;
}

.hero-card {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(3px * var(--ui-scale)) solid #4a4a6e;
    padding: calc(1rem * var(--ui-scale));
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: calc(8px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 165, 0, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.hero-card:hover::before {
    opacity: 1;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.hero-card[data-hero="warrior"]:hover {
    border-color: #FF4444;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="priest"]:hover {
    border-color: #FFFFFF;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="wizard"]:hover {
    border-color: #0099DD;
    box-shadow: 0 0 30px rgba(0, 153, 221, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="jester"]:hover {
    border-color: #00FF88;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="templar"]:hover {
    border-color: #888888;
    box-shadow: 0 0 30px rgba(136, 136, 136, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="pirate"]:hover {
    border-color: #D4AF37;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-portrait {
    width: calc(170px * var(--ui-scale));
    height: calc(170px * var(--ui-scale));
    object-fit: cover;
    border-radius: 50%;
    border: calc(3px * var(--ui-scale)) solid #4a4a6e;
    margin-bottom: calc(0.5rem * var(--ui-scale));
    transition: all 0.3s ease;
}

/* Responsive portraits */
@media (max-width: 1400px) {
    .hero-portrait {
        width: calc(120px * var(--ui-scale));
        height: calc(120px * var(--ui-scale));
    }
}

@media (max-width: 1199px) {
    .hero-portrait {
        width: calc(150px * var(--ui-scale));
        height: calc(150px * var(--ui-scale));
    }
}

@media (max-width: 767px) {
    .hero-portrait {
        width: calc(170px * var(--ui-scale));
        height: calc(170px * var(--ui-scale));
    }
}

.hero-card[data-hero="warrior"]:hover .hero-portrait {
    border-color: #FF4444;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

.hero-card[data-hero="priest"]:hover .hero-portrait {
    border-color: #FFFFFF;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

.hero-card[data-hero="wizard"]:hover .hero-portrait {
    border-color: #0099DD;
    box-shadow: 0 0 20px rgba(0, 153, 221, 0.6);
}

.hero-card[data-hero="jester"]:hover .hero-portrait {
    border-color: #00FF88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
}

.hero-card[data-hero="templar"]:hover .hero-portrait {
    border-color: #888888;
    box-shadow: 0 0 20px rgba(136, 136, 136, 0.6);
}

.hero-card[data-hero="pirate"]:hover .hero-portrait {
    border-color: #D4AF37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
}

.hero-card h2 {
    font-size: calc(2.04rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
    text-align: center;
    position: relative;
    z-index: 1;
    font-weight: bold;
}

.hero-card[data-hero="warrior"] h2 {
    color: #FF4444;
    text-shadow: 0 0 15px #FF4444, 0 0 25px #FF4444;
}

.hero-card[data-hero="priest"] h2 {
    color: #FFFFFF;
    text-shadow: 0 0 15px #FFFFFF, 0 0 25px #FFFFFF;
}

.hero-card[data-hero="wizard"] h2 {
    color: #0099DD;
    text-shadow: 0 0 15px #0099DD, 0 0 25px #0099DD;
}

.hero-card[data-hero="jester"] h2 {
    color: #00FF88;
    text-shadow: 0 0 15px #00FF88, 0 0 25px #00FF88;
}

.hero-card[data-hero="templar"] h2 {
    color: #888888;
    text-shadow: 0 0 15px #888888, 0 0 25px #888888;
}

.hero-card[data-hero="pirate"] h2 {
    color: #D4AF37;
    text-shadow: 0 0 15px #D4AF37, 0 0 25px #D4AF37;
}

.hero-stats {
    margin: calc(0.5rem * var(--ui-scale)) 0;
    padding: calc(0.8rem * var(--ui-scale));
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
    border: calc(1px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    border-radius: calc(6px * var(--ui-scale));
    width: 100%;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.2);
}

.hero-stats-title {
    color: #ffa500;
    font-size: calc(0.75rem * var(--ui-scale));
    text-align: center;
    margin-bottom: calc(0.5rem * var(--ui-scale));
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
    font-weight: bold;
    letter-spacing: calc(0.05rem * var(--ui-scale));
}

.hero-stats p {
    margin: calc(0.25rem * var(--ui-scale)) 0;
    color: #FFD700;
    font-size: calc(1.1rem * var(--ui-scale));
    line-height: 1.8;
    text-shadow: 0 0 calc(5px * var(--ui-scale)) rgba(255, 215, 0, 0.5);
    font-weight: 600;
    letter-spacing: calc(0.03rem * var(--ui-scale));
}

.hero-desc {
    color: #FFD700;
    font-size: calc(1.02rem * var(--ui-scale));
    text-align: center;
    margin-top: calc(0.5rem * var(--ui-scale));
    line-height: 1.6;
    position: relative;
    z-index: 1;
    font-style: italic;
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
    padding: 0;
}

.hero-header {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.hero-stats p.hero-special {
    font-size: 0.85rem;
    text-align: left;
    margin-top: 0.3rem;
    line-height: 1.4;
    font-weight: 700;
    padding: 0;
}

/* Class-specific colors for special abilities */
.hero-card[data-hero="warrior"] .hero-special {
    color: #FF4444 !important;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.8) !important;
}

.hero-card[data-hero="priest"] .hero-special {
    color: #FFFFFF !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
}

.hero-card[data-hero="wizard"] .hero-special {
    color: #0099DD !important;
    text-shadow: 0 0 10px rgba(0, 153, 221, 0.8) !important;
}

.hero-card[data-hero="jester"] .hero-special {
    color: #00FF88 !important;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8) !important;
}

.hero-card[data-hero="templar"] .hero-special {
    color: #888888 !important;
    text-shadow: 0 0 10px rgba(136, 136, 136, 0.8) !important;
}

.hero-card[data-hero="pirate"] .hero-special {
    color: #D4AF37 !important;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8) !important;
}

/* Hero special tooltip for parrot emoji */
.hero-special-tooltip {
    cursor: help;
    font-size: inherit;
    display: inline-block;
    position: relative;
}

.hero-special-tooltip:hover::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.98);
    color: #FFD700;
    border: 3px solid #D4AF37;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: normal;
    width: 320px;
    max-width: 90vw;
    text-align: left;
    z-index: 10000;
    pointer-events: none;
    font-weight: normal;
    line-height: 1.5;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.hero-ultimates {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 165, 0, 0.05);
    border: 1px solid rgba(255, 165, 0, 0.2);
    border-radius: 6px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.ultimate-title {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #ffa500;
    text-align: center;
    letter-spacing: calc(1px * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(0.4rem * var(--ui-scale));
}

.ultimate-icons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.ultimate-icon {
    font-size: 2rem;
    cursor: help;
    padding: 0.5rem;
    background: rgba(255, 165, 0, 0.1);
    border: 2px solid rgba(255, 165, 0, 0.3);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.ultimate-icon img {
    width: 2rem;
    height: 2rem;
    object-fit: contain;
    display: block;
}

.ultimate-icon:hover {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.6);
    transform: scale(1.1);
}

.ultimate-icon.no-ult {
    opacity: 0.5;
    cursor: not-allowed;
}

.ultimate-icon.no-ult:hover {
    transform: none;
}

.ultimate-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.65rem;
    white-space: normal;
    width: 250px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    border: 1px solid #ffa500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    line-height: 1.4;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.ultimate-icon::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #ffa500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.ultimate-icon:hover::after,
.ultimate-icon:hover::before {
    opacity: 1;
}

.class-ultimate {
    color: #FF4444;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 0.5rem;
    line-height: 1.4;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.6);
    padding: 0.3rem;
    border-top: 1px solid rgba(255, 68, 68, 0.3);
}

/* Responsive text sizing */
/* Hero card media queries removed - scaling now handled by var(--ui-scale) */

/* Game Screen */
#game-screen {
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    height: 100vh;
    overflow: hidden;
}

/* Top Bar */
#top-bar {
    height: calc(80px * var(--ui-scale));
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1e 100%);
    border-bottom: 2px solid #4a4a6e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 calc(2rem * var(--ui-scale));
    padding-left: calc(270px * var(--ui-scale));
    padding-right: calc(270px * var(--ui-scale));
    gap: calc(2rem * var(--ui-scale));
    position: relative;
    z-index: 150;
}

.bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.bar-label {
    color: #ffa500;
    font-weight: bold;
    font-size: calc(1.1rem * var(--ui-scale));
    min-width: calc(50px * var(--ui-scale));
}

.bar {
    position: relative;
    height: calc(30px * var(--ui-scale));
    background: #1a1a1a;
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(4px * var(--ui-scale));
    overflow: visible;
    flex: 1;
    max-width: calc(300px * var(--ui-scale));
}

.bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 2px;
}

.exp-bar .bar-fill {
    background: linear-gradient(90deg, #ffa500 0%, #ffcc00 100%);
    box-shadow: 0 0 10px #ffa500;
}

.ulti-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.bar-label-small {
    color: #ffa500;
    font-size: 0.7rem;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 165, 0, 0.5);
    min-width: 30px;
}

.ulti-bar-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ulti-bar {
    height: 22px;
    width: 100%;
}

.ulti-bar .bar-fill {
    background: linear-gradient(90deg, #9333EA 0%, #C084FC 100%);
    box-shadow: 0 0 8px #9333EA;
}

.ulti-bar.ready .bar-fill {
    animation: ulti-ready-pulse 1s ease-in-out infinite;
}

@keyframes ulti-ready-pulse {
    0%, 100% {
        box-shadow: 0 0 8px #9333EA;
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 20px #9333EA, 0 0 30px #C084FC;
        opacity: 0.9;
    }
}

.bar-text-small {
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 22px;
    color: #fff;
    font-weight: bold;
    font-size: 0.75rem;
    text-shadow: 1px 1px 2px #000;
}

.ulti-hint {
    font-size: 0.65rem;
    color: #ffa500;
    text-align: center;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 165, 0, 0.6);
    margin-top: -0.1rem;
}

.bar-text {
    position: relative;
    z-index: 1;
    text-align: center;
    line-height: 30px;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.bar-progress-text {
    position: absolute;
    top: 0;
    right: 5px;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    z-index: 2;
}

.suicide-btn {
    background: #8b0000;
    border: 2px solid #ff0000;
    color: #fff;
    font-size: 1.2rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.suicide-btn:hover {
    background: #ff0000;
    box-shadow: 0 0 15px #ff0000;
}

.difficulty-display {
    color: #ff6b35;
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 140px;
    text-align: right;
    margin-left: auto;
}

.time-display {
    color: #ffa500;
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 120px;
    text-align: right;
}

.auto-aim-label {
    color: #d0d0d0;
    font-size: calc(0.6rem * var(--ui-scale));
    font-weight: normal;
    white-space: nowrap;
}

.ui-scale-content {
    display: flex;
    align-items: center;
    gap: calc(0.5rem * var(--ui-scale));
}

.ui-scale-content label {
    font-size: calc(0.6rem * var(--ui-scale));
    min-width: calc(60px * var(--ui-scale));
}

.ui-scale-info {
    font-size: calc(0.5rem * var(--ui-scale));
    color: #999;
    margin: calc(0.3rem * var(--ui-scale)) 0 0 0;
}

/* Auto Aim Control - In-Game */
.game-auto-aim-control {
    display: flex;
    align-items: center;
    gap: calc(0.6rem * var(--ui-scale));
}

.game-auto-aim-label {
    color: #ffa500;
    font-size: calc(0.9rem * var(--ui-scale));
    font-weight: bold;
    white-space: nowrap;
}

/* Toggle Switch - Modern iOS-style */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: calc(60px * var(--ui-scale));
    height: calc(30px * var(--ui-scale));
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #4a4a6e 0%, #2a2a3e 100%);
    border: calc(2px * var(--ui-scale)) solid #666;
    transition: all 0.3s ease;
    border-radius: calc(30px * var(--ui-scale));
    box-shadow: inset 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: calc(22px * var(--ui-scale));
    width: calc(22px * var(--ui-scale));
    left: calc(4px * var(--ui-scale));
    bottom: calc(2px * var(--ui-scale));
    background: linear-gradient(135deg, #d0d0d0 0%, #999 100%);
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.3) 0%, rgba(255, 215, 0, 0.3) 100%);
    border-color: #00FF88;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(0, 255, 136, 0.5),
                inset 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(calc(30px * var(--ui-scale)));
    background: linear-gradient(135deg, #00FF88 0%, #00CC66 100%);
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(0, 255, 136, 0.5);
}

.toggle-switch:hover .toggle-slider {
    border-color: #ffa500;
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.3),
                inset 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked:hover + .toggle-slider {
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(0, 255, 136, 0.7),
                inset 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(0, 0, 0, 0.2);
}

.mute-btn {
    background: transparent;
    border: 2px solid #4a4a6e;
    color: #fff;
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 200;
    pointer-events: auto;
}

.mute-btn:hover {
    border-color: #ffa500;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.5);
}

.mute-btn.muted {
    border-color: #ff0000;
}

#mute-icon {
    display: block;
    line-height: 1;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 200;
}

.menu-audio-controls {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: calc(100px * var(--ui-scale));
    height: calc(6px * var(--ui-scale));
    background: linear-gradient(90deg, #4a4a6e 0%, #4a4a6e 100%);
    border-radius: calc(3px * var(--ui-scale));
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider:hover {
    background: linear-gradient(90deg, #5a5a7e 0%, #5a5a7e 100%);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: calc(16px * var(--ui-scale));
    height: calc(16px * var(--ui-scale));
    background: #ffa500;
    border-radius: 50%;
    cursor: pointer;
    border: calc(2px * var(--ui-scale)) solid #fff;
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #ffb533;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.8);
    transform: scale(1.1);
}

.volume-slider::-moz-range-thumb {
    width: calc(16px * var(--ui-scale));
    height: calc(16px * var(--ui-scale));
    background: #ffa500;
    border-radius: 50%;
    cursor: pointer;
    border: calc(2px * var(--ui-scale)) solid #fff;
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
    transition: all 0.3s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: #ffb533;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.8);
    transform: scale(1.1);
}

/* Main Game Area */
#main-game {
    flex: 1;
    display: flex;
    justify-content: center; /* Center canvas horizontally */
    align-items: center; /* Center canvas vertically */
    position: relative;
    overflow: hidden;
    min-height: 0;
    border-bottom: 2px solid #4a4a6e;
    background: #000000; /* Black background for letterboxing */
}

/* Highscore Panel */
#highscore-panel {
    width: 250px;
    min-width: 250px;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border-right: none;
    padding: 1rem;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 150;
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    overflow-x: visible;
    transform: scale(var(--ui-scale));
    transform-origin: top left;
}

#highscore-panel.collapsed {
    transform: scale(var(--ui-scale)) translateX(-200px);
}

.panel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
    padding: 0.5rem;
    border-radius: 4px;
    position: relative;
}

.panel-header:hover {
    background: rgba(255, 215, 0, 0.1);
}

.panel-header h3 {
    color: #FFD700;
    text-align: center;
    margin: 0;
    font-size: 1.7rem;
    text-shadow: 0 0 15px #FFD700;
    flex: 1;
    transition: opacity 0.3s ease-out;
}

.collapsed .panel-header h3 {
    opacity: 0;
    pointer-events: none;
}

.panel-toggle {
    background: none;
    border: none;
    color: #FFD700;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s;
    position: absolute;
}

/* Highscore panel (left side) - arrow rotates */
#highscore-panel .panel-toggle::before {
    content: '▼';
}

#highscore-panel .panel-toggle {
    transform: rotate(90deg);
    right: 0.5rem;
}

#highscore-panel.collapsed .panel-toggle {
    transform: rotate(-90deg);
}

/* Stats panel (right side) - arrow rotates */
#stats-panel .panel-toggle::before {
    content: '▼';
}

#stats-panel .panel-toggle {
    transform: rotate(-90deg);
    left: 0.5rem;
}

#stats-panel.collapsed .panel-toggle {
    transform: rotate(90deg);
}

.panel-content {
    overflow: visible;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    max-height: 2000px;
    opacity: 1;
}

.panel-content.collapsed {
    max-height: 0;
    opacity: 0;
}

#highscore-panel h3 {
    color: #FFD700;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.7rem;
    text-shadow: 0 0 15px #FFD700;
}

#highscore-list {
    font-size: 1.1rem;
    overflow: visible;
}

#start-highscore-list {
    overflow: visible;
}

.highscore-entry {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4a4a6e;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.4rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
}

.highscore-entry:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
    transform: translateX(5px);
}

.highscore-entry:hover .highscore-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Medal effects for top 3 */
.highscore-entry.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.1) 100%);
    border: 2px solid #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.highscore-entry.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(128, 128, 128, 0.1) 100%);
    border: 2px solid #C0C0C0;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
}

.highscore-entry.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(184, 115, 51, 0.1) 100%);
    border: 2px solid #CD7F32;
    box-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
}


.highscore-name {
    color: #FFD700;
    font-weight: bold;
    font-size: calc(1.3rem * var(--ui-scale));
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.5);
}

.highscore-rank {
    color: #FFD700;
    font-weight: bold;
    font-size: calc(1.1rem * var(--ui-scale));
}

.highscore-entry.rank-1 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 12px #FFD700;
}

.highscore-entry.rank-1 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
}

.highscore-entry.rank-2 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.highscore-entry.rank-2 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.highscore-entry.rank-3 .highscore-name {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.highscore-entry.rank-3 .highscore-rank {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.highscore-score {
    color: #00FF88;
    font-weight: bold;
    font-size: 1.05rem;
    margin-top: 0.2rem;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.highscore-details {
    color: #aaa;
    font-size: 0.75rem;
    margin-top: 0.3rem;
    line-height: 1.5;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.highscore-difficulty {
    color: #ff9900;
    font-size: 0.75rem;
    margin-top: 0.2rem;
    font-weight: 600;
}

/* Highscore Inspection Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
    z-index: 100000;
}

.modal.hidden {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    pointer-events: none; /* Allow mouse events to pass through to elements below */
}

.highscore-inspect-content {
    position: relative;
    z-index: 100001;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98) 0%, rgba(15, 15, 30, 0.98) 100%);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(12px * var(--ui-scale));
    padding: calc(25px * var(--ui-scale));
    max-width: calc(1300px * var(--ui-scale));
    width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: calc(2px * var(--ui-scale)) solid #4a4a6e;
    padding-bottom: calc(15px * var(--ui-scale));
    margin-bottom: calc(20px * var(--ui-scale));
}

.modal-header > div {
    display: flex;
    flex-direction: column;
    gap: calc(5px * var(--ui-scale));
}

.modal-header h2 {
    margin: 0;
    color: #FFD700;
    font-size: calc(1.5rem * var(--ui-scale));
    text-shadow: 0 0 calc(12px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
}

.modal-header .hero-class-name {
    color: #FFD700;
    font-size: calc(1.8rem * var(--ui-scale));
    font-weight: bold;
    text-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
}

.inspect-close-btn {
    background: rgba(255, 68, 68, 0.2);
    border: calc(2px * var(--ui-scale)) solid #FF4444;
    color: #FF4444;
    font-size: calc(32px * var(--ui-scale));
    font-weight: bold;
    width: calc(45px * var(--ui-scale));
    height: calc(45px * var(--ui-scale));
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.inspect-close-btn:hover {
    transform: rotate(90deg) scale(1.15);
    background: rgba(255, 68, 68, 0.4);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
}

.inspect-body {
    padding: calc(10px * var(--ui-scale)) 0;
    display: grid;
    grid-template-columns: 1fr 2fr 3fr;
    gap: calc(30px * var(--ui-scale));
}

/* Responsive layout for inspect body */
@media (max-width: 1200px) {
    .inspect-body {
        grid-template-columns: 1fr 2fr;
        grid-template-rows: auto auto;
    }

    .inspect-right-column {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .inspect-body {
        grid-template-columns: 1fr;
        gap: calc(15px * var(--ui-scale));
    }

    .inspect-left-column,
    .inspect-middle-column,
    .inspect-right-column {
        grid-column: 1;
    }
}

.inspect-left-column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.inspect-middle-column {
    display: flex;
    flex-direction: column;
    gap: calc(25px * var(--ui-scale));
}

.inspect-right-column {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    max-height: 100%;
    overflow-y: auto;
}

.inspect-perks-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.inspect-perks-section h3 {
    color: #FFD700;
    font-size: calc(1.5rem * var(--ui-scale));
    margin-bottom: calc(20px * var(--ui-scale));
    text-shadow: 0 0 calc(12px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
}

#inspect-perks-list {
    display: flex;
    flex-direction: column;
    gap: calc(15px * var(--ui-scale));
}

.inspect-perk-item {
    background: rgba(26, 26, 46, 0.6);
    border: calc(1px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    border-radius: calc(6px * var(--ui-scale));
    padding: calc(0.8rem * var(--ui-scale));
    transition: all 0.2s ease;
}

.inspect-perk-item:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

/* Rarity-based borders */
.inspect-perk-item.rarity-normal {
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.inspect-perk-item.rarity-rare {
    border: 2px solid #3B82F6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.inspect-perk-item.rarity-epic {
    border: 2px solid #9333EA;
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.4);
}

.inspect-perk-item.rarity-legendary {
    border: 2px solid #FF8C00;
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.5);
}

.inspect-perk-header {
    font-size: 0.75rem;
    font-weight: bold;
    text-shadow: 0 0 8px currentColor;
    margin-bottom: 0.5rem;
}

.inspect-perk-item .perk-name {
    color: #FFD700;
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 0.4rem;
    text-shadow: 0 0 8px currentColor;
}

.inspect-perk-item .perk-desc {
    color: #CCC;
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.inspect-perk-item .perk-values {
    color: #4ade80;
    font-size: 0.7rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    line-height: 1.4;
}

.inspect-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    padding: 18px;
    background: rgba(74, 74, 110, 0.3);
    border-radius: 8px;
    border: 1px solid #4a4a6e;
}

.inspect-stat {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 0;
}

.inspect-stat .stat-label {
    color: #aaa;
    font-weight: 500;
}

.inspect-stat .stat-value {
    color: #FFFFFF;
    font-weight: bold;
    white-space: nowrap;
}

/* Special styling for ultimate stat */
.inspect-stat.ultimate-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inspect-stat.ultimate-stat .stat-label {
    white-space: nowrap;
}

.inspect-stat.ultimate-stat .stat-value {
    text-transform: capitalize;
}

.inspect-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #4a4a6e;
}

.inspect-section h3 {
    color: #FFD700;
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.inspect-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.inspect-stats-grid .inspect-stat {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #4a4a6e;
}

/* Action Bar at Death - Horizontal display */
.inspect-action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px 0;
}

.inspect-action-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    min-width: 80px;
    transition: all 0.2s ease;
}

.inspect-action-slot:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-3px);
}

.inspect-action-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.inspect-action-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.inspect-action-keybind {
    font-size: 0.75rem;
    color: #FFD700;
    font-weight: bold;
    text-transform: uppercase;
    padding: 2px 6px;
    background: rgba(255, 215, 0, 0.15);
    border-radius: 3px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.inspect-action-name {
    font-size: 0.7rem;
    color: #CCC;
    text-align: center;
    max-width: 90px;
    line-height: 1.2;
}

/* Inventory at Death - Grid display */
.inspect-inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(12px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale)) 0;
}

.inspect-inventory-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(6px * var(--ui-scale));
    background: rgba(26, 26, 46, 0.6);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 255, 255, 0.3);
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale));
    min-height: calc(90px * var(--ui-scale));
    transition: all 0.2s ease;
}

.inspect-inventory-slot:hover {
    background: rgba(255, 215, 0, 0.08);
    transform: translateY(-2px);
}

.inspect-inventory-slot.empty {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
}

.inspect-inventory-slot.empty:hover {
    background: rgba(0, 0, 0, 0.25);
    transform: none;
}

/* Rarity-based borders for inventory items */
.inspect-inventory-slot.rarity-normal {
    border: calc(2px * var(--ui-scale)) solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 255, 255, 0.2);
}

.inspect-inventory-slot.rarity-rare {
    border: calc(2px * var(--ui-scale)) solid #3B82F6;
    box-shadow: 0 0 calc(12px * var(--ui-scale)) rgba(59, 130, 246, 0.4);
}

.inspect-inventory-slot.rarity-epic {
    border: calc(2px * var(--ui-scale)) solid #9333EA;
    box-shadow: 0 0 calc(12px * var(--ui-scale)) rgba(147, 51, 234, 0.4);
}

.inspect-inventory-slot.rarity-legendary {
    border: calc(2px * var(--ui-scale)) solid #FF8C00;
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 140, 0, 0.5);
}

.inspect-inventory-icon {
    width: calc(48px * var(--ui-scale));
    height: calc(48px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(60, 60, 70, 0.6) 100%);
    border-radius: calc(6px * var(--ui-scale));
    border: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.15);
}

/* Rarity-based inner glow for inventory icons */
.inspect-inventory-slot.rarity-normal .inspect-inventory-icon {
    box-shadow: inset 0 0 calc(15px * var(--ui-scale)) rgba(255, 255, 255, 0.15);
}

.inspect-inventory-slot.rarity-rare .inspect-inventory-icon {
    box-shadow: inset 0 0 calc(20px * var(--ui-scale)) rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(59, 130, 246, 0.15) 100%);
}

.inspect-inventory-slot.rarity-epic .inspect-inventory-icon {
    box-shadow: inset 0 0 calc(20px * var(--ui-scale)) rgba(147, 51, 234, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(147, 51, 234, 0.15) 100%);
}

.inspect-inventory-slot.rarity-legendary .inspect-inventory-icon {
    box-shadow: inset 0 0 calc(25px * var(--ui-scale)) rgba(255, 140, 0, 0.4);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(255, 140, 0, 0.2) 100%);
}

.inspect-inventory-icon img {
    width: calc(44px * var(--ui-scale));
    height: calc(44px * var(--ui-scale));
    object-fit: contain;
    filter: drop-shadow(0 0 calc(2px * var(--ui-scale)) rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.6));
}

.inspect-inventory-name {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #FFF;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
}

.inspect-inventory-empty {
    font-size: calc(0.7rem * var(--ui-scale));
    color: #666;
    text-align: center;
    margin-top: auto;
    margin-bottom: auto;
}

/* Boss Loot History - Grid display */
.inspect-boss-loot-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(12px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale)) 0;
}

.inspect-boss-loot-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(6px * var(--ui-scale));
    background: rgba(26, 26, 46, 0.6);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale));
    min-height: calc(120px * var(--ui-scale));
    transition: all 0.2s ease;
}

.inspect-boss-loot-item:hover {
    background: rgba(255, 215, 0, 0.08);
    transform: translateY(-2px);
}

/* Rarity-based borders for boss loot items */
.inspect-boss-loot-item.rarity-normal {
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.inspect-boss-loot-item.rarity-rare {
    border: 2px solid #3B82F6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.inspect-boss-loot-item.rarity-epic {
    border: 2px solid #9333EA;
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.4);
}

.inspect-boss-loot-item.rarity-legendary {
    border: 2px solid #FF8C00;
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
}

.inspect-boss-loot-label {
    font-size: 0.75rem;
    color: #FFD700;
    font-weight: 600;
    text-align: center;
}

.inspect-boss-loot-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(80, 80, 90, 0.4);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.inspect-boss-loot-icon img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 1px rgba(255, 255, 255, 0.6));
}

.inspect-boss-loot-name {
    font-size: 0.75rem;
    color: #FFF;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
}

.inspect-boss-loot-choice {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
}

/* Canvas overlay for inspect tooltips - matches in-game tooltip system */
#inspect-tooltip-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100000;
}

/* Action Bar Tooltips in Inspect Screen - matches in-game action bar */
.inspect-action-slot[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 110%;
    transform: translateX(-50%);
    padding: calc(10px * var(--ui-scale)) calc(15px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.98);
    color: #FFD700;
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(8px * var(--ui-scale));
    font-size: calc(14px * var(--ui-scale));
    white-space: pre-line;
    text-align: center;
    z-index: 100000;
    pointer-events: none;
    max-width: calc(300px * var(--ui-scale));
    min-width: calc(200px * var(--ui-scale));
    line-height: 1.4;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

/* Pause Menu with Perks */
.pause-menu-content {
    position: relative;
    z-index: 100001;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.98) 0%, rgba(15, 15, 30, 0.98) 100%);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(12px * var(--ui-scale));
    padding: calc(25px * var(--ui-scale));
    max-width: calc(1200px * var(--ui-scale));
    width: auto;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.7);
    pointer-events: auto;
    cursor: none !important;
}

/* Force custom crosshair in pause menu - hide default cursor on all elements */
#pause-menu,
#pause-menu * {
    cursor: none !important;
}

.pause-menu-content .modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: calc(2px * var(--ui-scale)) solid #4a4a6e;
    padding-bottom: calc(15px * var(--ui-scale));
    margin-bottom: calc(20px * var(--ui-scale));
}

.pause-menu-content .modal-header h2 {
    margin: 0;
    color: #FFD700;
    font-size: calc(1.8rem * var(--ui-scale));
    text-shadow: 0 0 calc(12px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
}

.pause-menu-body {
    display: grid;
    grid-template-columns: 2fr auto 2fr;
    gap: 30px;
    align-items: start;
}

.pause-menu-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
    grid-column: 2;
    justify-self: center;
}

.pause-menu-right {
    display: flex;
    flex-direction: column;
    max-height: 65vh;
    overflow-y: auto;
    grid-column: 1;
    grid-row: 1;
}

.pause-stats-ticker {
    padding: calc(12px * var(--ui-scale));
    margin-bottom: calc(15px * var(--ui-scale));
    background: rgba(26, 26, 46, 0.6);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(8px * var(--ui-scale));
    text-align: center;
    font-size: calc(1.1rem * var(--ui-scale));
}

.pause-perks-section {
    border-top: none;
    padding-top: 0;
}

.pause-perks-section h3 {
    color: #FFD700;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

#pause-perks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Reuse inspect-perk-item styles for pause menu */
#pause-perks-list .inspect-perk-item {
    background: rgba(26, 26, 46, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    padding: 0.8rem;
    transition: all 0.2s ease;
}

#pause-perks-list .inspect-perk-item:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

/* Canvas */
#game-canvas {
    position: relative;
    z-index: 1;
    cursor: none;
    display: block;
    margin: 0 auto; /* Center horizontally */
    image-rendering: pixelated; /* Crisp pixel rendering */
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Custom Crosshair - Always on top (CS 1.6 style with gap in center) */
:root {
    --crosshair-color: #00FF00;
}

#custom-crosshair {
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Crosshair lines using SVG-like approach with box-shadow for outline */
#custom-crosshair::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    transform: translate(-50%, -50%);
    box-shadow:
        /* Top line - black outline (2px spread to be visible around colored lines) */
        0 -11px 0 2px #000,
        0 -10px 0 2px #000,
        0 -9px 0 2px #000,
        0 -8px 0 2px #000,
        0 -7px 0 2px #000,
        0 -6px 0 2px #000,
        0 -5px 0 2px #000,
        0 -4px 0 2px #000,
        /* Bottom line - black outline */
        0 11px 0 2px #000,
        0 10px 0 2px #000,
        0 9px 0 2px #000,
        0 8px 0 2px #000,
        0 7px 0 2px #000,
        0 6px 0 2px #000,
        0 5px 0 2px #000,
        0 4px 0 2px #000,
        /* Left line - black outline */
        -11px 0 0 2px #000,
        -10px 0 0 2px #000,
        -9px 0 0 2px #000,
        -8px 0 0 2px #000,
        -7px 0 0 2px #000,
        -6px 0 0 2px #000,
        -5px 0 0 2px #000,
        -4px 0 0 2px #000,
        /* Right line - black outline */
        11px 0 0 2px #000,
        10px 0 0 2px #000,
        9px 0 0 2px #000,
        8px 0 0 2px #000,
        7px 0 0 2px #000,
        6px 0 0 2px #000,
        5px 0 0 2px #000,
        4px 0 0 2px #000;
}

/* Hide black border when no-border class is applied */
#custom-crosshair.no-border::before {
    display: none;
}

/* Colored inner lines using CSS variable */
#custom-crosshair::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    transform: translate(-50%, -50%);
    background: var(--crosshair-color);
    box-shadow:
        /* Top line */
        0 -11px 0 1px var(--crosshair-color),
        0 -10px 0 1px var(--crosshair-color),
        0 -9px 0 1px var(--crosshair-color),
        0 -8px 0 1px var(--crosshair-color),
        0 -7px 0 1px var(--crosshair-color),
        0 -6px 0 1px var(--crosshair-color),
        0 -5px 0 1px var(--crosshair-color),
        0 -4px 0 1px var(--crosshair-color),
        /* Bottom line */
        0 11px 0 1px var(--crosshair-color),
        0 10px 0 1px var(--crosshair-color),
        0 9px 0 1px var(--crosshair-color),
        0 8px 0 1px var(--crosshair-color),
        0 7px 0 1px var(--crosshair-color),
        0 6px 0 1px var(--crosshair-color),
        0 5px 0 1px var(--crosshair-color),
        0 4px 0 1px var(--crosshair-color),
        /* Left line */
        -11px 0 0 1px var(--crosshair-color),
        -10px 0 0 1px var(--crosshair-color),
        -9px 0 0 1px var(--crosshair-color),
        -8px 0 0 1px var(--crosshair-color),
        -7px 0 0 1px var(--crosshair-color),
        -6px 0 0 1px var(--crosshair-color),
        -5px 0 0 1px var(--crosshair-color),
        -4px 0 0 1px var(--crosshair-color),
        /* Right line */
        11px 0 0 1px var(--crosshair-color),
        10px 0 0 1px var(--crosshair-color),
        9px 0 0 1px var(--crosshair-color),
        8px 0 0 1px var(--crosshair-color),
        7px 0 0 1px var(--crosshair-color),
        6px 0 0 1px var(--crosshair-color),
        5px 0 0 1px var(--crosshair-color),
        4px 0 0 1px var(--crosshair-color);
}

/* Action Bar (with integrated Exp Bar) */
#action-bar {
    position: fixed;
    bottom: 20px; /* Fixed position - always 20px from bottom */
    left: 50%;
    transform: translateX(-50%) scale(var(--ui-scale)); /* Scale with UI scale */
    transform-origin: center bottom; /* Scale from bottom center */
    display: flex;
    flex-direction: column; /* Stack exp bar on top, action slots below */
    gap: 0.4vw; /* No var(--ui-scale) - handled by transform scale */
    padding: 0.6vw; /* No var(--ui-scale) - handled by transform scale */
    background-image: url('../assets/ui/Actionbar/fg4_borders_01_07_result.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    z-index: 1000;
}

/* Experience Bar inside Action Bar */
#exp-bar-wrapper {
    display: flex;
    align-items: center;
    gap: calc(0.5vw * var(--ui-scale));
    width: 100%; /* Full width of action bar */
}

#exp-bar-wrapper .bar {
    flex: 1;
    max-width: none;
    min-height: 22px;
}

#exp-bar-wrapper .bar-label {
    font-size: calc(0.7rem * var(--ui-scale));
    white-space: nowrap;
}

#exp-bar-wrapper .bar-text {
    font-size: calc(0.65rem * var(--ui-scale));
    line-height: 22px;
}

#exp-bar-wrapper .bar-progress-text {
    font-size: calc(0.55rem * var(--ui-scale));
}

/* Action Slots Row */
.action-slots-row {
    display: flex;
    gap: calc(0.45vw * var(--ui-scale));
    justify-content: center;
}

.action-slot {
    position: relative;
    width: calc(3.5vw * var(--ui-scale)); /* 50% smaller */
    height: calc(3.5vw * var(--ui-scale)); /* 50% smaller */
    background-image: url('../assets/ui/Actionbar/fg4_slotBrown_result.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    cursor: pointer;
    transition: transform 0.1s ease;
    border-radius: calc(8px * var(--ui-scale));
}

.action-slot:hover {
    transform: scale(1.05);
}

.action-icon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: 70% 70%;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
}

.ulti-icon-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    object-fit: contain;
    pointer-events: none;
}

.action-cooldown {
    position: absolute;
    bottom: calc(14px * var(--ui-scale));
    left: calc(14px * var(--ui-scale));
    right: calc(14px * var(--ui-scale));
    height: 0%;
    max-height: calc(68px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.7);
    transition: height 0.1s linear;
    pointer-events: none;
    border-radius: calc(4px * var(--ui-scale));
}

.action-keybind {
    position: absolute;
    bottom: calc(3px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(15px * var(--ui-scale));
    color: #FFD700;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8),
                 1px 1px 2px rgba(0, 0, 0, 1);
    font-weight: bold;
    pointer-events: none;
    z-index: 3;
}

.action-timer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(27px * var(--ui-scale));
    color: #FFFFFF;
    text-shadow: 0 0 6px rgba(0, 0, 0, 1),
                 2px 2px 4px rgba(0, 0, 0, 1);
    font-weight: bold;
    display: none;
    pointer-events: none;
    z-index: 3;
}

.action-slot.on-cooldown .action-timer {
    display: block;
}

.action-slot.ready {
    animation: pulse-ready 1.5s ease-in-out infinite;
}

@keyframes pulse-ready {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

/* Action Bar Tooltips */
.action-slot[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 110%;
    transform: translateX(-50%);
    padding: calc(10px * var(--ui-scale)) calc(15px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.98);
    color: #FFD700;
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(8px * var(--ui-scale));
    font-size: calc(14px * var(--ui-scale));
    white-space: normal;
    text-align: center;
    z-index: 100000;
    pointer-events: none;
    max-width: calc(300px * var(--ui-scale));
    min-width: calc(200px * var(--ui-scale));
    line-height: 1.4;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

/* Stats Panel */
#stats-panel {
    width: 250px;
    min-width: 250px;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    border-left: none;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: visible;
    max-height: calc(100vh - 80px);
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 100000;
    transition: transform 0.3s ease-out;
    transform: scale(var(--ui-scale));
    transform-origin: top right;
}

#stats-panel.collapsed {
    transform: scale(var(--ui-scale)) translateX(200px);
}

#player-hero-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #4a4a6e;
}

.ingame-hero-portrait {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #ffa500;
    margin-bottom: 0.4rem;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
    display: none;
}

.ingame-hero-portrait[src]:not([src=""]) {
    display: block;
}

#stats-panel h3 {
    color: #FFD700;
    text-align: center;
    margin: 0;
    font-size: 1.5rem;
    text-shadow: 0 0 15px #FFD700;
}

.highscore-explanation {
    color: #aaa;
    font-size: 0.65rem;
    text-align: center;
    margin: 0.5rem 0;
    line-height: 1.4;
    padding: 0 0.5rem;
}

#stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-right: 0.5rem;
    overflow: visible;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4a4a6e;
    border-radius: 4px;
    align-items: center;
    position: relative;
    cursor: help;
    transition: all 0.2s ease;
}

.stat-row:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: rgba(255, 165, 0, 0.5);
}

.stat-row[data-tooltip] {
    position: relative;
}

.stat-row[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: fixed;
    right: calc(250px + 15px);
    top: var(--tooltip-top, 50%);
    transform: translateY(-50%);
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.98);
    color: #FFD700;
    border: 3px solid #FFD700;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: pre-line;
    text-align: center;
    z-index: 99999;
    pointer-events: none;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4);
    line-height: 1.4;
    font-weight: bold;
    animation: tooltipSlideLeft 0.2s ease-out;
    width: 250px;
}


@keyframes tooltipSlideLeft {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}


.stat-label {
    color: #b0b0b0;
    font-size: calc(1.07rem * var(--ui-scale));
}

.stat-label[title] {
    cursor: help;
    text-decoration: underline dotted;
}

.stat-value {
    color: #FFD700;
    font-weight: bold;
    font-size: calc(1.15rem * var(--ui-scale));
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.5);
    letter-spacing: calc(0.05rem * var(--ui-scale));
}

.stat-extra {
    color: #FFD700;
    font-size: calc(0.85rem * var(--ui-scale));
    margin-left: calc(0.4rem * var(--ui-scale));
    text-shadow: 0 0 calc(5px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
}

.stat-cap {
    color: #888;
    font-size: calc(0.85rem * var(--ui-scale));
    margin-left: calc(0.3rem * var(--ui-scale));
}

.stat-category {
    color: #FFD700;
    font-weight: bold;
    font-size: calc(1.07rem * var(--ui-scale));
    margin-top: calc(0.8rem * var(--ui-scale));
    margin-bottom: calc(0.4rem * var(--ui-scale));
    padding: calc(0.4rem * var(--ui-scale)) calc(0.5rem * var(--ui-scale));
    border-bottom: calc(2px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    text-align: center;
    letter-spacing: calc(0.05rem * var(--ui-scale));
    text-shadow: 0 0 calc(10px * var(--ui-scale)) #FFD700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.stat-category:hover {
    background: rgba(255, 215, 0, 0.1);
}

.category-toggle {
    background: none;
    border: none;
    color: #FFD700;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s;
}

.stat-category.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.stat-category-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.stat-category-content.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 25vh; /* Moved down to avoid overlapping with boss portrait */
    padding-bottom: 5vh;
    z-index: 100;
    pointer-events: none;
    overflow-y: auto; /* Allow scrolling if content is too tall */
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(3px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(2rem * var(--ui-scale));
    max-width: calc(600px * var(--ui-scale));
    width: 90vw;
    box-shadow: 0 0 calc(50px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
    pointer-events: auto;
    position: relative;
    max-height: 70vh;
    overflow-y: auto;
}

/* Mobile optimizations for modals */
@media (max-width: 768px) {
    .modal {
        padding-top: 10vh; /* Less top padding on mobile */
        padding-bottom: 2vh;
    }

    .modal-content {
        width: 95vw;
        max-height: 85vh;
        padding: calc(1rem * var(--ui-scale));
    }
}

@media (max-width: 480px) {
    .modal {
        padding-top: 5vh; /* Even less on small phones */
    }

    .modal-content {
        width: 98vw;
        max-height: 90vh;
    }
}

.audio-setting {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: 0.8rem;
}

.audio-setting label {
    min-width: 120px;
    color: #d0d0d0;
}

.audio-setting .volume-slider {
    flex: 1;
    width: auto;
}

.audio-setting span {
    min-width: 50px;
    text-align: right;
    color: #ffa500;
    font-weight: bold;
}

.ui-scale-setting {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: 0.8rem;
    justify-content: center;
}

.ui-scale-setting label {
    min-width: 120px;
    color: #d0d0d0;
}

.ui-scale-setting span {
    min-width: 30px;
    text-align: left;
    color: #ffa500;
    font-weight: bold;
}

.settings-info {
    color: #aaa;
    font-size: 0.65rem;
    text-align: center;
    margin: 0.5rem 0 1rem 0;
    font-style: italic;
}

/* Crosshair Settings */
.crosshair-setting {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: 0.8rem;
    justify-content: center;
}

.crosshair-setting label {
    min-width: 120px;
    color: #d0d0d0;
}

.crosshair-slider {
    flex: 1;
    max-width: 200px;
}

.crosshair-setting span {
    min-width: 50px;
    text-align: right;
    color: #ffa500;
    font-weight: bold;
}

.crosshair-color-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex: 1;
}

.crosshair-color-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.crosshair-color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.crosshair-color-btn.active {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    border-width: 3px !important;
}

.crosshair-border-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #ffa500;
}

.crosshair-reset-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4a4a6e 0%, #3a3a5e 100%);
    border: 2px solid #6a6a8e;
    color: #fff;
    font-size: 0.8rem;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.crosshair-reset-btn:hover {
    background: linear-gradient(135deg, #5a5a7e 0%, #4a4a6e 100%);
    border-color: #7a7a9e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.crosshair-reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.default-btn {
    background: linear-gradient(135deg, #4a4a6e 0%, #3a3a5e 100%);
    border: calc(2px * var(--ui-scale)) solid #6a6a8e;
    color: #fff;
    padding: calc(0.4rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    font-size: calc(0.55rem * var(--ui-scale));
    cursor: pointer;
    border-radius: calc(4px * var(--ui-scale));
    font-weight: bold;
    transition: all 0.3s ease;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    white-space: nowrap;
}

.default-btn:hover {
    background: linear-gradient(135deg, #5a5a7e 0%, #4a4a6e 100%);
    border-color: #ffa500;
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 165, 0, 0.4);
    transform: translateY(calc(-2px * var(--ui-scale)));
}

.default-btn:active {
    transform: translateY(0);
}

/* Removed dimming overlay - user requested no dimming */

.modal-content h2 {
    color: #ffa500;
    text-align: center;
    margin-bottom: calc(2rem * var(--ui-scale));
    font-size: calc(2rem * var(--ui-scale));
    text-shadow: 0 0 calc(10px * var(--ui-scale)) #ffa500;
}

.menu-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #ff3535 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    color: #fff;
    padding: calc(0.8rem * var(--ui-scale)) calc(2rem * var(--ui-scale));
    font-size: calc(1.1rem * var(--ui-scale));
    cursor: pointer;
    border-radius: calc(4px * var(--ui-scale));
    font-weight: bold;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: calc(1rem * var(--ui-scale));
}

.menu-btn:hover {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
    transform: translateY(-2px);
}

.menu-btn.secondary {
    background: linear-gradient(135deg, #4a4a6e 0%, #2a2a3e 100%);
}

/* Bug Icon */
.bug-icon {
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: middle;
    margin-left: 0.3rem;
    display: inline-block;
}

.bug-icon-large {
    width: 4rem;
    height: 4rem;
    vertical-align: middle;
    margin-right: 0.5rem;
    display: inline-block;
}

/* Perk Selection */
.perk-modal {
    max-width: calc(900px * var(--ui-scale));
    width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    pointer-events: auto; /* Ensure modal content is clickable */
    touch-action: pan-y; /* Allow vertical scrolling but prevent other gestures */
}

/* Mobile-specific perk modal adjustments */
@media (max-width: 768px) {
    .perk-modal {
        max-width: 95vw;
        max-height: 90vh;
        padding-top: 2vh;
        padding-bottom: 2vh;
    }
}

@media (max-width: 480px) {
    .perk-modal {
        max-width: 98vw;
        max-height: 92vh;
        padding-top: 1vh;
        padding-bottom: 1vh;
    }
}

/* Ultimate Selection Back Button */
.ulti-back-button {
    display: block;
    margin: calc(1rem * var(--ui-scale)) auto 0 auto;
    width: calc(200px * var(--ui-scale));
    text-align: center;
}

@media (max-width: 480px) {
    .ulti-back-button {
        width: calc(180px * var(--ui-scale));
    }
}

.perk-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(1rem * var(--ui-scale));
}

/* Responsive perk grid */
@media (max-width: 768px) {
    .perk-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .perk-grid {
        grid-template-columns: 1fr;
    }
}

/* Warrior ultimate selection - 2 columns */
.perk-grid.warrior-ultimate {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 480px) {
    .perk-grid.warrior-ultimate {
        grid-template-columns: 1fr;
    }
}

.perk-card {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(3px * var(--ui-scale)) solid #4a4a6e;
    padding: calc(1.5rem * var(--ui-scale));
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: calc(8px * var(--ui-scale));
    position: relative;
    text-align: center; /* ensure symmetric headings */
}

/* Header wrapper to enforce identical height across cards */
.perk-header {
    min-height: calc(4.2rem * var(--ui-scale)); /* more headroom to normalize different title line-breaks */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(0.25rem * var(--ui-scale));
}

/* Mobile optimizations for perk cards */
@media (max-width: 768px) {
    .perk-card {
        padding: calc(1rem * var(--ui-scale));
    }

    .perk-header {
        min-height: calc(3.5rem * var(--ui-scale));
    }
}

@media (max-width: 480px) {
    .perk-card {
        padding: calc(0.8rem * var(--ui-scale));
    }

    .perk-header {
        min-height: calc(3rem * var(--ui-scale));
    }
}

.perk-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(255, 165, 0, 0.5);
}

/* Active state for mobile touch */
.perk-card:active {
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(255, 165, 0, 0.6);
}

/* Ensure perk cards are tappable on mobile */
@media (max-width: 768px) {
    .perk-card {
        -webkit-tap-highlight-color: rgba(255, 165, 0, 0.3);
        touch-action: manipulation;
    }
}

.category-card {
    min-height: calc(120px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* align content from top for symmetric headers */
    align-items: center;
    gap: calc(0.25rem * var(--ui-scale)); /* consistent spacing between icon, title, description */
}

/* Mobile optimizations for category cards */
@media (max-width: 768px) {
    .category-card {
        min-height: calc(100px * var(--ui-scale));
    }
}

@media (max-width: 480px) {
    .category-card {
        min-height: calc(80px * var(--ui-scale));
    }
}

.perk-card.normal {
    border-color: #4a4a6e;
}

.perk-card.rare {
    border-color: #3B82F6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.perk-card.epic {
    border-color: #9333EA;
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.5);
}

.perk-card.legendary {
    border-color: #FF8C00;
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.6);
}

.perk-rarity {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

.perk-rarity.normal {
    background: rgba(74, 74, 110, 0.8);
    color: #d0d0d0;
}

.perk-rarity.rare {
    background: #3B82F6;
    color: #fff;
}

.perk-rarity.epic {
    background: #9333EA;
    color: #fff;
}

.perk-rarity.legendary {
    background: #FF8C00;
    color: #fff;
}

.reroll-button {
    background: linear-gradient(135deg, #4a4a6e 0%, #2a2a3e 100%);
    color: #FFD700;
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    padding: calc(0.8rem * var(--ui-scale)) calc(1.5rem * var(--ui-scale));
    font-size: calc(1rem * var(--ui-scale));
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    border-radius: calc(8px * var(--ui-scale));
    margin-bottom: calc(1.5rem * var(--ui-scale));
    transition: all 0.3s ease;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
}

.reroll-button:hover {
    background: linear-gradient(135deg, #5a5a7e 0%, #3a3a4e 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.reroll-button:active {
    transform: scale(0.95);
}

.perk-name {
    color: #FFD700;
    font-size: calc(1.2rem * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(0.5rem * var(--ui-scale));
    line-height: 1.25;
    display: block;
    text-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
}

/* Ultimate icon above title */
.perk-icon {
    display: block;
    font-size: calc(1.6rem * var(--ui-scale));
    line-height: 1;
    margin-bottom: calc(0.35rem * var(--ui-scale));
}

/* Class-specific perk name colors - for perk selection modal */
.perk-name.hero-specific-warrior {
    color: #FF4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.6);
}

.perk-name.hero-specific-priest {
    color: #FFFFFF;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.perk-name.hero-specific-wizard {
    color: #0099DD;
    text-shadow: 0 0 10px rgba(0, 153, 221, 0.6);
}

.perk-name.hero-specific-jester {
    color: #00FF88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

.perk-name.hero-specific-templar {
    color: #888888;
    text-shadow: 0 0 10px rgba(136, 136, 136, 0.6);
}

.perk-name.hero-specific-pirate {
    color: #D4AF37;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

.perk-description {
    color: #b0b0b0;
    font-size: calc(0.9rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
}

.perk-value {
    color: #4ade80;
    font-weight: bold;
    font-size: calc(1.1rem * var(--ui-scale));
}

/* Perk Keybind Display - Box overlapping border */
.perk-keybind {
    position: absolute;
    bottom: calc(-12px * var(--ui-scale)); /* Overlap the bottom border - half outside */
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(16px * var(--ui-scale));
    color: #FFD700;
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(4px * var(--ui-scale)) calc(10px * var(--ui-scale));
    font-weight: bold;
    pointer-events: none;
    z-index: 15;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.5),
                0 calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

/* Admin Button */
.admin-btn {
    background: transparent;
    border: 2px solid #4a4a6e;
    color: #ffa500;
    font-size: 1.2rem;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

.admin-btn:hover {
    border-color: #ffa500;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
    transform: scale(1.1);
}

/* Admin Modal */
#admin-modal input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    margin: 1rem 0;
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #4a4a6e;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    border-radius: 4px;
}

#admin-modal input[type="password"]:focus {
    outline: none;
    border-color: #ffa500;
}

#admin-modal .menu-btn {
    margin: 0.5rem;
}

/* Dev Console */
#dev-console {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #4a4a6e;
    border-radius: 8px;
    padding: 0.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    max-height: 200px;
    cursor: move;
}

#dev-console-header {
    background: rgba(74, 74, 110, 0.5);
    padding: 0.3rem 0.5rem;
    margin: -0.5rem -0.5rem 0.5rem -0.5rem;
    border-radius: 6px 6px 0 0;
    cursor: move;
    user-select: none;
    font-size: 0.8rem;
    color: #ffa500;
    font-weight: bold;
    text-align: center;
}

#dev-console.hidden {
    display: none;
}

#dev-console-output {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #00ff00;
    min-height: 60px;
    max-height: 140px;
}

#dev-console-output div {
    margin: 2px 0;
    padding: 2px 4px;
    border-bottom: 1px solid rgba(74, 74, 110, 0.3);
}

#dev-console-output div.error {
    color: #ff6b6b;
}

#dev-console-output div.success {
    color: #4CAF50;
}

#dev-console-output div.info {
    color: #ffaa00;
}

#dev-console-input {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid #4a4a6e;
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

#dev-console-input:focus {
    outline: none;
    border-color: #ffa500;
}

/* Game Over */
#game-over {
    padding-top: 30vh; /* Move modal down to avoid overlapping boss HP bar */
}

#final-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

#final-stats p {
    margin: 0.5rem 0;
    color: #d0d0d0;
    font-size: 1.1rem;
}

#final-stats span {
    color: #ffa500;
    font-weight: bold;
}

.highscore-message {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin: 1rem 0;
    padding: 0.5rem;
}

#highscore-entry {
    margin: 1.5rem 0;
}

#highscore-entry h3 {
    color: #ffa500;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

#player-name-input {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    background: #1a1a1a;
    border: 2px solid #4a4a6e;
    color: #d0d0d0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

#player-name-input:focus {
    outline: none;
    border-color: #ffa500;
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.3);
}

/* Notification System */
#notification-container {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.notification {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 3px solid #ffa500;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 165, 0, 0.8);
    animation: notificationSlide 0.5s ease-out;
    pointer-events: auto;
}

.notification.boss-warning {
    border-color: #9333EA;
    background: linear-gradient(135deg, #3a1a5e 0%, #2a1a3e 100%);
    box-shadow: 0 0 40px rgba(147, 51, 234, 0.8);
    font-size: 2rem;
    text-shadow: 0 0 10px #9333EA;
}

.notification.fade-out {
    animation: notificationFadeOut 0.5s ease-out forwards;
}

@keyframes notificationSlide {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notificationFadeOut {
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #4a4a6e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffa500;
}

/* Mobile Controls */
#mobile-controls {
    position: fixed;
    bottom: calc(30px * var(--ui-scale));
    left: 0;
    right: 0;
    z-index: 500;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: calc(20px * var(--ui-scale));
}

#mobile-controls.hidden {
    display: none;
}

#mobile-controls > * {
    pointer-events: auto;
}

.mobile-ulti-btn {
    width: calc(80px * var(--ui-scale));
    height: calc(80px * var(--ui-scale));
    border-radius: 50%;
    background: linear-gradient(135deg, #9333EA 0%, #C084FC 100%);
    border: calc(4px * var(--ui-scale)) solid #FFD700;
    color: #FFD700;
    font-size: calc(2.5rem * var(--ui-scale));
    cursor: pointer;
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(147, 51, 234, 0.8);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
}

.mobile-ulti-btn:active {
    transform: scale(0.9);
    box-shadow: 0 0 30px rgba(147, 51, 234, 1);
}

.mobile-ulti-btn.ready {
    animation: ulti-ready-pulse 1s ease-in-out infinite;
}

.mobile-ulti-btn.cooldown {
    background: linear-gradient(135deg, #4a4a6e 0%, #2a2a3e 100%);
    border-color: #666;
    color: #666;
    box-shadow: none;
}

#mobile-joystick {
    position: relative;
    width: calc(140px * var(--ui-scale));
    height: calc(140px * var(--ui-scale));
}

#joystick-base {
    position: absolute;
    width: calc(140px * var(--ui-scale));
    height: calc(140px * var(--ui-scale));
    border-radius: 50%;
    background: rgba(74, 74, 110, 0.3);
    border: calc(3px * var(--ui-scale)) solid rgba(74, 74, 110, 0.6);
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(74, 74, 110, 0.4);
}

#joystick-stick {
    position: absolute;
    width: calc(60px * var(--ui-scale));
    height: calc(60px * var(--ui-scale));
    border-radius: 50%;
    background: linear-gradient(135deg, #ffa500 0%, #ff6b35 100%);
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 165, 0, 0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease-out;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    /* Hide panels completely on mobile - they're in the way */
    #highscore-panel,
    #stats-panel {
        display: none !important;
    }

    #game-canvas {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    #main-game {
        flex-direction: column;
    }

    #game-canvas {
        width: 100% !important;
        height: calc(100vh - 50px) !important;
        border: none;
    }

    #top-bar {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
        height: 50px;
        font-size: 0.6rem;
        gap: 0.3rem;
        justify-content: space-between;
    }

    .bar-container {
        gap: 0.3rem;
    }

    .bar-container {
        flex-direction: column;
        gap: 0.2rem;
        flex: 0 1 auto;
    }

    .bar {
        max-width: 100px;
        height: 20px;
    }

    .bar-label {
        font-size: 0.5rem;
        min-width: auto;
    }

    .bar-text {
        font-size: 0.55rem;
        line-height: 20px;
    }

    .bar-progress-text {
        font-size: 0.5rem;
    }

    .ulti-bar-wrapper {
        margin-top: 0;
    }

    .ulti-bar {
        height: 15px;
    }

    .bar-text-small {
        font-size: 0.5rem;
        line-height: 15px;
    }

    .bar-label-small {
        font-size: 0.45rem;
    }

    .ulti-hint {
        display: none;
    }

    .difficulty-display,
    .time-display {
        font-size: 0.55rem;
        min-width: 60px;
        display: none; /* Hide on mobile to save space */
    }

    .suicide-btn,
    .admin-btn {
        display: none; /* Hide non-essential buttons on mobile */
    }

    .mute-btn {
        font-size: 0.8rem;
        width: 30px;
        height: 30px;
        padding: 0.2rem;
    }

    #start-highscore-panel {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #4a4a6e;
        max-height: 30vh;
    }

    #hero-selection {
        flex-direction: column;
    }

    #start-main-content {
        padding: 1rem 0.5rem;
    }

    .start-top-controls {
        flex-direction: column;
        left: 0.5rem;
        right: 0.5rem;
        top: 0.5rem;
    }

    .ui-scale-control {
        margin: 0.8rem auto;
        padding: 0.6rem 0.8rem;
        width: fit-content;
    }

    .ui-scale-control label {
        font-size: 0.5rem;
    }

    .ui-scale-input {
        width: 60px;
        padding: 0.4rem;
        font-size: 0.6rem;
    }

    .ui-scale-control span {
        font-size: 0.5rem;
    }

    #game-statistics-panel {
        min-width: auto;
        width: 100%;
        padding: 0.5rem;
    }

    #game-statistics-panel h3 {
        font-size: 0.6rem;
        margin-bottom: 0.5rem;
    }

    .stat-label-main {
        font-size: 0.45rem;
    }

    .stat-value-main {
        font-size: 0.6rem;
    }

    .hero-stat-name {
        font-size: 0.63rem;
    }

    .hero-stat-count {
        font-size: 0.7rem;
    }

    .start-audio-controls {
        width: 100%;
        padding: 0.5rem;
    }

    .start-audio-controls .audio-setting label {
        font-size: 0.5rem;
        min-width: 40px;
    }

    .start-audio-controls .audio-setting .volume-slider {
        width: 80px;
    }

    .start-audio-controls .audio-setting span {
        font-size: 0.5rem;
        min-width: 30px;
    }

    .general-perks-button {
        font-size: 0.7rem;
        padding: 0.5rem 0.8rem;
    }

    .general-perks-content {
        max-width: 95vw;
        width: 95vw;
        padding: 1rem;
        max-height: 90vh;
    }

    .general-perks-content h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .general-perks-close {
        font-size: 1.2rem;
        width: 35px;
        height: 35px;
    }

    .general-perk-category h3 {
        font-size: 0.9rem;
    }

    .general-perk-items {
        grid-template-columns: 1fr;
    }

    .general-perk-item .perk-name {
        font-size: 0.75rem;
    }

    .general-perk-item .perk-desc {
        font-size: 0.6rem;
    }

    .general-perk-item .perk-values {
        font-size: 0.55rem;
    }

    .hero-perks-section {
        padding: 0.5rem;
    }


    .game-title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .controls-info {
        display: none;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    #start-highscore-panel {
        display: none !important; /* Hide highscore on mobile start screen */
    }

    #start-main-content {
        width: 100%;
    }

    #game-statistics-panel {
        display: none !important; /* Hide stats on mobile start screen */
    }

    .start-audio-controls {
        max-width: 300px;
        margin: 0 auto;
    }

    .menu-mute-btn {
        top: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .modal-content {
        max-width: 90vw;
        padding: 1rem;
    }

    .modal-content h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .perk-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .perk-card {
        padding: 1rem;
    }

    .perk-name {
        font-size: 1rem;
    }

    .perk-description {
        font-size: 0.75rem;
    }

    .menu-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    #highscore-panel,
    #stats-panel {
        width: 200px;
    }

    #highscore-panel h3,
    #stats-panel h3 {
        font-size: 1.3rem;
    }

    #top-bar {
        padding-left: 220px;
        gap: 1rem;
    }

    .bar {
        max-width: 200px;
    }
}

/* Small screens / landscape phones */
@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .game-title {
        font-size: 1.2rem;
    }

    .version-text {
        font-size: 0.7rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* Hero card sizes now handled by var(--ui-scale) */

    .class-ultimate {
        font-size: calc(0.7rem * var(--ui-scale));
    }

    #mobile-joystick {
        width: 100px;
        height: 100px;
    }

    #joystick-base {
        width: 100px;
        height: 100px;
    }

    #joystick-stick {
        width: 40px;
        height: 40px;
    }

    #top-bar {
        height: 50px;
    }

    #game-canvas {
        height: calc(100vh - 50px) !important;
    }

    .bar {
        max-width: 100px;
        height: 20px;
    }

    .bar-text {
        font-size: 0.55rem;
        line-height: 20px;
    }

    .ulti-bar {
        height: 15px;
    }

    .bar-text-small {
        font-size: 0.5rem;
        line-height: 15px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .game-title {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .bar-label {
        font-size: 0.5rem;
        min-width: 25px;
    }

    .difficulty-display,
    .time-display {
        font-size: 0.55rem;
        min-width: 60px;
    }

    .suicide-btn,
    .admin-btn {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }

    #mobile-joystick {
        width: 80px;
        height: 80px;
    }

    #joystick-base {
        width: 80px;
        height: 80px;
    }

    #joystick-stick {
        width: 35px;
        height: 35px;
    }
}


/* Highscore Inspection Modal */
.highscore-inspect-content {
    max-width: 1300px;
    max-height: 90vh;
    overflow-y: auto;
}

.highscore-inspect-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #4a4a6e;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.highscore-inspect-content .modal-header h2 {
    margin: 0;
    color: #FFD700;
}

.inspect-body {
    padding: 10px 0;
}

.inspect-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(74, 74, 110, 0.3);
    border-radius: 5px;
}

.inspect-stat {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 5px 0;
}

.inspect-stat .stat-label {
    color: #888;
    font-weight: bold;
}

.inspect-stats-section,
.inspect-perks-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(74, 74, 110, 0.2);
    border-radius: 5px;
}

.inspect-stats-section h3,
.inspect-perks-section h3 {
    margin-top: 0;
    color: #FFD700;
    border-bottom: 1px solid #4a4a6e;
    padding-bottom: 5px;
}

.inspect-combat-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#inspect-perks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.inspect-perk-item {
    background: rgba(26, 26, 46, 0.8);
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #4a4a6e;
}

.inspect-perk-item.rarity-rare {
    border-left-color: #3B82F6;
}

.inspect-perk-item.rarity-epic {
    border-left-color: #9333EA;
}

.inspect-perk-item.rarity-legendary {
    border-left-color: #FF8C00;
}

.inspect-perk-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.inspect-perk-value {
    color: #00FF88;
    font-size: 0.9em;
}

.highscore-entry {
    cursor: pointer;
    transition: background-color 0.2s;
}

.highscore-entry:hover {
    background-color: rgba(74, 74, 110, 0.3);
}

/* Patch Selector Dropdown */
.patch-selector {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    background: rgba(26, 26, 46, 0.9);
    color: #FFFFFF;
    border: 2px solid #4a4a6e;
    border-radius: 5px;
    font-family: "Courier New", monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.patch-selector:hover {
    border-color: #00FF88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.patch-selector:focus {
    outline: none;
    border-color: #00FF88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.patch-selector option {
    background: #1a1a2e;
    color: #FFFFFF;
}

/* Improved Close Button for Highscore Inspect Modal */
.inspect-close-btn {
    background: rgba(255, 68, 68, 0.2);
    border: 2px solid #FF4444;
    color: #FF4444;
    font-size: 28px;
    font-weight: bold;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.inspect-close-btn:hover {
    background: rgba(255, 68, 68, 0.4);
    border-color: #FF6666;
    color: #FF6666;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
    transform: rotate(90deg) scale(1.1);
}

.inspect-close-btn:active {
    transform: rotate(90deg) scale(0.95);
}

/* Modal backdrop for click-to-close */
#highscore-inspect-modal:not(.hidden) {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3vh;
    z-index: 10000;
    pointer-events: auto;
}

#highscore-inspect-modal.hidden {
    display: none !important;
}

/* Modal content should not close on click */
.highscore-inspect-content {
    pointer-events: auto;
    position: relative;
    z-index: 10001;
}

/* ====================================
   BUG REPORT SYSTEM
   ==================================== */

/* Bug Report Button - Bottom Right Corner */
.bug-report-btn {
    position: fixed;
    bottom: calc(20px * var(--ui-scale));
    right: calc(20px * var(--ui-scale));
    width: calc(50px * var(--ui-scale));
    height: calc(50px * var(--ui-scale));
    border-radius: 50%;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border: calc(2px * var(--ui-scale)) solid #D2691E;
    color: #fff;
    font-size: calc(24px * var(--ui-scale));
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bug-report-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.7);
    background: linear-gradient(135deg, #A0522D, #CD853F);
}

.bug-report-btn:active {
    transform: scale(0.95);
}

/* Bug Report Modal Form Styling */
.bug-report-form {
    display: flex;
    flex-direction: column;
    gap: calc(15px * var(--ui-scale));
    width: 100%;
}

.bug-report-form label {
    font-size: calc(12px * var(--ui-scale));
    color: #FFD700;
    margin-bottom: calc(-10px * var(--ui-scale));
}

.bug-report-form textarea {
    width: 100%;
    padding: calc(10px * var(--ui-scale));
    background: #1a1a1a;
    border: calc(2px * var(--ui-scale)) solid #444;
    color: #d0d0d0;
    font-family: 'Press Start 2P', monospace;
    font-size: calc(10px * var(--ui-scale));
    resize: vertical;
    min-height: calc(100px * var(--ui-scale));
    line-height: 1.5;
}

.bug-report-form input[type="text"] {
    width: 100%;
    padding: calc(10px * var(--ui-scale));
    background: #1a1a1a;
    border: calc(2px * var(--ui-scale)) solid #444;
    color: #d0d0d0;
    font-family: 'Press Start 2P', monospace;
    font-size: calc(10px * var(--ui-scale));
}

.bug-report-form textarea:focus,
.bug-report-form input[type="text"]:focus {
    outline: none;
    border-color: #FFD700;
}

.bug-report-actions {
    display: flex;
    gap: calc(10px * var(--ui-scale));
    margin-top: calc(10px * var(--ui-scale));
}

.bug-report-actions .menu-btn {
    flex: 1;
}

/* ========================================
   TOWN PORTAL MODAL STYLES
   ======================================== */

#town-portal-modal {
    cursor: default;
    pointer-events: none !important; /* Allow clicks to pass through to inventory below */
}

#town-portal-modal * {
    cursor: default;
    pointer-events: none; /* Disable by default, re-enable for content */
}

#town-portal-modal button {
    cursor: pointer !important;
    pointer-events: auto; /* Re-enable for buttons */
}

.town-portal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: calc(4px * var(--ui-scale)) solid #9333EA;
    border-radius: calc(16px * var(--ui-scale));
    padding: calc(30px * var(--ui-scale));
    max-width: calc(600px * var(--ui-scale));
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 calc(30px * var(--ui-scale)) rgba(147, 51, 234, 0.5),
                0 0 calc(60px * var(--ui-scale)) rgba(147, 51, 234, 0.3);
    animation: portalFadeIn 0.4s ease-out;
    position: relative;
    z-index: 10001;
    cursor: default;
    pointer-events: auto; /* Re-enable for modal content */
}

@keyframes portalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.town-portal-body {
    display: flex;
    flex-direction: column;
    gap: calc(20px * var(--ui-scale));
}

.town-portal-message {
    font-size: calc(18px * var(--ui-scale));
    color: #FFD700;
    text-align: center;
    font-weight: bold;
    margin: 0;
}

.town-portal-message span {
    color: #9333EA;
}

.town-portal-description {
    font-size: calc(14px * var(--ui-scale));
    color: #CCCCCC;
    text-align: center;
    line-height: 1.6;
    margin: 0;
}

/* Portal Stats Display */
.town-portal-stats {
    display: flex;
    justify-content: space-around;
    gap: calc(15px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.3);
    border-radius: calc(12px * var(--ui-scale));
    border: calc(2px * var(--ui-scale)) solid rgba(147, 51, 234, 0.3);
}

.portal-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(8px * var(--ui-scale));
}

.portal-stat-label {
    font-size: calc(12px * var(--ui-scale));
    color: #888888;
    text-transform: uppercase;
}

.portal-stat-value {
    font-size: calc(18px * var(--ui-scale));
    color: #FFFFFF;
    font-weight: bold;
}

/* Portal Action Buttons */
.town-portal-actions {
    display: flex;
    gap: calc(20px * var(--ui-scale));
    margin-top: calc(10px * var(--ui-scale));
}

.town-portal-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(10px * var(--ui-scale));
    padding: calc(25px * var(--ui-scale)) calc(20px * var(--ui-scale));
    border: calc(3px * var(--ui-scale)) solid transparent;
    border-radius: calc(12px * var(--ui-scale));
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Press Start 2P', monospace;
    position: relative;
    overflow: visible; /* Changed from hidden to visible so keyboard numbers show */
}

.town-portal-btn .btn-icon {
    font-size: calc(36px * var(--ui-scale));
}

.town-portal-btn .btn-text {
    font-size: calc(14px * var(--ui-scale));
    font-weight: bold;
    text-align: center;
}

.town-portal-btn .btn-desc {
    font-size: calc(10px * var(--ui-scale));
    color: #AAAAAA;
    text-align: center;
    line-height: 1.4;
}

/* Keyboard number indicators - matching perk selector style */
.town-portal-btn::before {
    content: attr(data-key);
    position: absolute;
    bottom: calc(-12px * var(--ui-scale)); /* Overlap the bottom border - half outside */
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(16px * var(--ui-scale));
    color: #FFD700;
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(4px * var(--ui-scale)) calc(10px * var(--ui-scale));
    font-weight: bold;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Town Button (Return to Town) */
.town-btn {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.3) 100%);
    border-color: #22C55E;
    color: #FFFFFF;
}

.town-btn:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.4) 0%, rgba(22, 163, 74, 0.5) 100%);
    border-color: #4ADE80;
    transform: translateY(calc(-3px * var(--ui-scale)));
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(34, 197, 94, 0.6);
}

/* Continue Button (Keep Fighting) */
.continue-btn {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.3) 100%);
    border-color: #EF4444;
    color: #FFFFFF;
}

.continue-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(220, 38, 38, 0.5) 100%);
    border-color: #F87171;
    transform: translateY(calc(-3px * var(--ui-scale)));
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(239, 68, 68, 0.6);
}

/* Warning Message */
.town-portal-warning {
    font-size: calc(12px * var(--ui-scale));
    color: #FFA500;
    text-align: center;
    margin: calc(10px * var(--ui-scale)) 0 0 0;
    font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .town-portal-actions {
        flex-direction: column;
    }

    .town-portal-stats {
        flex-direction: column;
        gap: calc(10px * var(--ui-scale));
    }

    .town-portal-btn {
        width: 100%;
    }
}

.bug-report-status {
    text-align: center;
    font-size: calc(10px * var(--ui-scale));
    min-height: calc(20px * var(--ui-scale));
    margin-top: calc(-5px * var(--ui-scale));
}

.bug-report-status.success {
    color: #00FF00;
}

.bug-report-status.error {
    color: #FF4444;
}
/* ===================================
   Boss HP Bar System - Large and Prominent
   =================================== */

.boss-hp-bar {
    position: fixed;
    top: calc(80px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #2a0a0a 0%, #1a0505 100%);
    border-radius: calc(16px * var(--ui-scale));
    padding: calc(15px * var(--ui-scale)) calc(20px * var(--ui-scale));
    min-width: calc(700px * var(--ui-scale));
    max-width: calc(900px * var(--ui-scale));
    box-shadow:
        0 calc(8px * var(--ui-scale)) calc(30px * var(--ui-scale)) rgba(255, 0, 0, 0.7),
        inset 0 calc(2px * var(--ui-scale)) calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
    z-index: 9999;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
    animation: bossBarPulse 2s ease-in-out infinite;
}

@keyframes bossBarPulse {
    0%, 100% {
        box-shadow: 
            0 calc(4px * var(--ui-scale)) calc(15px * var(--ui-scale)) rgba(255, 0, 0, 0.5),
            inset 0 calc(2px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 
            0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(255, 0, 0, 0.8),
            inset 0 calc(2px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(255, 215, 0, 0.4);
    }
}

.boss-hp-bar.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-50px);
}

.boss-hp-portrait-container {
    width: calc(120px * var(--ui-scale));
    height: calc(120px * var(--ui-scale));
    border-radius: calc(12px * var(--ui-scale));
    overflow: hidden;
    box-shadow:
        0 0 calc(20px * var(--ui-scale)) rgba(255, 0, 0, 0.8),
        inset 0 0 calc(15px * var(--ui-scale)) rgba(255, 215, 0, 0.4);
    flex-shrink: 0;
    background: #000;
}

.boss-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.boss-hp-info {
    flex: 1;
    margin-left: calc(20px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--ui-scale));
}

.boss-name-container {
    display: flex;
    align-items: center;
    gap: calc(12px * var(--ui-scale));
}

.boss-crown {
    font-size: calc(32px * var(--ui-scale));
    filter: drop-shadow(0 0 calc(8px * var(--ui-scale)) #FFD700);
    animation: crownFloat 3s ease-in-out infinite;
}

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

.boss-name {
    font-size: calc(28px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
    text-shadow:
        calc(3px * var(--ui-scale)) calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
        0 0 calc(15px * var(--ui-scale)) rgba(255, 0, 0, 0.6);
    letter-spacing: calc(2px * var(--ui-scale));
    text-transform: uppercase;
}

.boss-number {
    font-size: calc(18px * var(--ui-scale));
    color: #FFD700;
    background: rgba(255, 0, 0, 0.3);
    padding: calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale));
    border-radius: calc(10px * var(--ui-scale));
    font-weight: bold;
}

.boss-hp-bar-container {
    position: relative;
    width: 100%;
}

.boss-hp-bar-bg {
    width: 100%;
    height: calc(40px * var(--ui-scale));
    background: linear-gradient(to bottom, #1a1a1a 0%, #0a0a0a 100%);
    border-radius: calc(20px * var(--ui-scale));
    border: calc(3px * var(--ui-scale)) solid #444;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 calc(3px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.9);
}

.boss-hp-fill {
    height: 100%;
    background: linear-gradient(to right, 
        #FF0000 0%, 
        #FF3333 50%, 
        #FF0000 100%);
    border-radius: calc(13px * var(--ui-scale));
    transition: width 0.3s ease;
    box-shadow: 
        0 0 calc(10px * var(--ui-scale)) rgba(255, 0, 0, 0.8),
        inset 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(255, 100, 100, 0.5);
    position: relative;
    overflow: hidden;
}

.boss-hp-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: bossHpShine 2s linear infinite;
}

@keyframes bossHpShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

.boss-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(18px * var(--ui-scale));
    font-weight: bold;
    color: #FFFFFF;
    text-shadow:
        calc(2px * var(--ui-scale)) calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)) #000,
        calc(-2px * var(--ui-scale)) calc(-2px * var(--ui-scale)) calc(4px * var(--ui-scale)) #000,
        0 0 calc(8px * var(--ui-scale)) rgba(255, 0, 0, 0.9);
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: calc(1px * var(--ui-scale));
}

/* Boss Loot Window */
#loot-window {
    cursor: default;
}

#loot-window * {
    cursor: default;
}

#loot-window .loot-choice-card {
    cursor: pointer !important;
}

.loot-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2a1a0a 0%, #1a0a05 100%);
    border: calc(4px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(16px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    min-width: calc(500px * var(--ui-scale));
    max-width: calc(700px * var(--ui-scale));
    max-height: 80vh;
    overflow-y: auto;
    box-shadow:
        0 calc(8px * var(--ui-scale)) calc(30px * var(--ui-scale)) rgba(0, 0, 0, 0.8),
        inset 0 calc(2px * var(--ui-scale)) calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.2);
    z-index: 500;
    opacity: 1;
    transition: opacity 0.3s ease;
    cursor: default;
}

.loot-window.hidden {
    display: none;
}

.loot-window-header {
    text-align: center;
    border-bottom: calc(2px * var(--ui-scale)) solid #FFD700;
    padding-bottom: calc(15px * var(--ui-scale));
    margin-bottom: calc(20px * var(--ui-scale));
    position: relative;
}

.loot-window-header h2 {
    font-size: calc(32px * var(--ui-scale));
    color: #FFD700;
    text-shadow:
        0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.8),
        calc(2px * var(--ui-scale)) calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)) #000;
    margin: 0 0 calc(10px * var(--ui-scale)) 0;
}

.loot-window-header h3 {
    font-size: calc(20px * var(--ui-scale));
    color: #FFFFFF;
    margin: 0;
}

.loot-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    color: #FFD700;
    font-size: calc(32px * var(--ui-scale));
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: calc(40px * var(--ui-scale));
    height: calc(40px * var(--ui-scale));
    transition: color 0.2s ease, transform 0.2s ease;
}

.loot-close-btn:hover {
    color: #FFF;
    transform: scale(1.1);
}

.loot-window-body {
    padding: calc(10px * var(--ui-scale)) 0;
}

.loot-warning-message {
    background: linear-gradient(135deg, #4a1a1a 0%, #2a0a0a 100%);
    border: calc(2px * var(--ui-scale)) solid #FF4444;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(12px * var(--ui-scale));
    margin-bottom: calc(15px * var(--ui-scale));
    color: #FF6666;
    font-size: calc(14px * var(--ui-scale));
    text-align: center;
    font-weight: bold;
    animation: warningPulse 1.5s ease-in-out infinite;
}

.loot-warning-message.hidden {
    display: none;
}

@keyframes warningPulse {
    0%, 100% {
        box-shadow: 0 0 calc(5px * var(--ui-scale)) rgba(255, 68, 68, 0.5);
    }
    50% {
        box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 68, 68, 0.9);
    }
}

.loot-gold-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(10px * var(--ui-scale));
    background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0a 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(10px * var(--ui-scale));
    padding: calc(15px * var(--ui-scale));
    margin-bottom: calc(20px * var(--ui-scale));
}

.loot-gold-icon {
    font-size: calc(32px * var(--ui-scale));
}

.loot-gold-amount {
    font-size: calc(36px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.8);
}

.loot-gold-label {
    font-size: calc(20px * var(--ui-scale));
    color: #FFFFFF;
}

.loot-items-section h4 {
    font-size: calc(20px * var(--ui-scale));
    color: #FFD700;
    margin: 0 0 calc(15px * var(--ui-scale)) 0;
    text-align: center;
}

.loot-items-container {
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--ui-scale));
    max-height: calc(400px * var(--ui-scale));
    overflow-y: auto;
}

.loot-item {
    display: grid;
    grid-template-columns: calc(60px * var(--ui-scale)) 1fr auto;
    gap: calc(10px * var(--ui-scale));
    background: linear-gradient(135deg, #3a2a1a 0%, #2a1a0a 100%);
    border: calc(2px * var(--ui-scale)) solid #8B4513;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(10px * var(--ui-scale));
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
}

.loot-item:hover {
    transform: translateY(calc(-2px * var(--ui-scale)));
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(15px * var(--ui-scale)) rgba(0, 0, 0, 0.5);
}

.loot-item-collected {
    opacity: 0.5;
}

.loot-item-common {
    border-color: #8B8B8B;
}

.loot-item-uncommon {
    border-color: #1eff00;
}

.loot-item-rare {
    border-color: #0070dd;
}

.loot-item-epic {
    border-color: #a335ee;
}

.loot-item-legendary {
    border-color: #ff8000;
}

.loot-item-icon {
    width: calc(60px * var(--ui-scale));
    height: calc(60px * var(--ui-scale));
    border-radius: calc(6px * var(--ui-scale));
    overflow: hidden;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loot-item-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.loot-item-icon-placeholder {
    font-size: calc(32px * var(--ui-scale));
    color: #666;
}

.loot-item-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: calc(5px * var(--ui-scale));
}

.loot-item-name {
    font-size: calc(16px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
}

.loot-item-type {
    font-size: calc(13px * var(--ui-scale));
    color: #AAAAAA;
}

.loot-item-stats {
    display: flex;
    flex-direction: column;
    gap: calc(3px * var(--ui-scale));
}

.loot-item-stat {
    font-size: calc(12px * var(--ui-scale));
    color: #FFFFFF;
}

/* Loot Choice Container - holds the two choice cards */
.loot-choice-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(20px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    flex-wrap: wrap;
}

/* Individual choice card (item or gold) */
.loot-choice-card {
    /* Equal width for both cards */
    width: calc(150px * var(--ui-scale));
    height: calc(150px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    border-radius: calc(12px * var(--ui-scale));
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: calc(10px * var(--ui-scale));
    border: calc(3px * var(--ui-scale)) solid transparent;
    position: relative;
}

/* Keyboard number indicators for loot choices - matching perk selector style */
.loot-choice-card::before {
    content: attr(data-key);
    position: absolute;
    bottom: calc(-12px * var(--ui-scale)); /* Overlap the bottom border - half outside */
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(16px * var(--ui-scale));
    color: #FFD700;
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(4px * var(--ui-scale)) calc(10px * var(--ui-scale));
    font-weight: bold;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.loot-choice-card:hover {
    /* Consistent grey border on hover - matching shop and inventory */
    border-color: #888888;
    border-width: calc(6px * var(--ui-scale));
}

/* Item card styling */
.loot-choice-card-item {
    background: linear-gradient(135deg, rgba(65, 105, 225, 0.2) 0%, rgba(30, 144, 255, 0.3) 100%);
    border-color: #4169E1;
}

/* Gold card styling */
.loot-choice-card-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.3) 100%);
    border-color: #FFD700;
}

/* Rarity-based item card colors */
.loot-choice-card-item.loot-item-common {
    border-color: #AAAAAA;
}

.loot-choice-card-item.loot-item-uncommon {
    border-color: #4CAF50;
}

.loot-choice-card-item.loot-item-rare {
    border-color: #2196F3;
}

.loot-choice-card-item.loot-item-epic {
    border-color: #9C27B0;
}

.loot-choice-card-item.loot-item-legendary {
    border-color: #FF9800;
}

/* Icon container - larger since we removed text */
.loot-choice-icon-container {
    width: calc(100px * var(--ui-scale));
    height: calc(100px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(8px * var(--ui-scale));
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(60, 60, 70, 0.6) 100%);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 255, 255, 0.15);
}

.loot-choice-icon-img {
    max-width: calc(91px * var(--ui-scale));
    max-height: calc(91px * var(--ui-scale));
    object-fit: contain;
    filter: drop-shadow(0 0 calc(2px * var(--ui-scale)) rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.6));
}

/* Rarity-based styling for loot choice cards */
.loot-choice-card-item.loot-item-common .loot-choice-icon-container {
    box-shadow: inset 0 0 calc(15px * var(--ui-scale)) rgba(255, 255, 255, 0.15);
}

.loot-choice-card-item.loot-item-rare .loot-choice-icon-container {
    box-shadow: inset 0 0 calc(20px * var(--ui-scale)) rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(59, 130, 246, 0.15) 100%);
}

.loot-choice-card-item.loot-item-epic .loot-choice-icon-container {
    box-shadow: inset 0 0 calc(20px * var(--ui-scale)) rgba(147, 51, 234, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(147, 51, 234, 0.15) 100%);
}

.loot-choice-card-item.loot-item-legendary .loot-choice-icon-container {
    box-shadow: inset 0 0 calc(25px * var(--ui-scale)) rgba(255, 140, 0, 0.4);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(255, 140, 0, 0.2) 100%);
}

.loot-choice-icon-placeholder {
    font-size: calc(40px * var(--ui-scale));
    color: #888;
}

/* Gold coin GIF styling - scaled down 3x */
.loot-choice-gold-coin {
    max-width: calc(30px * var(--ui-scale));
    max-height: calc(30px * var(--ui-scale));
    object-fit: contain;
    filter: drop-shadow(0 0 calc(2px * var(--ui-scale)) rgba(255, 215, 0, 0.8))
            drop-shadow(0 0 calc(1px * var(--ui-scale)) rgba(255, 215, 0, 0.6));
}

/* Gold card icon container - golden glow with relative positioning */
.loot-choice-card-gold .loot-choice-icon-container {
    box-shadow: inset 0 0 calc(20px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(255, 215, 0, 0.15) 100%);
    position: relative;
}

/* Gold amount text - positioned in bottom-right corner inside icon container */
.loot-gold-amount {
    position: absolute;
    bottom: calc(4px * var(--ui-scale));
    right: calc(4px * var(--ui-scale));
    font-size: calc(18px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
    text-shadow:
        -1px -1px 2px #000,
        1px -1px 2px #000,
        -1px 1px 2px #000,
        1px 1px 2px #000,
        0 0 calc(8px * var(--ui-scale)) rgba(255, 215, 0, 0.8);
    line-height: 1;
}

/* OR divider between cards */
.loot-choice-divider {
    font-size: calc(20px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
    padding: calc(10px * var(--ui-scale));
    text-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.8);
}

/* Helper text below cards */
.loot-choice-helper {
    width: 100%;
    text-align: center;
    font-size: calc(13px * var(--ui-scale));
    color: #888;
    margin-top: calc(10px * var(--ui-scale));
    font-style: italic;
}

.loot-collected-msg {
    color: #4CAF50;
    font-size: calc(14px * var(--ui-scale));
    font-weight: bold;
    text-align: center;
    padding: calc(10px * var(--ui-scale));
}

.loot-no-items {
    text-align: center;
    color: #AAAAAA;
    font-style: italic;
    padding: calc(20px * var(--ui-scale));
}

/* Loot tooltip (shows on hover) */
.loot-tooltip {
    position: fixed;
    z-index: 100000;
    background: rgba(20, 20, 30, 0.98);
    border: calc(2px * var(--ui-scale)) solid #4a4a6e;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(12px * var(--ui-scale));
    min-width: calc(200px * var(--ui-scale));
    max-width: calc(300px * var(--ui-scale));
    box-shadow: 0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.loot-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.loot-tooltip-header {
    padding-bottom: calc(8px * var(--ui-scale));
    border-bottom: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.2);
    margin-bottom: calc(8px * var(--ui-scale));
}

.loot-tooltip-name {
    font-size: calc(18px * var(--ui-scale));
    font-weight: bold;
    color: #FFFFFF;
    margin-bottom: calc(4px * var(--ui-scale));
}

/* Rarity colors for item name (matching shop tooltip) */
.loot-tooltip-rarity-common { color: #FFFFFF; }
.loot-tooltip-rarity-uncommon { color: #4CAF50; }
.loot-tooltip-rarity-rare { color: #2196F3; }
.loot-tooltip-rarity-epic { color: #9C27B0; }
.loot-tooltip-rarity-legendary { color: #FF9800; }

.loot-tooltip-type {
    font-size: calc(14px * var(--ui-scale));
    font-weight: bold;
}

/* Type colors (matching shop tooltip) */
.loot-tooltip-type-consumable { color: #FFFFFF; }
.loot-tooltip-type-equipment { color: #00AAFF; }

.loot-tooltip-separator {
    border-bottom: calc(1px * var(--ui-scale)) solid #666666;
    margin: calc(6px * var(--ui-scale)) 0;
}

.loot-tooltip-description {
    font-size: calc(14px * var(--ui-scale));
    color: #AAAAAA;
    line-height: 1.4;
    margin: calc(4px * var(--ui-scale)) 0;
}

.loot-tooltip-stats {
    padding: calc(8px * var(--ui-scale)) 0;
    font-size: calc(13px * var(--ui-scale));
    color: #4CAF50;
}

.loot-tooltip-footer {
    padding-top: calc(8px * var(--ui-scale));
    border-top: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.2);
    margin-top: calc(8px * var(--ui-scale));
}

.loot-tooltip-sell {
    font-size: calc(13px * var(--ui-scale));
    color: #FFD700;
    font-style: italic;
}

/* Rarity-based tooltip header colors */
.loot-tooltip-common {
    border-bottom-color: #AAAAAA;
}

.loot-tooltip-uncommon {
    border-bottom-color: #4CAF50;
}

.loot-tooltip-rare {
    border-bottom-color: #2196F3;
}

.loot-tooltip-epic {
    border-bottom-color: #9C27B0;
}

.loot-tooltip-legendary {
    border-bottom-color: #FF9800;
}


/* Mobile responsiveness */
@media (max-width: 768px) {
    .boss-hp-bar {
        min-width: calc(350px * var(--ui-scale));
        top: calc(100px * var(--ui-scale));
        padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale));
    }

    .boss-hp-portrait-container {
        width: calc(60px * var(--ui-scale));
        height: calc(60px * var(--ui-scale));
    }

    .boss-name {
        font-size: calc(16px * var(--ui-scale));
    }

    .boss-number {
        font-size: calc(12px * var(--ui-scale));
    }

    .boss-hp-bar-bg {
        height: calc(24px * var(--ui-scale));
    }

    .boss-hp-text {
        font-size: calc(12px * var(--ui-scale));
    }
}

@media (max-width: 480px) {
    .boss-hp-bar {
        min-width: calc(280px * var(--ui-scale));
        flex-direction: column;
        align-items: center;
        padding: calc(6px * var(--ui-scale));
    }

    .boss-hp-portrait-container {
        width: calc(50px * var(--ui-scale));
        height: calc(50px * var(--ui-scale));
    }

    .boss-hp-info {
        margin-left: 0;
        margin-top: calc(8px * var(--ui-scale));
        width: 100%;
    }

    .boss-name {
        font-size: calc(14px * var(--ui-scale));
    }

    .boss-number {
        font-size: calc(10px * var(--ui-scale));
    }

    .boss-hp-bar-bg {
        height: calc(20px * var(--ui-scale));
    }

    .boss-hp-text {
        font-size: calc(10px * var(--ui-scale));
    }
}
