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

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    overflow: hidden;
    background: #000;
    color: #e8eaf2;
}

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    touch-action: none;
}

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

.scene {
    position: absolute;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
    visibility: hidden;
}

.scene.active {
    display: flex;
    pointer-events: auto;
    visibility: visible;
}

/* Shared menu / guide backdrop (keep this aesthetic) */
.menu-scene {
    scroll-behavior: smooth;
    background:
        linear-gradient(135deg, rgba(0,0,0,0.7), rgba(40,20,60,0.8)),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, transparent 1px, transparent 2px, rgba(255,255,255,0.02) 3px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0px, transparent 1px, transparent 2px, rgba(255,255,255,0.02) 3px),
        radial-gradient(circle at 20% 30%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
        linear-gradient(180deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: 100% 100%, 50px 50px, 50px 50px, 100% 100%, 100% 100%, 100% 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.menu-scene::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.5), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(255,255,255,0.4), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,0.4), transparent),
        radial-gradient(2px 2px at 90% 60%, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 33% 50%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 75% 85%, rgba(255,255,255,0.4), transparent);
    background-size: 200px 200px, 300px 300px, 250px 250px, 350px 350px, 280px 280px, 220px 220px, 320px 320px;
    background-position: 0 0, 40px 60px, 130px 270px, 70px 100px, 180px 50px, 250px 150px, 90px 200px;
    animation: particle-float 60s linear infinite;
    opacity: 0.5;
    pointer-events: none;
}

@keyframes particle-float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-50px, -50px) rotate(360deg); }
}

/* Main menu panel */
.menu-shell {
    position: relative;
    z-index: 2;
    width: min(320px, 92vw);
    pointer-events: auto;
}

.menu-panel {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
}

.menu-panel-header {
    margin-bottom: 4px;
}

.menu-panel-header .game-panel-title {
    font-size: 0.95rem;
    letter-spacing: 0.14em;
}

#main-menu.menu-scene {
    background:
        radial-gradient(ellipse at 50% 40%, rgba(255, 80, 20, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, rgba(10, 8, 20, 0.35) 0%, rgba(10, 8, 20, 0.15) 45%, rgba(10, 8, 20, 0.5) 100%);
}

.menu-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 4px 0 12px;
}

.menu-title {
    position: relative;
    margin: 0 0 0.65rem;
    line-height: 1;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-title-stack {
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.menu-title-layer,
.menu-title-text {
    display: block;
    font-size: clamp(2.4rem, 9vw, 3.6rem);
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1;
    text-align: center;
}

.menu-title-depth {
    position: absolute;
    inset: 0;
    color: #1a0500;
    transform: translate(5px, 7px);
    z-index: 0;
    text-shadow: none;
}

.menu-title-heat {
    position: absolute;
    inset: 0;
    color: transparent;
    z-index: 1;
    transform: translate(2px, 3px);
    text-shadow:
        0 0 20px rgba(255, 90, 20, 0.85),
        0 0 40px rgba(255, 50, 0, 0.45);
    opacity: 0.75;
    animation: title-heat-pulse 2.4s ease-in-out infinite;
}

.menu-title-text {
    position: relative;
    z-index: 2;
    background: linear-gradient(
        180deg,
        #fff8e8 0%,
        #ffd080 18%,
        #ff8c2a 42%,
        #e83810 68%,
        #8a1800 100%
    );
    background-size: 100% 220%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: lava-title-flow 3.5s ease-in-out infinite;
    filter:
        drop-shadow(0 2px 0 rgba(60, 8, 0, 0.95))
        drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55))
        drop-shadow(0 0 18px rgba(255, 110, 30, 0.55));
}

.menu-embers {
    position: absolute;
    left: 50%;
    bottom: -0.15rem;
    width: min(320px, 80vw);
    height: 2.5rem;
    transform: translateX(-50%);
    pointer-events: none;
}

.menu-embers i {
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe8a0 0%, #ff6a10 55%, transparent 100%);
    opacity: 0;
    animation: ember-rise 3.2s ease-out infinite;
}

.menu-embers i:nth-child(1) { left: 8%; animation-delay: 0s; }
.menu-embers i:nth-child(2) { left: 22%; animation-delay: 0.6s; width: 3px; height: 3px; }
.menu-embers i:nth-child(3) { left: 38%; animation-delay: 1.1s; }
.menu-embers i:nth-child(4) { left: 54%; animation-delay: 0.3s; width: 5px; height: 5px; }
.menu-embers i:nth-child(5) { left: 70%; animation-delay: 1.8s; }
.menu-embers i:nth-child(6) { left: 86%; animation-delay: 2.4s; width: 3px; height: 3px; }

@keyframes lava-title-flow {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 0% 100%; }
}

@keyframes title-heat-pulse {
    0%, 100% { opacity: 0.55; filter: blur(0); }
    50% { opacity: 0.9; filter: blur(1px); }
}

@keyframes ember-rise {
    0% { opacity: 0; transform: translateY(0) scale(0.6); }
    15% { opacity: 0.9; }
    100% { opacity: 0; transform: translateY(-2.2rem) scale(0.2); }
}

