* {
    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;
    --start-ui-scale: 1; /* Dynamically set by JS for 1:1 viewport scaling */
}

/* Start page elements use dynamic viewport-based scaling */
#game-info-panel,
#game-info-panel *,
.start-settings-panel,
.start-settings-panel *,
.controls-info,
.controls-info *,
#start-highscore-panel,
#start-highscore-panel *,
#highscore-inspect-modal,
#highscore-inspect-modal * {
    --ui-scale: var(--start-ui-scale);
}

/* 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;
}

/* Info Panel Container (Statistics/Donations) */
#game-info-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(250px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
}

/* Panel Header (shared between collapsible panels) */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: calc(0.5rem * var(--ui-scale));
    border-bottom: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
}

/* Panel Title (for Statistics, Donations panels) */
.panel-title {
    color: #FFD700;
    font-size: calc(0.9rem * var(--ui-scale));
    margin: 0;
    text-align: center;
    flex: 1;
}

/* Statistics Panel */
#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(0.75rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    width: calc(280px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
    transition: width 0.3s ease;
}

/* Width controlled by unified collapsed styles */
#statistics-panel.collapsed .panel-header {
    border-bottom: none;
    padding-bottom: 0;
}

/* Donations Panel */
#donations-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(0.75rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    width: calc(280px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
    transition: width 0.3s ease;
}

/* Width controlled by unified collapsed styles */
#donations-panel.collapsed .panel-header {
    border-bottom: none;
    padding-bottom: 0;
}

/* Panel Collapse Button */
.panel-collapse-btn {
    background: transparent;
    border: none;
    color: #FFD700;
    cursor: pointer;
    padding: calc(0.25rem * var(--ui-scale));
    font-size: calc(0.8rem * var(--ui-scale));
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-collapse-btn:hover {
    color: #ffa500;
}

.panel-collapse-btn .collapse-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.collapsible-panel.collapsed .panel-collapse-btn .collapse-icon {
    transform: rotate(-90deg);
}

/* Panel Content (collapsible) */
.panel-content {
    display: flex;
    flex-direction: column;
    gap: calc(0.5rem * var(--ui-scale));
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: calc(0.5rem * var(--ui-scale));
}

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

.collapsible-panel.collapsed {
    gap: 0;
}

.collapsible-panel.collapsed .panel-header {
    border-bottom: none;
    padding-bottom: 0;
}

/* Override: Keep titles visible in right panels when collapsed */
.right-panels-container .collapsible-panel.collapsed .panel-header h3,
.right-panels-container .collapsible-panel .panel-header h3 {
    opacity: 1 !important;
    pointer-events: auto !important;
    color: #FFD700 !important;
    font-size: calc(0.75rem * var(--ui-scale)) !important;
    margin: 0 !important;
}

/* Info Tabs Inside Panel */
.info-tabs {
    display: flex;
    gap: calc(0.5rem * var(--ui-scale));
    margin: 0;
}

.info-tab {
    flex: 1;
    padding: calc(0.5rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    background: rgba(255, 255, 255, 0.05);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
    border-radius: calc(4px * var(--ui-scale));
    color: #d0d0d0;
    font-size: calc(0.5rem * var(--ui-scale));
    font-family: 'Press Start 2P', 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: calc(1px * var(--ui-scale));
}

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

.info-tab.active {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    border-color: #ffa500;
    color: #1a1a2e;
    font-weight: bold;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.4);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

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

/* Donations Content */
.donations-layout {
    display: flex;
    gap: calc(1rem * var(--ui-scale));
    align-items: flex-start;
    max-width: calc(600px * var(--ui-scale));
    margin: 0 auto;
}

.donation-info {
    flex: 1;
}

.donation-text {
    font-size: calc(1.05rem * var(--ui-scale));
    color: #d0d0d0;
    text-align: center;
    margin-bottom: calc(1rem * var(--ui-scale));
    line-height: 1.6;
}

.donation-address {
    background: rgba(255, 165, 0, 0.1);
    border: calc(1px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
    border-radius: calc(6px * var(--ui-scale));
    padding: calc(0.8rem * var(--ui-scale));
    margin-top: calc(0.8rem * var(--ui-scale));
}

.address-label {
    font-size: calc(1.05rem * var(--ui-scale));
    color: #ffa500;
    margin: 0 0 calc(0.5rem * var(--ui-scale)) 0;
    font-weight: bold;
    letter-spacing: calc(1px * var(--ui-scale));
}

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

.address-value {
    flex: 1;
    font-size: calc(0.96rem * var(--ui-scale));
    color: #d0d0d0;
    margin: 0;
    word-break: break-all;
    font-family: monospace;
    letter-spacing: calc(0.5px * var(--ui-scale));
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    cursor: text;
}

.copy-btn {
    flex-shrink: 0;
    background: rgba(255, 165, 0, 0.2);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.5);
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(0.4rem * var(--ui-scale)) calc(0.6rem * var(--ui-scale));
    font-size: calc(1.75rem * var(--ui-scale));
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

.copy-btn:hover {
    background: rgba(255, 165, 0, 0.4);
    border-color: #ffa500;
    transform: scale(1.05);
}

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

.copy-btn.copied {
    background: rgba(74, 255, 74, 0.3);
    border-color: #4aff4a;
}

/* Swedish Flag */
.swedish-flag {
    display: inline-block;
    width: calc(1.5em * var(--ui-scale));
    height: calc(1em * var(--ui-scale));
    background: linear-gradient(to right,
        #006AA7 0%, #006AA7 35%,
        #FECC00 35%, #FECC00 45%,
        #006AA7 45%, #006AA7 100%);
    position: relative;
    vertical-align: middle;
    border: calc(1px * var(--ui-scale)) solid rgba(255, 255, 255, 0.2);
    border-radius: calc(2px * var(--ui-scale));
}

.swedish-flag::after {
    content: '';
    position: absolute;
    top: 40%;
    left: 0;
    right: 0;
    height: 20%;
    background: #FECC00;
}

/* QR Button (for Bitcoin) */
.qr-btn {
    flex-shrink: 0;
    background: rgba(255, 165, 0, 0.2);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.5);
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(0.5rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    font-size: calc(0.7rem * var(--ui-scale));
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: calc(0.3rem * var(--ui-scale));
    font-weight: bold;
    color: #ffa500;
    letter-spacing: calc(0.5px * var(--ui-scale));
}

.qr-icon {
    font-size: calc(1.2rem * var(--ui-scale));
    line-height: 1;
}

.qr-btn:hover {
    background: rgba(255, 165, 0, 0.4);
    border-color: #ffa500;
    transform: scale(1.05);
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.4);
}

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

/* QR Code Modal */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.qr-modal-content {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(3px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(12px * var(--ui-scale));
    padding: calc(2rem * var(--ui-scale));
    max-width: calc(400px * var(--ui-scale));
    text-align: center;
    position: relative;
    box-shadow: 0 0 calc(30px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
}

.qr-close-btn {
    position: absolute;
    top: calc(0.5rem * var(--ui-scale));
    right: calc(0.5rem * var(--ui-scale));
    background: rgba(255, 0, 0, 0.2);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 0, 0, 0.5);
    border-radius: calc(4px * var(--ui-scale));
    color: #ff4444;
    font-size: calc(1.2rem * var(--ui-scale));
    width: calc(2rem * var(--ui-scale));
    height: calc(2rem * var(--ui-scale));
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-close-btn:hover {
    background: rgba(255, 0, 0, 0.4);
    border-color: #ff0000;
    transform: scale(1.1);
}

.qr-modal-title {
    font-size: calc(1.2rem * var(--ui-scale));
    color: #ffa500;
    margin: 0 0 calc(1rem * var(--ui-scale)) 0;
    letter-spacing: calc(1px * var(--ui-scale));
}

.qr-code-image {
    width: calc(250px * var(--ui-scale));
    height: calc(250px * var(--ui-scale));
    border: calc(2px * var(--ui-scale)) solid rgba(255, 165, 0, 0.3);
    border-radius: calc(8px * var(--ui-scale));
    margin-bottom: calc(1rem * var(--ui-scale));
}

.qr-address-text {
    font-size: calc(0.8rem * var(--ui-scale));
    color: #d0d0d0;
    font-family: monospace;
    word-break: break-all;
    margin: 0 0 calc(1rem * var(--ui-scale)) 0;
    padding: calc(0.5rem * var(--ui-scale));
    background: rgba(255, 165, 0, 0.1);
    border-radius: calc(4px * var(--ui-scale));
}

.qr-copy-btn {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(6px * var(--ui-scale));
    padding: calc(0.8rem * var(--ui-scale)) calc(1.5rem * var(--ui-scale));
    color: #1a1a2e;
    font-size: calc(0.9rem * var(--ui-scale));
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
}

.qr-copy-btn:hover {
    background: linear-gradient(135deg, #ffb700 0%, #ffa500 100%);
    transform: translateY(calc(-2px * var(--ui-scale)));
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 165, 0, 0.5);
}

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

.qr-copy-btn.copied {
    background: linear-gradient(135deg, #4aff4a 0%, #00cc00 100%);
    border-color: #4aff4a;
}

/* Top Donors */
.top-donors {
    flex: 1;
}

.top-donors h5 {
    font-size: calc(1.05rem * var(--ui-scale));
    color: #ffa500;
    margin: 0 0 calc(0.6rem * var(--ui-scale)) 0;
    letter-spacing: calc(1px * var(--ui-scale));
    text-align: center;
}

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

.donor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(0.3rem * var(--ui-scale));
    padding: calc(0.6rem * var(--ui-scale));
    border-radius: calc(4px * var(--ui-scale));
    border: calc(1px * var(--ui-scale)) solid;
    transition: all 0.2s ease;
}

.donor-item:hover {
    transform: translateY(calc(-2px * var(--ui-scale)));
}

.donor-item.gold {
    background: linear-gradient(135deg, rgba(255, 223, 0, 0.2), rgba(255, 200, 50, 0.15));
    border-color: #FFD700;
    box-shadow: 0 0 calc(15px * var(--ui-scale)) rgba(255, 215, 0, 0.6),
                inset 0 0 calc(20px * var(--ui-scale)) rgba(255, 223, 0, 0.1);
}

.donor-item.silver {
    background: rgba(192, 192, 192, 0.15);
    border-color: rgba(192, 192, 192, 0.6);
}

.donor-name {
    font-size: calc(0.875rem * var(--ui-scale));
    color: #d0d0d0;
    text-align: center;
    font-weight: bold;
}

.donor-amount {
    font-size: calc(0.96rem * var(--ui-scale));
    color: #4aff4a;
    font-weight: bold;
    text-align: center;
}

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

/* Right Panels Container - holds Settings and Stats/Donations */
.right-panels-container {
    position: absolute;
    top: calc(2rem * var(--ui-scale));
    right: calc(2rem * var(--ui-scale));
    z-index: 10000;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: calc(0.4rem * var(--ui-scale));
    max-height: calc(95vh - 4rem * var(--ui-scale));
}

/* Base panel styling for all right-side panels */
.right-panels-container > div {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #ffa500;
    border-radius: calc(6px * var(--ui-scale));
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    transition: width 0.3s ease;
}

/* Collapsed state - EXACT same size for all panels, scales with screen */
.right-panels-container .collapsed,
.right-panels-container > div.collapsed,
.right-panels-container > .start-settings-panel.collapsed,
.right-panels-container > .collapsible-panel.collapsed,
.right-panels-container #start-settings-panel.collapsed,
.right-panels-container #statistics-panel.collapsed,
.right-panels-container #donations-panel.collapsed,
#start-settings-panel.collapsed,
#statistics-panel.collapsed,
#donations-panel.collapsed,
div.start-settings-panel.collapsed,
div.collapsible-panel.collapsed {
    width: calc(220px * var(--ui-scale)) !important;
    min-width: calc(220px * var(--ui-scale)) !important;
    max-width: calc(220px * var(--ui-scale)) !important;
    padding: calc(10px * var(--ui-scale)) calc(14px * var(--ui-scale)) !important;
    height: auto !important;
    min-height: 0 !important;
    gap: 0 !important;
}

/* Expanded state - wider for better content display */
.right-panels-container > div:not(.collapsed) {
    width: calc(280px * var(--ui-scale));
    padding: calc(0.75rem * var(--ui-scale));
}

/* Unified styling for all right panel headers */
.right-panels-container .panel-header,
.right-panels-container .settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
    cursor: pointer;
}

.right-panels-container .panel-title,
.right-panels-container .settings-panel-title {
    color: #FFD700;
    font-size: calc(0.9rem * var(--ui-scale));
    margin: 0;
    flex: 1;
    white-space: nowrap;
    font-weight: bold;
}

.right-panels-container .panel-collapse-btn,
.right-panels-container .settings-collapse-btn {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: calc(1.5px * var(--ui-scale)) solid rgba(255, 215, 0, 0.5);
    border-radius: calc(4px * var(--ui-scale));
    color: #FFD700;
    cursor: pointer;
    padding: calc(0.3rem * var(--ui-scale)) calc(0.5rem * var(--ui-scale));
    font-size: calc(0.85rem * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: calc(0.4rem * var(--ui-scale));
    transition: all 0.2s ease;
    box-shadow: 0 0 calc(4px * var(--ui-scale)) rgba(255, 165, 0, 0.2);
}

.right-panels-container .panel-collapse-btn:hover,
.right-panels-container .settings-collapse-btn:hover {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.4) 0%, rgba(255, 215, 0, 0.2) 100%);
    border-color: #FFD700;
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.4);
    transform: scale(1.05);
}

/* Responsive - smaller screens - keep consistent button styling */
@media (max-width: 768px) {
    .right-panels-container {
        top: calc(1rem * var(--ui-scale));
        right: calc(1rem * var(--ui-scale));
        gap: calc(0.3rem * var(--ui-scale));
    }

    /* Keep same collapsed size ratio on small screens */
    .right-panels-container > div.collapsed,
    .right-panels-container > .start-settings-panel.collapsed,
    .right-panels-container > .collapsible-panel.collapsed {
        width: calc(200px * var(--ui-scale)) !important;
        min-width: calc(200px * var(--ui-scale)) !important;
        max-width: calc(200px * var(--ui-scale)) !important;
        padding: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale)) !important;
    }

    .right-panels-container > div:not(.collapsed) {
        width: calc(280px * var(--ui-scale));
        padding: calc(0.6rem * var(--ui-scale));
    }

    .right-panels-container .panel-title,
    .right-panels-container .settings-panel-title {
        font-size: calc(0.85rem * var(--ui-scale));
    }
}

@media (max-width: 480px) {
    .right-panels-container {
        top: calc(0.5rem * var(--ui-scale));
        right: calc(0.5rem * var(--ui-scale));
    }

    .right-panels-container > div.collapsed,
    .right-panels-container > .start-settings-panel.collapsed,
    .right-panels-container > .collapsible-panel.collapsed {
        width: calc(180px * var(--ui-scale)) !important;
        min-width: calc(180px * var(--ui-scale)) !important;
        max-width: calc(180px * var(--ui-scale)) !important;
        padding: calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale)) !important;
    }

    .right-panels-container > div:not(.collapsed) {
        width: calc(240px * var(--ui-scale));
    }

    .right-panels-container .panel-title,
    .right-panels-container .settings-panel-title {
        font-size: 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(0.75rem * var(--ui-scale));
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 165, 0, 0.3);
    width: calc(280px * var(--ui-scale));
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
    transition: width 0.3s ease;
}