.menu-tagline {
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.45;
    color: rgba(228, 232, 248, 0.92);
    max-width: 28ch;
    margin: 0 auto 0.45rem;
    text-align: center;
}

.menu-description {
    font-size: 0.72rem;
    font-weight: 300;
    line-height: 1.5;
    color: rgba(185, 195, 220, 0.78);
    max-width: 36ch;
    margin: 0 auto 0.85rem;
    text-align: center;
}

/* Floating corner icons */
.menu-decoration {
    position: absolute;
    font-size: clamp(2.5rem, 6vw, 4rem);
    opacity: 0.18;
    animation: float-decoration 6s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 12px rgba(102, 126, 234, 0.35));
}

.menu-decoration.top-left {
    top: 5%;
    left: 5%;
    animation-delay: 0s;
}

.menu-decoration.top-right {
    top: 5%;
    right: 5%;
    animation-delay: 1.5s;
}

.menu-decoration.bottom-left {
    bottom: 5%;
    left: 5%;
    animation-delay: 3s;
}

.menu-decoration.bottom-right {
    bottom: 5%;
    right: 5%;
    animation-delay: 4.5s;
}

@keyframes float-decoration {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.15;
    }
    50% {
        transform: translateY(-18px) rotate(4deg);
        opacity: 0.28;
    }
}

.menu-actions-wrap {
    position: relative;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    width: 100%;
}

.menu-preview-viewport {
    position: relative;
    margin: 0 0 10px;
    width: 100%;
    height: 118px;
    border-radius: 8px;
    border: 2px solid rgba(255, 200, 80, 0.35);
    background: transparent;
    overflow: hidden;
    pointer-events: none;
    box-shadow:
        inset 0 0 24px rgba(255, 80, 20, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.35);
}

.menu-preview-viewport::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    box-shadow: inset 0 -18px 28px rgba(255, 60, 10, 0.18);
    pointer-events: none;
    z-index: 1;
}

.menu-preview-label {
    position: absolute;
    top: 6px;
    left: 8px;
    z-index: 2;
    font-size: 0.58rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 210, 77, 0.75);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.menu-btn {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.55rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    pointer-events: auto;
    width: 100%;
}

.menu-btn-primary {
    background: rgba(255, 140, 60, 0.18);
    border: 1px solid rgba(255, 140, 60, 0.45);
    color: #ffe08a;
}

.menu-btn-primary:hover {
    background: rgba(255, 140, 60, 0.3);
    border-color: rgba(255, 170, 90, 0.65);
}

.menu-btn-secondary {
    background: rgba(100, 180, 255, 0.12);
    border: 1px solid rgba(100, 180, 255, 0.4);
    color: #b8dcff;
}

.menu-btn-secondary:hover {
    background: rgba(100, 180, 255, 0.22);
    border-color: rgba(140, 200, 255, 0.6);
}

.save-info {
    margin-top: 0.65rem;
    font-size: 0.72rem;
    color: rgba(200, 210, 230, 0.75);
    text-align: center;
}

.menu-btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(220, 226, 245, 0.9);
}

.menu-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.24);
}

/* Shared in-game / menu panel chrome */
.game-panel {
    background: rgba(10, 8, 20, 0.92);
    border: 2px solid rgba(255, 200, 80, 0.35);
    border-radius: 10px;
    padding: 10px;
    pointer-events: auto;
    box-sizing: border-box;
}

.game-panel--menu {
    border-color: rgba(255, 200, 80, 0.35);
}

.game-panel--guide {
    width: min(320px, 94vw);
    height: min(480px, 82vh);
    max-height: min(480px, 82vh);
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-color: rgba(255, 200, 80, 0.35);
}

.game-panel--class {
    width: min(920px, 96vw);
    max-height: calc(100vh - 1.3rem);
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-color: rgba(120, 180, 255, 0.35);
}

.inventory-header,
.game-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.inventory-title,
.game-panel-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #ffd24d;
}

.game-panel--class .game-panel-title {
    color: #8ec0ff;
}

.stats-panel .inventory-title {
    color: #8ec0ff;
}

.skills-panel .inventory-title {
    color: #ffaa66;
}

.game-panel-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
}

.game-panel-header-spacer {
    width: 3.5rem;
}

.game-panel-title {
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* How to Play — compact tabbed panel */
#controls-screen.menu-scene {
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0.65rem 0;
    height: 100%;
    max-height: 100vh;
    box-sizing: border-box;
}

.guide-shell {
    position: relative;
    z-index: 1;
    pointer-events: auto;
    padding: 0 0.4rem;
}

.guide-back {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: #aaa;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.guide-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
}

.guide-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    flex-shrink: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.guide-tabs::-webkit-scrollbar {
    display: none;
}

.guide-tab {
    flex: 1 1 0;
    min-width: 2.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 3px;
    font-family: inherit;
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #888;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.guide-tab-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.guide-tab-label {
    white-space: nowrap;
}

.guide-tab:hover {
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.18);
}

.guide-tab.active {
    color: #ffe08a;
    background: rgba(255, 140, 60, 0.12);
    border-color: rgba(255, 140, 60, 0.4);
}