/* Width controlled by unified collapsed styles in right-panels-container */

/* Force Settings panel to match other collapsed panels exactly */
.start-settings-panel.collapsed {
    width: 130px !important;
    min-width: 130px !important;
    max-width: 130px !important;
    padding: 8px 10px !important;
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(0.5rem * var(--ui-scale));
    border-radius: calc(4px * var(--ui-scale));
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}

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

.settings-panel-title {
    color: #FFD700;
    font-size: calc(0.9rem * var(--ui-scale));
    margin: 0;
    text-align: center;
    flex: 1;
}

.settings-collapse-btn {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: calc(1.5px * var(--ui-scale)) solid rgba(255, 215, 0, 0.5);
    border-radius: calc(4px * var(--ui-scale));
    color: #FFD700;
    cursor: pointer;
    padding: calc(0.3rem * var(--ui-scale)) calc(0.5rem * var(--ui-scale));
    font-size: calc(0.85rem * var(--ui-scale));
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 calc(4px * var(--ui-scale)) rgba(255, 165, 0, 0.2);
}

.settings-collapse-btn:hover {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.4) 0%, rgba(255, 215, 0, 0.2) 100%);
    border-color: #FFD700;
    box-shadow: 0 0 calc(8px * var(--ui-scale)) rgba(255, 165, 0, 0.4);
    transform: scale(1.05);
}

.settings-collapse-btn .collapse-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}

.start-settings-panel.collapsed .settings-collapse-btn .collapse-icon {
    transform: rotate(-90deg);
}

.settings-panel-content {
    display: flex;
    flex-direction: column;
    gap: calc(1rem * var(--ui-scale));
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: calc(0.5rem * var(--ui-scale));
}

.start-settings-panel.collapsed .settings-panel-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.start-settings-panel.collapsed .settings-panel-header {
    border-bottom: none;
    padding-bottom: 0;
}

/* Auto-collapse settings panel on small screens */
@media (max-width: 900px) {
    .start-settings-panel:not(.user-expanded) {
        /* Will be auto-collapsed via JS on small screens */
    }
}

.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;
}

/* Changelog Modal Styles */
.changelog-content {
    max-width: 900px;
    width: 90vw;
}

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

.changelog-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);
}

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

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

.changelog-section ul {
    margin-left: calc(1.2rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
    list-style-type: disc;
}

.changelog-section li {
    margin-bottom: calc(0.6rem * var(--ui-scale));
    line-height: 1.5;
    color: #FFFFFF;
}

.changelog-section li strong {
    color: #FFD700;
}

.changelog-section code {
    background: rgba(255, 215, 0, 0.1);
    padding: calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale));
    border-radius: calc(3px * var(--ui-scale));
    font-family: 'Courier New', monospace;
    color: #FFA500;
    font-size: calc(0.85rem * var(--ui-scale));
}

.changelog-note {
    color: #4CAF50;
    font-style: italic;
    padding: calc(0.6rem * var(--ui-scale));
    background: rgba(76, 175, 80, 0.1);
    border-left: calc(3px * var(--ui-scale)) solid #4CAF50;
    border-radius: calc(4px * var(--ui-scale));
    margin-top: calc(0.5rem * var(--ui-scale));
    display: block;
    line-height: 1.4;
}

.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;
}

.logo-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: calc(1rem * var(--ui-scale));
    margin-bottom: calc(0.5rem * var(--ui-scale));
}

.main-logo {
    height: calc(120px * var(--ui-scale));
    width: auto;
    filter: drop-shadow(0 0 15px rgba(255, 107, 53, 0.4));
    cursor: pointer;
    transition: filter 0.3s ease;
}

.main-logo:hover {
    filter: drop-shadow(0 0 20px rgba(255, 107, 53, 0.6));
}

.main-logo.spinning {
    animation: logoFullSpin 0.6s ease-in-out;
}

@keyframes logoFullSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Mill Confetti Animation */
.mill-confetti {
    position: fixed;
    top: -50px;
    pointer-events: none;
    z-index: 9999;
    filter: drop-shadow(0 0 5px rgba(255, 107, 53, 0.6));
    animation: millFall linear forwards;
}

@keyframes millFall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(calc(100vh + 100px)) translateX(var(--drift)) rotate(calc(var(--rotations) * 360deg));
        opacity: 0.5;
    }
}

.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-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(1rem * var(--ui-scale));
    margin: calc(0.3rem * var(--ui-scale)) 0 calc(0.8rem * var(--ui-scale)) 0;
}

.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: 0;
    letter-spacing: calc(0.05rem * var(--ui-scale));
}

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

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

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

.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;
}

/* Discord Link */
.discord-link {
    display: inline-block;
    margin-left: calc(1rem * var(--ui-scale));
    vertical-align: middle;
    transition: all 0.3s ease;
    position: relative;
    top: calc(3px * var(--ui-scale));
}

.discord-logo {
    height: calc(20px * var(--ui-scale));
    width: auto;
    transition: all 0.3s ease;
    filter: drop-shadow(0 calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(88, 101, 242, 0.3));
}

.discord-link:hover .discord-logo {
    transform: translateY(calc(-4px * var(--ui-scale))) scale(1.05);
    filter: drop-shadow(0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(88, 101, 242, 0.5));
}

.discord-link:active .discord-logo {
    transform: translateY(calc(-2px * var(--ui-scale))) scale(1.02);
}

.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: #C0C0C0;
    box-shadow: 0 0 30px rgba(192, 192, 192, 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: #C0C0C0;
    box-shadow: 0 0 20px rgba(192, 192, 192, 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[data-hero="darkranger"]:hover {
    border-color: #7B5DBD;
    box-shadow: 0 0 30px rgba(123, 93, 189, 0.5);
    transform: translateY(-5px) scale(1.02);
}

.hero-card[data-hero="darkranger"]:hover .hero-portrait {
    border-color: #7B5DBD;
    box-shadow: 0 0 20px rgba(123, 93, 189, 0.6);
}

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

.hero-card[data-hero="monk"]:hover .hero-portrait {
    border-color: #FF9933;
    box-shadow: 0 0 20px rgba(255, 153, 51, 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: #C0C0C0;
    text-shadow: 0 0 15px #C0C0C0, 0 0 25px #C0C0C0;
}

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

.hero-card[data-hero="darkranger"] h2 {
    color: #7B5DBD;
    text-shadow: 0 0 15px #7B5DBD, 0 0 25px #7B5DBD, 0 0 1px rgba(255, 255, 255, 0.1);
}

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

.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 ability NAMES (not the label) */
.hero-card[data-hero="wizard"] .hero-special-tooltip {
    color: #0099DD !important;
    text-shadow: 0 0 10px rgba(0, 153, 221, 0.8) !important;
}

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

.hero-card[data-hero="darkranger"] .hero-special-tooltip {
    color: #7B5DBD !important;
    text-shadow: 0 0 10px rgba(123, 93, 189, 0.8) !important;
}

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

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

/* Hero abilities container - holds spells and ultimates on same row */
.hero-abilities {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    width: 100%;
}

.hero-spells {
    flex: 1;
    padding: 0.5rem;
    background: rgba(100, 150, 255, 0.05);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 6px;
    position: relative;
    z-index: 1;
}

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

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

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

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

.spell-icon:hover {
    background: rgba(100, 150, 255, 0.2);
    border-color: rgba(100, 150, 255, 0.6);
    transform: scale(1.1);
}

/* Hero ability tooltip overlay - renders above everything */
#hero-ability-tooltip-overlay {
    position: fixed;
    padding: calc(16px * var(--ui-scale));
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    color: #fff;
    border-radius: calc(4px * var(--ui-scale));
    font-size: 0.7rem;
    white-space: normal;
    text-align: left;
    z-index: 999999;
    pointer-events: none;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(0, 0, 0, 0.9);
    line-height: 1.5;
    width: calc(420px * var(--ui-scale));
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

#hero-ability-tooltip-overlay.spell-tooltip {
    border: 2px solid #6496ff;
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.5);
}

#hero-ability-tooltip-overlay.ultimate-tooltip {
    border: 2px solid #ffa500;
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
}


.hero-ultimates {
    flex: 1;
    padding: 0.5rem;
    background: rgba(255, 165, 0, 0.05);
    border: 1px solid rgba(255, 165, 0, 0.2);
    border-radius: 6px;
    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;
}


.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;
}

.ingame-logo {
    position: absolute;
    left: calc(1rem * var(--ui-scale));
    top: 50%;
    transform: translateY(-50%);
    width: calc(40px * var(--ui-scale));
    height: calc(40px * var(--ui-scale));
    cursor: pointer;
    transition: filter 0.3s ease;
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.4));
    z-index: 151;
}

.ingame-logo:hover {
    filter: drop-shadow(0 0 12px rgba(255, 107, 53, 0.6));
}

.ingame-logo.spinning {
    animation: logoSpin 0.6s ease-in-out;
}

@keyframes logoSpin {
    from {
        transform: translateY(-50%) rotate(0deg);
    }
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Return to Main Menu Dialog */
.return-menu-dialog {
    position: absolute;
    left: calc(60px * var(--ui-scale));
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: calc(2px * var(--ui-scale)) solid #ff6b35;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(0.8rem * var(--ui-scale)) calc(1rem * var(--ui-scale));
    display: flex;
    align-items: center;
    gap: calc(1rem * var(--ui-scale));
    z-index: 152;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
}

.return-menu-dialog.hidden {
    display: none;
}

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

.return-menu-text {
    color: #FFD700;
    font-size: calc(0.9rem * var(--ui-scale));
    font-weight: bold;
    white-space: nowrap;
}

.return-menu-buttons {
    display: flex;
    gap: calc(0.5rem * var(--ui-scale));
}

.return-menu-btn {
    padding: calc(0.4rem * var(--ui-scale)) calc(0.8rem * var(--ui-scale));
    font-size: calc(0.85rem * var(--ui-scale));
    font-weight: bold;
    border: calc(2px * var(--ui-scale)) solid;
    border-radius: calc(4px * var(--ui-scale));
    cursor: pointer;
    transition: all 0.2s ease;
}

.yes-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #ff4520 100%);
    border-color: #ff8855;
    color: white;
}

.yes-btn:hover {
    background: linear-gradient(135deg, #ff8855 0%, #ff6b35 100%);
    transform: scale(1.05);
}

.no-btn {
    background: linear-gradient(135deg, #4a4a6e 0%, #3a3a5e 100%);
    border-color: #5a5a7e;
    color: #CCCCCC;
}

.no-btn:hover {
    background: linear-gradient(135deg, #5a5a7e 0%, #4a4a6e 100%);
    transform: scale(1.05);
}

.bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    margin-left: calc(15rem * var(--ui-scale));
}

.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);
    text-align: center;
}

.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;
}

/* Single column variant for death info */
.inspect-stats-grid.inspect-stats-single-column {
    grid-template-columns: 1fr;
}

.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;
    justify-content: center;
    gap: 6px;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    min-width: 90px;
    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: 70px;
    height: 70px;
    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: 64px;
    height: 64px;
    object-fit: contain;
}

.inspect-action-keybind {
    display: none;
}

.inspect-action-name {
    display: none;
}

/* Inventory at Death - Grid display (4x3 grid for 12 slots) */
.inspect-inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 12px;
    padding: 10px 0;
    justify-content: center;
}

.inspect-inventory-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px;
    width: 86px;
    height: 86px;
    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,
.inspect-inventory-slot.rarity-common {
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

.inspect-inventory-slot.rarity-uncommon {
    border: 2px solid #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

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

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

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

.inspect-inventory-slot.rarity-seasonal {
    border: 2px solid #00FF00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.inspect-inventory-icon {
    width: 70px;
    height: 70px;
    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: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.inspect-inventory-slot.rarity-uncommon .inspect-inventory-icon {
    box-shadow: inset 0 0 18px rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(76, 175, 80, 0.15) 100%);
}

.inspect-inventory-slot.rarity-rare .inspect-inventory-icon {
    box-shadow: inset 0 0 20px 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 20px 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 25px 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-slot.rarity-seasonal .inspect-inventory-icon {
    box-shadow: inset 0 0 25px rgba(0, 255, 0, 0.4);
    background: linear-gradient(135deg, rgba(80, 80, 90, 0.5) 0%, rgba(0, 255, 0, 0.2) 100%);
}

.inspect-inventory-icon img {
    width: 64px;
    height: 64px;
    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-inventory-name {
    display: none;
}

/* Rarity-based name colors for inventory items */
.inspect-inventory-slot.rarity-common .inspect-inventory-name {
    color: #FFFFFF;
}

.inspect-inventory-slot.rarity-uncommon .inspect-inventory-name {
    color: #4CAF50;
}

.inspect-inventory-slot.rarity-rare .inspect-inventory-name {
    color: #2196F3;
}

.inspect-inventory-slot.rarity-epic .inspect-inventory-name {
    color: #9C27B0;
}

.inspect-inventory-slot.rarity-legendary .inspect-inventory-name {
    color: #FF9800;
}

.inspect-inventory-slot.rarity-seasonal .inspect-inventory-name {
    color: #00FF00;
}

/* Normal rarity (for perks/other systems that use "normal" instead of "common") */
.inspect-inventory-slot.rarity-normal .inspect-inventory-name {
    color: #FFFFFF;
}

.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 tooltip overlay - renders above everything (matches loot tooltip styling) */
#inspect-tooltip-overlay {
    position: fixed;
    z-index: 999999;
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(16px * var(--ui-scale));
    width: calc(420px * var(--ui-scale));
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
                inset 0 calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

/* Expand tooltip width when shift is held and stat ranges are shown */
#inspect-tooltip-overlay.shift-expanded {
    width: calc(480px * var(--ui-scale));
}

/* Rarity-based border colors for inspect tooltip */
#inspect-tooltip-overlay[data-rarity="common"] { border-color: #FFFFFF !important; }
#inspect-tooltip-overlay[data-rarity="uncommon"] { border-color: #4CAF50 !important; }
#inspect-tooltip-overlay[data-rarity="rare"] { border-color: #2196F3 !important; }
#inspect-tooltip-overlay[data-rarity="epic"] { border-color: #9C27B0 !important; }
#inspect-tooltip-overlay[data-rarity="legendary"] { border-color: #FF9800 !important; }
#inspect-tooltip-overlay[data-rarity="seasonal"] { border-color: #00FF00 !important; }

/* Ensure inspect tooltip child elements use proper styling */
#inspect-tooltip-overlay .loot-tooltip-name {
    font-size: calc(20px * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(2px * var(--ui-scale));
    text-transform: uppercase;
    letter-spacing: calc(0.5px * var(--ui-scale));
}

#inspect-tooltip-overlay .loot-tooltip-rarity-common { color: #FFFFFF !important; }
#inspect-tooltip-overlay .loot-tooltip-rarity-uncommon { color: #4CAF50 !important; }
#inspect-tooltip-overlay .loot-tooltip-rarity-rare { color: #2196F3 !important; }
#inspect-tooltip-overlay .loot-tooltip-rarity-epic { color: #9C27B0 !important; }
#inspect-tooltip-overlay .loot-tooltip-rarity-legendary { color: #FF9800 !important; }
#inspect-tooltip-overlay .loot-tooltip-rarity-seasonal { color: #00FF00 !important; }

#inspect-tooltip-overlay .loot-tooltip-header {
    padding-bottom: calc(8px * var(--ui-scale));
    margin-bottom: calc(8px * var(--ui-scale));
}

#inspect-tooltip-overlay .loot-tooltip-rarity {
    font-size: calc(13px * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(2px * var(--ui-scale));
    line-height: 1.4;
}

#inspect-tooltip-overlay .loot-tooltip-description {
    font-size: calc(13px * var(--ui-scale));
    color: #b0b0c0;
    line-height: 1.5;
    margin: calc(4px * var(--ui-scale)) 0;
}

#inspect-tooltip-overlay .loot-tooltip-stats {
    font-size: calc(14px * var(--ui-scale));
}

#inspect-tooltip-overlay .loot-stat-line {
    color: #4CAF50;
    line-height: 1.7;
    font-size: calc(14px * var(--ui-scale));
}

#inspect-tooltip-overlay .loot-stat-line.loot-stat-negative {
    color: #FF5555;
}

/* Pause Menu with Perks */
.pause-menu-content {
    position: relative;
    z-index: 2; /* Just above canvas - tooltips are drawn on canvas so they can't go higher */
    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: calc(650px * var(--ui-scale)); /* Fixed max height - prevents growing too large */
    height: auto;
    overflow: hidden; /* Content scrolls inside sections, not the whole menu */
    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;
    max-height: calc(550px * var(--ui-scale)); /* Constrain body height */
    overflow: hidden;
}

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

.pause-menu-right {
    display: flex;
    flex-direction: column;
    height: calc(500px * var(--ui-scale)); /* Explicit height for flex children */
    overflow: hidden; /* Individual sections handle overflow */
    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));
    flex-shrink: 0; /* Don't shrink this */
}

.pause-perks-section {
    border-top: none;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

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

#pause-perks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: scroll; /* Force scrollbar to always show */
    flex: 1;
    padding-right: calc(8px * var(--ui-scale)); /* Space for scrollbar */
}

/* 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;
}

/* When forge is open, canvas needs higher z-index for drag effect to show above forge panel */
body.forge-open #game-canvas {
    z-index: 10010 !important;
}

/* 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;
    transition: transform 0.3s ease;
}

/* Action bar collapsed state - 2.5x smaller (0.4 scale instead of 0.2) */
#action-bar.collapsed {
    transform: translateX(-50%) scale(calc(var(--ui-scale) * 0.4));
}

/* Collapse toggle arrow */
#action-bar-toggle-arrow {
    position: absolute;
    left: -30px;
    bottom: 10px; /* Position near bottom instead of centered */
    transform: scale(1.5); /* Make arrow 1.5x bigger and always visible */
    cursor: pointer;
    z-index: 1001;
    transition: all 0.2s ease;
    pointer-events: auto; /* Always clickable */
}

#action-bar-toggle-arrow:hover {
    filter: brightness(1.3) drop-shadow(0 0 8px #4ade80);
}

/* Rotate arrow when collapsed */
#action-bar.collapsed #action-bar-toggle-arrow svg {
    transform: rotate(180deg);
}

/* Make arrow larger when action bar is collapsed so it stays visible */
#action-bar.collapsed #action-bar-toggle-arrow {
    transform: scale(3); /* Scale up when collapsed */
}

/* 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));
    overflow: hidden; /* Clip cooldown overlay to slot bounds */
}

.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;
    /* Center the cooldown overlay to match the 70% icon size */
    left: 15%;
    width: 70%;
    bottom: 15%;
    height: 0%;
    max-height: 70%; /* Cap at icon size */
    background: rgba(0, 0, 0, 0.7);
    transition: height 0.1s linear;
    pointer-events: none;
    border-radius: 4px;
    /* Clip to parent bounds to ensure it never exceeds slot size */
    overflow: hidden;
}

.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 bar tooltip overlay - renders above everything */
#action-bar-tooltip-overlay {
    position: fixed;
    padding: calc(16px * var(--ui-scale));
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    color: #FFD700;
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(4px * var(--ui-scale));
    font-size: calc(18px * var(--ui-scale));
    white-space: normal;
    text-align: left;
    z-index: 999999;
    pointer-events: none;
    width: calc(420px * var(--ui-scale));
    line-height: 1.4;
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(0, 0, 0, 0.9);
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

/* 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;
}

/* Stats tooltip overlay - renders above everything */
#stats-tooltip-overlay {
    position: fixed;
    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: 999999;
    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;
    width: 350px;
    max-width: 90vw;
    margin-right: 10px;
}

#stats-tooltip-overlay.visible {
    display: block;
    animation: tooltipSlideInFromRight 0.2s ease-out;
}

@keyframes tooltipSlideInFromRight {
    from {
        opacity: 0;
        transform: translate(-100%, -105%);
    }
    to {
        opacity: 1;
        transform: translate(-100%, -100%);
    }
}


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

@keyframes tooltipFadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}


.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: auto; /* Allow mouse cursor visibility */
    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.9rem;
    text-align: center;
    margin: 0.5rem 0 1rem 0;
    font-style: italic;
}

/* Hotkey Settings */
.hotkey-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 1rem;
}

.hotkey-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hotkey-setting label {
    color: #d0d0d0;
    font-size: 0.9rem;
    min-width: 120px;
}

.hotkey-btn {
    min-width: 100px;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(70, 130, 180, 0.3), rgba(100, 149, 237, 0.4));
    border: 2px solid #4682B4;
    border-radius: 5px;
    color: #FFFFFF;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.hotkey-btn:hover {
    background: linear-gradient(135deg, rgba(70, 130, 180, 0.5), rgba(100, 149, 237, 0.6));
    border-color: #5A9BD4;
    transform: scale(1.05);
}

.hotkey-btn.rebinding {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.4), rgba(255, 140, 0, 0.5));
    border-color: #FFA500;
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.hotkey-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* 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.9rem * 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 Card Tooltips - Ensure they appear above canvas */
.perk-card[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    top: -10px;
    transform: translate(-50%, -100%);
    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: 100001;
    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);
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-100% - 5px));
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%);
    }
}

.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: #C0C0C0;
    text-shadow: 0 0 10px rgba(192, 192, 192, 0.6);
}

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

.perk-name.hero-specific-darkranger {
    color: #9D7FDB;
    text-shadow: 0 0 10px rgba(157, 127, 219, 0.6);
}

.perk-name.hero-specific-monk {
    color: #FF9933;
    text-shadow: 0 0 10px rgba(255, 153, 51, 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);
}

/* Victory Modal Highscore Entry - Base Styling */
#victory-highscore-entry {
    margin: 1.5rem 0;
}

#victory-entry-title {
    color: #ffa500;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-align: center;
}

#victory-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;
    margin-bottom: 1rem;
}

#victory-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;
    }

    .ingame-logo {
        width: 30px;
        height: 30px;
        left: 0.5rem;
    }

    .return-menu-dialog {
        left: 42px;
        padding: 0.5rem 0.7rem;
        gap: 0.6rem;
    }

    .return-menu-text {
        font-size: 0.7rem;
    }

    .return-menu-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }

    .bar-container {
        gap: 0.3rem;
        margin-left: 0;
    }

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

    .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-info-panel {
        min-width: auto;
        width: 100%;
        padding: 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-info-panel {
        display: none !important; /* Hide stats/donations 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;
    }

    .main-logo {
        height: 80px;
    }

    .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;
    }

    .ingame-logo {
        width: 25px;
        height: 25px;
        left: 0.3rem;
    }

    .return-menu-dialog {
        left: 35px;
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }

    .return-menu-text {
        font-size: 0.65rem;
    }

    .return-menu-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }

    #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;
    }

    .main-logo {
        height: 60px;
    }

    .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: calc(90vh / var(--ui-scale));
    overflow-y: auto;
    transform: scale(var(--ui-scale));
    transform-origin: top center;
}

.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: #FFA500;
}

.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;
}

/* ========================================
   FINAL BOSS VICTORY MODAL
   ======================================== */

.final-boss-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 100%);
    border: calc(4px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(16px * var(--ui-scale));
    padding: calc(30px * var(--ui-scale));
    max-width: calc(700px * var(--ui-scale));
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 calc(40px * var(--ui-scale)) rgba(255, 215, 0, 0.6),
                0 0 calc(80px * var(--ui-scale)) rgba(255, 215, 0, 0.4);
    animation: victoryFadeIn 0.5s ease-out;
    position: relative;
    z-index: 10001;
    cursor: default;
    pointer-events: auto;
}

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

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

.victory-message {
    font-size: calc(24px * var(--ui-scale));
    color: #FFD700;
    text-align: center;
    font-weight: bold;
    margin: 0;
    text-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.8);
}

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

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

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

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

.difficulty-warning {
    font-size: calc(13px * var(--ui-scale));
    color: #FF6B6B;
    text-align: center;
    padding: calc(15px * var(--ui-scale));
    background: rgba(255, 107, 107, 0.1);
    border: calc(2px * var(--ui-scale)) solid rgba(255, 107, 107, 0.3);
    border-radius: calc(8px * var(--ui-scale));
    margin: 0;
}

.difficulty-warning strong {
    color: #FF4444;
}

/* Final Boss Loot Display */
.final-boss-loot-display {
    padding: calc(20px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.4);
    border-radius: calc(12px * var(--ui-scale));
    border: calc(2px * var(--ui-scale)) solid rgba(255, 215, 0, 0.3);
    min-height: calc(120px * var(--ui-scale));
}

.final-boss-question {
    margin-top: calc(10px * var(--ui-scale));
}

.continue-prompt {
    font-size: calc(16px * var(--ui-scale));
    color: #FFFFFF;
    text-align: center;
    font-weight: bold;
    margin: 0 0 calc(20px * var(--ui-scale)) 0;
}

.final-boss-actions {
    display: flex;
    gap: calc(20px * var(--ui-scale));
}

.final-boss-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;
}

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

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

.final-boss-btn .btn-desc {
    font-size: calc(10px * var(--ui-scale));
    color: #AAAAAA;
    text-align: center;
}

.final-boss-btn.continue-btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #60a5fa;
}

.final-boss-btn.continue-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(59, 130, 246, 0.4);
}

.final-boss-btn.finish-btn {
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    border-color: #4ade80;
}

.final-boss-btn.finish-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    border-color: #86efac;
    transform: translateY(-2px);
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(34, 197, 94, 0.4);
}

/* ========================================
   MILESTONE TOWN MODAL
   ======================================== */

.milestone-town-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: calc(4px * var(--ui-scale)) solid #60a5fa;
    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(96, 165, 250, 0.5),
                0 0 calc(60px * var(--ui-scale)) rgba(96, 165, 250, 0.3);
    animation: milestoneFadeIn 0.4s ease-out;
    position: relative;
    z-index: 10001;
    cursor: default;
    pointer-events: auto;
}

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

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

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

.milestone-message span {
    color: #FFD700;
}

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

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

.milestone-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;
}

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

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

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

.milestone-btn.town-btn {
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    border-color: #4ade80;
}

.milestone-btn.town-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    border-color: #86efac;
    transform: translateY(-2px);
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(34, 197, 94, 0.4);
}

.milestone-btn.continue-btn {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border-color: #60a5fa;
}

.milestone-btn.continue-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(12px * var(--ui-scale)) rgba(59, 130, 246, 0.4);
}

/* 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%;
    }

    .final-boss-actions {
        flex-direction: column;
    }

    .final-boss-btn {
        width: 100%;
    }

    .milestone-town-actions {
        flex-direction: column;
    }

    .milestone-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-gold-display {
    background: linear-gradient(135deg, #4a3a1a 0%, #2a1a0a 100%);
    border: calc(2px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(12px * var(--ui-scale));
    margin-bottom: calc(15px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(16px * var(--ui-scale));
    text-align: center;
    font-weight: bold;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.3);
}

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

.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;
}

/* Drop chance display below item */
.loot-drop-chance {
    font-size: calc(14px * var(--ui-scale));
    font-weight: bold;
    color: #4FC3F7;
    text-shadow:
        -1px -1px 2px #000,
        1px -1px 2px #000,
        -1px 1px 2px #000,
        1px 1px 2px #000;
    margin-top: calc(8px * var(--ui-scale));
    text-align: center;
}

/* 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));
}

/* Game item tooltip (inventory/shop - HTML overlay) */
.game-item-tooltip {
    position: fixed;
    z-index: 100004;
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(16px * var(--ui-scale));
    width: calc(420px * var(--ui-scale));
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
                inset 0 calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s ease, width 0.1s ease;
    pointer-events: none;
}

/* Expand tooltip width when shift is held */
.game-item-tooltip.shift-expanded {
    width: calc(480px * var(--ui-scale)) !important;
}