.guide-panes {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.guide-pane {
    display: none;
    position: absolute;
    inset: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 140, 60, 0.45) rgba(255, 255, 255, 0.04);
}

.guide-pane::-webkit-scrollbar {
    width: 6px;
}

.guide-pane::-webkit-scrollbar-thumb {
    background: rgba(255, 140, 60, 0.45);
    border-radius: 4px;
}

.guide-pane.active {
    display: block;
}

.guide-lead {
    font-size: 0.68rem;
    font-weight: 300;
    color: #888;
    margin: 0 0 6px;
    line-height: 1.4;
}

.guide-dl {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.guide-row {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 6px;
    align-items: center;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    font-size: 0.72rem;
    border-bottom: none;
}

.guide-row dt {
    margin: 0;
}

.guide-row dd {
    margin: 0;
    color: #bbb;
    font-weight: 300;
}

.guide-kbd {
    display: inline-block;
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: bold;
    color: #ffd24d;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 200, 80, 0.25);
    border-radius: 3px;
    padding: 1px 4px;
    min-width: 1.1rem;
    text-align: center;
}

.guide-note {
    margin-top: 6px;
    padding: 5px 6px;
    font-size: 0.65rem;
    color: #ffaa66;
    background: rgba(255, 140, 60, 0.08);
    border: 1px solid rgba(255, 140, 60, 0.22);
    border-radius: 4px;
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.guide-list li {
    font-size: 0.68rem;
    font-weight: 300;
    line-height: 1.45;
    color: #bbb;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    position: static;
    padding-left: 6px;
}

.guide-list li::before {
    display: none;
}

.guide-list strong {
    font-weight: 600;
    color: #e8ecff;
}

.guide-class-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.guide-class-card {
    border-radius: 6px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--guide-accent, rgba(168, 180, 232, 0.5));
}

.guide-class-card-inner {
    padding: 6px 7px;
    border-radius: 0;
    background: transparent;
    text-align: left;
}

.guide-class-crest {
    display: inline;
    font-size: 0.85rem;
    margin-right: 4px;
    filter: none;
}

.guide-class-card h3 {
    display: inline;
    font-size: 0.72rem;
    font-weight: bold;
    color: #fff;
}

.guide-class-role {
    display: block;
    font-size: 0.58rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--guide-accent, #a8b4e8);
    margin: 2px 0;
}

.guide-class-stats {
    font-size: 0.62rem;
    color: #9fd4ff;
    margin: 0 0 2px;
}

.guide-class-desc {
    font-size: 0.62rem;
    color: #888;
    margin: 0;
    line-height: 1.35;
}

.guide-class-warrior { --guide-accent: #e88a7a; }
.guide-class-mage { --guide-accent: #8aa8ff; }
.guide-class-tank { --guide-accent: #a8b8c8; }
.guide-class-summoner { --guide-accent: #7accaa; }

.guide-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.guide-subtab {
    font-family: inherit;
    font-size: 0.58rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #888;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 2px 7px;
    cursor: pointer;
}

.guide-subtab.active {
    color: #ffe08a;
    background: rgba(255, 140, 60, 0.12);
    border-color: rgba(255, 140, 60, 0.4);
}

.guide-subpane {
    padding: 6px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.guide-subpane p {
    font-size: 0.68rem;
    line-height: 1.5;
    color: #bbb;
    margin: 0;
}

.guide-tip-title {
    font-size: 0.72rem;
    font-weight: bold;
    margin: 0 0 4px;
    color: #fff;
}

.guide-tip-warrior { color: #e88a7a; }
.guide-tip-mage { color: #8aa8ff; }
.guide-tip-tank { color: #a8b8c8; }
.guide-tip-summoner { color: #7accaa; }

.guide-info-cards {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.guide-info-card {
    padding: 6px 7px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.guide-info-card h3 {
    font-size: 0.62rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffd24d;
    margin: 0 0 4px;
}

@media (max-width: 768px) {
    .menu-panel {
        padding: 10px;
    }

    .guide-class-grid {
        grid-template-columns: 1fr;
    }

    .guide-class-desc {
        display: none;
    }
}

@media (max-height: 720px) {
    .guide-lead,
    .menu-description {
        display: none;
    }

    .game-panel--guide {
        height: min(440px, 78vh);
        max-height: min(440px, 78vh);
    }
}

.btn {
    padding: 1.2rem 3.5rem;
    font-size: 1.3rem;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 12px;
    cursor: pointer;
    margin: 0.5rem;
    font-weight: 900;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    user-select: none;
}

/* Removed complex ::before animation that was blocking clicks */

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff5252 0%, #a61e1e 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    border-color: rgba(255, 215, 0, 0.8);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(80, 80, 80, 0.8) 0%, rgba(40, 40, 40, 0.8) 100%);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.9) 0%, rgba(60, 60, 60, 0.9) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 215, 0, 0.8);
}

/* Class Selection */
#class-selection {
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0.65rem 0;
    height: 100%;
    max-height: 100vh;
    box-sizing: border-box;
}

.class-selection-shell {
    position: relative;
    z-index: 1;
    pointer-events: auto;
    padding: 0 0.4rem;
    box-sizing: border-box;
}

.class-selection-topbar {
    margin-bottom: 6px;
}

.class-nav-btn {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: #aaa;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.class-nav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
}

.class-selection-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #8ec0ff;
    margin: 0;
}

.class-selection-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.class-selection-sub {
    font-size: 0.92rem;
    font-weight: 300;
    color: rgba(190, 200, 225, 0.75);
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    pointer-events: auto;
    flex: 1;
    min-height: 0;
    align-content: center;
}

.class-card {
    position: relative;
    border-radius: 6px;
    padding: 0;
    transition: border-color 0.2s, background 0.2s;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--class-accent);
    box-shadow: none;
}

.class-card::before {
    display: none;
}

.class-card-inner {
    position: relative;
    height: 100%;
    padding: 6px 7px;
    border-radius: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.class-card-inner::after {
    display: none;
}

.class-card-warrior { --class-accent: #c45c4a; --class-glow: rgba(196, 92, 74, 0.35); }
.class-card-mage { --class-accent: #5a7ee8; --class-glow: rgba(90, 126, 232, 0.35); }
.class-card-tank { --class-accent: #8a9aaa; --class-glow: rgba(138, 154, 170, 0.35); }
.class-card-summoner { --class-accent: #4ab88a; --class-glow: rgba(74, 184, 138, 0.35); }

.class-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    border-left-color: var(--class-accent);
    transform: none;
    box-shadow: none;
}

.class-card:hover .class-card-inner {
    background: transparent;
}

.class-card-crest {
    font-size: 1.65rem;
    line-height: 1;
    margin-bottom: 0.25rem;
    filter: drop-shadow(0 0 10px var(--class-glow));
}

.class-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #f2f4ff;
    margin-bottom: 0.1rem;
}

.class-role {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--class-accent);
    margin-bottom: 0.25rem;
}

.class-blurb {
    font-size: 0.65rem;
    font-weight: 300;
    line-height: 1.3;
    color: rgba(170, 180, 205, 0.75);
    margin-bottom: 0.4rem;
    min-height: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.class-stat-bars {
    width: 100%;
    margin-bottom: 0.45rem;
}

.class-stat-row {
    display: grid;
    grid-template-columns: 1.5rem 1fr 1.6rem;
    gap: 0.25rem;
    align-items: center;
    margin-bottom: 0.2rem;
    font-size: 0.62rem;
}

.class-stat-label {
    font-weight: 600;
    color: rgba(160, 170, 195, 0.85);
    text-align: left;
}

.class-stat-val {
    font-weight: 500;
    color: rgba(220, 226, 245, 0.9);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.class-stat-track {
    height: 5px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.class-stat-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.class-stat-fill.hp { background: linear-gradient(90deg, #8b2222, #e04444); }
.class-stat-fill.mp { background: linear-gradient(90deg, #2233aa, #5577ff); }
.class-stat-fill.atk { background: linear-gradient(90deg, #aa6622, #dd9944); }
.class-stat-fill.def { background: linear-gradient(90deg, #445566, #8899aa); }

.class-card .btn.class-select-btn {
    width: 100%;
    margin-top: auto;
    padding: 4px 6px;
    font-size: 0.62rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 4px;
    border: 1px solid rgba(255, 140, 60, 0.35);
    background: rgba(255, 140, 60, 0.12);
    color: #ffe08a;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    box-shadow: none;
}

.class-card .btn.class-select-btn:hover {
    background: rgba(255, 140, 60, 0.22);
    border-color: rgba(255, 140, 60, 0.55);
    transform: none;
    box-shadow: none;
}

.btn-select {
    margin-top: 0;
}

@media (max-width: 1024px) {
    .class-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .class-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
        margin: 0;
    }

    .class-blurb {
        display: none;
    }

    .class-nav-btn {
        font-size: 0.72rem;
        padding: 0.35rem 0.5rem;
    }

    .menu-decoration {
        font-size: 2.2rem;
        opacity: 0.12;
    }
}

@media (max-height: 720px) {
    #class-selection {
        padding: 0.4rem 0;
    }

    .class-selection-shell {
        max-height: calc(100vh - 0.8rem);
    }

    .class-blurb {
        display: none;
    }

    .class-card-crest {
        font-size: 1.35rem;
        margin-bottom: 0.15rem;
    }

    .class-stat-row {
        margin-bottom: 0.12rem;
    }
}

/* Game HUD */
#game-hud {
    pointer-events: none;
}

#game-hud > * {
    pointer-events: auto;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    min-width: 250px;
}

.stat-bar {
    margin-bottom: 8px;
}

.stat-bar label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.bar-container {
    position: relative;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    overflow: hidden;
}

.bar {
    height: 100%;
    transition: width 0.3s;
}

.hp-bar {
    background: linear-gradient(90deg, #ff4444, #cc0000);
}

.mp-bar {
    background: linear-gradient(90deg, #4444ff, #0000cc);
}

.xp-bar {
    background: linear-gradient(90deg, #44ff44, #00cc00);
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
}

.level-display {
    margin-top: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.player-name-display {
    margin-top: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffe8a8;
    letter-spacing: 0.04em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.85);
}

.player-name-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 232, 168, 0.2);
}

.player-name-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 232, 168, 0.95);
    margin-right: 4px;
}

.player-name-input {
    flex: 1 1 180px;
    min-width: 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.35);
    color: #f4f6ff;
}

.player-name-input:focus {
    outline: none;
    border-color: rgba(255, 170, 90, 0.65);
    box-shadow: 0 0 0 2px rgba(255, 140, 60, 0.2);
}

.player-name-hint {
    flex: 1 1 100%;
    font-size: 0.65rem;
    color: rgba(180, 190, 210, 0.75);
    margin: 0;
}

.room-display {
    margin-top: 8px;
    font-size: 1rem;
    font-weight: bold;
    color: #ffaa00;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.dungeon-floor-display {
    margin-top: 6px;
    font-size: 0.95rem;
    font-weight: bold;
    color: #b8a5ff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Wave Info Display */
.wave-info {
    margin-top: 8px;
    font-size: 0.95rem;
    color: #00ff88;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wave-timer, .wave-enemies {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#wave-timer-value {
    color: #ffff00;
    font-weight: bold;
}

#wave-enemies-count {
    color: #ff6666;
    font-weight: bold;
}

/* Equipment Display */
.equipment-display {
    margin-top: 16px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    max-width: 220px;
}

.equipment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
}

.equipment-title {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    color: #ffa500;
}

.equipment-item {
    margin: 4px 0;
    font-size: 0.8rem;
}

.equipment-label {
    color: #aaa;
    font-weight: bold;
}

.equipment-name {
    color: #fff;
    margin-left: 4px;
}

.equipment-name.common {
    color: #aaaaaa;
}

.equipment-name.rare {
    color: #4444ff;
}

.equipment-name.epic {
    color: #aa00ff;
}

.equipment-name.mythical {
    color: #ffd24d;
    text-shadow: 0 0 8px rgba(255, 210, 77, 0.55);
    font-weight: 600;
}

.defeat-tip {
    margin-top: 12px;
    padding: 10px 14px;
    border-left: 3px solid rgba(255, 200, 80, 0.7);
    background: rgba(255, 200, 80, 0.08);
    color: #e8d4a8;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
}

/* Loot phase banner */
.loot-phase-banner {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    text-align: center;
    padding: 12px 24px;
    background: rgba(10, 8, 20, 0.85);
    border: 2px solid rgba(255, 200, 80, 0.6);
    border-radius: 10px;
    pointer-events: auto;
    min-width: 260px;
}

.loot-phase-title {
    font-size: 1rem;
    font-weight: bold;
    color: #ffd24d;
    margin-bottom: 6px;
    text-shadow: 0 0 8px rgba(255, 200, 80, 0.5);
}

.loot-phase-timer {
    font-size: 0.9rem;
    color: #e8e8ff;
    margin-bottom: 8px;
}

.loot-phase-timer span {
    color: #5cffb0;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

.loot-phase-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.loot-phase-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #5cffb0, #ffd24d);
    border-radius: 3px;
    transition: width 0.3s linear;
}

.btn-claim {
    font-size: 0.85rem;
    padding: 6px 18px;
    background: linear-gradient(135deg, #3a7a50, #5cffb0);
    border: 1px solid rgba(92, 255, 176, 0.5);
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
}

.btn-claim:hover {
    filter: brightness(1.15);
}

.btn-ascension {
    font-size: 0.85rem;
    padding: 6px 18px;
    margin-top: 8px;
    background: linear-gradient(135deg, #8a6a10, #ffee66);
    border: 1px solid rgba(255, 238, 120, 0.65);
    color: #1a1408;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    pointer-events: auto;
}

.btn-ascension:hover {
    filter: brightness(1.12);
}

.loot-phase-banner .btn-claim,
.loot-phase-banner .btn-ascension {
    display: inline-block;
    margin: 6px 4px 0;
}

/* Inventory + Stats + Skills buttons */
.btn-inventory,
.btn-stats,
.btn-skills {
    position: absolute;
    top: 16px;
    z-index: 150;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    background: rgba(10, 8, 20, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.btn-inventory {
    right: 16px;
}

.btn-stats {
    right: 68px;
}

.btn-skills {
    right: 120px;
}

.btn-inventory:hover,
.btn-inventory.active {
    background: rgba(30, 25, 50, 0.9);
    border-color: rgba(255, 200, 80, 0.5);
}

.btn-stats:hover,
.btn-stats.active {
    background: rgba(20, 25, 45, 0.9);
    border-color: rgba(120, 180, 255, 0.55);
}

.btn-skills:hover,
.btn-skills.active {
    background: rgba(25, 20, 40, 0.9);
    border-color: rgba(255, 140, 60, 0.55);
}

.inventory-panel,
.stats-panel,
.skills-panel {
    position: relative;
    overflow: hidden;
    background: rgba(10, 8, 20, 0.92);
    border-radius: 10px;
    padding: 10px;
    pointer-events: auto;
    box-sizing: border-box;
}

.inventory-panel {
    width: 100%;
    border: 2px solid rgba(255, 200, 80, 0.35);
}

.stats-panel {
    width: 100%;
    border: 2px solid rgba(120, 180, 255, 0.35);
}

.skills-panel {
    position: absolute;
    bottom: 24px;
    left: 16px;
    top: auto;
    z-index: 160;
    width: 300px;
    border: 2px solid rgba(255, 140, 60, 0.35);
}

.inventory-wrapper {
    display: none;
}

.right-panels {
    position: absolute;
    top: 70px;
    right: 16px;
    z-index: 160;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.right-panels > * {
    pointer-events: auto;
    flex: 0 1 auto;
}

.right-panels.stats-solo::before {
    content: '';
    display: block;
    min-height: 318px;
    flex-shrink: 0;
    pointer-events: none;
}

.skills-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.skill-compact-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 7px;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-compact-card.ultimate {
    border-color: rgba(255, 200, 80, 0.4);
    background: rgba(255, 200, 80, 0.07);
}

.skill-compact-card.on-cooldown {
    border-left: 3px solid #ff8844;
}

.skill-compact-card.no-mp:not(.on-cooldown) {
    border-left: 3px solid #4488ff;
}

.skill-compact-top {
    display: flex;
    align-items: center;
    gap: 4px;
}

.skill-compact-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.skill-compact-name {
    flex: 1;
    font-size: 0.72rem;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-compact-key {
    font-size: 0.65rem;
    color: #ffd24d;
    font-weight: bold;
}

.skill-compact-meta {
    font-size: 0.62rem;
    color: #9fd4ff;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skill-compact-status {
    font-size: 0.62rem;
    font-weight: bold;
    margin-top: auto;
}

.skill-compact-status.ready {
    color: #5cffb0;
}

.skill-compact-status.cooldown {
    color: #ffaa66;
}

.skill-compact-status.no-mp {
    color: #88aaff;
}

.skills-panel * {
    pointer-events: auto;
}

.stats-breakdown {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 6px;
}

.stat-compact-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    gap: 6px;
    align-items: center;
    font-size: 0.72rem;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}

.stat-compact-label {
    font-weight: bold;
    color: #ccc;
}

.stat-compact-total {
    font-weight: bold;
    color: #5cffb0;
    text-align: right;
}

.stat-compact-bonus {
    font-size: 0.65rem;
    color: #888;
    text-align: right;
    white-space: nowrap;
}

.stat-compact-base {
    color: #666;
}

.stat-compact-bonus .bonus-equip {
    color: #7ec8ff;
}

.stat-compact-bonus .bonus-gem {
    color: #cc88ff;
}

.stats-buffs {
    min-height: 0;
}

.stats-buffs-empty {
    font-size: 0.68rem;
    color: #666;
    text-align: center;
    padding: 4px 0;
}

.stats-buff-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.stats-buff-chip {
    font-size: 0.62rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.stats-buff-chip.gem-ruby { border-color: #ff222288; color: #ff8888; }
.stats-buff-chip.gem-sapphire { border-color: #2288ff88; color: #88bbff; }
.stats-buff-chip.gem-emerald { border-color: #22ff6688; color: #88ffaa; }
.stats-buff-chip.gem-amethyst { border-color: #cc55ff88; color: #ddaaff; }
.stats-buff-chip.skill-buff { border-color: #ffd24d88; color: #ffe08a; }

.inventory-panel * {
    pointer-events: auto;
}

.stats-panel * {
    pointer-events: auto;
}

.btn-close-inv {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
}

.btn-close-inv:hover {
    color: #fff;
}

.inventory-section-title {
    font-size: 0.68rem;
    font-weight: bold;
    color: #888;
    margin: 4px 0 3px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.inv-equipped-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px 8px;
}

.inv-slot {
    font-size: 0.68rem;
    margin: 0;
    color: #bbb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-item-name {
    color: #fff;
}

.inv-item-name.common { color: #aaaaaa; }
.inv-item-name.rare { color: #4da6ff; }
.inv-item-name.epic { color: #cc66ff; }
.inv-item-name.mythical {
    color: #ffd24d;
    text-shadow: 0 0 6px rgba(255, 210, 77, 0.45);
}

.inv-count {
    font-weight: normal;
    color: #666;
}

.inv-active-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.inv-active-cell,
.inv-gem-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 2px;
    min-height: 0;
    font-family: inherit;
}

.inv-gem-cell {
    cursor: pointer;
    transition: transform 0.12s, filter 0.12s;
}

.inv-gem-cell.filled:hover {
    transform: scale(1.06);
    filter: brightness(1.15);
}

.inv-gem-cell.empty {
    background: rgba(255, 255, 255, 0.03);
    border-style: dashed;
    cursor: default;
}

.inv-active-cell.empty {
    background: rgba(255, 255, 255, 0.03);
    border-style: dashed;
}

.inv-active-cell.filled {
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.08);
}

.inv-gem-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.gem-cell-letter {
    font-size: 0.82rem;
    font-weight: bold;
    line-height: 1;
}

.gem-cell-letter.dim {
    color: #555;
    font-weight: normal;
}

.gem-cell-tier {
    font-size: 0.62rem;
    font-weight: bold;
    line-height: 1;
}

.gem-cell-dur,
.gem-cell-timer,
.gem-cell-expiry {
    font-size: 0.55rem;
    opacity: 0.85;
    line-height: 1;
}

.gem-cell-expiry {
    color: #ff8866;
}

.gold-display {
    font-size: 0.82rem;
    color: #ffd060;
    margin-top: 2px;
    text-shadow: 0 0 8px rgba(255, 200, 60, 0.35);
}

.inv-potion-grid,
.inv-potion-active-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 6px;
}

.inv-potion-cell,
.inv-potion-active-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    padding: 2px;
    box-sizing: border-box;
}

.inv-potion-cell {
    cursor: pointer;
}

.inv-potion-cell.empty,
.inv-potion-active-cell.empty {
    opacity: 0.35;
    border-style: dashed;
}

.inv-potion-cell.filled:hover {
    filter: brightness(1.15);
}

.potion-cell-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.potion-cell-icon.dim {
    opacity: 0.4;
}

.potion-cell-short {
    font-size: 0.58rem;
    font-weight: bold;
    line-height: 1;
}

.potion-cell-stack,
.potion-cell-timer {
    font-size: 0.55rem;
    opacity: 0.9;
    line-height: 1;
}

.boss-shop {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    width: min(360px, 92vw);
    border: 2px solid rgba(170, 100, 255, 0.45);
    background: rgba(10, 8, 20, 0.95);
    border-radius: 10px;
    padding: 12px;
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.shop-intro {
    font-size: 0.75rem;
    color: #bbaadd;
    margin: 0 0 8px;
    line-height: 1.35;
}

.shop-gold {
    font-size: 0.85rem;
    color: #ffd060;
    margin-bottom: 10px;
}

.shop-potion-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.shop-potion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: #eee;
    cursor: pointer;
    text-align: left;
}

.shop-potion-row:hover:not(.cant-afford) {
    background: rgba(170, 100, 255, 0.15);
}

.shop-potion-row.cant-afford {
    opacity: 0.45;
    cursor: not-allowed;
}

.shop-potion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.shop-potion-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shop-potion-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #eee;
}

.shop-potion-desc {
    font-size: 0.65rem;
    color: #999;
}

.shop-potion-price {
    font-size: 0.8rem;
    font-weight: bold;
    color: #ffd060;
    flex-shrink: 0;
}

.stats-buff-chip.potion-buff {
    border-color: rgba(200, 140, 255, 0.5);
    color: #ddb8ff;
}

.stats-buff-chip.boss-debuff {
    border-color: rgba(102, 204, 255, 0.55);
    color: #99ddff;
    background: rgba(40, 80, 120, 0.25);
}

.stats-buff-chip.plague-debuff {
    border-color: rgba(136, 255, 68, 0.55);
    color: #bbff88;
    background: rgba(40, 80, 20, 0.35);
}

.inventory-active {
    margin-bottom: 2px;
}

.inv-empty {
    font-size: 0.68rem;
    color: #666;
    font-style: italic;
    padding: 4px 0;
}

.btn-equip-inv {
    flex-shrink: 0;
    padding: 3px 8px;
    font-size: 0.72rem;
    background: rgba(92, 255, 176, 0.2);
    border: 1px solid rgba(92, 255, 176, 0.4);
    color: #5cffb0;
    border-radius: 4px;
    cursor: pointer;
}

.btn-equip-inv:hover {
    background: rgba(92, 255, 176, 0.35);
}

.btn-drop-inv {
    flex-shrink: 0;
    padding: 3px 8px;
    font-size: 0.72rem;
    background: rgba(255, 120, 80, 0.15);
    border: 1px solid rgba(255, 120, 80, 0.4);
    color: #ff8866;
    border-radius: 4px;
    cursor: pointer;
}

.btn-drop-inv:hover {
    background: rgba(255, 120, 80, 0.3);
}

/* Boss Health Bar */
.hud-top-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 400px;
}

.boss-name {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    color: #ff4444;
}

.boss-bar-container {
    height: 30px;
}

.boss-hp-bar {
    background: linear-gradient(90deg, #ff0000, #990000);
}

/* Skill Bar */
.hud-bottom-center {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

.skill-bar {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.skill-slot {
    position: relative;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(0,0,0,0.8), rgba(40,40,40,0.9));
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.skill-slot:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.5);
}

.skill-slot.ultimate {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, rgba(40,0,0,0.9), rgba(60,20,20,0.9));
}

.skill-slot.ultimate:hover {
    border-color: #ffaa00;
    box-shadow: 0 6px 12px rgba(255, 107, 107, 0.6);
}

/* Key label above skill box */
.skill-key-label {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: bold;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.skill-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    line-height: 1;
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.skill-cooldown {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    border-radius: 6px;
    display: none;
}

.skill-cooldown.active {
    display: block;
}

.skill-mp-cost {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.7rem;
    background: rgba(0,0,255,0.6);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Result Screens */
#victory-screen,
#defeat-screen {
    justify-content: center;
    align-items: center;
}

#victory-screen {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

#defeat-screen {
    background: linear-gradient(135deg, #434343 0%, #000000 100%);
}

.result-content {
    text-align: center;
}

.result-title {
    font-size: 4rem;
    margin-bottom: 2rem;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.result-title.victory {
    color: #fff;
}

.result-title.defeat {
    color: #ff4444;
}

.result-stats {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.result-stats p {
    margin: 0.5rem 0;
}

.victory-lb-title {
    margin-top: 1rem !important;
    font-size: 0.85rem !important;
    color: rgba(255, 220, 140, 0.85) !important;
}

.victory-leaderboard {
    margin: 0.35rem auto 0;
    padding: 0.65rem 0.75rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(220, 230, 245, 0.9);
    white-space: pre-wrap;
    text-align: left;
    max-width: 320px;
}

/* Damage Numbers */
#damage-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.damage-number {
    position: absolute;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
}

.damage-number.critical {
    font-size: 2rem;
    color: #ffff00;
}

.damage-number.player-damage {
    color: #ff4444;
}

.damage-number.text-message {
    font-size: 0.85rem;
    color: #ffcc66;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.9;
}

.damage-number.heal-message {
    color: #66ff99;
    text-shadow: 0 0 8px rgba(80, 255, 140, 0.5);
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px);
    }
}

@keyframes notificationPop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes notificationFade {
    0% {
        opacity: 0.9;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes notificationRise {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 0.9;
        transform: translateY(0);
    }
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .hud-top-left {
        min-width: 200px;
    }

    .hud-top-center {
        min-width: 300px;
    }

    .skill-slot {
        width: 54px;
        height: 54px;
    }
    
    .skill-key-label {
        font-size: 0.65rem;
        padding: 1px 6px;
    }
    
    .skill-icon {
        font-size: 1.6rem;
    }
}
/* Touch Controls - Hidden by default on desktop */
#touch-joystick,
.touch-skill-button {
    display: none;
}

/* Ensure they stay hidden on desktop even if JS tries to show them */
@media (min-width: 769px) and (pointer: fine) {
    #touch-joystick,
    .touch-skill-button {
        display: none !important;
    }
}

/* Room minimap */
.room-minimap {
    position: relative;
    margin-top: 8px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    width: fit-content;
}

.minimap-grid {
    display: grid;
    grid-template-columns: repeat(4, 14px);
    grid-template-rows: repeat(4, 14px);
    gap: 3px;
}

.minimap-cell {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: rgba(80, 80, 100, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.minimap-cell.cleared {
    background: rgba(60, 180, 100, 0.55);
    border-color: rgba(100, 255, 150, 0.35);
}

.minimap-cell.current {
    background: rgba(255, 200, 80, 0.75);
    border-color: #ffcc44;
    box-shadow: 0 0 6px rgba(255, 200, 80, 0.6);
}

.minimap-boss-marker {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    border-radius: 3px;
    background: rgba(40, 20, 20, 0.9);
    border: 1px solid rgba(255, 80, 80, 0.45);
    box-shadow: 0 0 4px rgba(255, 40, 40, 0.25);
    pointer-events: none;
    z-index: 2;
}

.minimap-boss-marker.ready {
    border-color: rgba(255, 120, 80, 0.75);
    box-shadow: 0 0 8px rgba(255, 80, 40, 0.45);
}

.minimap-boss-marker.current {
    border-color: #ffcc44;
    box-shadow: 0 0 8px rgba(255, 200, 80, 0.75);
    background: rgba(60, 40, 20, 0.95);
}

/* Player debuff bar */
.player-debuff-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-width: 280px;
}

.debuff-chip {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(180, 40, 40, 0.75);
    border: 1px solid rgba(255, 100, 100, 0.5);
    color: #ffe0e0;
    animation: debuff-pulse 1.2s ease-in-out infinite;
}

.debuff-chip.debuff-plague-debuff {
    background: rgba(80, 160, 40, 0.75);
    border-color: rgba(140, 255, 80, 0.5);
    color: #e8ffd0;
}

@keyframes debuff-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

.gem-cell-expiry.gem-expiry-warn {
    color: #ff8866;
    font-weight: 700;
}

/* Difficulty picker */
.difficulty-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.difficulty-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(220, 225, 240, 0.9);
    margin-right: 4px;
}

.difficulty-btn {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: #dde2f0;
    cursor: pointer;
}

.difficulty-btn.active {
    background: rgba(255, 140, 60, 0.25);
    border-color: rgba(255, 170, 90, 0.55);
    color: #ffe8a8;
}

.difficulty-btn[data-difficulty="hardcore"].active {
    background: rgba(200, 50, 50, 0.3);
    border-color: rgba(255, 100, 100, 0.55);
    color: #ffcccc;
}

.difficulty-hint {
    flex: 1 1 100%;
    font-size: 0.65rem;
    color: rgba(180, 190, 210, 0.75);
    margin: 0;
}