/* Rarity-based border colors for game tooltip */
.game-item-tooltip[data-rarity="common"] { border-color: #FFFFFF !important; }
.game-item-tooltip[data-rarity="uncommon"] { border-color: #4CAF50 !important; }
.game-item-tooltip[data-rarity="rare"] { border-color: #2196F3 !important; }
.game-item-tooltip[data-rarity="epic"] { border-color: #9C27B0 !important; }
.game-item-tooltip[data-rarity="legendary"] { border-color: #FF9800 !important; }
.game-item-tooltip[data-rarity="seasonal"] { border-color: #00FF00 !important; }

.game-item-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   FORGE INTERFACE (HTML Version - Matches Tooltip Style)
   ======================================== */
.forge-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10015; /* Higher than canvas (10010) but lower than forge-panel (10020) */
    display: flex;
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    pointer-events: none; /* Don't block clicks - only forge panel should capture events */
    transform: translate(-8%, 3%); /* Shift slightly up and left, but down more so it fits in viewport */
}

.forge-interface.hidden {
    display: none !important;
}

.forge-interface .hidden {
    display: none !important;
}

/* Dark overlay REMOVED - user wants full interaction with items */
.forge-overlay {
    display: none !important;
}

/* Ensure inventory stays above canvas and forge */
.inventory-panel {
    z-index: 10025 !important;
    position: relative !important;
}

/* Main forge panel - tooltip style, viewport-scaled */
.forge-panel {
    position: relative;
    z-index: 10020; /* Higher than canvas (10010) so forge appears on top */
    width: 40vw;
    height: 75vh;
    --ui-scale: var(--panel-scale, 1);
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid #8B4513;
    border-radius: calc(8px * var(--ui-scale));
    box-shadow: 0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
                inset 0 calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    pointer-events: all; /* Re-enable pointer events only for the panel */
}

/* Header section with portrait, dialogue, and forge slot */
.forge-header {
    padding: calc(20px * var(--ui-scale));
    border-bottom: calc(2px * var(--ui-scale)) solid rgba(139, 69, 19, 0.5);
    background: linear-gradient(180deg, rgba(139, 69, 19, 0.2) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(30px * var(--ui-scale));
    position: relative;
    min-height: calc(400px * var(--ui-scale));
}

/* Portrait - positioned on left side absolutely, moved down a bit */
.forge-portrait {
    position: absolute;
    left: calc(20px * var(--ui-scale));
    top: calc(110px * var(--ui-scale)); /* Moved down for spacing from title */
    width: calc(225px * var(--ui-scale));
    height: calc(225px * var(--ui-scale));
    border: calc(4px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(6px * var(--ui-scale));
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
    z-index: 1;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Dialogue section - centered */
.forge-dialogue {
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--ui-scale));
    align-items: center;
    justify-content: center;
}

.forge-title {
    font-size: calc(42px * var(--ui-scale));
    font-weight: 900;
    color: #FFD700;
    text-shadow: calc(3px * var(--ui-scale)) calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
    letter-spacing: calc(2px * var(--ui-scale));
    text-align: center;
    margin-bottom: calc(4px * var(--ui-scale));
}

.forge-subtitle {
    font-size: calc(26px * var(--ui-scale));
    font-weight: 700;
    color: #CD853F;
    text-align: center;
    font-style: italic;
    margin-bottom: calc(16px * var(--ui-scale));
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.6);
}

/* Speech bubble - positioned to the left near portrait, WIDER for 2 rows instead of 4 */
.forge-dialogue-text {
    position: absolute;
    left: calc(270px * var(--ui-scale)); /* Position next to portrait */
    top: calc(170px * var(--ui-scale)); /* Aligned with moved-down portrait */
    font-size: calc(18px * var(--ui-scale));
    font-weight: 600;
    color: #2a1a0a;
    line-height: 1.6;
    padding: calc(20px * var(--ui-scale));
    background: #FFF8E7;
    border: calc(3px * var(--ui-scale)) solid #8B4513;
    border-radius: calc(8px * var(--ui-scale));
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
    max-width: calc(500px * var(--ui-scale)); /* Narrower to not overlap with forge slot */
    z-index: 2;
    pointer-events: none; /* Allow clicks to pass through to elements below */
}

/* Speech bubble pointer (pointing left to portrait) */
.forge-dialogue-text::before {
    content: '';
    position: absolute;
    left: calc(-15px * var(--ui-scale));
    top: calc(20px * var(--ui-scale));
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(10px * var(--ui-scale)) calc(15px * var(--ui-scale)) calc(10px * var(--ui-scale)) 0;
    border-color: transparent #8B4513 transparent transparent;
}

.forge-dialogue-text::after {
    content: '';
    position: absolute;
    left: calc(-11px * var(--ui-scale));
    top: calc(22px * var(--ui-scale));
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale)) calc(8px * var(--ui-scale)) 0;
    border-color: transparent #FFF8E7 transparent transparent;
}

/* Forge slot container - centered below title/subtitle, below speech bubble */
.forge-slot-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(10px * var(--ui-scale));
    margin-top: calc(190px * var(--ui-scale)); /* Moved down for spacing from title */
    position: relative;
    z-index: 3; /* Above speech bubble (z-index: 2) */
}

.forge-slot-label {
    font-size: calc(18px * var(--ui-scale));
    font-weight: 900;
    color: #FF8C00;
    text-shadow: calc(2px * var(--ui-scale)) calc(2px * var(--ui-scale)) calc(3px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
    letter-spacing: calc(1px * var(--ui-scale));
}

.forge-slot {
    width: calc(150px * var(--ui-scale));
    height: calc(130px * var(--ui-scale));
    background: radial-gradient(circle, rgba(42, 26, 10, 0.9) 0%, rgba(10, 6, 4, 0.9) 100%);
    border: calc(3px * var(--ui-scale)) solid #FF8C00;
    border-radius: calc(4px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.forge-slot:hover {
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 140, 0, 0.5);
}

/* Forge slot rarity borders */
.forge-slot[data-rarity="common"] { border-color: #DDDDDD !important; }
.forge-slot[data-rarity="rare"] { border-color: #4DB8FF !important; }
.forge-slot[data-rarity="epic"] { border-color: #BB77FF !important; }
.forge-slot[data-rarity="legendary"] { border-color: #FFE44D !important; }
.forge-slot[data-rarity="seasonal"] { border-color: #00FF00 !important; }

.forge-slot-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: calc(17px * var(--ui-scale));
    font-weight: 700;
    color: #888888;
    text-align: center;
    line-height: 1.4;
    width: 100%;
    pointer-events: none;
}

.forge-slot-icon {
    width: calc(110px * var(--ui-scale));
    height: calc(110px * var(--ui-scale));
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.forge-slot-name {
    font-size: calc(16px * var(--ui-scale));
    font-weight: 800;
    color: #FFD700;
    text-align: center;
    max-width: calc(180px * var(--ui-scale));
    word-wrap: break-word;
    line-height: 1.3;
}

.forge-slot-remove-hint {
    font-size: calc(13px * var(--ui-scale));
    font-weight: 600;
    color: #999999;
    text-align: center;
    margin-top: calc(6px * var(--ui-scale));
}

/* Stats panel - matches tooltip styling */
.forge-stats-panel {
    flex: 1;
    margin: 0 calc(20px * var(--ui-scale)) calc(20px * var(--ui-scale)) calc(20px * var(--ui-scale));
    padding: calc(16px * var(--ui-scale));
    background: rgba(20, 15, 10, 0.95);
    border: calc(3px * var(--ui-scale)) solid #5a4a3a;
    border-radius: calc(6px * var(--ui-scale));
    overflow-y: auto;
    overflow-x: hidden;
    min-height: calc(200px * var(--ui-scale));
    max-height: calc(400px * var(--ui-scale));
}

/* Stats panel rarity borders */
.forge-stats-panel[data-rarity="common"] { border-color: #DDDDDD !important; }
.forge-stats-panel[data-rarity="rare"] { border-color: #4DB8FF !important; }
.forge-stats-panel[data-rarity="epic"] { border-color: #BB77FF !important; }
.forge-stats-panel[data-rarity="legendary"] { border-color: #FFE44D !important; }
.forge-stats-panel[data-rarity="seasonal"] { border-color: #00FF00 !important; }

.forge-stats-empty {
    font-size: calc(18px * var(--ui-scale));
    font-weight: 600;
    color: #999999;
    text-align: center;
    padding: calc(50px * var(--ui-scale));
    font-style: italic;
}

/* Item header in stats panel */
.forge-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: calc(16px * var(--ui-scale));
}

.forge-item-info {
    display: flex;
    flex-direction: column;
    gap: calc(6px * var(--ui-scale));
}

.forge-item-name {
    font-size: calc(28px * var(--ui-scale));
    font-weight: 900;
    color: #FFD700;
    word-break: break-word;
    line-height: 1.2;
    text-shadow: calc(2px * var(--ui-scale)) calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

.forge-item-rarity {
    font-size: calc(16px * var(--ui-scale));
    font-weight: 700;
    color: #4DB8FF;
    text-transform: capitalize;
}

.forge-upgrades-counter {
    font-size: calc(16px * var(--ui-scale));
    font-weight: 900;
    color: #00FF88;
    text-align: right;
    white-space: nowrap;
}

.forge-upgrades-counter.exhausted {
    color: #FF4444;
}

.forge-item-desc {
    font-size: calc(15px * var(--ui-scale));
    font-weight: 600;
    color: #CCCCCC;
    font-style: italic;
    margin-bottom: calc(16px * var(--ui-scale));
    word-break: break-word;
    line-height: 1.5;
}

.forge-separator {
    height: calc(1px * var(--ui-scale));
    background: #5a4a3a;
    margin: calc(12px * var(--ui-scale)) 0;
}

/* Stats list */
.forge-stats-list {
    display: flex;
    flex-direction: column;
    gap: calc(12px * var(--ui-scale));
}

/* Individual stat row */
.forge-stat-row {
    padding: calc(14px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.2);
    border-radius: calc(6px * var(--ui-scale));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: calc(14px * var(--ui-scale));
    transition: background 0.2s;
}

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

.forge-stat-row.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.forge-stat-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.forge-stat-line {
    display: flex;
    align-items: baseline;
    gap: calc(6px * var(--ui-scale));
    margin-bottom: calc(4px * var(--ui-scale));
    flex-wrap: wrap;
}

.forge-stat-value {
    font-size: calc(22px * var(--ui-scale));
    font-weight: 900;
    color: #00FF88;
    flex-shrink: 0;
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.6);
}

.forge-stat-value.negative {
    color: #FF4444;
}

.forge-stat-name {
    font-size: calc(22px * var(--ui-scale));
    font-weight: 700;
    color: #FFFFFF;
    word-break: break-word;
}

/* Gold stats (damageReflection, damageReduction, fireAuraDPS, stunImmunity) */
.forge-stat-value.gold-stat,
.forge-stat-name.gold-stat {
    color: #FFD700;
}

.forge-stat-tier {
    font-size: calc(20px * var(--ui-scale));
    color: #FFD700;
    font-weight: 900;
    flex-shrink: 0;
}

/* Tier 3 star - bigger with white/red double border */
.forge-stat-tier.tier3 {
    font-size: calc(28px * var(--ui-scale));
    color: #FFFFFF;
    text-shadow:
        0 0 2px #FF0000,
        0 0 4px #FF0000,
        0 0 6px #FF4444,
        1px 1px 0 #FF0000,
        -1px -1px 0 #FF0000,
        1px -1px 0 #FF0000,
        -1px 1px 0 #FF0000;
}

.forge-stat-preview {
    font-size: calc(16px * var(--ui-scale));
    font-weight: 600;
    color: #999999;
    word-break: break-word;
}

/* Upgrade button */
.forge-upgrade-btn {
    padding: calc(10px * var(--ui-scale)) calc(18px * var(--ui-scale));
    background: rgba(139, 69, 19, 0.8);
    border: calc(2px * var(--ui-scale)) solid #CD853F;
    border-radius: calc(6px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(16px * var(--ui-scale));
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

.forge-upgrade-btn:hover:not(:disabled) {
    background: #FFD700;
    border-color: #FFFFFF;
    color: #000000;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.5);
}

.forge-upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error message */
.forge-error-message {
    position: fixed;
    bottom: 50%;
    left: 50%;
    transform: translate(-50%, 50%);
    padding: calc(18px * var(--ui-scale)) calc(32px * var(--ui-scale));
    background: rgba(255, 68, 68, 0.95);
    color: #FFFFFF;
    font-size: calc(18px * var(--ui-scale));
    font-weight: 900;
    border-radius: calc(8px * var(--ui-scale));
    box-shadow: 0 calc(6px * var(--ui-scale)) calc(16px * var(--ui-scale)) rgba(0, 0, 0, 0.6);
    z-index: 10002;
    max-width: calc(500px * var(--ui-scale));
    text-align: center;
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

/* Close button */
.forge-close-btn {
    position: absolute;
    top: calc(16px * var(--ui-scale));
    right: calc(16px * var(--ui-scale));
    width: calc(44px * var(--ui-scale));
    height: calc(44px * var(--ui-scale));
    background: rgba(139, 69, 19, 0.8);
    border: calc(3px * var(--ui-scale)) solid #CD853F;
    border-radius: calc(6px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(28px * var(--ui-scale));
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3;
}

.forge-close-btn:hover {
    background: #FF4444;
    border-color: #FFFFFF;
    color: #FFFFFF;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 68, 68, 0.5);
}

/* ========================================
   VENDOR UI (Castle Shop, Scroll Shop, Gambler, Black Market)
   ======================================== */

/* Vendor interface container - same position as forge */
.vendor-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10015;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.vendor-interface.hidden {
    display: none !important;
}

/* Overlay background - no dimming */
.vendor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

/* Main vendor panel - same style as forge, viewport-scaled */
.vendor-panel {
    position: relative;
    z-index: 10020;
    width: 40vw;
    height: 70vh;
    --ui-scale: var(--panel-scale, 1);
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid #8B4513;
    border-radius: calc(8px * var(--ui-scale));
    box-shadow:
        0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
        inset 0 calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.1);
    font-family: 'MedievalSharp', Georgia, 'Times New Roman', serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    pointer-events: all;
    display: flex;
    flex-direction: column;
}

/* Vendor header section */
.vendor-header {
    padding: calc(20px * var(--ui-scale));
    border-bottom: calc(2px * var(--ui-scale)) solid rgba(139, 69, 19, 0.5);
    background: linear-gradient(180deg, rgba(139, 69, 19, 0.2) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(16px * var(--ui-scale));
    position: relative;
    min-height: calc(340px * var(--ui-scale));
}

/* Vendor portrait */
.vendor-portrait {
    position: absolute;
    left: calc(20px * var(--ui-scale));
    top: calc(90px * var(--ui-scale));
    width: calc(200px * var(--ui-scale));
    height: calc(200px * var(--ui-scale));
    border: calc(4px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(6px * var(--ui-scale));
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(255, 215, 0, 0.6);
    z-index: 1;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    object-fit: cover;
}

/* Vendor title section */
.vendor-title-section {
    display: flex;
    flex-direction: column;
    gap: calc(4px * var(--ui-scale));
    align-items: center;
    justify-content: center;
}

.vendor-title {
    font-size: calc(42px * var(--ui-scale));
    font-weight: 900;
    color: #FFD700;
    text-shadow: calc(3px * var(--ui-scale)) calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
    letter-spacing: calc(2px * var(--ui-scale));
    text-align: center;
}

.vendor-subtitle {
    font-size: calc(26px * var(--ui-scale));
    font-weight: 700;
    color: #CD853F;
    text-align: center;
    font-style: italic;
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.6);
}

/* Vendor speech bubble */
.vendor-dialogue-text {
    position: absolute;
    left: calc(245px * var(--ui-scale));
    top: calc(140px * var(--ui-scale));
    font-size: calc(18px * var(--ui-scale));
    font-weight: 600;
    color: #2a1a0a;
    line-height: 1.6;
    padding: calc(20px * var(--ui-scale));
    background: #FFF8E7;
    border: calc(3px * var(--ui-scale)) solid #8B4513;
    border-radius: calc(8px * var(--ui-scale));
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(8px * var(--ui-scale)) rgba(0, 0, 0, 0.3);
    max-width: calc(450px * var(--ui-scale));
    z-index: 2;
    pointer-events: none;
}

/* Speech bubble pointer */
.vendor-dialogue-text::before {
    content: '';
    position: absolute;
    left: calc(-15px * var(--ui-scale));
    top: calc(20px * var(--ui-scale));
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(10px * var(--ui-scale)) calc(15px * var(--ui-scale)) calc(10px * var(--ui-scale)) 0;
    border-color: transparent #8B4513 transparent transparent;
}

.vendor-dialogue-text::after {
    content: '';
    position: absolute;
    left: calc(-11px * var(--ui-scale));
    top: calc(22px * var(--ui-scale));
    width: 0;
    height: 0;
    border-style: solid;
    border-width: calc(8px * var(--ui-scale)) calc(12px * var(--ui-scale)) calc(8px * var(--ui-scale)) 0;
    border-color: transparent #FFF8E7 transparent transparent;
}

/* Vendor items panel */
.vendor-items-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

/* Vendor items grid - 5 columns x 4 rows = 20 items per page */
.vendor-items-grid {
    display: grid;
    grid-template-columns: repeat(5, calc(110px * var(--ui-scale)));
    grid-template-rows: repeat(4, calc(110px * var(--ui-scale)));
    gap: calc(10px * var(--ui-scale));
    padding: calc(15px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.3);
    border-radius: calc(8px * var(--ui-scale));
    border: calc(2px * var(--ui-scale)) solid rgba(139, 69, 19, 0.5);
    pointer-events: auto;
}

/* Vendor item slot */
.vendor-item-slot {
    width: calc(100px * var(--ui-scale));
    height: calc(100px * var(--ui-scale));
    background: radial-gradient(circle, rgba(42, 26, 10, 0.9) 0%, rgba(10, 6, 4, 0.9) 100%);
    border: calc(2px * var(--ui-scale)) solid #5a3a1a;
    border-radius: calc(4px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
    position: relative;
    pointer-events: auto;
}

.vendor-item-slot:hover {
    transform: scale(1.05);
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 215, 0, 0.4);
}

.vendor-item-slot[data-rarity="common"] { border-color: #FFFFFF; }
.vendor-item-slot[data-rarity="uncommon"] { border-color: #4CAF50; }
.vendor-item-slot[data-rarity="rare"] { border-color: #2196F3; }
.vendor-item-slot[data-rarity="epic"] { border-color: #9C27B0; }
.vendor-item-slot[data-rarity="legendary"] { border-color: #FF9800; }
.vendor-item-slot[data-rarity="seasonal"] { border-color: #00FF00; }

.vendor-item-slot.empty {
    border-color: #3a2a1a;
    cursor: default;
}

.vendor-item-slot.empty:hover {
    transform: none;
    box-shadow: none;
}

/* Vendor item icon */
.vendor-item-icon {
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none;
}

/* Vendor item price tag */
.vendor-item-price {
    position: absolute;
    bottom: calc(4px * var(--ui-scale));
    right: calc(4px * var(--ui-scale));
    display: flex;
    align-items: center;
    gap: calc(3px * var(--ui-scale));
    background: transparent;
    padding: calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale));
    font-size: calc(18px * var(--ui-scale));
    color: #FFD700;
    font-weight: bold;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 1), -1px -1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.vendor-price-icon {
    width: calc(18px * var(--ui-scale));
    height: calc(18px * var(--ui-scale));
    object-fit: contain;
}

/* Vendor buy confirmation popup */
.vendor-confirm-popup {
    position: fixed;
    z-index: 100005;
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid #FFD700;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale));
    box-shadow: 0 calc(8px * var(--ui-scale)) calc(32px * var(--ui-scale)) rgba(0, 0, 0, 0.9);
    font-family: 'MedievalSharp', Georgia, serif;
    pointer-events: all;
}

.vendor-confirm-popup.hidden {
    display: none;
}

.vendor-confirm-text {
    color: #FFFFFF;
    font-size: calc(20px * var(--ui-scale));
    font-weight: bold;
    text-align: center;
    margin-bottom: calc(15px * var(--ui-scale));
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.vendor-confirm-buttons {
    display: flex;
    gap: calc(15px * var(--ui-scale));
    justify-content: center;
}

.vendor-confirm-yes,
.vendor-confirm-no {
    padding: calc(10px * var(--ui-scale)) calc(25px * var(--ui-scale));
    font-size: calc(16px * var(--ui-scale));
    font-weight: bold;
    border: calc(2px * var(--ui-scale)) solid;
    border-radius: calc(4px * var(--ui-scale));
    cursor: pointer;
    font-family: 'MedievalSharp', Georgia, serif;
    transition: all 0.2s;
}

.vendor-confirm-yes {
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    border-color: #81C784;
    color: #FFFFFF;
}

.vendor-confirm-yes:hover {
    background: linear-gradient(180deg, #66BB6A 0%, #43A047 100%);
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(76, 175, 80, 0.5);
}

.vendor-confirm-no {
    background: linear-gradient(180deg, #f44336 0%, #c62828 100%);
    border-color: #ef5350;
    color: #FFFFFF;
}

.vendor-confirm-no:hover {
    background: linear-gradient(180deg, #ef5350 0%, #e53935 100%);
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(244, 67, 54, 0.5);
}

/* Vendor info text */
.vendor-info-text {
    text-align: center;
    color: #AAAAAA;
    font-size: calc(14px * var(--ui-scale));
    font-style: italic;
    padding: calc(10px * var(--ui-scale)) calc(20px * var(--ui-scale));
    margin-top: auto;
    border-top: calc(1px * var(--ui-scale)) solid rgba(139, 69, 19, 0.3);
}

/* Vendor error message */
.vendor-error-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100010;
    background: linear-gradient(135deg, rgba(80, 20, 20, 0.98) 0%, rgba(50, 10, 10, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid #FF4444;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale)) calc(40px * var(--ui-scale));
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(255, 68, 68, 0.5);
    animation: vendor-error-shake 0.4s ease-out;
    pointer-events: none;
}

.vendor-error-msg.hidden {
    display: none;
}

.vendor-error-text {
    color: #FF6666;
    font-size: calc(22px * var(--ui-scale));
    font-weight: bold;
    font-family: 'MedievalSharp', Georgia, serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes vendor-error-shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    20% { transform: translate(-50%, -50%) rotate(-2deg); }
    40% { transform: translate(-50%, -50%) rotate(2deg); }
    60% { transform: translate(-50%, -50%) rotate(-1deg); }
    80% { transform: translate(-50%, -50%) rotate(1deg); }
}

/* Vendor close button */
.vendor-close-btn {
    position: absolute;
    top: calc(16px * var(--ui-scale));
    right: calc(16px * var(--ui-scale));
    width: calc(44px * var(--ui-scale));
    height: calc(44px * var(--ui-scale));
    background: rgba(139, 69, 19, 0.8);
    border: calc(3px * var(--ui-scale)) solid #CD853F;
    border-radius: calc(6px * var(--ui-scale));
    color: #FFD700;
    font-size: calc(28px * var(--ui-scale));
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3;
}

.vendor-close-btn:hover {
    background: #FF4444;
    border-color: #FFFFFF;
    color: #FFFFFF;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 68, 68, 0.5);
}

/* Vendor gold display */
.vendor-gold-display {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: calc(8px * var(--ui-scale));
    padding: calc(15px * var(--ui-scale)) calc(25px * var(--ui-scale));
    background: rgba(0, 0, 0, 0.4);
    border-top: calc(2px * var(--ui-scale)) solid rgba(139, 69, 19, 0.5);
}

.vendor-gold-icon {
    width: calc(28px * var(--ui-scale));
    height: calc(28px * var(--ui-scale));
}

.vendor-gold-display span {
    font-size: calc(22px * var(--ui-scale));
    font-weight: 900;
    color: #FFD700;
    text-shadow: calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) calc(2px * var(--ui-scale)) rgba(0, 0, 0, 0.8);
}

.vendor-gold-label {
    color: #CCCCCC !important;
    font-weight: 600 !important;
    font-size: calc(18px * var(--ui-scale)) !important;
}

/* Scrollbar styling for vendor items panel */
.vendor-items-panel::-webkit-scrollbar {
    width: calc(10px * var(--ui-scale));
}

.vendor-items-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: calc(5px * var(--ui-scale));
}

.vendor-items-panel::-webkit-scrollbar-thumb {
    background: #8B4513;
    border-radius: calc(5px * var(--ui-scale));
}

/* Vendor items container with arrows */
.vendor-items-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(15px * var(--ui-scale));
    flex: 1;
    padding: calc(10px * var(--ui-scale)) calc(20px * var(--ui-scale));
    pointer-events: auto;
}

.vendor-arrow-with-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(5px * var(--ui-scale));
}

/* Vendor pagination arrows */
.vendor-arrow {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: calc(8px * var(--ui-scale));
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.vendor-arrow:hover {
    opacity: 1;
    transform: scale(1.1);
}

.vendor-arrow img {
    width: calc(50px * var(--ui-scale));
    height: calc(50px * var(--ui-scale));
    object-fit: contain;
}

.vendor-arrow-left img {
    transform: scaleX(-1);
}

.vendor-arrow.hidden {
    visibility: hidden;
    pointer-events: none;
}

/* Vendor page indicator */
.vendor-page-indicator {
    text-align: center;
    font-size: calc(18px * var(--ui-scale));
    font-weight: bold;
    color: #FFD700;
    margin-top: calc(5px * var(--ui-scale));
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.vendor-page-indicator.hidden {
    display: none;
}

/* Vendor item stock indicator */
.vendor-item-stock {
    position: absolute;
    top: calc(2px * var(--ui-scale));
    right: calc(4px * var(--ui-scale));
    font-size: calc(14px * var(--ui-scale));
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

/* Vendor item original price (strikethrough for discounts) */
.vendor-item-original-price {
    position: absolute;
    bottom: calc(18px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    font-size: calc(10px * var(--ui-scale));
    color: #888888;
    text-decoration: line-through;
    text-decoration-color: #FF0000;
    pointer-events: none;
}

.vendor-items-panel::-webkit-scrollbar-thumb:hover {
    background: #CD853F;
}

/* ========================================
   ITEM DRAG PREVIEW (HTML overlay)
   ======================================== */
.item-drag-preview {
    position: fixed;
    z-index: 999999; /* Above everything */
    pointer-events: none;
    width: calc(75px * var(--ui-scale, 1));
    height: calc(75px * var(--ui-scale, 1));
    background: rgba(20, 15, 25, 0.9);
    border: 3px solid #DDDDDD;
    border-radius: 6px;
    opacity: 0.9;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-drag-preview.hidden {
    display: none !important;
}

/* Rarity border colors with glow */
.item-drag-preview[data-rarity="common"] {
    border-color: #DDDDDD;
    box-shadow: 0 0 12px rgba(221, 221, 221, 0.6), 0 0 4px rgba(221, 221, 221, 0.8);
}
.item-drag-preview[data-rarity="rare"] {
    border-color: #4DB8FF;
    box-shadow: 0 0 12px rgba(77, 184, 255, 0.6), 0 0 4px rgba(77, 184, 255, 0.8);
}
.item-drag-preview[data-rarity="epic"] {
    border-color: #BB77FF;
    box-shadow: 0 0 12px rgba(187, 119, 255, 0.6), 0 0 4px rgba(187, 119, 255, 0.8);
}
.item-drag-preview[data-rarity="legendary"] {
    border-color: #FFE44D;
    box-shadow: 0 0 15px rgba(255, 228, 77, 0.7), 0 0 5px rgba(255, 228, 77, 0.9);
}
.item-drag-preview[data-rarity="seasonal"] {
    border-color: #00FF00;
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.6), 0 0 4px rgba(0, 255, 0, 0.8);
}

.item-drag-preview-icon {
    width: 88%;
    height: 88%;
    object-fit: contain;
    image-rendering: pixelated;
}

/* Tooltip container - icon floated left */
.tooltip-container {
    position: relative;
    min-height: calc(120px * var(--ui-scale));
}

/* Tooltip icon container (floated left) */
.tooltip-icon-container {
    float: left;
    width: calc(120px * var(--ui-scale));
    height: calc(120px * var(--ui-scale));
    background: linear-gradient(135deg, rgba(30, 20, 40, 0.8) 0%, rgba(40, 30, 50, 0.8) 100%);
    border: calc(2px * var(--ui-scale)) solid #4a3a6a;
    border-radius: calc(4px * var(--ui-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(6px * var(--ui-scale));
    margin-right: calc(12px * var(--ui-scale));
    margin-bottom: calc(12px * var(--ui-scale));
}

/* Tooltip icon image */
.tooltip-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Loot tooltip (shows on hover) */
.loot-tooltip {
    position: fixed;
    z-index: 100000;
    background: linear-gradient(135deg, rgba(15, 10, 25, 0.98) 0%, rgba(20, 15, 30, 0.98) 100%);
    border: calc(3px * var(--ui-scale)) solid;
    border-radius: calc(4px * var(--ui-scale));
    padding: calc(16px * var(--ui-scale));
    width: calc(420px * var(--ui-scale));
    box-shadow: 0 calc(4px * var(--ui-scale)) calc(20px * var(--ui-scale)) rgba(0, 0, 0, 0.9),
                inset 0 calc(1px * var(--ui-scale)) calc(1px * var(--ui-scale)) rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* Expand tooltip width when shift is held and stat ranges are shown */
.loot-tooltip.shift-expanded {
    width: calc(480px * var(--ui-scale));
}

/* Rarity-based border colors for loot tooltip */
.loot-tooltip[data-rarity="common"] { border-color: #FFFFFF !important; }
.loot-tooltip[data-rarity="uncommon"] { border-color: #4CAF50 !important; }
.loot-tooltip[data-rarity="rare"] { border-color: #2196F3 !important; }
.loot-tooltip[data-rarity="epic"] { border-color: #9C27B0 !important; }
.loot-tooltip[data-rarity="legendary"] { border-color: #FF9800 !important; }
.loot-tooltip[data-rarity="seasonal"] { border-color: #00FF00 !important; }

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

.loot-tooltip-header {
    padding-bottom: calc(8px * var(--ui-scale));
    margin-bottom: calc(8px * var(--ui-scale));
}

.loot-tooltip-name {
    font-size: calc(20px * var(--ui-scale));
    font-weight: bold;
    color: #FFFFFF;
    margin-bottom: calc(2px * var(--ui-scale));
    text-transform: uppercase;
    letter-spacing: calc(0.5px * var(--ui-scale));
}

.loot-tooltip-rarity {
    font-size: calc(13px * var(--ui-scale));
    font-weight: bold;
    margin-bottom: calc(2px * var(--ui-scale));
    line-height: 1.4;
}

/* 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-rarity-seasonal { color: #00FF00; }

.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; }

/* Armor text display (positioned at bottom of icon portrait, just above separator) */
.loot-tooltip-armor-text {
    position: absolute;
    top: calc(108px * var(--ui-scale));
    left: calc(132px * var(--ui-scale));
    font-size: calc(16px * var(--ui-scale));
    font-weight: bold;
    color: #FFFFFF;
    line-height: 1.4;
    white-space: nowrap;
}

.loot-tooltip-separator {
    border-bottom: calc(1px * var(--ui-scale)) solid rgba(107, 79, 163, 0.4);
    margin: calc(8px * var(--ui-scale)) 0;
    clear: both;
}

.loot-tooltip-description {
    font-size: calc(13px * var(--ui-scale));
    color: #b0b0c0;
    line-height: 1.5;
    margin: calc(4px * var(--ui-scale)) 0;
    clear: both;
}

.loot-tooltip-stats {
    font-size: calc(14px * var(--ui-scale));
    clear: both;
}

.loot-stat-line {
    color: #4CAF50;
    line-height: 1.7;
    font-size: calc(14px * var(--ui-scale));
}

.loot-stat-line.loot-stat-negative {
    color: #FF5555;
}

.loot-tooltip-footer {
    margin-top: calc(8px * var(--ui-scale));
    clear: both;
}

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

/* ===== MEDIEVAL MODAL ELEMENTS ===== */
/* These define structure only - theming applied via body.medieval-theme */

.medieval-border-top,
.medieval-border-bottom {
    height: 8px;
    background: repeating-linear-gradient(
        90deg,
        #8b7355 0px,
        #8b7355 20px,
        #5a4a3a 20px,
        #5a4a3a 40px
    );
    margin: -3rem -2.5rem 2rem -2.5rem;
    border-radius: 4px 4px 0 0;
}

.medieval-border-bottom {
    margin: 2rem -2.5rem -3rem -2.5rem;
    border-radius: 0 0 4px 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.stats-grid p {
    margin: 0.3rem 0;
    font-size: 1.1rem;
}

/* Victory modal specific styling (only when medieval theme active) */
body.medieval-theme .medieval-modal .medieval-backdrop {
    background: rgba(20, 15, 10, 0.85);
}

body.medieval-theme .medieval-modal .medieval-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    border-radius: 8px;
    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        inset 0 0 60px rgba(139, 115, 85, 0.15);
    position: relative;
    max-width: 600px;
    margin: 100px auto;
    padding: 3rem 2.5rem;
}

body.medieval-theme .medieval-title {
    font-family: 'Cinzel', 'Times New Roman', serif;
    font-size: 2.5rem;
    color: #d4af37;
    text-align: center;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(212, 175, 55, 0.4);
    margin-bottom: 1.5rem;
    letter-spacing: 3px;
}

body.medieval-theme .victory-stats {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 6px;
    border: 2px solid #8b7355;
    margin-bottom: 1.5rem;
}

body.medieval-theme .victory-message {
    font-size: 1.3rem;
    color: #d4af37;
    text-align: center;
    margin-bottom: 1rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .stats-grid p {
    color: #c9a96e;
}

body.medieval-theme .stats-grid span {
    color: #d4af37;
    font-weight: bold;
}

body.medieval-theme .medieval-btn {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 3px solid #8b7355;
    color: #d4af37;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 0 20px rgba(139, 115, 85, 0.1);
}

body.medieval-theme .medieval-btn:hover {
    background: linear-gradient(135deg, #6a5a4a 0%, #4a3f2f 100%);
    border-color: #d4af37;
    transform: translateY(-2px);
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .medieval-btn:active {
    transform: translateY(0);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

body.medieval-theme #victory-name-input {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
    color: #d4af37;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    margin-bottom: 1rem;
}

body.medieval-theme #victory-name-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.medieval-theme #victory-entry-title {
    color: #d4af37;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    text-align: center;
}


/* ===== MEDIEVAL THEME SYSTEM ===== */
/* Applied when body has 'medieval-theme' class */

/* Front Page / Hero Selection */
body.medieval-theme #hero-selection {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
}

body.medieval-theme #start-highscore-panel {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

body.medieval-theme #start-highscore-panel h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .patch-selector {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .patch-selector:focus {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.medieval-theme #start-highscore-list {
    color: #c9a96e;
}

body.medieval-theme .highscore-item {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #8b7355;
}

body.medieval-theme .highscore-item:hover {
    background: rgba(139, 115, 85, 0.2);
}

body.medieval-theme .rank {
    color: #d4af37;
}

body.medieval-theme .player-name,
body.medieval-theme .hero-name,
body.medieval-theme .score-value {
    color: #c9a96e;
}

/* Settings Panel */
body.medieval-theme .start-settings-panel {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .settings-panel-title {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .settings-section-title {
    color: #d4af37;
}

body.medieval-theme .auto-aim-label,
body.medieval-theme .audio-setting label,
body.medieval-theme .ui-scale-content label {
    color: #c9a96e;
}

body.medieval-theme .volume-slider {
    background: rgba(0, 0, 0, 0.4);
}

body.medieval-theme .ui-scale-input {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .ui-scale-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .default-btn {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .default-btn:hover {
    background: linear-gradient(135deg, #6a5a4a 0%, #4a3f2f 100%);
    border-color: #d4af37;
}

/* Info Panel */
body.medieval-theme #game-info-panel {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .info-tab {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #8b7355;
    color: #c9a96e;
}

body.medieval-theme .info-tab.active {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    color: #d4af37;
    border-color: #d4af37;
}

body.medieval-theme .info-tab:hover {
    background: rgba(139, 115, 85, 0.2);
    color: #d4af37;
}

body.medieval-theme .stat-label-main,
body.medieval-theme .stat-value-main {
    color: #d4af37;
}

body.medieval-theme .hero-stats-item {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #8b7355;
}

body.medieval-theme .hero-stats-item:hover {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Logo and Title */
body.medieval-theme .game-subtitle {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .version-text {
    color: #c9a96e;
}

body.medieval-theme .changelog-btn {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .changelog-btn:hover {
    background: linear-gradient(135deg, #6a5a4a 0%, #4a3f2f 100%);
    border-color: #d4af37;
}

/* Hero Selection Cards */
body.medieval-theme .hero-card {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.medieval-theme .hero-card:hover {
    border-color: #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .hero-name {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .hero-description {
    color: #c9a96e;
}

/* All Modals */
body.medieval-theme .modal-backdrop {
    background: rgba(20, 15, 10, 0.85);
}

body.medieval-theme .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme .modal-content h2,
body.medieval-theme .modal-content h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.4);
}

body.medieval-theme .modal-content p,
body.medieval-theme .modal-content label {
    color: #c9a96e;
}

/* Modal Buttons */
body.medieval-theme .modal-content button,
body.medieval-theme .menu-btn {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 3px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .modal-content button:hover,
body.medieval-theme .menu-btn:hover {
    background: linear-gradient(135deg, #6a5a4a 0%, #4a3f2f 100%);
    border-color: #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* Modal Inputs */
body.medieval-theme input[type="text"],
body.medieval-theme input[type="number"],
body.medieval-theme select,
body.medieval-theme textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme input[type="text"]:focus,
body.medieval-theme input[type="number"]:focus,
body.medieval-theme select:focus,
body.medieval-theme textarea:focus {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* In-Game UI Panels */
body.medieval-theme .ui-panel,
body.medieval-theme #stat-panel,
body.medieval-theme #inventory-panel {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
}

body.medieval-theme .ui-panel h3,
body.medieval-theme .panel-title {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .stat-label {
    color: #c9a96e;
}

body.medieval-theme .stat-value {
    color: #d4af37;
}

/* Inventory Items */
body.medieval-theme .inventory-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
}

body.medieval-theme .inventory-slot:hover {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Highscore Modal */
body.medieval-theme #final-stats {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
}

body.medieval-theme #final-stats p {
    color: #c9a96e;
}

body.medieval-theme #final-stats span {
    color: #d4af37;
}

body.medieval-theme .highscore-message {
    color: #d4af37;
}

/* Changelog Modal */
body.medieval-theme .changelog-entry {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid #8b7355;
}

body.medieval-theme .changelog-version {
    color: #d4af37;
}

body.medieval-theme .changelog-date {
    color: #c9a96e;
}

/* Donations */
body.medieval-theme .donor-item {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #8b7355;
}

body.medieval-theme .donor-name,
body.medieval-theme .donor-amount {
    color: #c9a96e;
}

body.medieval-theme .donor-item.gold .donor-name,
body.medieval-theme .donor-item.gold .donor-amount {
    color: #d4af37;
}

/* Tooltips */
body.medieval-theme .tooltip {
    background: rgba(58, 47, 31, 0.95);
    border: 2px solid #8b7355;
    color: #c9a96e;
}

body.medieval-theme .tooltip-title {
    color: #d4af37;
}

/* Perk Selection */
body.medieval-theme .perk-card {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
}

body.medieval-theme .perk-card:hover {
    border-color: #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .perk-name {
    color: #d4af37;
}

body.medieval-theme .perk-description {
    color: #c9a96e;
}

/* Shop */
body.medieval-theme .shop-item {
    background: rgba(58, 47, 31, 0.9);
    border: 3px solid #8b7355;
}

body.medieval-theme .shop-item:hover {
    border-color: #d4af37;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .item-name {
    color: #d4af37;
}

body.medieval-theme .item-price {
    color: #d4af37;
}

body.medieval-theme .item-description {
    color: #c9a96e;
}

/* Level Up Message */
body.medieval-theme .level-up-message {
    color: #d4af37;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.6);
}

/* In-Game Top Bar */
body.medieval-theme #top-bar {
    background: linear-gradient(180deg, #3a2f1f 0%, #2a1f0f 100%);
    border-bottom: 3px solid #8b7355;
}

body.medieval-theme .difficulty-display,
body.medieval-theme .time-display,
body.medieval-theme #score-display {
    color: #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* In-Game Highscore Panel */
body.medieval-theme #highscore-panel {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border-right: 3px solid #8b7355;
}

body.medieval-theme #highscore-panel h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme #highscore-panel .panel-header {
    border-bottom: 2px solid #8b7355;
}

body.medieval-theme #highscore-list {
    color: #c9a96e;
}

/* Highscore Inspect Modal */
body.medieval-theme .highscore-inspect-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme .highscore-inspect-content .modal-header {
    border-bottom: 2px solid #8b7355;
}

body.medieval-theme .highscore-inspect-content .modal-header h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .inspect-body {
    color: #c9a96e;
}

body.medieval-theme .inspect-close-btn {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .inspect-close-btn:hover {
    background: linear-gradient(135deg, #6a5a4a 0%, #4a3f2f 100%);
    border-color: #d4af37;
}

/* Perk Selection Modal */
body.medieval-theme #perk-selection .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme #perk-selection h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Pause Menu */
body.medieval-theme #pause-menu .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
}

body.medieval-theme #pause-menu h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme #pause-menu .modal-header {
    border-bottom: 2px solid #8b7355;
}

/* Boss HP Bar */
body.medieval-theme .boss-hp-bar {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 3px solid #8b7355;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(139, 115, 85, 0.1);
}

body.medieval-theme .boss-name {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 15px rgba(212, 175, 55, 0.6);
}

body.medieval-theme .boss-number {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .boss-hp-bar-bg {
    background: linear-gradient(to bottom, #2a1f0f 0%, #1a0f05 100%);
    border: 3px solid #8b7355;
}

body.medieval-theme .boss-hp-fill {
    background: linear-gradient(to right, #8b0000 0%, #b22222 50%, #8b0000 100%);
}

body.medieval-theme .boss-hp-text {
    color: #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .boss-hp-portrait-container {
    border: 3px solid #8b7355;
    box-shadow: 0 0 15px rgba(139, 115, 85, 0.5);
}

/* Loot Window */
body.medieval-theme .loot-window {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme .loot-window-header {
    border-bottom: 2px solid #8b7355;
}

body.medieval-theme .loot-window-header h2,
body.medieval-theme .loot-window-header h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 15px rgba(212, 175, 55, 0.6);
}

body.medieval-theme .loot-close-btn {
    color: #d4af37;
}

body.medieval-theme .loot-close-btn:hover {
    color: #FFD700;
}

body.medieval-theme .loot-gold-display {
    background: linear-gradient(135deg, #5a4a3a 0%, #3a2f1f 100%);
    border: 2px solid #8b7355;
    color: #d4af37;
}

/* Town Portal & Boss Modals */
body.medieval-theme #town-portal-modal .modal-content,
body.medieval-theme #final-boss-modal .modal-content,
body.medieval-theme #milestone-town-modal .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
}

body.medieval-theme .town-portal-content h2,
body.medieval-theme #final-boss-modal h2,
body.medieval-theme #milestone-town-modal h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.medieval-theme .town-portal-content p,
body.medieval-theme #final-boss-modal p,
body.medieval-theme #milestone-town-modal p {
    color: #c9a96e;
}

/* Settings Menus */
body.medieval-theme #audio-settings-menu .modal-content,
body.medieval-theme #hotkey-settings-menu .modal-content,
body.medieval-theme #ui-settings-menu .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
}

body.medieval-theme #audio-settings-menu h2,
body.medieval-theme #hotkey-settings-menu h2,
body.medieval-theme #ui-settings-menu h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* XP and Ultimate Bars */
body.medieval-theme .exp-bar .bar-fill {
    background: linear-gradient(90deg, #8b7355 0%, #d4af37 100%);
    box-shadow: 0 0 10px #d4af37;
}

body.medieval-theme .ulti-bar .bar-fill {
    background: linear-gradient(90deg, #5a4a3a 0%, #8b7355 100%);
    box-shadow: 0 0 8px #8b7355;
}

body.medieval-theme .bar-text,
body.medieval-theme .bar-progress-text {
    color: #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Loot Choice Cards */
body.medieval-theme .loot-choice-card-item {
    background: linear-gradient(135deg, rgba(58, 47, 31, 0.6) 0%, rgba(42, 31, 15, 0.7) 100%);
}

body.medieval-theme .loot-choice-card-gold {
    background: linear-gradient(135deg, rgba(90, 74, 58, 0.6) 0%, rgba(58, 47, 31, 0.7) 100%);
    border-color: #d4af37;
}

body.medieval-theme .loot-choice-card:hover {
    border-color: #d4af37;
}

/* Action Slots */
body.medieval-theme .action-keybind {
    color: #d4af37;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Perklist, Changelog, Difficulty Modals */
body.medieval-theme .general-perks-modal {
    background: rgba(20, 15, 10, 0.85);
}

body.medieval-theme .general-perks-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme .general-perks-content h2 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.4);
}

body.medieval-theme .general-perks-close {
    background: rgba(139, 85, 85, 0.3);
    border: 2px solid #8b5555;
    color: #d4af37;
}

body.medieval-theme .general-perks-close:hover {
    background: rgba(139, 85, 85, 0.5);
    border-color: #d4af37;
}

body.medieval-theme .general-perk-category h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    border-bottom-color: rgba(139, 115, 85, 0.3);
}

body.medieval-theme .general-perk-item {
    background: rgba(58, 47, 31, 0.6);
    border-color: rgba(139, 115, 85, 0.3);
}

body.medieval-theme .general-perk-item:hover {
    background: rgba(139, 115, 85, 0.3);
    border-color: rgba(212, 175, 55, 0.5);
}

body.medieval-theme .general-perk-item .perk-name {
    color: #d4af37;
}

body.medieval-theme .general-perk-item .perk-desc {
    color: #c9a96e;
}

body.medieval-theme .general-perk-item .perk-values {
    color: #8b7355;
    border-top-color: rgba(139, 115, 85, 0.2);
}

/* Perks in Highscore Inspect */
body.medieval-theme .inspect-perks-section {
    background: rgba(58, 47, 31, 0.3);
    border: 2px solid #8b7355;
}

body.medieval-theme .inspect-perks-section h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    border-bottom-color: #8b7355;
}

body.medieval-theme .inspect-perk-item {
    background: rgba(58, 47, 31, 0.6);
    border-color: rgba(139, 115, 85, 0.3);
}

body.medieval-theme .inspect-perk-item:hover {
    background: rgba(139, 115, 85, 0.3);
    border-color: rgba(212, 175, 55, 0.5);
}

body.medieval-theme .inspect-perk-header {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
}

body.medieval-theme .inspect-perk-item .perk-name {
    color: #d4af37;
}

body.medieval-theme .inspect-perk-item .perk-desc {
    color: #c9a96e;
}

body.medieval-theme .inspect-perk-item .perk-values {
    color: #8b7355;
    border-top-color: rgba(139, 115, 85, 0.2);
}

body.medieval-theme .inspect-perk-name {
    color: #d4af37;
}

body.medieval-theme .inspect-perk-value {
    color: #8b7355;
}

body.medieval-theme .inspect-stats-section {
    background: rgba(58, 47, 31, 0.3);
    border: 2px solid #8b7355;
}

body.medieval-theme .inspect-stats-section h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    border-bottom-color: #8b7355;
}

/* Hero names in inspect and highscore list */
body.medieval-theme .inspect-hero-name,
body.medieval-theme .hero-class {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Pause Menu Perks List */
body.medieval-theme #pause-perks-list .inspect-perk-item {
    background: rgba(58, 47, 31, 0.6);
    border-color: rgba(139, 115, 85, 0.3);
}

body.medieval-theme #pause-perks-list .inspect-perk-item:hover {
    background: rgba(139, 115, 85, 0.3);
    border-color: rgba(212, 175, 55, 0.5);
}

/* ===== THEME RADIO BUTTONS ===== */
.theme-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.theme-radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.theme-radio-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.theme-radio-option input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.theme-radio-option .radio-label {
    font-size: 1rem;
    color: #FFFFFF;
    cursor: pointer;
}

/* Start Page Theme Options - Smaller and Left Aligned */
.start-settings-panel .settings-section .theme-radio-group {
    align-items: flex-start;
}

.start-settings-panel .theme-radio-group {
    align-items: flex-start;
    padding-left: 0;
}

.start-settings-panel .theme-radio-option {
    justify-content: flex-start;
    padding: 6px 0;
    width: 100%;
}

.start-settings-panel .theme-radio-option input[type="radio"] {
    width: 12px;
    height: 12px;
    margin-right: 8px;
}

.start-settings-panel .theme-radio-option .radio-label {
    font-size: 0.7rem;
}

/* Medieval theme radio buttons */
body.medieval-theme .theme-radio-option .radio-label {
    color: #c9a96e;
}

body.medieval-theme .theme-radio-option:hover {
    background: rgba(139, 115, 85, 0.2);
}

/* Pixelated theme radio buttons */
body.pixelated-theme .theme-radio-option .radio-label {
    color: #00FF00;
}

body.pixelated-theme .theme-radio-option:hover {
    background: rgba(0, 255, 0, 0.1);
}

/* ===== PIXELATED THEME SYSTEM ===== */
/* Authentic retro pixel game aesthetic with CRT effects */

/* Base pixelated rendering and retro effects */
body.pixelated-theme {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    font-smooth: never;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

/* Scanline overlay effect for authentic CRT look */
body.pixelated-theme::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 999999;
    animation: scanline-flicker 0.1s infinite;
}

@keyframes scanline-flicker {
    0% { opacity: 0.05; }
    50% { opacity: 0.08; }
    100% { opacity: 0.05; }
}

/* CRT screen curvature effect */
body.pixelated-theme::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 999998;
}

body.pixelated-theme canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: contrast(1.1) brightness(1.05);
}

/* Pixelated border mixin - creates retro box pattern */
.pixel-border {
    box-shadow:
        0 -4px 0 0 #00FF00,
        0 4px 0 0 #00FF00,
        -4px 0 0 0 #00FF00,
        4px 0 0 0 #00FF00,
        -4px -4px 0 0 #00FF00,
        4px -4px 0 0 #00FF00,
        -4px 4px 0 0 #00FF00,
        4px 4px 0 0 #00FF00;
}

/* Front Page / Hero Selection */
body.pixelated-theme #hero-selection {
    background:
        repeating-linear-gradient(
            0deg,
            #000000 0px,
            #000000 4px,
            #0a0a0a 4px,
            #0a0a0a 8px
        );
    border: none;
    position: relative;
}

body.pixelated-theme #start-highscore-panel {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        0 0 20px rgba(0, 255, 0, 0.5),
        0 8px 0 -4px #00FF00,
        0 -8px 0 -4px #00FF00,
        8px 0 0 -4px #00FF00,
        -8px 0 0 -4px #00FF00;
    position: relative;
}

body.pixelated-theme #start-highscore-panel h3 {
    color: #00FF00;
    font-family: 'Courier New', monospace;
    text-shadow:
        2px 0 0 #000000,
        -2px 0 0 #000000,
        0 2px 0 #000000,
        0 -2px 0 #000000,
        0 0 10px #00FF00;
    font-weight: bold;
    letter-spacing: 2px;
}

body.pixelated-theme .patch-selector {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .patch-selector:focus {
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

body.pixelated-theme #start-highscore-list {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .highscore-item {
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 2px solid #00FF00;
}

body.pixelated-theme .highscore-item:hover {
    background: rgba(0, 255, 0, 0.2);
}

body.pixelated-theme .rank {
    color: #FFFF00;
}

body.pixelated-theme .player-name,
body.pixelated-theme .hero-name,
body.pixelated-theme .score-value {
    color: #00FF00;
}

/* Settings Panel */
body.pixelated-theme .start-settings-panel {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

body.pixelated-theme .settings-panel-title {
    color: #00FF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
    font-weight: bold;
}

body.pixelated-theme .settings-section-title {
    color: #FFFF00;
}

body.pixelated-theme .auto-aim-label,
body.pixelated-theme .audio-setting label,
body.pixelated-theme .ui-scale-content label {
    color: #00FF00;
}

body.pixelated-theme .volume-slider {
    background: #000000;
}

body.pixelated-theme .ui-scale-input {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .ui-scale-input:focus {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme .default-btn {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .default-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #FFFF00;
}

/* Info Panel */
body.pixelated-theme #game-info-panel {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

body.pixelated-theme .info-tab {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .info-tab.active {
    background: rgba(0, 255, 0, 0.3);
    color: #FFFF00;
    border-color: #FFFF00;
}

body.pixelated-theme .info-tab:hover {
    background: rgba(0, 255, 0, 0.2);
    color: #FFFF00;
}

body.pixelated-theme .stat-label-main,
body.pixelated-theme .stat-value-main {
    color: #00FF00;
}

body.pixelated-theme .hero-stats-item {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00FF00;
}

body.pixelated-theme .hero-stats-item:hover {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* Logo and Title */
body.pixelated-theme .game-subtitle {
    color: #00FF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .version-text {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .changelog-btn {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .changelog-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #FFFF00;
}

/* Hero Selection Cards */
body.pixelated-theme .hero-card {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

body.pixelated-theme .hero-card:hover {
    border-color: #FFFF00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme .hero-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .hero-description {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* All Modals */
body.pixelated-theme .modal-backdrop {
    background: rgba(0, 0, 0, 0.9);
}

body.pixelated-theme .modal-content {
    background:
        repeating-linear-gradient(
            90deg,
            #000000 0px,
            #000000 2px,
            #001100 2px,
            #001100 4px
        ),
        repeating-linear-gradient(
            0deg,
            #000000 0px,
            #000000 2px,
            #001100 2px,
            #001100 4px
        );
    border: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        0 0 30px rgba(0, 255, 0, 0.6),
        0 8px 0 -4px #00FF00,
        0 -8px 0 -4px #00FF00,
        8px 0 0 -4px #00FF00,
        -8px 0 0 -4px #00FF00,
        8px 8px 0 -4px #00FF00,
        -8px 8px 0 -4px #00FF00,
        8px -8px 0 -4px #00FF00,
        -8px -8px 0 -4px #00FF00;
    position: relative;
}

body.pixelated-theme .modal-content h2,
body.pixelated-theme .modal-content h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow:
        2px 0 0 #000000,
        -2px 0 0 #000000,
        0 2px 0 #000000,
        0 -2px 0 #000000,
        2px 2px 0 #000000,
        -2px -2px 0 #000000,
        2px -2px 0 #000000,
        -2px 2px 0 #000000,
        0 0 15px #FFFF00;
    font-weight: bold;
    letter-spacing: 3px;
}

body.pixelated-theme .modal-content p,
body.pixelated-theme .modal-content label {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Modal Buttons */
body.pixelated-theme .modal-content button,
body.pixelated-theme .menu-btn {
    background: #000000;
    border: 3px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
    box-shadow:
        inset 0 0 0 1px #003300,
        0 4px 0 -1px #00FF00,
        0 -4px 0 -1px #00FF00,
        4px 0 0 -1px #00FF00,
        -4px 0 0 -1px #00FF00,
        0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    text-shadow:
        1px 0 0 #000000,
        -1px 0 0 #000000,
        0 1px 0 #000000,
        0 -1px 0 #000000;
}

body.pixelated-theme .modal-content button:hover,
body.pixelated-theme .menu-btn:hover {
    background:
        repeating-linear-gradient(
            90deg,
            rgba(0, 255, 0, 0.1) 0px,
            rgba(0, 255, 0, 0.1) 2px,
            rgba(0, 255, 0, 0.2) 2px,
            rgba(0, 255, 0, 0.2) 4px
        );
    border-color: #FFFF00;
    color: #FFFF00;
    box-shadow:
        inset 0 0 0 1px #333300,
        0 4px 0 -1px #FFFF00,
        0 -4px 0 -1px #FFFF00,
        4px 0 0 -1px #FFFF00,
        -4px 0 0 -1px #FFFF00,
        0 0 20px rgba(255, 255, 0, 0.6);
}

body.pixelated-theme .modal-content button:active,
body.pixelated-theme .menu-btn:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 0 0 1px #003300,
        0 2px 0 -1px #00FF00,
        0 0 5px rgba(0, 255, 0, 0.5);
}

/* Modal Inputs */
body.pixelated-theme input[type="text"],
body.pixelated-theme input[type="number"],
body.pixelated-theme select,
body.pixelated-theme textarea {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme input[type="text"]:focus,
body.pixelated-theme input[type="number"]:focus,
body.pixelated-theme select:focus,
body.pixelated-theme textarea:focus {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* In-Game UI Panels */
body.pixelated-theme .ui-panel,
body.pixelated-theme #stat-panel,
body.pixelated-theme #inventory-panel {
    background: #000000;
    border: 3px solid #00FF00;
}

body.pixelated-theme .ui-panel h3,
body.pixelated-theme .panel-title {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .stat-label {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .stat-value {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

/* Inventory Items */
body.pixelated-theme .inventory-slot {
    background: #000000;
    border: 2px solid #00FF00;
}

body.pixelated-theme .inventory-slot:hover {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

/* Highscore Modal */
body.pixelated-theme #final-stats {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00FF00;
}

body.pixelated-theme #final-stats p {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #final-stats span {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .highscore-message {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Victory Modal */
body.pixelated-theme .medieval-modal .medieval-backdrop {
    background: rgba(0, 0, 0, 0.9);
}

body.pixelated-theme .medieval-modal .medieval-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
}

body.pixelated-theme .medieval-title {
    font-family: 'Courier New', monospace;
    color: #FFFF00;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .victory-stats {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00FF00;
}

body.pixelated-theme .victory-message {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .stats-grid p {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .stats-grid span {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .medieval-btn {
    background: #000000;
    border: 3px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .medieval-btn:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #FFFF00;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme #victory-name-input {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #victory-name-input:focus {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme #victory-entry-title {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

/* Perk Selection */
body.pixelated-theme .perk-card {
    background: #000000;
    border: 3px solid #00FF00;
}

body.pixelated-theme .perk-card:hover {
    border-color: #FFFF00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme .perk-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .perk-description {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Shop */
body.pixelated-theme .shop-item {
    background: #000000;
    border: 3px solid #00FF00;
}

body.pixelated-theme .shop-item:hover {
    border-color: #FFFF00;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme .item-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .item-price {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .item-description {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Level Up Message */
body.pixelated-theme .level-up-message {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 20px rgba(255, 255, 0, 0.8);
}

/* In-Game Top Bar */
body.pixelated-theme #top-bar {
    background: #000000;
    border-bottom: 4px solid #00FF00;
    box-shadow: inset 0 0 0 2px #003300;
}

body.pixelated-theme .difficulty-display {
    color: #FF00FF;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .time-display {
    color: #00FFFF;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme #score-display {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

/* In-Game Highscore Panel */
body.pixelated-theme #highscore-panel {
    background: #000000;
    border-right: 4px solid #00FF00;
    box-shadow: inset 0 0 0 2px #003300;
}

body.pixelated-theme #highscore-panel h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme #highscore-panel .panel-header {
    border-bottom: 2px solid #00FF00;
}

body.pixelated-theme #highscore-list {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Highscore Inspect Modal */
body.pixelated-theme .highscore-inspect-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        0 0 30px rgba(0, 255, 0, 0.6);
}

body.pixelated-theme .highscore-inspect-content .modal-header {
    border-bottom: 2px solid #00FF00;
}

body.pixelated-theme .highscore-inspect-content .modal-header h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme .inspect-body {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-close-btn {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-close-btn:hover {
    background: #003300;
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* Perk Selection Modal */
body.pixelated-theme #perk-selection .modal-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        0 0 30px rgba(0, 255, 0, 0.6);
}

body.pixelated-theme #perk-selection h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

/* Pause Menu */
body.pixelated-theme #pause-menu .modal-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: inset 0 0 0 2px #003300;
}

body.pixelated-theme #pause-menu h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme #pause-menu .modal-header {
    border-bottom: 2px solid #00FF00;
}

/* Boss HP Bar */
body.pixelated-theme .boss-hp-bar {
    background: #000000;
    border: 4px solid #FF0000;
    box-shadow:
        inset 0 0 0 2px #330000,
        0 0 20px rgba(255, 0, 0, 0.8);
}

body.pixelated-theme .boss-name {
    color: #FF0000;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 15px rgba(255, 0, 0, 0.8);
}

body.pixelated-theme .boss-number {
    background: #000000;
    border: 2px solid #FF0000;
    color: #FF0000;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .boss-hp-bar-bg {
    background: #000000;
    border: 3px solid #FF0000;
}

body.pixelated-theme .boss-hp-fill {
    background: #FF0000;
    box-shadow: inset 0 0 10px rgba(255, 100, 100, 0.5);
}

body.pixelated-theme .boss-hp-text {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .boss-hp-portrait-container {
    border: 3px solid #FF0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

/* Loot Window */
body.pixelated-theme .loot-window {
    background: #000000;
    border: 4px solid #FFFF00;
    box-shadow:
        inset 0 0 0 2px #333300,
        0 0 30px rgba(255, 255, 0, 0.6);
}

body.pixelated-theme .loot-window-header {
    border-bottom: 2px solid #FFFF00;
}

body.pixelated-theme .loot-window-header h2,
body.pixelated-theme .loot-window-header h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 15px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme .loot-close-btn {
    color: #FF0000;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

body.pixelated-theme .loot-close-btn:hover {
    color: #FFFF00;
}

body.pixelated-theme .loot-gold-display {
    background: #000000;
    border: 2px solid #FFFF00;
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

/* Town Portal & Boss Modals */
body.pixelated-theme #town-portal-modal .modal-content,
body.pixelated-theme #final-boss-modal .modal-content,
body.pixelated-theme #milestone-town-modal .modal-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: inset 0 0 0 2px #003300;
}

body.pixelated-theme .town-portal-content h2,
body.pixelated-theme #final-boss-modal h2,
body.pixelated-theme #milestone-town-modal h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme .town-portal-content p,
body.pixelated-theme #final-boss-modal p,
body.pixelated-theme #milestone-town-modal p {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* Settings Menus */
body.pixelated-theme #audio-settings-menu .modal-content,
body.pixelated-theme #hotkey-settings-menu .modal-content,
body.pixelated-theme #ui-settings-menu .modal-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: inset 0 0 0 2px #003300;
}

body.pixelated-theme #audio-settings-menu h2,
body.pixelated-theme #hotkey-settings-menu h2,
body.pixelated-theme #ui-settings-menu h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
}

/* XP and Ultimate Bars */
body.pixelated-theme .exp-bar .bar-fill {
    background: #00FF00;
    box-shadow: 0 0 10px #00FF00;
}

body.pixelated-theme .ulti-bar .bar-fill {
    background: #FF00FF;
    box-shadow: 0 0 8px #FF00FF;
}

body.pixelated-theme .bar-text,
body.pixelated-theme .bar-progress-text {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

/* Loot Choice Cards */
body.pixelated-theme .loot-choice-card-item {
    background: #000000;
    border-color: #00FFFF;
}

body.pixelated-theme .loot-choice-card-gold {
    background: #000000;
    border-color: #FFFF00;
}

body.pixelated-theme .loot-choice-card:hover {
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

/* Action Slots */
body.pixelated-theme .action-keybind {
    color: #00FF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

/* Perklist, Changelog, Difficulty Modals */
body.pixelated-theme .general-perks-modal {
    background: rgba(0, 0, 0, 0.9);
}

body.pixelated-theme .general-perks-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        0 0 30px rgba(0, 255, 0, 0.6);
}

body.pixelated-theme .general-perks-content h2 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 20px rgba(255, 255, 0, 0.8);
}

body.pixelated-theme .general-perks-close {
    background: #000000;
    border: 2px solid #FF0000;
    color: #FF0000;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .general-perks-close:hover {
    background: #330000;
    border-color: #FF0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

body.pixelated-theme .general-perk-category h3 {
    color: #00FF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
    border-bottom-color: rgba(0, 255, 0, 0.3);
}

body.pixelated-theme .general-perk-item {
    background: #000000;
    border-color: rgba(0, 255, 0, 0.5);
}

body.pixelated-theme .general-perk-item:hover {
    background: #001100;
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

body.pixelated-theme .general-perk-item .perk-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .general-perk-item .perk-desc {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .general-perk-item .perk-values {
    color: #00FFFF;
    font-family: 'Courier New', monospace;
    border-top-color: rgba(0, 255, 0, 0.2);
}

/* Perks in Highscore Inspect */
body.pixelated-theme .inspect-perks-section {
    background: #000000;
    border: 2px solid #00FF00;
}

body.pixelated-theme .inspect-perks-section h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000, 0 0 10px rgba(255, 255, 0, 0.8);
    border-bottom-color: #00FF00;
}

body.pixelated-theme .inspect-perk-item {
    background: #000000;
    border-color: rgba(0, 255, 0, 0.5);
}

body.pixelated-theme .inspect-perk-item:hover {
    background: #001100;
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

body.pixelated-theme .inspect-perk-header {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-perk-item .perk-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-perk-item .perk-desc {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-perk-item .perk-values {
    color: #00FFFF;
    font-family: 'Courier New', monospace;
    border-top-color: rgba(0, 255, 0, 0.2);
}

body.pixelated-theme .inspect-perk-name {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-perk-value {
    color: #00FFFF;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .inspect-stats-section {
    background: #000000;
    border: 2px solid #00FF00;
}

body.pixelated-theme .inspect-stats-section h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
    border-bottom-color: #00FF00;
}

/* Hero names in inspect and highscore list */
body.pixelated-theme .inspect-hero-name,
body.pixelated-theme .hero-class {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px #000000;
}

/* Pause Menu Perks List */
body.pixelated-theme #pause-perks-list .inspect-perk-item {
    background: #000000;
    border-color: rgba(0, 255, 0, 0.5);
}

body.pixelated-theme #pause-perks-list .inspect-perk-item:hover {
    background: #001100;
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* ===== MEDIEVAL THEME - STATS PANEL ===== */
body.medieval-theme #stats-panel {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border-left: 3px solid #8b7355;
}

body.medieval-theme #player-hero-header {
    border-bottom: 2px solid #8b7355;
}

body.medieval-theme .ingame-hero-portrait {
    border: 3px solid #d4af37;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

body.medieval-theme #stats-panel h3 {
    color: #d4af37;
    font-family: 'Cinzel', 'Times New Roman', serif;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
}

body.medieval-theme .stat-row {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #8b7355;
}

body.medieval-theme .stat-row:hover {
    background: rgba(139, 115, 85, 0.2);
    border-color: #d4af37;
}

body.medieval-theme .stat-label {
    color: #c9a96e;
}

body.medieval-theme .stat-value {
    color: #d4af37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

body.medieval-theme .stat-extra {
    color: #d4af37;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

body.medieval-theme .stat-cap {
    color: #8b7355;
}

body.medieval-theme .stat-category {
    color: #d4af37;
    border-bottom: 2px solid rgba(212, 175, 55, 0.3);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
}

body.medieval-theme .stat-category:hover {
    background: rgba(139, 115, 85, 0.2);
}

body.medieval-theme .category-toggle {
    color: #d4af37;
}

body.medieval-theme #stats-tooltip-overlay {
    background: rgba(58, 47, 31, 0.98);
    border: 2px solid #8b7355;
    color: #d4af37;
}

body.medieval-theme .panel-toggle {
    background: rgba(58, 47, 31, 0.9);
    border: 2px solid #8b7355;
    color: #d4af37;
}

/* ===== PIXELATED THEME - STATS PANEL ===== */
body.pixelated-theme #stats-panel {
    background:
        repeating-linear-gradient(
            90deg,
            #000000 0px,
            #000000 2px,
            #001100 2px,
            #001100 4px
        ),
        repeating-linear-gradient(
            0deg,
            #000000 0px,
            #000000 2px,
            #001100 2px,
            #001100 4px
        );
    border-left: 4px solid #00FF00;
    box-shadow:
        inset 0 0 0 2px #003300,
        -8px 0 0 -4px #00FF00,
        0 0 20px rgba(0, 255, 0, 0.4);
}

body.pixelated-theme #player-hero-header {
    border-bottom: 2px solid #00FF00;
}

body.pixelated-theme .ingame-hero-portrait {
    border: 3px solid #FFFF00;
    box-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme #stats-panel h3 {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow:
        2px 0 0 #000000,
        -2px 0 0 #000000,
        0 2px 0 #000000,
        0 -2px 0 #000000,
        0 0 10px #FFFF00;
    letter-spacing: 2px;
}

body.pixelated-theme .stat-row {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00FF00;
}

body.pixelated-theme .stat-row:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: #FFFF00;
}

body.pixelated-theme .stat-label {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .stat-value {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow:
        1px 0 0 #000000,
        -1px 0 0 #000000,
        0 1px 0 #000000,
        0 -1px 0 #000000,
        0 0 8px #FFFF00;
    letter-spacing: 1px;
}

body.pixelated-theme .stat-extra {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    text-shadow:
        1px 0 0 #000000,
        -1px 0 0 #000000,
        0 1px 0 #000000,
        0 -1px 0 #000000;
}

body.pixelated-theme .stat-cap {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .stat-category {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
    border-bottom: 2px solid rgba(255, 255, 0, 0.5);
    text-shadow:
        2px 0 0 #000000,
        -2px 0 0 #000000,
        0 2px 0 #000000,
        0 -2px 0 #000000,
        0 0 10px #FFFF00;
    letter-spacing: 2px;
}

body.pixelated-theme .stat-category:hover {
    background: rgba(0, 255, 0, 0.2);
}

body.pixelated-theme .category-toggle {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #stats-tooltip-overlay {
    background: rgba(0, 0, 0, 0.98);
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme .panel-toggle {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
}

/* ===== MEDIEVAL THEME - GAME OVER HIGHSCORE ===== */
body.medieval-theme #game-over .modal-content {
    background: linear-gradient(135deg, #3a2f1f 0%, #2a1f0f 100%);
    border: 4px solid #8b7355;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(139, 115, 85, 0.15);
}

body.medieval-theme #game-over h2 {
    font-family: 'Cinzel', 'Times New Roman', serif;
    color: #d4af37;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), 0 0 20px rgba(212, 175, 55, 0.4);
    letter-spacing: 3px;
}

body.medieval-theme #final-stats {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
}

body.medieval-theme #final-stats p {
    color: #c9a96e;
}

body.medieval-theme #final-stats span {
    color: #d4af37;
}

body.medieval-theme #player-name-input {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #8b7355;
    color: #d4af37;
    font-family: 'Courier New', monospace;
}

body.medieval-theme #player-name-input:focus {
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

body.medieval-theme #highscore-entry h3,
body.medieval-theme #highscore-entry-title {
    color: #d4af37;
}

body.medieval-theme #highscore-result p,
body.medieval-theme #highscore-placement {
    color: #d4af37;
}

/* ===== PIXELATED THEME - GAME OVER HIGHSCORE ===== */
body.pixelated-theme #game-over .modal-content {
    background: #000000;
    border: 4px solid #00FF00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
}

body.pixelated-theme #game-over h2 {
    font-family: 'Courier New', monospace;
    color: #FFFF00;
    text-shadow: 2px 2px #000000;
    font-weight: bold;
}

body.pixelated-theme #final-stats {
    background: rgba(0, 255, 0, 0.1);
    border: 2px solid #00FF00;
}

body.pixelated-theme #final-stats p {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #final-stats span {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #player-name-input {
    background: #000000;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #player-name-input:focus {
    border-color: #FFFF00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

body.pixelated-theme #highscore-entry h3,
body.pixelated-theme #highscore-entry-title {
    color: #FFFF00;
    font-family: 'Courier New', monospace;
}

body.pixelated-theme #highscore-result p,
body.pixelated-theme #highscore-placement {
    color: #00FF00;
    font-family: 'Courier New', monospace;
}

/* ========================================
   Utility classes for inline style cleanup
   ======================================== */

/* Initially hidden elements (shown via JavaScript) */
.initially-hidden {
    display: none;
}

/* Fixed position overlay base */
.fixed-overlay {
    display: none;
    position: fixed;
    pointer-events: none;
}

/* Tooltip overlay base */
.tooltip-overlay {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 100002;
}

/* Stats tooltip - highest z-index */
#stats-tooltip-overlay {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 999999;
}

/* Item tooltip canvas */
#item-tooltip-canvas {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 100003;
}

/* Custom crosshair */
#custom-crosshair {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 999999;
}

/* Spell drag overlay */
#spell-drag-overlay {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 100000;
}

/* Buff/debuff tooltip */
#buff-debuff-tooltip {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 100002;
}

/* Start screen mute toggle */
#start-mute-toggle {
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: opacity 0.2s;
}

/* Audio setting centered layout */
.audio-setting-centered {
    justify-content: center;
    margin-top: 10px;
}

/* Score display styling */
#score-display {
    color: #FFD700;
    font-weight: bold;
}

/* XP bar label image */
.bar-label img {
    height: 30px;
    width: auto;
}

/* Hero stat rows - initially hidden */
.hero-stat {
    display: none;
}

/* QR modal - initially hidden */
#btc-qr-modal {
    display: none;
}

/* === FINAL OVERRIDES - All collapsed panels must be exactly equal size === */
.start-settings-panel.collapsed,
#start-settings-panel.collapsed,
.collapsible-panel.collapsed,
#statistics-panel.collapsed,
#donations-panel.collapsed {
    --ui-scale: 1 !important;
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    padding: 12px 18px !important;
}

/* Ensure consistent text size for collapsed panel titles */
.start-settings-panel.collapsed .settings-panel-title,
#start-settings-panel.collapsed .settings-panel-title,
.collapsible-panel.collapsed .panel-title,
#statistics-panel.collapsed .panel-title,
#donations-panel.collapsed .panel-title {
    font-size: 1rem !important;
    white-space: nowrap !important;
}

/* Make entire panel header clickable */
.right-panels-container .panel-header,
.right-panels-container .settings-panel-header {
    cursor: pointer !important;
    user-select: none;
}

/* Fixed-width layout for collapsed headers - arrows align perfectly */
.right-panels-container .collapsed .panel-header,
.right-panels-container .collapsed .settings-panel-header,
.start-settings-panel.collapsed .settings-panel-header,
.collapsible-panel.collapsed .panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* Title takes fixed space, arrows always at same position */
.right-panels-container .collapsed .panel-title,
.right-panels-container .collapsed .settings-panel-title,
.start-settings-panel.collapsed .settings-panel-title,
.collapsible-panel.collapsed .panel-title {
    flex: 1 !important;
    text-align: left !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Consistent button styling in collapsed state */
.right-panels-container .collapsed .panel-collapse-btn,
.right-panels-container .collapsed .settings-collapse-btn {
    flex-shrink: 0 !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    margin-left: 8px !important;
}

/* === DONATIONS PANEL EXPANDED FIXES === */
#donations-panel:not(.collapsed) {
    width: 320px !important;
    max-width: 320px !important;
}

#donations-panel .donations-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#donations-panel .top-donors h5 {
    color: #FFD700;
    font-size: 0.8rem;
    margin: 0 0 8px 0;
    text-align: center;
}

#donations-panel .donors-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#donations-panel .donor-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255, 165, 0, 0.1);
    border-radius: 4px;
    font-size: 0.7rem;
}

#donations-panel .donor-item.gold {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
}

#donations-panel .donor-item.silver {
    background: rgba(192, 192, 192, 0.15);
    border: 1px solid rgba(192, 192, 192, 0.3);
}

#donations-panel .donor-name {
    color: #e0e0e0;
}

#donations-panel .donor-amount {
    color: #FFD700;
    font-weight: bold;
}

#donations-panel .donation-text {
    font-size: 0.65rem;
    color: #b0b0b0;
    text-align: center;
    margin: 8px 0;
}

#donations-panel .donation-address {
    margin-bottom: 8px;
}

#donations-panel .address-label {
    color: #ffa500;
    font-size: 0.7rem;
    margin: 0 0 2px 0;
}

#donations-panel .address-value {
    color: #e0e0e0;
    font-size: 0.6rem;
    word-break: break-all;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 6px;
    border-radius: 4px;
    margin: 0;
    font-family: monospace;
}

#donations-panel .address-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

#donations-panel .address-wrapper .address-value {
    flex: 1;
}

#donations-panel .qr-btn,
#donations-panel .copy-btn {
    background: rgba(255, 165, 0, 0.2);
    border: 1px solid rgba(255, 165, 0, 0.4);
    color: #FFD700;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.6rem;
    white-space: nowrap;
}

#donations-panel .qr-btn:hover,
#donations-panel .copy-btn:hover {
    background: rgba(255, 165, 0, 0.4);
}
