@import url('/fonts/fonts.css');

/* ════════════════════════════════════════════════════════════════════════
   RPG ARENA — Premium Dark Fantasy Skin
   ════════════════════════════════════════════════════════════════════════ */

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

/* Prevent text selection / Tap to Search app-wide — re-enable on editable fields */
*, *::before, *::after {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
}

.hidden { display: none !important; }

/* Event Banner Styles */
.event-content { padding: 16px; }
.event-no-banner { text-align: center; padding: 40px; }
.event-no-banner-icon { font-size: 3rem; margin-bottom: 12px; }
.event-no-banner-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.event-no-banner-desc { color: rgba(255,255,255, 0.5); }
.event-banner-card { max-width: 400px; margin: 0 auto; }
.event-pity-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.event-pity-header { display: flex; justify-content: space-between; font-size: 0.8rem; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.event-pity-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.event-pity-fill { height: 100%; background: linear-gradient(90deg, #9b59b6, #8e44ad); border-radius: 4px; transition: width 0.3s; }
.event-pity-odds { display: flex; justify-content: space-between; font-size: 0.75rem; }
.event-pity-odds strong { color: #f1c40f; }
.event-odds-table { margin-bottom: 20px; }
.event-odds-row { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.8rem; }
.event-odds-row.event-guaranteed { background: rgba(241,196,15,0.1); color: #f1c40f; font-weight: 700; }
.event-pull-section { text-align: center; margin-bottom: 20px; }
.event-pull-cost { display: flex; justify-content: center; gap: 12px; margin-bottom: 12px; font-size: 0.85rem; }
.event-cost-value { color: #3498db; font-weight: 600; }
.event-pull-btn { padding: 12px 32px; font-size: 1rem; border-radius: 8px; }
.event-results { margin-top: 16px; }
.event-result-won { text-align: center; font-size: 1.2rem; font-weight: 700; color: #f1c40f; padding: 12px; background: rgba(241,196,15,0.1); border-radius: 8px; margin-bottom: 12px; }
.event-result-won.won { animation: glow-pulse 1s ease-in-out infinite; }
@keyframes glow-pulse { 0%, 100% { box-shadow: 0 0 10px rgba(241,196,15,0.3); } 50% { box-shadow: 0 0 20px rgba(241,196,15,0.6); } }
.event-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 12px; }
.event-item { text-align: center; padding: 10px; border-radius: 6px; font-size: 0.75rem; background: rgba(255,255,255,0.05); }
.event-item.common { border: 1px solid rgba(255,255,255,0.1); }
.event-item.uncommon { border: 1px solid rgba(46,204,113,0.4); color: #2ecc71; }
.event-item.rare { border: 1px solid rgba(52,152,219,0.4); color: #3498db; }
.event-item.epic { border: 1px solid rgba(155,89,182,0.4); color: #9b59b6; }
.event-item.legendary { border: 1px solid rgba(241,196,15,0.4); color: #f1c40f; }
.event-new-stats { text-align: center; font-size: 0.7rem; color: rgba(255,255,255,0.4); }

/* Assistant */
.assistant-notification {
    position: fixed;
    right: 18px;
    bottom: 18px;
    left: auto;
    transform: none;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0)),
        linear-gradient(135deg, rgba(17,23,34,0.96), rgba(11,16,26,0.94));
    color: #f2f0e9;
    padding: 12px 14px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(212, 176, 95, 0.18);
    box-shadow: 0 18px 40px rgba(0,0,0,0.32);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
    max-width: min(320px, calc(100vw - 32px));
    width: 320px;
    overflow: hidden;
}

@media (max-width: 680px) {
    .premium-feature-art-wrap {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}
.premium-feature-grid {
    justify-content: center;
    align-items: stretch;
}
.premium-feature-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.premium-feature-card .premium-feature-head {
    flex: 0 0 auto;
}
.premium-feature-grid {
    justify-content: center;
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
}
.premium-feature-card {
    flex: 0 1 180px;
    max-width: 220px;
}
.premium-feature-art-wrap.pc-only { display: block; }
.premium-feature-art-wrap.mobile-only { display: none; }
.premium-feature-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
@media (max-width: 680px) {
    .premium-feature-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .premium-feature-card {
        width: 100%;
        max-width: 100%;
        flex: none;
    }
    .premium-feature-art-wrap.pc-only { display: none; }
    .premium-feature-art-wrap.mobile-only { 
        display: block; 
        border-radius: var(--radius) var(--radius) 0 0;
        overflow: hidden;
    }
    .premium-feature-art-wrap.mobile-only .premium-feature-art {
        width: 100%;
        height: auto;
        display: block;
    }
    .premium-feature-art-wrap.mobile-only {
        border-radius: var(--radius) var(--radius) 0 0;
    }
}
.premium-feature-grid {
    justify-content: center;
    align-items: stretch;
}
@media (max-width: 680px) {
    .premium-feature-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .premium-feature-card {
        width: 100%;
        border-radius: var(--radius);
        overflow: hidden;
    }
    .premium-feature-art-wrap.pc-only { display: none; }
    .premium-feature-art-wrap.mobile-only { 
        display: block; 
        border-radius: var(--radius) var(--radius) 0 0;
        overflow: hidden;
    }
    .premium-feature-art-wrap.mobile-only .premium-feature-art {
        width: 100%;
        height: auto;
        display: block;
    }
    .premium-feature-card .premium-feature-art-wrap.mobile-only:first-child {
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .premium-feature-card .premium-feature-art-wrap.mobile-only:last-child {
        border-radius: 0;
    }
}
.premium-feature-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.premium-feature-card .premium-feature-head {
    flex: 0 0 auto;
}
.assistant-notification.hidden { display: none !important; }
.assistant-notification::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/images/rune-bg.png') center/cover no-repeat;
    opacity: 0.04;
    pointer-events: none;
}
.assistant-notification > * {
    position: relative;
    z-index: 1;
}
@keyframes slideUp {
    from { transform: translateY(18px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.assistant-icon {
    display: none;
}
.assistant-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}
.assistant-msg-line {
    font-size: 0.79rem;
    line-height: 1.45;
    color: rgba(242,240,233,0.92);
}
.assistant-msg-line::before {
    content: 'Guide';
    display: inline-block;
    margin-right: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(201,146,42,0.16);
    border: 1px solid rgba(201,146,42,0.24);
    color: #e5c57a;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    vertical-align: middle;
}
.assistant-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.assistant-close {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 5px 9px;
    border-radius: 999px;
}
.assistant-close:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.22);
}
.assistant-disable {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.68);
    cursor: pointer;
    font-size: 0.68rem;
    padding: 6px 10px;
    border-radius: 999px;
    letter-spacing: 0.04em;
}
.assistant-disable:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

@media (max-width: 480px) {
    .assistant-notification {
        width: auto;
        max-width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
        bottom: 16px;
        padding: 11px 12px;
        border-radius: 14px;
    }
    @keyframes slideUp {
        from { transform: translateY(20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
    .assistant-msg-line {
        font-size: 0.76rem;
    }
    .assistant-actions {
        flex-direction: row;
        justify-content: space-between;
    }
}
.assistant-highlight {
    animation: pulse-glow 1.5s infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(155,89,182,0); }
    50% { box-shadow: 0 0 12px 4px rgba(155,89,182,0.6); }
}

/* Tutorial Banner */
.tutorial-banner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: min(100%, 520px);
    margin-left: auto;
    padding: 10px 12px;
    border-radius: 16px;
    flex-wrap: nowrap;
    border: 1px solid rgba(212, 176, 95, 0.14);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0)),
        radial-gradient(circle at top left, rgba(201,146,42,0.11), transparent 52%),
        linear-gradient(135deg, rgba(18,24,35,0.95), rgba(10,15,24,0.94));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    position: relative;
    overflow: hidden;
}
.tutorial-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/images/rune-bg.png') center/cover no-repeat;
    opacity: 0.035;
    pointer-events: none;
}
.tutorial-banner > * {
    position: relative;
    z-index: 1;
}
.tutorial-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}
.tutorial-tag {
    justify-self: start;
    background: rgba(201,146,42,0.13);
    color: #e5c57a;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(201,146,42,0.22);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.tutorial-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f3ead0;
    line-height: 1.2;
}
.tutorial-msg {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(234, 238, 245, 0.72);
    line-height: 1.35;
}
.tutorial-progress {
    flex: 0 0 auto;
    min-width: 54px;
    text-align: center;
    padding: 7px 8px;
    border-radius: 12px;
    background: rgba(201,146,42,0.1);
    border: 1px solid rgba(201,146,42,0.18);
    color: #f1d79b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.tutorial-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}
.skip-tutorial-btn, .goto-missions-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: #f2f0e9;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.goto-missions-btn {
    background: linear-gradient(135deg, rgba(201,146,42,0.24), rgba(201,146,42,0.12));
    border-color: rgba(201,146,42,0.26);
    color: #f6ebca;
}
.skip-tutorial-btn:hover, .goto-missions-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255,255,255,0.28);
}
.skip-tutorial-btn:hover {
    background: rgba(255,255,255,0.1);
}
.goto-missions-btn:hover {
    background: linear-gradient(135deg, rgba(201,146,42,0.3), rgba(201,146,42,0.16));
}

/* ── CSS Variables ── */
:root {
    --bg0:   #070b10;
    --bg1:   #0d1520;
    --bg2:   #111e2e;
    --bg3:   #172438;
    --bg4:   #1e2f45;
    --bg5:   #243749;

    --border:      rgba(255,255,255,0.07);
    --border-mid:  rgba(255,255,255,0.12);
    --border-hi:   rgba(255,255,255,0.22);

    --gold:        #d4a843;
    --gold-light:  #f0c84a;
    --gold-bright: #f5d070;
    --gold-dim:    rgba(212,168,67,0.2);
    --gold-glow:   rgba(212,168,67,0.4);

    --red:         #c0392b;
    --red-light:   #e74c3c;
    --red-dim:     rgba(231,76,60,0.15);
    --green:       #2ecc71;
    --green-dim:   rgba(46,204,113,0.15);
    --blue:        #3498db;
    --blue-dim:    rgba(52,152,219,0.15);
    --purple:      #9b59b6;
    --purple-dim:  rgba(155,89,182,0.15);

    --text:        #c8d0dc;
    --text-dim:    rgba(180,190,210,0.45);
    --text-bright: #eef2f8;

    --topbar-h:  72px;
    --sidebar-w: 228px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
}

/* ════════ SCROLLBARS ════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,146,42,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,146,42,0.45); }

/* ════════ BASE ════════ */
body {
    background: var(--bg0);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Lock background scroll + gestures when an in-game overlay (e.g. dungeon guild) is open. */
body.modal-lock {
    overflow-y: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

/* Combat overlays should fully hide global navigation (topbar + sidebar). */
body.combat-lock .topbar,
body.combat-lock .sidebar {
    display: none !important;
}

/* When a modal/overlay is open, keep the topbar visible.
   Default: don't change layout on most browsers (Android/desktop). */
body.modal-lock .topbar {
    position: relative;
}

/* iOS/WebKit: the topbar can be scrolled away; once body scrolling is locked, it can't be recovered.
   Force it visible while the overlay is open. */
@supports (-webkit-touch-callout: none) {
    body.modal-lock .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 300000;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   AUTH SCREENS
   ════════════════════════════════════════════════════════════════════════ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
#screen-auth { overflow-x: hidden; }
#screen-game.active { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.auth-bg {
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse at 15% 40%, rgba(120,40,40,0.35) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 60%, rgba(30,50,120,0.35) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 100%, rgba(80,30,100,0.2) 0%, transparent 60%),
        linear-gradient(180deg, #07080f 0%, #0c0e1a 100%);
}
.auth-bg::after {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.018'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-bg::before {
    content: '';
    position: fixed;
    inset: -50%;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1px 1px at 12% 28%, rgba(255,215,0,0.35), transparent),
        radial-gradient(1px 1px at 25% 55%, rgba(255,215,0,0.25), transparent),
        radial-gradient(1.5px 1.5px at 38% 12%, rgba(255,255,255,0.3), transparent),
        radial-gradient(1px 1px at 52% 65%, rgba(255,215,0,0.2), transparent),
        radial-gradient(1px 1px at 68% 32%, rgba(255,255,255,0.2), transparent),
        radial-gradient(1.5px 1.5px at 78% 72%, rgba(255,215,0,0.3), transparent),
        radial-gradient(1px 1px at 88% 48%, rgba(255,255,255,0.15), transparent),
        radial-gradient(1px 1px at 18% 82%, rgba(255,215,0,0.18), transparent),
        radial-gradient(1px 1px at 55% 92%, rgba(255,215,0,0.25), transparent),
        radial-gradient(1.5px 1.5px at 42% 42%, rgba(255,215,0,0.15), transparent),
        radial-gradient(1px 1px at 72% 16%, rgba(255,215,0,0.22), transparent),
        radial-gradient(1px 1px at 30% 68%, rgba(255,255,255,0.12), transparent),
        radial-gradient(1px 1px at 60% 22%, rgba(255,215,0,0.2), transparent),
        radial-gradient(1.5px 1.5px at 48% 78%, rgba(255,255,255,0.12), transparent),
        radial-gradient(1px 1px at 82% 88%, rgba(255,215,0,0.18), transparent),
        radial-gradient(1px 1px at 92% 8%, rgba(255,255,255,0.12), transparent);
    animation: particleDrift 25s ease-in-out infinite alternate;
}
@keyframes particleDrift {
    0%   { transform: translate(-5%, -5%) rotate(0deg); }
    50%  { transform: translate(3%, -2%) rotate(2deg); }
    100% { transform: translate(5%, 5%) rotate(-2deg); }
}

.auth-container {
    position: relative; z-index: 1;
    max-width: 440px; width: 92%;
    margin: 0 auto; padding: 56px 20px 40px;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.auth-container > * { animation: authFadeIn 0.6s ease both; }
.auth-container > :nth-child(1) { animation-delay: 0s; }
.auth-container > :nth-child(2) { animation-delay: 0.08s; }
.auth-container > :nth-child(3) { animation-delay: 0.16s; }
.auth-container > :nth-child(4) { animation-delay: 0.24s; }
.auth-container > :nth-child(5) { animation-delay: 0.32s; }
.auth-container > :nth-child(6) { animation-delay: 0.40s; }
.auth-container > :nth-child(7) { animation-delay: 0.48s; }
.auth-container > :nth-child(8) { animation-delay: 0.56s; }
@keyframes authFadeIn { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: translateY(0); } }
.auth-container.wide { max-width: 800px; padding-top: 36px; }

.game-title {
    font-family: 'Cinzel Decorative', 'Cinzel', serif;
    font-size: clamp(2rem, 6vw, 3.6rem);
    color: var(--gold-light);
    text-shadow: 0 0 60px var(--gold-glow), 0 0 20px var(--gold-dim), 0 2px 6px rgba(0,0,0,0.9);
    letter-spacing: 0.06em;
    text-align: center;
    animation: titleGlow 4s ease-in-out infinite;
}
.game-title.small { font-size: clamp(1.3rem, 4vw, 2rem); }
@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 40px var(--gold-glow), 0 2px 6px rgba(0,0,0,0.9); }
    50%       { text-shadow: 0 0 80px rgba(212,168,67,0.7), 0 0 30px var(--gold-dim), 0 2px 6px rgba(0,0,0,0.9); }
}
.game-subtitle {
    font-family: 'IM Fell English', 'Georgia', serif;
    color: var(--text-dim); font-style: italic; font-size: 0.95rem;
    letter-spacing: 0.25em; text-align: center;
}
.auth-beta-notice {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(201,146,42,0.18);
    background: linear-gradient(180deg, rgba(201,146,42,0.12), rgba(255,255,255,0.03));
    color: rgba(255,245,214,0.88);
    font-size: 0.78rem;
    line-height: 1.45;
}

.auth-server-select {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.auth-server-select label {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}
.auth-server-select button.server-select-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--gold-light, #f1c40f);
    font-family: 'Cinzel', serif;
    font-size: 0.82rem;
    padding: 7px 12px;
    cursor: pointer;
}
.auth-server-select button.server-select-btn:hover { border-color: var(--gold, #c9926a); }
.auth-server-select button.server-select-btn:focus { outline: none; border-color: var(--gold, #c9926a); }
.server-caret { opacity: 0.6; font-size: 0.7rem; }

.server-picker-box { max-width: 360px; text-align: left; }
.server-picker-box .modal-title { font-family: 'Cinzel', serif; color: var(--gold-light, #f1c40f); }
.server-picker-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #fff;
    font-family: 'Cinzel', serif;
    text-align: left;
    padding: 12px 14px;
    margin: 8px 0;
    cursor: pointer;
}
.server-picker-option:hover { border-color: var(--gold, #c9926a); background: rgba(255,255,255,0.09); }
.server-picker-option:last-child { margin-bottom: 0; }
.server-picker-name { font-size: 1rem; color: var(--gold-light, #f1c40f); }
.server-picker-desc { font-family: sans-serif; font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 3px; }

.coming-soon {
    position: fixed; inset: 0; z-index: 300000;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% 30%, #1b2434, #0c1118);
    padding: 20px;
}
.coming-soon.hidden { display: none; }
.coming-soon-box { text-align: center; max-width: 480px; width: 100%; }
.coming-soon-box .game-logo { margin-bottom: 8px; }
.coming-soon-title {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--gold-light, #f1c40f);
    margin: 24px 0 6px;
}
.coming-soon-sub { font-size: 1rem; color: rgba(255,255,255,0.5); }
.coming-soon-text {
    font-family: sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.75);
    margin: 8px 0;
}
.coming-soon-box .btn-primary { margin-top: 18px; padding: 12px 28px; font-size: 1rem; }

.game-logo {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
    height: auto;
    border-radius: 30px;
    border: 2px solid transparent;
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)) padding-box,
                linear-gradient(145deg, var(--gold), var(--gold-light)) border-box;
    box-shadow: inset 0 0 40px rgba(255,215,0,0.25), 0 20px 60px rgba(0,0,0,0.7);
    animation: logoGlow 4s ease-in-out infinite;
    transition: all 0.3s ease;
}
.game-logo:hover { transform: scale(1.015); box-shadow: inset 0 0 60px rgba(255,215,0,0.35), 0 25px 70px rgba(0,0,0,0.8); }
@keyframes logoGlow {
    0%, 100% { box-shadow: inset 0 0 30px rgba(255,215,0,0.2), 0 20px 60px rgba(0,0,0,0.7); }
    50%       { box-shadow: inset 0 0 60px rgba(255,215,0,0.4), 0 20px 60px rgba(0,0,0,0.7); }
}

.auth-container::before {
    content: '';
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(1.1);
    width: 100vw; height: 100vh;
    background: url('/images/logo/battle.png') no-repeat center center;
    background-size: cover;
    opacity: 0.10;
    z-index: -1;
    pointer-events: none;
    filter: blur(2px) brightness(1.1);
    animation: backgroundBreathing 8s ease-in-out infinite;
}
@keyframes backgroundBreathing {
    0%, 100% { opacity: 0.08; transform: translate(-50%,-50%) scale(1.1); }
    50%       { opacity: 0.14; transform: translate(-50%,-50%) scale(1.15); }
}

.auth-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 10px; padding: 4px; width: 100%; }
.tab-btn {
    flex: 1; background: none; border: none; color: var(--text-dim);
    font-family: 'Cinzel', serif; font-size: 0.82rem; letter-spacing: 0.04em;
    padding: 9px 16px; border-radius: 7px; cursor: pointer; transition: all 0.2s;
}
.tab-btn.active {
    background: linear-gradient(135deg, #b8860b, var(--gold-light));
    color: #1a0f00; font-weight: 700;
    box-shadow: 0 2px 12px rgba(212,168,67,0.3);
}

.tab-content { display: none; flex-direction: column; gap: 12px; width: 100%; }
.tab-content.active { display: flex; animation: tabSlideIn 0.3s ease; }
@keyframes tabSlideIn { 0% { opacity: 0; transform: translateX(-8px); } 100% { opacity: 1; transform: translateX(0); } }
.auth-legal-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 0.76rem;
}
.auth-legal-link {
    appearance: none;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.62);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.18s ease;
}
.auth-legal-link:hover { color: var(--gold); }
.auth-legal-sep { color: rgba(255,255,255,0.22); }

.input-field, .auth-input {
    width: 100%; padding: 12px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-family: 'Inter', sans-serif; font-size: 0.92rem;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
}
.input-field:focus, .auth-input:focus {
    border-color: var(--gold);
    background: rgba(255,255,255,0.07);
    box-shadow: 0 0 20px rgba(212,168,67,0.12), inset 0 0 20px rgba(212,168,67,0.04);
}
.auth-password-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin-top: -4px;
    margin-bottom: 2px;
    color: rgba(255,255,255,0.72);
    font-size: 0.78rem;
    user-select: none;
    cursor: pointer;
}
.auth-password-toggle input {
    accent-color: var(--gold);
    cursor: pointer;
}
.auth-password-toggle span {
    line-height: 1;
}
.auth-referral-note {
    margin-top: -4px;
    margin-bottom: 4px;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--text-dim);
    text-align: center;
}
.auth-legal-modal {
    max-width: 760px;
    width: min(94vw, 760px);
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        radial-gradient(circle at top, rgba(201,146,42,0.12), transparent 34%),
        linear-gradient(180deg, rgba(18,24,37,0.98), rgba(10,14,22,0.98));
    box-shadow: 0 30px 70px rgba(0,0,0,0.55);
}
.game-guide-modal {
    max-width: 980px;
    width: min(96vw, 980px);
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        radial-gradient(circle at top, rgba(201,146,42,0.14), transparent 30%),
        linear-gradient(180deg, rgba(18,24,37,0.99), rgba(10,14,22,0.99));
    box-shadow: 0 30px 70px rgba(0,0,0,0.55);
}
.auth-legal-header { margin-bottom: 18px; }
.auth-legal-header h2 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.35rem;
    color: var(--text-bright);
}
.game-guide-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    color: var(--text);
}
.game-guide-hero {
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(201,146,42,0.16);
    background:
        linear-gradient(135deg, rgba(201,146,42,0.14), rgba(255,255,255,0.03)),
        rgba(255,255,255,0.02);
}
.game-guide-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}
.game-guide-title {
    font-family: 'Cinzel', serif;
    font-size: 1.18rem;
    color: var(--text-bright);
    margin-bottom: 8px;
}
.game-guide-hero p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.82);
}
.game-guide-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.game-guide-section h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
}
.game-guide-grid,
.guide-class-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.game-guide-card,
.guide-class-card {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.035);
}
.game-guide-card h3,
.guide-class-name {
    margin: 0 0 8px 0;
    color: var(--text-bright);
    font-size: 0.96rem;
}
.guide-class-name {
    font-family: 'Cinzel', serif;
}
.guide-subtitle {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
}
.game-guide-card p,
.guide-class-card p {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.65;
    color: rgba(255,255,255,0.82);
}
.guide-class-tip {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--gold-light);
}
.game-guide-card ul,
.guide-class-card ul {
    margin: 0;
    padding-left: 18px;
    color: rgba(255,255,255,0.82);
}
.game-guide-card li,
.guide-class-card li {
    margin-bottom: 7px;
    font-size: 0.82rem;
    line-height: 1.55;
}
@media (max-width: 760px) {
    .game-guide-modal {
        width: min(96vw, 96vw);
        padding: 18px;
    }
    .game-guide-grid,
    .guide-class-grid {
        grid-template-columns: 1fr;
    }
    .game-guide-hero,
    .game-guide-card,
    .guide-class-card {
        padding: 14px 15px;
    }
}
.auth-legal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--text);
}
.auth-legal-section {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.auth-legal-section h3 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--gold);
}
.auth-legal-section p {
    margin: 0 0 8px 0;
    font-size: 0.84rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.82);
}
.auth-legal-section p:last-child { margin-bottom: 0; }
.auth-legal-section ul {
    margin: 0 0 8px 0;
    padding-left: 18px;
    color: rgba(255,255,255,0.82);
}
.auth-legal-section li {
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
}
.auth-legal-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-bright);
    margin-bottom: 6px;
}
.auth-legal-updated {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}
textarea.auth-input { resize: vertical; min-height: 80px; }

.error-msg {
    background: rgba(192,57,43,0.12); border: 1px solid rgba(192,57,43,0.4);
    border-radius: var(--radius-sm); padding: 10px 14px;
    color: var(--red-light); font-size: 0.83rem; text-align: center;
}
.error-msg.hidden { display: none; }

.class-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
@media (max-width: 500px) { .class-grid { grid-template-columns: 1fr; } }
.class-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px; text-align: center;
    cursor: pointer; transition: all 0.2s; position: relative;
    overflow: hidden;
}
.class-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(3,6,10,0.18) 42%, rgba(3,6,10,0.86) 100%);
    pointer-events: none;
}
.class-card:hover { border-color: var(--gold-dim); transform: translateY(-2px); box-shadow: 0 18px 34px rgba(0,0,0,0.28); }
.class-card.selected { border-color: var(--gold); background: rgba(212,168,67,0.08); box-shadow: 0 0 24px rgba(212,168,67,0.2), 0 18px 44px rgba(0,0,0,0.34); }
.class-card.class-card-taken {
    opacity: 0.45;
    filter: grayscale(0.3);
    border-color: rgba(255,255,255,0.08);
}
.class-card.class-card-taken::after {
    content: 'Taken';
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(224,82,82,0.14);
    border: 1px solid rgba(224,82,82,0.24);
    color: var(--red-light);
    font-size: 0.68rem;
    font-weight: 700;
}
.class-art {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    min-height: 220px;
    margin-bottom: 12px;
    border-radius: calc(var(--radius) - 4px);
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(201,146,42,0.22), rgba(10,16,24,0.9) 70%);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.class-art::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.1) 50%, rgba(4,7,12,0.56) 100%);
    pointer-events: none;
}
.class-art-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.class-art-fallback {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: radial-gradient(circle at top, rgba(201,146,42,0.18), rgba(10,16,24,0.96) 74%);
}
.class-name,
.class-stats,
.class-discounts,
.class-desc {
    position: relative;
    z-index: 1;
}
.class-name { font-size: 1rem; color: var(--gold-light); font-weight: 600; margin-bottom: 5px; font-family: 'Cinzel', serif; }
.class-stats { font-size: 0.68rem; color: var(--text-dim); letter-spacing: 0.05em; margin-bottom: 6px; }
.class-discounts { font-size: 0.65rem; color: rgba(46,204,113,0.7); margin-bottom: 5px; }
.class-desc { font-family: 'IM Fell English', serif; font-style: italic; font-size: 0.82rem; color: var(--text); margin-top: auto; }

/* ════════════════════════════════════════════════════════════════════════
   SHARED BUTTONS
   ════════════════════════════════════════════════════════════════════════ */
.btn-primary {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 22px;
    background: linear-gradient(160deg, #6b3d00 0%, #b07020 40%, var(--gold-light) 70%, #c8860a 100%);
    border: 1px solid rgba(228,180,60,0.5);
    border-radius: var(--radius-sm);
    color: #1a0800; font-family: 'Cinzel', serif;
    font-size: 0.88rem; font-weight: 700; letter-spacing: 0.06em;
    cursor: pointer; transition: all 0.22s;
    box-shadow: 0 4px 24px rgba(201,146,42,0.25), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 0 rgba(0,0,0,0.2);
    text-shadow: 0 1px 2px rgba(255,210,100,0.3);
}
.btn-primary::after {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 55%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    transition: left 0.5s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 7px 32px rgba(201,146,42,0.4), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-primary:hover::after { left: 160%; }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 10px rgba(201,146,42,0.25); }
.btn-primary:disabled { background: rgba(255,255,255,0.06); color: var(--text-dim); border-color: var(--border); cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.82rem;
    cursor: pointer; transition: all 0.18s;
    backdrop-filter: blur(4px);
}
.btn-secondary:hover { border-color: rgba(201,146,42,0.3); color: var(--gold-light); background: rgba(201,146,42,0.06); }
.btn-secondary:active { transform: scale(0.98); }

.btn-sm {
    padding: 4px 11px; border-radius: 6px;
    border: 1px solid var(--border-mid);
    background: rgba(255,255,255,0.03);
    color: var(--text-dim); font-size: 0.73rem;
    cursor: pointer; transition: all 0.14s;
}
.btn-sm:hover { border-color: rgba(201,146,42,0.3); color: var(--gold-light); background: rgba(201,146,42,0.05); }
.btn-sm.danger { border-color: rgba(224,82,82,0.22); color: var(--red-light); }
.btn-sm.danger:hover { background: var(--red-dim); border-color: rgba(224,82,82,0.45); }

.btn-attack {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    background: linear-gradient(145deg, #4a0000 0%, #8b1a1a 50%, #c0392b 100%);
    border: 1px solid rgba(224,82,82,0.45);
    border-radius: var(--radius-sm);
    color: #fff; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    box-shadow: 0 3px 16px rgba(139,26,26,0.4), inset 0 1px 0 rgba(255,255,255,0.12);
    transition: all 0.2s;
}
.btn-attack:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 22px rgba(192,57,43,0.55); }
.btn-attack:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-train {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 18px;
    background: linear-gradient(145deg, #2c1800, #6b3d00, var(--gold));
    border: 1px solid rgba(201,146,42,0.38);
    border-radius: var(--radius-sm);
    color: #1a0800; font-family: 'Cinzel', serif; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s;
    box-shadow: 0 3px 14px rgba(201,146,42,0.14), inset 0 1px 0 rgba(255,255,255,0.15);
    text-align: center;
}
.btn-train:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 5px 20px rgba(201,146,42,0.3); }
.btn-train:disabled { background: rgba(255,255,255,0.05); color: var(--text-dim); border-color: var(--border); cursor: not-allowed; transform: none; box-shadow: none; }

.btn-upgrade {
    min-width: 132px; padding: 10px 16px;
    background:
        linear-gradient(180deg, rgba(255,236,180,0.95), rgba(210,152,55,0.98)),
        linear-gradient(145deg, #2a1800, #6b3d00, var(--gold));
    border: 1px solid rgba(233,190,96,0.42);
    border-radius: 999px;
    color: #1a0800; font-size: 0.76rem; font-weight: 800; letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer; transition: all 0.18s;
    box-shadow: 0 8px 22px rgba(201,146,42,0.18), inset 0 1px 0 rgba(255,255,255,0.38);
    white-space: nowrap;
}
.btn-upgrade:hover:not(:disabled) { opacity: 0.96; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(201,146,42,0.24), inset 0 1px 0 rgba(255,255,255,0.45); }
.btn-upgrade:disabled {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    color: var(--text-dim); border-color: var(--border); cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-forge {
    width: 100%; padding: 9px;
    background: linear-gradient(145deg, #1a1200, #4a3800, #aa8020);
    border: 1px solid rgba(201,146,42,0.28);
    border-radius: var(--radius-sm);
    color: #1a0800; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all 0.18s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-forge:disabled { background: rgba(255,255,255,0.04); color: var(--text-dim); border-color: var(--border); cursor: not-allowed; }
.btn-forge-owned:disabled { background: rgba(39,174,96,0.06); color: rgba(46,204,113,0.4); border-color: rgba(39,174,96,0.2); }
.btn-forge:not(:disabled):hover { opacity: 0.9; transform: translateY(-1px); }

.btn-shop {
    background: linear-gradient(135deg, #6b3d00, var(--gold-light));
    color: #1a0800; border: 1px solid rgba(228,184,75,0.4);
    padding: 7px 16px; border-radius: var(--radius-sm);
    font-weight: 700; font-size: 0.8rem; cursor: pointer; transition: all 0.18s;
    box-shadow: 0 2px 8px rgba(201,146,42,0.15);
    white-space: nowrap;
}
.btn-shop:hover:not(:disabled) { transform: scale(1.03); box-shadow: 0 4px 16px rgba(201,146,42,0.3); }
.btn-shop:disabled { opacity: 0.28; cursor: not-allowed; }

.btn-collect {
    padding: 8px; width: 100%;
    background: rgba(39,174,96,0.12);
    border: 1px solid rgba(39,174,96,0.38);
    border-radius: var(--radius-sm);
    color: var(--green); font-size: 0.82rem; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
}
.btn-collect:enabled:hover { background: rgba(39,174,96,0.22); }
.btn-collect:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-cancel-travel {
    padding: 7px; width: 100%;
    background: var(--red-dim); border: 1px solid rgba(224,82,82,0.3);
    border-radius: var(--radius-sm);
    color: var(--red-light); font-size: 0.78rem; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.btn-cancel-travel:hover:not(:disabled) { background: rgba(192,57,43,0.25); }
.btn-cancel-travel:disabled { opacity: 0.35; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════════════════ */
.topbar {
    height: var(--topbar-h); min-height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; gap: 12px;
    z-index: 200; flex-shrink: 0;
    position: relative;
    background: linear-gradient(180deg, rgba(8,12,22,0.98) 0%, rgba(10,16,28,0.96) 100%);
    border-bottom: 1px solid rgba(201,146,42,0.2);
    box-shadow: 0 2px 40px rgba(0,0,0,0.8), 0 1px 0 rgba(201,146,42,0.12);
    overflow: hidden;
}
.topbar::after {
    content: '';
    position: absolute; inset: 0;
    background: url('/images/logo/top-bar.png') center center / cover no-repeat;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}
.topbar > * { position: relative; z-index: 1; }
.topbar::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(201,146,42,0.0) 10%,
        rgba(232,184,75,0.7) 30%,
        rgba(245,208,112,0.9) 50%,
        rgba(232,184,75,0.7) 70%,
        rgba(201,146,42,0.0) 90%,
        transparent 100%);
    animation: topbarShimmer 5s ease-in-out infinite;
}
@keyframes topbarShimmer {
    0%,100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

/* Avatar */
.topbar-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
}

.topbar-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;

    border: 2px solid rgba(201,146,42,0.5);
    box-shadow:
        0 0 0 1px rgba(201,146,42,0.15),
        0 0 18px rgba(201,146,42,0.2);

    background: var(--bg3);
    transition: box-shadow 0.3s;
}

.topbar-avatar:hover {
    box-shadow:
        0 0 0 2px rgba(201,146,42,0.6),
        0 0 28px rgba(201,146,42,0.4);
}

.topbar-avatar-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.topbar-name {
    font-family: 'Cinzel', serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-bright);
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.topbar-level {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--gold-light);
    white-space: nowrap;

    background: rgba(201,146,42,0.1);
    border: 1px solid rgba(201,146,42,0.25);
    padding: 1px 8px;
    border-radius: 8px;
    align-self: flex-start;
}

/* Bars Layout */
.topbar-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
    max-width: 380px;
}

.topbar-bar-row {
    display: flex;
    align-items: center;
    gap: 7px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.topbar-bar-label {
    font-size: 0.56rem;
    font-weight: 800;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    width: 16px;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* Track (Frame) */
.topbar-bar-track {
    flex: 1;
    height: 10px;
    min-width: 60px;
    border-radius: 5px;
    overflow: hidden;
    position: relative;

    background: linear-gradient(to bottom, #0e0e0e, #1a1a1a);
    border: 1px solid rgba(201,146,42,0.18);

    box-shadow:
        inset 0 1px 2px rgba(0,0,0,0.9),
        inset 0 -1px 2px rgba(255,255,255,0.05),
        0 0 4px rgba(0,0,0,0.6);
}

/* Inner groove */
.topbar-bar-track::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 4px;

    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.04),
        rgba(0,0,0,0.35)
    );

    pointer-events: none;
}

/* End cap */
.topbar-bar-track::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);

    width: 6px;
    height: 6px;
    border-radius: 50%;

    background: radial-gradient(circle, #caa64a, #5a3b00);
    box-shadow: 0 0 4px rgba(0,0,0,0.7);
}

/* Fill base */
.topbar-bar-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    overflow: hidden;

    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);

    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.4);
}

/* Global lighting layer */
.topbar-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;

    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.25),
        rgba(255,255,255,0.05) 40%,
        transparent 60%
    );

    pointer-events: none;
}

/* HP */
.topbar-bar-fill.hp-fill {
    background: linear-gradient(90deg, #145a32, #1e8449, #2ecc71);
    box-shadow:
        inset 0 0 6px rgba(0,0,0,0.6),
        0 0 4px rgba(46,204,113,0.25);
}

.hp-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 25% 50%, rgba(255,255,255,0.2), transparent 60%);
    opacity: 0.5;
}

/* XP */
.topbar-bar-fill.xp-fill {
    background: repeating-linear-gradient(
        90deg,
        #caa64a,
        #caa64a 6px,
        #b8963f 6px,
        #b8963f 12px
    );

    box-shadow:
        0 0 6px rgba(202,166,74,0.5),
        inset 0 0 4px rgba(0,0,0,0.6);
}

/* XP shine (separate layer, no conflict) */
.xp-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 40%;
    height: 100%;

    background: rgba(255,255,255,0.25);
    transform: skewX(-20deg);

    animation: xpShine 3s infinite;
}

@keyframes xpShine {
    100% { left: 140%; }
}

/* MP */
.topbar-bar-fill.mp-fill {
    background: linear-gradient(90deg, #5f27cd, #8e44ad, #d7bde2);
    box-shadow:
        0 0 10px rgba(155,89,182,0.45),
        inset 0 0 6px rgba(0,0,0,0.6);
}

.mp-fill::before {
    content: '';
    position: absolute;
    inset: 0;

    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255,255,255,0.35),
        transparent 70%
    );

    animation: mpFlow 2s linear infinite;
}

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

/* Text */
.topbar-bar-text {
    font-size: 0.6rem;
    color: #bfbfbf;
    white-space: nowrap;
    min-width: 62px;
    text-align: right;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.topbar-bar-num,
.topbar-bar-sep {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.topbar-bar-num {
    display: inline-block;
    min-width: 2.8em;
}

.topbar-bar-num-max {
    text-align: left;
}

.topbar-bar-sep {
    display: inline-block;
    width: 0.8em;
    text-align: center;
    opacity: 0.7;
}

.topbar-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; margin-left: auto; }
.topbar-currency {
    font-size: 0.8rem; color: var(--text); white-space: nowrap; font-weight: 600;
    padding: 4px 10px; border-radius: 6px; border: 1px solid transparent; transition: all 0.15s;
}
.topbar-gems-btn { cursor: pointer; border-color: rgba(142,68,173,0.3); background: rgba(142,68,173,0.08); }
.topbar-gems-btn:hover { background: rgba(142,68,173,0.2); border-color: rgba(142,68,173,0.5); }
.topbar-chat-btn {
    font-size: 0.74rem;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(52,152,219,0.28);
    background: linear-gradient(180deg, rgba(52,152,219,0.15), rgba(52,152,219,0.07));
    color: var(--accent-blue);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.topbar-chat-btn:hover {
    background: linear-gradient(180deg, rgba(52,152,219,0.24), rgba(52,152,219,0.1));
    border-color: rgba(52,152,219,0.5);
    transform: translateY(-1px);
}
.topbar-chat-btn.has-alert {
    position: relative;
}
.topbar-chat-btn.has-alert::after {
    content: '!';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff6666, #c0392b);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(192,57,43,0.38);
}

.topbar-menu-btn {
    font-size: 0.74rem;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(201,146,42,0.28);
    background: linear-gradient(180deg, rgba(201,146,42,0.15), rgba(201,146,42,0.07));
    color: var(--gold);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.topbar-menu-btn:hover {
    background: linear-gradient(180deg, rgba(201,146,42,0.24), rgba(201,146,42,0.1));
    border-color: rgba(201,146,42,0.5);
    transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════════════════════════
   GAME LAYOUT
   ════════════════════════════════════════════════════════════════════════ */
.game-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* ════════════════════════════════════════════════════════════════════════
   SIDEBAR / NAV
   Desktop : horizontal scrollable bar (flex row, images visible)
   Mobile  : fixed bottom bar (emoji only)
   ════════════════════════════════════════════════════════════════════════ */

/* ── Desktop base (applies ≥ 641 px) ── */
.sidebar {
    width: 100%;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), transparent 42%),
        linear-gradient(180deg, rgba(10,15,26,0.98), rgba(8,12,20,0.98));
    border-bottom: 1px solid rgba(201,146,42,0.15);
    overflow-x: auto;
    overflow-y: visible;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(201,146,42,0.3) transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.18);
}
.sidebar::before,
.sidebar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
}
.sidebar::before {
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,146,42,0.4), transparent);
}
.sidebar::after {
    top: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 15% 50%, rgba(201,146,42,0.08), transparent 18%),
        radial-gradient(circle at 85% 50%, rgba(52,152,219,0.08), transparent 18%);
    opacity: 0.9;
}
.sidebar::-webkit-scrollbar { height: 4px; }
.sidebar::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.sidebar::-webkit-scrollbar-thumb { background: rgba(201,146,42,0.3); border-radius: 2px; }

.sidebar-inner {
    display: flex;
    align-items: center;
    height: 63px;
    width: max-content;
    margin: 0 auto;
}

.sidebar-left,
.sidebar-right {
    flex-shrink: 0;
    height: 63px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
}
.sidebar-left img,
.sidebar-right img {
    height: 63px;
    width: auto;
    display: block;
}

.sidebar-buttons {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

@media (min-width: 641px) {
    .sidebar {
        background:
            linear-gradient(rgba(5,8,14,0.82), rgba(5,8,14,0.82)),
            url('/images/logo/arena.png') center center / cover no-repeat;
    }
}
.nav-hub-group {
    position: relative;
    display: flex;
    align-items: center;
    overflow: visible;
}
.character-inline-hub {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
    width: 63px;
    border-radius: 18px;
    border: none;
    background: transparent;
    box-shadow: none;
    z-index: 9999;
    position: relative;
    overflow: visible;
}
.character-inline-hub::before {
    content: '';
    position: absolute;
    top: -14px;
    left: -14px;
    width: calc(100% + 28px);
    height: var(--dropdown-frame-height, calc(100% + 28px));
    background: transparent url('/images/assets/inventory/dropdown.png') center / 100% 100% no-repeat;
    pointer-events: none;
    z-index: -1;
}
.character-inline-hub.hidden {
    display: none;
}
.nav-btn.nav-sub-btn {
    width: 100%;
    height: 63px;
    margin: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    cursor: pointer;
}
.nav-btn.nav-sub-btn:first-child {
    border-radius: 18px 18px 0 0;
}
.nav-btn.nav-sub-btn:last-child {
    border-radius: 0 0 18px 18px;
}
.nav-btn.nav-sub-btn:only-child {
    border-radius: 18px;
}
.sub-btn-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    pointer-events: none;
}
.nav-sub-btn .sub-btn-icon {
    height: 34px;
    width: auto;
    display: block;
    opacity: 0.75;
    filter: drop-shadow(0 0 4px rgba(255,200,100,0.35));
}
.sub-btn-label {
    font-size: 0.7rem;
    font-weight: 900;
    color: #E5D8C2;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-shadow: 0 0 6px rgba(255,200,100,0.4), 0 1px 4px rgba(0,0,0,0.9);
    line-height: 1.2;
    white-space: nowrap;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 63px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
    position: relative;
    overflow: visible;
}
.nav-btn img {
    display: block;
    height: 63px;
    width: auto;
    object-fit: cover;
    pointer-events: none;
}
.nav-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}
.nav-btn.active {
    filter: drop-shadow(0 0 8px rgba(52,152,219,0.45));
}
.nav-btn.tutorial-highlight {
    animation: tutorial-nav-pulse 1.6s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(201,146,42,0.45));
}
.nav-btn.tutorial-highlight img {
    filter: drop-shadow(0 0 10px rgba(201,146,42,0.5));
}
.nav-btn.tutorial-highlight::after {
    content: '';
    position: absolute;
    inset: 8px 6px;
    border-radius: 14px;
    border: 1px solid rgba(201,146,42,0.28);
    box-shadow: 0 0 0 0 rgba(201,146,42,0.35);
    pointer-events: none;
    animation: tutorial-nav-ring 1.6s ease-in-out infinite;
}
@keyframes tutorial-nav-pulse {
    0%, 100% {
        transform: translateY(0);
        filter: drop-shadow(0 0 0 rgba(201,146,42,0));
    }
    50% {
        transform: translateY(-2px);
        filter: drop-shadow(0 0 10px rgba(201,146,42,0.55));
    }
}
@keyframes tutorial-nav-ring {
    0%, 100% {
        opacity: 0.55;
        box-shadow: 0 0 0 0 rgba(201,146,42,0.18);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 0 8px rgba(201,146,42,0);
    }
}

.unread-badge {
    position: absolute;
    top: -3px;
    right: -5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    padding: 3px 6px;
    background: var(--red-light);
    color: #fff;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: 0 0 10px rgba(224,82,82,0.5);
    pointer-events: none;
    z-index: 6;
}
.unread-badge.hidden { display: none; }

/* Hide desktop-only elements that don't apply */
.sidebar-section-label { display: none; }
.nav-edge { display: none !important; }

/* ── Mobile override ≤ 640 px ── */
@media (max-width: 640px) {
    .sidebar {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        border-top: none;
        border-bottom: 1px solid rgba(201,146,42,0.15);
        padding: 0;
        overflow-x: auto;
    }
    
    .sidebar-inner {
        width: 100%;
        height: 40px;
        justify-content: center;
    }
    
    .sidebar-left,
    .sidebar-right {
        display: none;
    }
    
    .sidebar-left img,
    .sidebar-right img {
        height: 40px;
    }

    .sidebar-buttons {
        width: 100%;
        justify-content: center;
        flex-shrink: 1;
    }
    
    .nav-btn {
        height: 40px;
    }
    
    .nav-btn img {
        height: 40px;
    }
    .nav-btn.nav-sub-btn {
        height: 38px;
    }
    .nav-sub-btn .sub-btn-icon {
        height: 18px;
        opacity: 0.65;
        filter: drop-shadow(0 0 3px rgba(255,200,100,0.25));
    }
    .sub-btn-label {
        font-size: 0.5rem;
    }
    
    .unread-badge {
        top: -1px;
        right: -2px;
        font-size: 0.55rem;
        padding: 2px 5px;
        min-width: 18px;
    }
    
    /* Mobile scrolling: avoid nested scroll containers (causes iOS/WebKit overlay + z-index glitches). */
    #screen-game.active {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .game-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: unset;
        overflow: visible;
    }
    
    .tab-content-area {
        flex: 1;
        overflow: visible;
        padding: 16px;
        padding-bottom: 16px;
        -webkit-overflow-scrolling: auto;
    }
    
    /* Ensure active tab content is visible */
    .game-tab.active {
        display: block;
        width: 100%;
    }
}
/* ════════════════════════════════════════════════════════════════════════
   TAB CONTENT AREA
   ════════════════════════════════════════════════════════════════════════ */
.tab-content-area {
    flex: 1; min-width: 0; overflow-y: auto; padding: 22px 24px;
    background:
        linear-gradient(rgba(5,8,14,0.82), rgba(5,8,14,0.82)),
        url('/images/logo/arena.png') center center / cover no-repeat; /* removed 'fixed' */
    position: relative;
}
.tab-content-area::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 40px 40px; pointer-events: none; z-index: 0;
}

.game-tab { display: none; position: relative; z-index: 1; }
.game-tab.active { display: block; }

#chat-widget-root {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 6000;
    display: block;
    pointer-events: none;
}

.chat-widget-bubble {
    pointer-events: auto;
    min-width: 70px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(12,16,24,0.88);
    color: var(--text-bright);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}
.chat-widget-bubble:hover {
    background: rgba(20,26,38,0.92);
    border-color: rgba(255,255,255,0.15);
}
.chat-widget-bubble-alert {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff6666, #c0392b);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(192,57,43,0.38);
}

.chat-widget-bubble-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chat-widget {
    width: min(360px, calc(100vw - 36px));
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(180deg, rgba(8,12,20,0.96), rgba(7,11,18,0.94));
    box-shadow: 0 24px 60px rgba(0,0,0,0.45);
    overflow: hidden;
    pointer-events: auto;
}

.chat-widget.collapsed .chat-widget-body {
    display: none;
}

.chat-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, rgba(52,152,219,0.18), rgba(255,255,255,0.03));
    border-bottom: 1px solid rgba(255,255,255,0.08);
    cursor: move;
    user-select: none;
}

#chat-widget-root.dragging .chat-widget,
.chat-widget.dragging {
    box-shadow: 0 28px 70px rgba(0,0,0,0.55);
}

.chat-widget-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-widget-subtitle {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.52);
    margin-top: 2px;
}

.chat-widget-collapse,
.chat-widget-target-clear {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: var(--text-bright);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.chat-widget-target-clear.active {
    border-color: rgba(52,152,219,0.3);
    background: rgba(52,152,219,0.12);
    color: #9fd3ff;
}

.chat-widget-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}
.chat-widget-view-tabs,
.chat-thread-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.chat-view-tab,
.chat-thread-tab {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.82);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chat-thread-tab {
    padding: 0;
    overflow: hidden;
    background: transparent;
    border-color: rgba(255,255,255,0.08);
}
.chat-thread-tab-main {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 7px 9px 7px 10px;
    font-size: inherit;
    font-weight: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.chat-thread-tab-close {
    border: 0;
    border-left: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    color: rgba(255,255,255,0.62);
    width: 22px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.62rem;
    font-weight: 800;
}
.chat-thread-tab-close:hover {
    background: rgba(231,76,60,0.12);
    color: #ffb2a8;
}
.chat-view-tab.active,
.chat-thread-tab.active {
    border-color: rgba(52,152,219,0.32);
    background: rgba(52,152,219,0.14);
    color: #b9e2ff;
}
.chat-thread-tab-alert {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(231,76,60,0.9);
    color: #fff;
    font-size: 0.66rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chat-view-tab .chat-thread-tab-alert {
    margin-left: 2px;
}
.chat-thread-empty {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.48);
    padding: 4px 2px;
}

.chat-widget-target-row,
.chat-widget-compose,
.chat-widget-foot {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-widget-more {
    display: flex;
    justify-content: center;
}

.chat-widget-more-btn {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.78);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.chat-widget-target-input,
.chat-widget-message-input {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.32);
    color: var(--text-bright);
    padding: 10px 12px;
    font-size: 0.8rem;
}

.chat-widget-target-input::placeholder,
.chat-widget-message-input::placeholder {
    color: rgba(255,255,255,0.34);
}

.chat-suggest-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: -2px;
}

.chat-suggest-item {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text-bright);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
}

.chat-suggest-item:hover {
    border-color: rgba(52,152,219,0.28);
    background: rgba(52,152,219,0.12);
}

.chat-suggest-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-widget-messages {
    min-height: 220px;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 2px;
}

.chat-line {
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}

.chat-line.private {
    background: rgba(155,89,182,0.12);
    border-color: rgba(155,89,182,0.26);
}

.chat-line.outgoing {
    box-shadow: inset 0 0 0 1px rgba(52,152,219,0.12);
}
.chat-line.unread-highlight {
    border-color: rgba(241,196,15,0.38);
    box-shadow: inset 0 0 0 1px rgba(241,196,15,0.14), 0 0 0 1px rgba(241,196,15,0.08);
    background: linear-gradient(180deg, rgba(241,196,15,0.08), rgba(255,255,255,0.03));
}

.chat-line-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    font-size: 0.68rem;
}

.chat-line-time {
    color: rgba(255,255,255,0.5);
    font-variant-numeric: tabular-nums;
}

.chat-line-author {
    color: #9fd3ff;
    font-weight: 700;
}

.chat-line-channel {
    color: rgba(255,255,255,0.42);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.chat-line-text,
.chat-empty {
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.9);
    word-break: break-word;
}

.chat-empty {
    color: rgba(255,255,255,0.46);
    padding: 18px 8px;
    text-align: center;
}

.chat-send-btn {
    flex-shrink: 0;
    width: 26px;
    min-width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent url('/images/assets/rightarrow.png') center / 100% 100% no-repeat;
    cursor: pointer;
    box-shadow: none;
}

.chat-send-btn:hover {
    opacity: 0.92;
}

.chat-line-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.chat-pm-btn,
.chat-reply-btn,
.chat-edit-btn,
.chat-delete-btn {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 8px;
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    opacity: 0.92;
}
.chat-pm-btn,
.chat-reply-btn {
    color: #9fd3ff;
    border-color: rgba(52,152,219,0.22);
    background: rgba(52,152,219,0.1);
}
.chat-pm-btn:hover,
.chat-reply-btn:hover {
    opacity: 1;
    background: rgba(52,152,219,0.16);
    border-color: rgba(52,152,219,0.38);
}
.chat-edit-btn {
    color: #f5d070;
    border-color: rgba(241,196,15,0.24);
    background: rgba(241,196,15,0.1);
}
.chat-edit-btn:hover {
    opacity: 1;
    background: rgba(241,196,15,0.16);
    border-color: rgba(241,196,15,0.4);
}
.chat-delete-btn {
    color: #ffb2a8;
    border-color: rgba(231,76,60,0.24);
    background: rgba(231,76,60,0.1);
}
.chat-delete-btn:hover {
    opacity: 1;
    background: rgba(231,76,60,0.16);
    border-color: rgba(231,76,60,0.38);
}

.chat-widget-message-input.editing {
    border-color: rgba(241,196,15,0.5);
    background: rgba(241,196,15,0.05);
}

.chat-widget-foot {
    justify-content: space-between;
    align-items: flex-start;
}

.chat-widget-limit {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.38);
}

.chat-widget-status {
    min-height: 1.1em;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.56);
    text-align: right;
}

.chat-widget-status.success {
    color: #8ee0a8;
}

.chat-widget-status.error {
    color: #ff9b9b;
}

.tab-header { margin-bottom: 20px; }
.tab-header h2 {
    font-family: 'Cinzel', serif; font-size: 1.05rem; font-weight: 700;
    color: var(--text-bright); letter-spacing: 0.05em;
    display: flex; align-items: center; gap: 10px;
}
.tab-header h2::after {
    content: ''; flex: 1; max-width: 80px; height: 1px;
    background: linear-gradient(90deg, rgba(201,146,42,0.35), transparent);
}

/* ════════════════════════════════════════════════════════════════════════
   CHARACTER SHEET
   ════════════════════════════════════════════════════════════════════════ */
.class-scene {
    --class-scene-tint: rgba(201, 146, 42, 0.18);
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius-lg) + 4px);
    border: 1px solid rgba(255,255,255,0.06);
    background:
        radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 44%),
        linear-gradient(145deg, rgba(8,14,24,0.98), rgba(7,11,20,0.94));
    box-shadow: 0 24px 70px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.03);
}
.class-scene-backdrop,
.class-scene-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.class-scene-backdrop {
    pointer-events: none;
    background-image:
        linear-gradient(115deg, rgba(4,7,14,0.96) 15%, rgba(7,11,20,0.72) 48%, rgba(10,14,24,0.92) 100%),
        var(--class-bg);
    background-size: cover, cover;
    background-position: center, center top;
    opacity: 0.95;
    transform: scale(1.03);
    filter: saturate(1.08) brightness(0.72);
}
.class-scene-glow {
    background:
        radial-gradient(circle at top right, var(--class-scene-tint), transparent 34%),
        radial-gradient(circle at bottom left, rgba(255,255,255,0.06), transparent 28%);
    mix-blend-mode: screen;
    opacity: 0.85;
}
.class-scene-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    backdrop-filter: blur(1px);
}
.class-scene-mage {
    --class-scene-tint: rgba(78, 145, 255, 0.25);
    --stat-icon-filter: brightness(0) invert(1) sepia(0.72) saturate(4.2) hue-rotate(185deg) brightness(1.08);
    --profile-stat-icon-filter: brightness(0) invert(1) sepia(0.8) saturate(4.8) hue-rotate(185deg) brightness(1.18);
    --stat-fill-start: rgba(118, 195, 255, 0.95);
    --stat-fill-end: rgba(63, 127, 255, 0.58);
    --stat-fill-glow: rgba(86, 156, 255, 0.22);
}
.class-scene-warrior {
    --class-scene-tint: rgba(224, 119, 72, 0.24);
    --stat-icon-filter: brightness(0) invert(1) sepia(0.8) saturate(4.6) hue-rotate(340deg) brightness(1.02);
    --profile-stat-icon-filter: brightness(0) invert(1) sepia(0.86) saturate(5.2) hue-rotate(340deg) brightness(1.12);
    --stat-fill-start: rgba(255, 166, 116, 0.95);
    --stat-fill-end: rgba(226, 94, 54, 0.58);
    --stat-fill-glow: rgba(245, 116, 72, 0.22);
}
.class-scene-paladin {
    --class-scene-tint: rgba(245, 207, 108, 0.24);
    --stat-icon-filter: brightness(0) invert(1) sepia(0.92) saturate(3.4) hue-rotate(356deg) brightness(1.02);
    --profile-stat-icon-filter: brightness(0) invert(1) sepia(0.96) saturate(4.0) hue-rotate(356deg) brightness(1.12);
    --stat-fill-start: rgba(255, 229, 138, 0.95);
    --stat-fill-end: rgba(228, 183, 72, 0.58);
    --stat-fill-glow: rgba(242, 206, 98, 0.24);
}
.class-scene-rogue {
    --class-scene-tint: rgba(101, 222, 173, 0.22);
    --stat-icon-filter: brightness(0) invert(1) sepia(0.78) saturate(4.1) hue-rotate(118deg) brightness(1.04);
    --profile-stat-icon-filter: brightness(0) invert(1) sepia(0.84) saturate(4.7) hue-rotate(118deg) brightness(1.14);
    --stat-fill-start: rgba(136, 242, 192, 0.95);
    --stat-fill-end: rgba(63, 198, 137, 0.58);
    --stat-fill-glow: rgba(95, 224, 164, 0.22);
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    width: min(100%, 1120px);
    margin: 0 auto;
}
@media (max-width: 680px) {
    .char-grid {
        grid-template-columns: 1fr !important;
        width: 100%;
    }
    .char-panel,
    .char-panel-equipment {
        grid-column: auto !important;
        width: 100%;
        min-width: 0;
    }
    .char-panel {
        padding: 16px;
    }
    .char-panel h3 {
        margin-bottom: 12px;
        font-size: 0.64rem;
        letter-spacing: 0.1em;
    }
    .stat-row {
        grid-template-columns: 18px minmax(0, 1fr) 56px 40px;
        column-gap: 6px;
        padding: 6px 0;
    }
    .stat-icon {
        width: 18px;
        font-size: 0.88rem;
    }
    .stat-label {
        display: none;
    }
    .stat-bar-wrap {
        grid-column: 2;
        min-width: 0;
    }
    .stat-val,
    .stat-total {
        font-size: 0.72rem;
        white-space: nowrap;
    }
    .stat-val {
        grid-column: 3;
        justify-self: end;
    }
    .stat-total {
        grid-column: 4;
        justify-self: end;
    }
    .stat-bonus {
        font-size: 0.54rem;
    }
    .stat-bar {
        height: 5px;
    }
    .element-strip {
        margin-top: 10px;
        gap: 6px;
    }
    .element-strip-heading {
        font-size: 0.56rem;
        letter-spacing: 0.1em;
    }
    .element-badge-row {
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
    }
    .element-badge-row::-webkit-scrollbar { display: none; }
    .element-entry {
        gap: 4px;
        flex: 0 0 auto;
    }
    .element-badge {
        min-width: 46px;
        padding: 5px 8px;
    }
    .element-badge-icon {
        font-size: 0.8rem;
    }
    .element-badge-icon-img { width: 14px; height: 14px; object-fit: contain; display: block; }
    .element-badge-value {
        min-width: 20px;
        font-size: 0.74rem;
    }
    .achievement-launch-btn {
        margin-top: 12px;
        padding: 10px 12px;
        font-size: 0.74rem;
    }
    .achievement-launch-meta {
        font-size: 0.66rem;
    }
}

.char-panel {
    background: linear-gradient(145deg, rgba(10,16,28,0.9), rgba(12,19,31,0.72));
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px;
    transition: border-color 0.2s, box-shadow 0.2s; position: relative; overflow: hidden;
    box-shadow: 0 18px 44px rgba(0,0,0,0.28);
}
.char-panel::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,146,42,0.18), transparent);
    z-index: 1;
}
.char-panel-equipment::after,
.profile-equipment-card::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(145deg, rgba(5,10,18,0.72), rgba(8,12,20,0.88)),
        url('/images/character-bg.png'),
        var(--class-bg);
    background-size: cover, cover, cover;
    background-position: center, center, center top;
    opacity: 0.22;
    pointer-events: none;
}
.char-panel-equipment > *,
.profile-equipment-card > * {
    position: relative;
    z-index: 2;
}
.profile-equipment-card {
    position: relative;
    overflow: hidden;
}
.char-panel:hover { border-color: var(--border-mid); }
.char-panel.full { grid-column: 1 / -1; }
.char-panel-elemental { grid-column: 1; }
.char-panel-setups { grid-column: 2; }
.msg { padding:8px 12px;border-radius:6px;border:1px solid rgba(255,255,255,0.1);font-size:0.8rem;transition:opacity 0.3s; }
.char-panel-setups .setup-card:hover { border-color: rgba(255,255,255,0.15) !important; }
.char-panel-setups .setup-card .setup-name:focus { background: rgba(255,255,255,0.06) !important; }
.char-panel-elemental .elem-overview { display:flex;align-items:center;gap:8px;margin-bottom:10px;flex-wrap:wrap }
.char-panel-elemental .elem-name { font-size:0.9rem;font-weight:600;color:#e2e8f0 }
.char-panel-elemental .elem-lvl-badge { font-size:0.7rem;padding:2px 8px;border-radius:10px;background:rgba(168,85,247,0.2);color:#a855f7 }
.char-panel-elemental .elem-element-tag { font-size:0.65rem;padding:2px 8px;border-radius:10px;background:rgba(255,255,255,0.06);color:var(--text-dim);text-transform:capitalize }
.char-panel-elemental .elem-stat-grid { display:grid;grid-template-columns:1fr 1fr;gap:3px 12px;font-size:0.75rem;color:var(--text-dim) }
.char-panel-elemental .elem-bar { width:100%;height:5px;border-radius:3px;background:rgba(255,255,255,0.08);overflow:hidden;margin:2px 0 }
.char-panel-elemental .elem-bar-fill { height:100%;border-radius:3px;transition:width 0.3s }
.char-panel-elemental .hp-fill { background:linear-gradient(90deg,#22c55e,#16a34a) }
.char-panel-elemental .xp-fill { background:linear-gradient(90deg,#a855f7,#7c3aed) }
.elem-feed-row { display:flex;align-items:center;gap:6px;padding:4px 8px;margin-bottom:2px;border-radius:6px;background:rgba(255,255,255,0.02);font-size:0.72rem;color:var(--text-dim) }
.elem-feed-name { flex:1;min-width:0 }
.elem-feed-stack { color:rgba(255,255,255,0.3);font-size:0.65rem;flex-shrink:0 }
.elem-feed-ctrls { display:flex;align-items:center;gap:2px;flex-shrink:0 }
.elem-qty-btn { display:inline-flex;align-items:center;justify-content:center;font-size:0.7rem;padding:1px 5px;min-width:18px;border:1px solid rgba(255,255,255,0.1);border-radius:4px;background:rgba(255,255,255,0.06);color:var(--text-dim);cursor:pointer;font-family:inherit;line-height:1.4;user-select:none }
.elem-qty-btn:hover { background:rgba(255,255,255,0.12) }
.elem-qty-input { width:32px;text-align:center;font-size:0.7rem;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.1);border-radius:4px;color:inherit;padding:1px 0;font-family:inherit }
.elem-feed-go { display:inline-flex;align-items:center;justify-content:center;font-size:0.65rem;padding:1px 6px;border:1px solid rgba(46,204,113,0.3);border-radius:4px;background:rgba(46,204,113,0.12);color:#2ecc71;cursor:pointer !important;font-family:inherit;line-height:1.4;user-select:none }
.elem-feed-go:hover { background:rgba(46,204,113,0.2) }
.elem-feed-go._feeding { opacity:0.4;cursor:default }

/* Elemental stat assignment UI */
.elem-stat-assign { margin-top:6px;font-size:0.72rem;position:relative;z-index:2 }
.elem-assign-row { display:flex;align-items:center;gap:4px;padding:3px 6px;margin-bottom:2px;border-radius:4px;background:rgba(255,255,255,0.02);position:relative;z-index:2 }
.elem-assign-row span:first-child { flex:1;color:var(--text-dim) }
.elem-assign-val { min-width:16px;text-align:center;color:var(--text-bright);font-weight:600 }
.elem-assign-go { display:block;text-align:center;font-size:0.72rem;padding:5px;margin-top:6px;border:1px solid rgba(168,85,247,0.3);border-radius:6px;background:rgba(168,85,247,0.1);color:#a855f7;cursor:pointer;user-select:none;position:relative;z-index:2 }
.elem-assign-go:hover { background:rgba(168,85,247,0.2) }
.elem-assign-dec, .elem-assign-inc { cursor:pointer }

.profile-card::before,
.shop-card::after,
.upgrade-card::after,
.modal-box::before,
.tab-content-area::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: url('/images/rune-bg.png') center / auto no-repeat;
    opacity: 0.05;
}

.profile-card::before,
.shop-card::after,
.upgrade-card::after,
.modal-box::before {
    z-index: 0;
}

.tab-content-area::after {
    z-index: 0;
}

.profile-card > *,
.shop-card > *,
.upgrade-card > *,
.modal-box > *,
.tab-content-area > * {
    position: relative;
    z-index: 1;
}
.achievement-launch-btn {
    margin-top: 14px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(201,146,42,0.22);
    background: linear-gradient(145deg, rgba(201,146,42,0.08), rgba(255,255,255,0.03));
    color: var(--text-bright);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.profile-badges-inline {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.profile-badge-chip {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
    font-size: 1rem;
}
.profile-badges-empty { font-size: 0.74rem; color: var(--text-dim); }

.lb-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.lb-badge {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    font-size: 0.86rem;
    line-height: 1;
}

/* Squads */
.squads-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .squads-grid { grid-template-columns: 1fr; } }
.squads-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 16px;
}
.squads-card-head { 
    display:flex; 
    flex-wrap: wrap; 
    align-items: center; 
    justify-content:space-between; 
    gap: 12px; 
}
.squads-card-head .squads-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
@media (max-width: 480px) {
    .squads-card-head { justify-content: center; text-align: center; }
}
.squads-title { font-family: 'Cinzel',serif; font-weight: 800; color: var(--gold-light); font-size: 1.1rem; }
.squads-meta { font-size: 0.78rem; color: var(--text-dim); margin-top: 4px; }
.squads-actions { display:flex; gap: 10px; align-items:center; }
.squads-actions .input-field { flex: 1; margin: 0; }
.squads-actions { flex-wrap: wrap; }
#tab-squads .squads-actions .input-field {
    min-height: 44px;
    font-size: 1rem;
    line-height: 1.2;
    direction: ltr;
    text-align: left;
}
#tab-squads .squads-actions .btn-primary,
#tab-squads .squads-actions .btn-secondary {
    flex: 0 0 auto;
}
@media (max-width: 520px) {
    #tab-squads .squads-actions { gap: 6px; flex-wrap: nowrap; }
    #tab-squads .squads-actions .input-field { min-width: 0; flex: 1; width: auto; }
    #tab-squads .squads-card { max-width: 100%; box-sizing: border-box; overflow-x: hidden; }
    .clan-base-map { height: 300px !important; }
    .squad-row { gap: 6px; }
    .squad-info { min-width: 0; }
    .squad-name { white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }
    .squad-metric { font-size: 0.75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .squads-member { flex-wrap: wrap; gap: 4px; }
}
@media (max-width: 400px) {
    #tab-squads .squads-actions { flex-wrap: wrap; }
    #tab-squads .squads-actions .input-field { flex: 1 1 100%; }
    #tab-squads .squads-actions .btn-primary,
    #tab-squads .squads-actions .btn-secondary { flex: 1; }
}
.squads-members { margin-top: 12px; display: grid; gap: 8px; }
.squads-member { padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.06); background: rgba(0,0,0,0.18); }
.squads-member-name { display:block; font-weight: 800; color: var(--text-bright); }
.squads-member-sub { display:block; font-size: 0.74rem; color: var(--text-dim); margin-top: 2px; }
.online-dot { display:inline-block; width:10px; height:10px; border-radius:50%; vertical-align:middle; margin-right:2px; }
.clan-base-icon { opacity:0.55; filter:drop-shadow(0 2px 6px rgba(0,0,0,0.9)); transition:opacity .2s ease, filter .2s ease; }
.clan-base-icon:hover { opacity:1; filter:drop-shadow(0 2px 8px rgba(0,0,0,0.9)); }
.clan-base-wrap.owned .clan-base-icon { opacity:1; }
.squads-leaderboard { margin-top: 10px; display: grid; gap: 8px; }
.squad-row { display:flex; gap: 10px; align-items:center; padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); background: rgba(0,0,0,0.18); }
.squad-rank { width: 44px; text-align:center; font-weight: 900; color: var(--gold); }
.squad-info { flex: 1; min-width: 0; }
.squad-name { font-weight: 900; color: var(--text-bright); overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.squad-sub { font-size: 0.74rem; color: var(--text-dim); margin-top: 2px; }
.squad-metric { font-weight: 900; color: var(--gold-light); white-space: nowrap; }

.squads-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}
.squads-setup-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.squads-subhead {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 4px;
}
@media (max-width: 600px) {
    .squads-setup-grid { grid-template-columns: 1fr; }
}

/* Badge picker: ensure <select>/<option> are readable across browsers */
#badge-picker-modal select.input-field {
    background: rgba(8,12,22,0.97);
    color: var(--text-bright);
}
#badge-picker-modal select.input-field option {
    background: rgba(8,12,22,0.98);
    color: var(--text-bright);
}
.squad-role-select {
    background: rgba(8,12,22,0.97);
    color: var(--text-bright);
}
.squad-role-select option {
    background: rgba(8,12,22,0.98);
    color: var(--text-bright);
}
.achievement-launch-meta {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
}
.char-panel h3 {
    color: var(--gold); margin-bottom: 16px;
    font-family: 'Cinzel', serif; font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase;
    display: flex; align-items: center; gap: 10px;
}
.char-panel h3::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(90deg, rgba(201,146,42,0.3), transparent);
}

.char-hero-panel { padding: 0 !important; min-height: 190px; }
.char-hero-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center top;
    opacity: 0.12; filter: blur(3px) brightness(0.7);
}
.char-hero-content {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 22px; padding: 26px;
    background: linear-gradient(135deg, rgba(5,8,14,0.75) 0%, rgba(12,20,32,0.45) 100%);
}
.char-hero-left { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.char-avatar-ring {
    width: 112px; height: 112px; border-radius: 50%; padding: 3px;
    background: conic-gradient(from 180deg, var(--gold) 0%, var(--gold-bright) 25%, var(--gold) 50%, rgba(201,146,42,0.2) 75%, var(--gold) 100%);
    box-shadow: 0 4px 18px rgba(0,0,0,0.7);
    animation: ringRotate 12s linear infinite;
}
@keyframes ringRotate { to { transform: rotate(360deg); } }
.char-avatar-img {
    width: 100%; height: 100%; border-radius: 50%;
    object-fit: cover; display: block; background: var(--bg3);
    animation: ringRotateReverse 12s linear infinite;
}
@keyframes ringRotateReverse { to { transform: rotate(-360deg); } }
.char-hero-badge {
    font-family: 'Cinzel', serif; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--gold);
    background: rgba(201,146,42,0.08); border: 1px solid rgba(201,146,42,0.22);
    padding: 3px 12px; border-radius: 10px;
}
.char-hero-right { flex: 1; min-width: 0; }
.char-hero-name {
    font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 700;
    color: var(--text-bright); letter-spacing: 0.02em;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
    margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.char-hero-sub { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 14px; }
.char-hp-row, .char-xp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.char-hp-label {
    font-size: 0.56rem; font-weight: 800; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim); width: 16px; flex-shrink: 0;
}
.char-hp-track {
    flex: 1; max-width: 250px; height: 6px;
    background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.04);
}
.char-hp-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.char-hp-text { font-size: 0.62rem; color: var(--text-dim); white-space: nowrap; min-width: 68px; text-align: right; }

.stat-row {
    display: grid;
    grid-template-columns: 24px 108px minmax(56px, 1fr) 78px 52px 32px;
    align-items: center;
    column-gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.12s;
}
.stat-row:last-child { border-bottom: none; }
.stat-row:hover { background: rgba(255,255,255,0.015); border-radius: 6px; }
.stat-icon { font-size: 1rem; width: 22px; text-align: center; }
.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 22px;
}
.stat-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
    filter: var(--stat-icon-filter, brightness(0) invert(1) opacity(0.92));
}
.stat-icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 1;
}
.stat-icon-img:not([style*="display: none"]) + .stat-icon-fallback {
    display: none;
}
.stat-label { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.stat-val {
    font-size: 0.88rem;
    color: var(--text-dim);
    font-weight: 600;
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.stat-total {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-bright);
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.stat-bonus {
    font-size: 0.62rem;
    margin-left: 3px;
}
.stat-bonus.positive { color: #2ecc71; }
.stat-beast-active { background: rgba(168,85,247,0.06); border-radius: 6px; }
.stat-upgrade-btn {
    font-size: 0.62rem;
    padding: 2px 0;
    width: 100%;
    text-align: center;
    border-radius: 4px;
    border: 1px solid var(--class-scene-tint, rgba(155,89,182,0.3));
    background: color-mix(in srgb, var(--class-scene-tint, rgba(155,89,182,0.12)) 60%, transparent);
    color: var(--text-bright);
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    transition: background 0.15s;
    line-height: 1.4;
}
.stat-upgrade-btn:hover:not(:disabled) {
    background: var(--class-scene-tint, rgba(155,89,182,0.25));
}
.stat-upgrade-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.stat-bonus.negative { color: #e74c3c; }
.stat-bar-wrap { width: 100%; }
.stat-bar {
    height: 6px;
    position: relative;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        rgba(16, 20, 28, 0.88);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.02),
        inset 0 10px 18px rgba(255,255,255,0.02),
        0 0 8px rgba(0,0,0,0.18);
}
.stat-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            90deg,
            rgba(78, 86, 100, 0.42) 0 7px,
            rgba(20, 24, 32, 0) 7px 10px,
            rgba(58, 64, 78, 0.24) 10px 16px,
            transparent 16px 19px
        ),
        linear-gradient(90deg, rgba(255,255,255,0.05), transparent 62%);
    opacity: 0.95;
    pointer-events: none;
}
.stat-fill { height: 100%; border-radius: 2px; }
.stat-fill,
.str-fill,
.def-fill,
.agi-fill,
.mag-fill,
.vit-fill,
.hit-fill,
.crit-fill {
    border-radius: 999px;
    position: relative;
    background:
        linear-gradient(90deg, var(--stat-fill-start, rgba(206,214,228,0.76)) 0%, var(--stat-fill-end, rgba(158,171,188,0.54)) 72%, rgba(118,126,141,0.20) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        0 0 8px rgba(255,255,255,0.04),
        0 0 10px var(--stat-fill-glow, rgba(255,255,255,0.08));
}
.stat-fill::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.03) 45%, transparent 46%),
        repeating-linear-gradient(
            100deg,
            rgba(255,255,255,0.12) 0 8px,
            rgba(255,255,255,0.02) 8px 14px
        );
    opacity: 0.9;
    pointer-events: none;
}
.stat-fill::after {
    content: '';
    position: absolute;
    top: -2px;
    right: 0;
    width: 24px;
    height: calc(100% + 4px);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255,255,255,0.0), rgba(255,255,255,0.22) 50%, rgba(255,255,255,0.0) 100%);
    filter: blur(2px);
    opacity: 0.55;
    pointer-events: none;
}
@media (max-width: 920px) {
    .stat-row {
        grid-template-columns: 24px 88px minmax(40px, 1fr) 72px 48px 28px;
        column-gap: 6px;
    }
}

.detail-slot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.detail-slot-grid-compact {
    margin-top: 12px;
}

.detail-slot {
    min-height: 56px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.07);
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(10,15,24,0.4));
}

.detail-slot-label {
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.detail-slot-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-bright);
}

.element-strip {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.character-hub-modal-box {
    max-width: 640px;
}
.character-hub-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.character-hub-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 112px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        radial-gradient(circle at top right, rgba(201,146,42,0.12), transparent 32%),
        linear-gradient(145deg, rgba(15, 23, 36, 0.96), rgba(10, 15, 26, 0.94));
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.character-hub-option:hover {
    transform: translateY(-2px);
    border-color: rgba(201,146,42,0.26);
    box-shadow: 0 14px 28px rgba(0,0,0,0.22);
}
.character-hub-option.active {
    border-color: rgba(201,146,42,0.38);
    background:
        radial-gradient(circle at top right, rgba(201,146,42,0.18), transparent 32%),
        linear-gradient(145deg, rgba(20, 29, 45, 0.98), rgba(12, 18, 30, 0.96));
    box-shadow: inset 0 0 0 1px rgba(201,146,42,0.18), 0 12px 30px rgba(0,0,0,0.18);
}
.character-hub-option-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.28));
}
.character-hub-option-icon-hero {
    width: 76%;
    height: 76%;
    max-width: 104px;
    max-height: 104px;
}
@media (max-width: 760px) {
    .character-hub-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .character-hub-option {
        min-height: 94px;
    }
}

.element-strip-heading {
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: center;
}

.element-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.char-combat-summary {
    margin-top: 13px;
    font-size: 0.74rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    padding-top: 11px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.char-combat-summary-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.char-combat-summary-note {
    color: rgba(255,255,255,0.3);
}

@media (max-width: 680px) {
    .char-panel .stat-row {
        grid-template-columns: 18px minmax(18px, 1fr) 68px 48px 24px;
        column-gap: 6px;
        padding: 6px 0;
    }
    .char-panel .stat-label {
        display: none;
    }
    .char-panel .stat-bar-wrap {
        grid-column: 2;
        min-width: 0;
    }
    .char-panel .stat-val,
    .char-panel .stat-total {
        font-size: 0.72rem;
        white-space: nowrap;
    }
    .char-panel .stat-val {
        grid-column: 3;
        justify-self: end;
    }
    .char-panel .stat-total {
        grid-column: 4;
        justify-self: end;
    }
}

.element-entry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.element-badge {
    display: inline-flex;
    justify-content: center;
    min-width: 54px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.07);
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(10,15,24,0.35));
}

.element-badge-icon {
    font-size: 0.9rem;
    line-height: 1;
}
.element-badge-icon-img { width: 16px; height: 16px; object-fit: contain; display: block; flex: 0 0 auto; }

.element-badge-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-bright);
    display: inline-block;
    min-width: 26px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.element-badge.element-badge-value-damage .element-badge-value {
    color: #f1c40f;
}

.element-badge.element-badge-value-resist .element-badge-value {
    color: #5dade2;
}


.shop-tabs.filter-tabs { flex-wrap: wrap; gap: 4px; }
.shop-tabs .filter-btn { font-size: 0.72rem; padding: 5px 8px; white-space: nowrap; }

.record-row { display: flex; justify-content: space-around; text-align: center; margin-top: 8px; }
.record-item { display: flex; flex-direction: column; gap: 5px; }
.record-num { font-size: 1.65rem; color: var(--text-bright); font-weight: 700; }
.record-num.wins   { color: var(--green); text-shadow: 0 0 15px rgba(39,174,96,0.3); }
.record-num.losses { color: var(--red-light); text-shadow: 0 0 15px rgba(224,82,82,0.3); }
.record-lbl { font-size: 0.62rem; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase; }

.achievements-panel-loading {
    color: var(--text-dim);
    font-size: 0.82rem;
}

.achievements-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.achievements-summary > div {
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.72rem;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.achievements-summary > div:hover { background: rgba(255,255,255,0.08); }
.achievements-summary > div.active {
    background: rgba(255,215,0,0.1);
    border-color: rgba(255,215,0,0.3);
    color: var(--text-bright);
}

.achievements-summary strong {
    color: var(--text-bright);
}

.achievements-list {
    display: grid;
    gap: 10px;
}

.weekly-tasks-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.weekly-task-claim-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weekly-task-choice-note {
    font-size: 0.76rem;
    color: var(--text-dim);
}

.weekly-task-materials {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.weekly-task-material-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(52,152,219,0.25);
    background: rgba(52,152,219,0.08);
    color: var(--text-bright);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.weekly-task-material-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(52,152,219,0.42);
    background: rgba(52,152,219,0.14);
}

.achievement-card {
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(10,15,24,0.32));
}

.achievement-card.claimable {
    border-color: rgba(201,146,42,0.35);
    box-shadow: 0 0 0 1px rgba(201,146,42,0.08) inset;
}

.achievement-card.claimed {
    opacity: 0.78;
}

.achievement-card-head {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.achievement-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    font-size: 1.05rem;
    flex-shrink: 0;
}

.achievement-copy {
    min-width: 0;
    flex: 1;
}

.achievement-name {
    color: var(--text-bright);
    font-weight: 700;
    font-size: 0.82rem;
}

.achievement-desc {
    color: var(--text-dim);
    font-size: 0.73rem;
    margin-top: 2px;
    line-height: 1.4;
}

.achievement-tier-note {
    margin-top: 5px;
    color: var(--gold);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.achievement-progress-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.achievement-progress-bar {
    height: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.04);
}

.achievement-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(201,146,42,0.82), rgba(255,226,150,0.98));
}

.achievement-progress-text {
    font-size: 0.7rem;
    color: var(--text-dim);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.achievement-rewards {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.achievement-reward-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-dim);
    font-size: 0.68rem;
}

.achievement-claim-btn {
    margin-top: 10px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(201,146,42,0.28);
    background: rgba(201,146,42,0.12);
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 8px 10px;
    cursor: pointer;
}

.achievement-claim-btn.locked,
.achievement-claim-btn.claimed {
    border-color: rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text-dim);
    cursor: default;
}

/* ════════════════════════════════════════════════════════════════════════
   TRAINING
   ════════════════════════════════════════════════════════════════════════ */
.train-status-bar {
    background: rgba(201,146,42,0.07); border: 1px solid rgba(201,146,42,0.22);
    border-radius: var(--radius-sm); padding: 11px 16px; margin-bottom: 16px;
    color: var(--gold); font-size: 0.86rem; text-align: center;
}
.train-status-bar.ready { background: rgba(39,174,96,0.07); border-color: rgba(39,174,96,0.28); color: var(--green); }
.train-status-bar.hidden { display: none; }
.train-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 500px) { .train-grid { grid-template-columns: 1fr; } }

/* ════════════════════════════════════════════════════════════════════════
   UPGRADE
   ════════════════════════════════════════════════════════════════════════ */
.gold-display {
    background: rgba(201,146,42,0.06); border: 1px solid rgba(201,146,42,0.18);
    border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 16px;
    font-size: 0.96rem; color: var(--gold); text-align: center;
}
.upgrade-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
@media(max-width:500px){ .upgrade-grid { grid-template-columns: 1fr; } }
.upgrade-card {
    position: relative; overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(201,146,42,0.16), transparent 38%),
        linear-gradient(165deg, rgba(17,24,36,0.96), rgba(10,14,22,0.98));
    border: 1px solid rgba(201,146,42,0.16); border-radius: 18px; padding: 16px;
    transition: border-color 0.2s, transform 0.18s;
    display: flex; flex-direction: column; min-height: 228px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 14px 34px rgba(0,0,0,0.22);
}
.upgrade-card:hover { border-color: rgba(201,146,42,0.3); transform: translateY(-2px); }
.upgrade-card-aura {
    position: absolute; inset: -40% auto auto 55%;
    width: 140px; height: 140px;
    background: radial-gradient(circle, rgba(201,146,42,0.16), transparent 68%);
    pointer-events: none;
}
.upgrade-card-header { position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; z-index: 1; }
.upgrade-card-badge {
    width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, rgba(201,146,42,0.22), rgba(201,146,42,0.06));
    border: 1px solid rgba(201,146,42,0.26); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.upgrade-card-icon { font-size: 1.45rem; }
.upgrade-card-title-group { display: flex; flex-direction: column; min-width: 0; }
.upgrade-card-name { font-size: 0.96rem; color: var(--gold-light); font-weight: 700; letter-spacing: 0.02em; }
.upgrade-card-status { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }
.upgrade-card-status.ready { color: #79d98b; }
.upgrade-card-status.locked { color: var(--text-dim); }
.upgrade-card-val { margin-left: auto; font-size: 1.5rem; line-height: 1; color: var(--text-bright); font-weight: 800; font-variant-numeric: tabular-nums; }
.upgrade-card-hint { position: relative; z-index: 1; font-size: 0.74rem; color: var(--text-dim); line-height: 1.45; min-height: 32px; }
.upgrade-discount-row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; min-height: 24px; }
.upgrade-discount {
    font-size: 0.66rem; padding: 4px 8px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03);
}
.upgrade-discount.sale { color: #f1c40f; border-color: rgba(241,196,15,0.24); background: rgba(241,196,15,0.08); }
.upgrade-discount.premium { color: #c59dff; border-color: rgba(155,89,182,0.28); background: rgba(155,89,182,0.12); }
.upgrade-stat-track {
    position: relative; z-index: 1; height: 8px; border-radius: 999px; overflow: hidden;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05); margin-bottom: 14px;
}
.upgrade-stat-fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, rgba(201,146,42,0.45), rgba(255,226,150,0.98));
    box-shadow: 0 0 16px rgba(201,146,42,0.24);
}
.upgrade-card-footer {
    position: relative; z-index: 1; margin-top: auto;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.upgrade-cost-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.upgrade-cost-label { font-size: 0.64rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.upgrade-cost-value { font-size: 0.9rem; color: var(--text-bright); font-weight: 700; font-variant-numeric: tabular-nums; }
.upgrade-cost-price { font-size: 0.76rem; color: var(--gold); font-weight: 700; }
.upgrade-wallet {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
    padding: 12px 16px; border-radius: 16px;
    background: radial-gradient(circle at right center, rgba(201,146,42,0.18), transparent 30%), linear-gradient(150deg, rgba(18,24,36,0.96), rgba(8,12,18,0.98));
    border: 1px solid rgba(201,146,42,0.18); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.upgrade-wallet-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.12em; }
.upgrade-wallet-value { font-family: 'Cinzel', serif; font-size: 1rem; color: var(--gold-bright); font-weight: 700; }
@media(max-width:700px){
    .upgrade-card-footer { align-items: stretch; flex-direction: column; }
    .btn-upgrade { width: 100%; min-width: 0; }
}

/* ════════════════════════════════════════════════════════════════════════
   FORGE & INVENTORY
   ════════════════════════════════════════════════════════════════════════ */
.forge-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(215px,1fr)); gap: 12px; }
.forge-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, var(--bg2), var(--bg3));
    border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
    transition: border-color 0.2s, transform 0.15s;
}
.forge-card:hover { border-color: var(--border-mid); transform: translateY(-1px); }
.forge-card.locked { opacity: 0.52; }
.forge-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.forge-card-name { font-size: 0.86rem; color: var(--gold-light); font-weight: 600; flex: 1; }
.forge-recipe { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 6px; line-height: 1.6; }
.forge-cost { font-size: 0.76rem; color: var(--gold); margin-bottom: 10px; }

.inv-hint { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 11px; letter-spacing: 0.04em; }
.inv-equipment-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(148px,1fr)); gap: 12px; }
.inv-item-cell {
    position: relative; background: rgba(255,255,255,0.03);
    border: 1px solid var(--border); border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 6px; cursor: pointer; padding: 12px 10px 10px; min-height: 186px;
    transition: all 0.16s; user-select: none;
}
.inv-item-cell:hover { border-color: var(--border-hi); background: rgba(255,255,255,0.07); transform: translateY(-2px); }
.inv-item-cell.inv-item-equipped { border-color: rgba(201,146,42,0.5); background: rgba(201,146,42,0.07); }
.inv-item-cell.inv-legendary { border-color: rgba(255,215,0,0.42); }
.inv-item-cell.inv-epic { border-color: rgba(230,126,34,0.42); }
.inv-item-cell.inv-rare { border-color: rgba(142,68,173,0.42); }
.inv-item-icon { display: flex; align-items: center; justify-content: center; font-size: 2.6rem; line-height: 1; }
.inv-item-icon img {
    width: 64px; height: 64px; object-fit: contain; display: block;
    filter:
        drop-shadow(0 0 8px rgba(255,255,255,0.08))
        drop-shadow(0 0 12px rgba(201,146,42,0.12));
    transition: filter 0.18s ease;
}
.inv-item-cell:hover .inv-item-icon img {
    filter:
        drop-shadow(0 0 10px rgba(255,255,255,0.1))
        drop-shadow(0 0 16px rgba(201,146,42,0.18));
}
.inv-item-name-label { font-size: 0.56rem; color: var(--text-dim); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; padding: 0 3px; }
.inv-item-setup-badges { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; margin-top: 3px; }
.setup-badge { font-size: 0.5rem; background: rgba(52,152,219,0.25); color: #5dade2; padding: 1px 4px; border-radius: 3px; white-space: nowrap; }
.inv-item-equipped-dot { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 5px rgba(201,146,42,0.8); }
.inv-item-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 6px !important;
    width: 100%;
    margin-top: auto !important;
    padding-top: 8px;
}
.inv-item-actions .btn-sm {
    width: 100%;
    min-width: 0;
    justify-content: center;
    font-size: 0.72rem !important;
    padding: 7px 8px !important;
    white-space: nowrap;
}
.inv-item-actions .btn-sm:last-child {
    background: rgba(155,89,182,0.2) !important;
    border-color: rgba(155,89,182,0.28);
    color: #ead9ff;
}
.inv-item-actions .btn-sm:last-child:hover:not(:disabled) {
    background: rgba(155,89,182,0.3) !important;
}
@media (max-width: 700px) {
    .inv-equipment-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .inv-item-cell {
        gap: 5px;
        padding: 10px 8px 8px;
        min-height: 168px;
        aspect-ratio: auto;
        justify-content: flex-start;
    }
    .inv-item-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 5px !important;
        width: 100%;
        margin-top: auto !important;
        padding-top: 6px;
    }
    .inv-item-actions .btn-sm {
        width: 100%;
        font-size: 0.66rem !important;
        padding: 6px 6px !important;
    }
}
.inv-consumable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.inv-consumable-card {
    background: linear-gradient(145deg, rgba(12,18,30,0.92), rgba(10,15,24,0.72));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 210px;
}
.inv-consumable-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.inv-consumable-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.inv-consumable-icon img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}
.inv-consumable-copy {
    min-width: 0;
    flex: 1;
}
.inv-consumable-name {
    color: var(--text-bright);
    font-weight: 700;
    font-size: 0.84rem;
    line-height: 1.25;
}
.inv-consumable-qty {
    color: var(--text-dim);
    font-size: 0.72rem;
    margin-top: 3px;
}
.inv-consumable-effect {
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 600;
    min-height: 18px;
}
.inv-consumable-desc {
    color: var(--text-dim);
    font-size: 0.74rem;
    line-height: 1.45;
    flex: 1;
}
.inv-consumable-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.inv-consumable-btn {
    width: 100%;
    justify-content: center;
}
.inv-consumable-use {
    background: rgba(39,174,96,0.15);
    border-color: rgba(39,174,96,0.4);
    color: #2ecc71;
}
.lootbox-card .inv-consumable-icon {
    background: linear-gradient(145deg, rgba(201,146,42,0.12), rgba(255,255,255,0.03));
}
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(108px,1fr)); gap: 9px; }
.mat-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px; text-align: center; }
.mat-name { font-size: 0.74rem; color: var(--text-bright); margin: 5px 0 2px; }
.mat-qty { font-size: 1.05rem; color: var(--gold); font-weight: 700; }

.elem-inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.elem-inv-card {
    background: linear-gradient(145deg, rgba(12,18,30,0.92), rgba(10,15,24,0.72));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.elem-inv-card.equipped {
    border-color: rgba(241, 196, 15, 0.5);
    background: rgba(241, 196, 15, 0.05);
}
.elem-inv-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.elem-inv-icon {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.elem-inv-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.elem-inv-copy {
    min-width: 0;
    flex: 1;
}
.elem-inv-name {
    color: var(--text-bright);
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.2;
}
.elem-inv-meta {
    color: var(--text-dim);
    font-size: 0.7rem;
    margin-top: 2px;
}
.elem-inv-stat {
    font-size: 0.77rem;
    color: var(--text-dim);
    line-height: 1.6;
}
.elem-inv-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.elem-bar-label {
    font-size: 0.68rem;
    color: var(--text-dim);
}
.elem-inv-card .elem-bar {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin: 1px 0;
}
.elem-inv-card .elem-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
    position: relative;
    overflow: hidden;
}
.elem-inv-card .hp-fill { background: linear-gradient(90deg,#22c55e,#16a34a) }
.elem-inv-card .xp-fill { background: linear-gradient(90deg,#a855f7,#7c3aed) }
.elem-inv-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.tt-close {
  position:absolute; top:6px; right:6px; z-index:10;
  width:28px; height:28px; border:none; border-radius:50%;
  background:rgba(224,64,255,0.10); color:#e040ff; font-size:20px; line-height:1;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  padding:0; transition:background .15s, color .15s, text-shadow .15s;
  text-shadow:0 0 8px rgba(224,64,255,0.5);
}
.tt-close:hover { background:rgba(180,48,208,0.20); color:#b030d0; text-shadow:0 0 14px rgba(180,48,208,0.7); }
.item-tooltip {
    /* Must sit above modals (e.g. `.modal-overlay` uses `z-index: 200000`). */
    position: fixed; z-index: 250000; width: 220px;
    background: rgba(8,12,22,0.97); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px; padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9);
    pointer-events: auto;
    /* Keep tooltip usable even for tall items (lots of stats/lines). */
    max-height: calc(100vh - 16px);
    /* Use grid to guarantee footer visibility (more reliable than flex with max-height). */
    display: grid;
    grid-template-rows: auto 1fr auto;
    /* Fixed footer layout: body scrolls, actions always visible. */
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.item-tooltip.hidden { display: none; }
.tt-preview {
    width: 100%; aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.03); border-bottom: 1px solid rgba(255,255,255,0.08); padding: 16px;
    flex-shrink: 0; position: relative;
}
.tt-preview img { width: 140px; height: 140px; object-fit: contain; }
.tt-preview-emoji { font-size: 5rem; line-height: 1; }
.tt-body {
    padding: 12px 14px;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.tt-name { font-size: 0.9rem; font-weight: 700; line-height: 1.2; color: var(--text-bright); }
.tt-meta { font-size: 0.64rem; color: var(--text-dim); margin-top: 2px; }
.tt-desc { font-size: 0.7rem; color: var(--text-dim); margin-bottom: 8px; font-style: italic; line-height: 1.5; }
.tt-stats { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.tt-stat { display: flex; align-items: center; gap: 4px; font-size: 0.74rem; }
.tt-stat-name { flex: 1; color: var(--text-dim); text-transform: capitalize; }
.tt-stat-val { font-weight: 700; color: var(--text-bright); }
.tt-vs { font-size: 0.66rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 6px; margin-bottom: 8px; }
.tt-actions {
    display: flex;
    gap: 5px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 10px 14px;
    flex-shrink: 0;
    background: rgba(8,12,22,0.97);
}
.tt-btn { flex: 1; padding: 7px 4px; border-radius: 7px; font-size: 0.7rem; font-weight: 600; cursor: pointer; border: 1px solid; transition: background 0.12s; }
.tt-btn-primary  { background: var(--blue-dim); border-color: rgba(52,152,219,0.35); color: var(--blue); }
.tt-btn-primary:hover { background: rgba(52,152,219,0.25); }
.tt-btn-secondary { background: rgba(255,255,255,0.04); border-color: var(--border-mid); color: var(--text); }
.tt-btn-secondary:hover { background: rgba(255,255,255,0.08); }
.tt-btn-danger { background: var(--red-dim); border-color: rgba(224,82,82,0.3); color: var(--red-light); }
.tt-btn-danger:hover:not(:disabled) { background: rgba(192,57,43,0.22); }
.tt-btn-danger:disabled { opacity: 0.28; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════════════════
   SHOP
   ════════════════════════════════════════════════════════════════════════ */
.shop-currency-row { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.shop-gems-cta {
    font-size: 0.78rem;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.16), rgba(52, 152, 219, 0.12));
    border-color: rgba(52, 152, 219, 0.32);
}
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(235px,1fr)); gap: 14px; margin-top: 6px; }

.shop-card {
    background: linear-gradient(145deg, var(--bg2), var(--bg3));
    border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
    transition: all 0.2s; position: relative; overflow: hidden;
    display: flex; flex-direction: column; height: 100%;
}
.shop-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,146,42,0.12), transparent);
}
.shop-card:hover { transform: translateY(-2px); border-color: var(--border-mid); box-shadow: 0 8px 28px rgba(0,0,0,0.45); }
.shop-card.legendary { background: linear-gradient(145deg, var(--bg2), #1e1200); border-color: rgba(255,215,0,0.35); box-shadow: 0 0 24px rgba(255,200,0,0.08); }
.shop-card.epic { background: linear-gradient(145deg, var(--bg2), #24150a); border-color: rgba(230,126,34,0.35); }
.shop-card.rare { background: linear-gradient(145deg, var(--bg2), #0e0e24); border-color: rgba(142,68,173,0.35); }
.shop-card.locked-future { opacity: 0.55; filter: grayscale(0.6); pointer-events: none; }
.shop-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.shop-card-icon { font-size: 2.4rem; width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 10px; background: rgba(255,255,255,0.04); overflow: hidden; }
.shop-card-icon img {
    width: 68px; height: 68px; object-fit: contain; border-radius: 8px; display: block;
    filter:
        drop-shadow(0 0 8px rgba(255,255,255,0.08))
        drop-shadow(0 0 12px rgba(201,146,42,0.1));
    transition: filter 0.18s ease;
}
.shop-card:hover .shop-card-icon img {
    filter:
        drop-shadow(0 0 10px rgba(255,255,255,0.1))
        drop-shadow(0 0 16px rgba(201,146,42,0.16));
}
.shop-card-name { font-size: 0.98rem; font-weight: 600; color: var(--text-bright); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-card-tier { font-size: 0.62rem; color: var(--gold); background: rgba(201,146,42,0.1); padding: 2px 7px; border-radius: 5px; flex-shrink: 0; }
.shop-card-desc { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 10px; min-height: 32px; line-height: 1.5; }
.shop-card-stats { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.04); padding: 9px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 0.76rem; }
.shop-card-stat { display: flex; justify-content: space-between; margin-bottom: 3px; }
.shop-card-stat:last-child { margin-bottom: 0; }
.shop-card-stat-label { color: var(--text-dim); }
.shop-card-stat-value.positive { color: var(--green); font-weight: 600; }
.shop-card-stat-value.negative { color: var(--red-light); font-weight: 600; }
.shop-card-requirements { font-size: 0.7rem; margin-bottom: 9px; padding: 6px 8px; background: rgba(0,0,0,0.2); border-radius: 5px; }
.shop-card-requirements.met { color: var(--green); border-left: 2px solid var(--green); }
.shop-card-requirements.not-met { color: var(--red-light); border-left: 2px solid var(--red-light); }
.shop-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; }
.shop-card-price { font-size: 0.98rem; color: var(--gold); font-weight: 700; }
.free-gems-modal-box {
    max-width: 460px;
    width: 100%;
}
.free-gems-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.free-gems-modal-header h3 {
    margin: 0;
    color: var(--text-bright);
    font-family: 'Cinzel', serif;
}
.free-gems-modal-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.free-gems-hero {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(52, 152, 219, 0.24);
    background: radial-gradient(circle at top, rgba(52, 152, 219, 0.16), rgba(14, 20, 30, 0.92) 72%);
    text-align: center;
}
.free-gems-amount {
    font-size: 1.9rem;
    font-weight: 700;
    color: #6dc5ff;
    margin-bottom: 6px;
}
.free-gems-copy {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.55;
}
.free-gems-status {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    border: 1px solid rgba(255,255,255,0.08);
}
.free-gems-status.ready {
    color: var(--green);
    background: rgba(39, 174, 96, 0.1);
    border-color: rgba(39, 174, 96, 0.25);
}
.free-gems-status.locked {
    color: var(--text-dim);
    background: rgba(255,255,255,0.04);
}
.free-gems-claim-btn {
    width: 100%;
}
.premium-badge {
    position: absolute; top: 8px; right: 8px;
    background: linear-gradient(135deg,#5a1a8a,#8e44ad);
    color: #fff; padding: 2px 8px; border-radius: 5px; font-size: 0.62rem; font-weight: 700;
    box-shadow: 0 2px 8px rgba(142,68,173,0.4);
}
.legendary-badge {
    position: absolute; top: 8px; right: 8px;
    background: linear-gradient(135deg,#7a5500,#d4af37);
    color: #1a0800; padding: 2px 8px; border-radius: 5px; font-size: 0.62rem; font-weight: 700;
    box-shadow: 0 2px 8px rgba(212,175,55,0.4);
}
.premium-feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 46%);
    pointer-events: none;
}
.premium-feature-grid {
    justify-content: center;
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.premium-feature-card {
    display: flex;
    flex-direction: column;
}
.premium-feature-card .premium-feature-head {
    flex: 0 0 auto;
}
.premium-feature-days {
    z-index: 4;
}
.premium-feature-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
}
.premium-feature-body {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}
.premium-feature-art-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex: 0 0 auto;
    position: relative;
    border-radius: 0;
    overflow: hidden;
    background: rgba(0,0,0,0.22);
    display: flex;
    align-items: center;
    justify-content: center;
}
.premium-feature-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.premium-feature-emoji {
    font-size: 2rem;
}
.premium-feature-meta {
    min-width: 0;
    flex: 0 0 auto;
    text-align: center;
}
.premium-feature-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 16px 18px 18px;
}
.premium-feature-desc {
    text-align: center;
}
.premium-feature-card > :not(.premium-badge):not(.legendary-badge) {
    position: relative;
    z-index: 1;
}
.premium-feature-card.is-active .premium-feature-art-wrap {
    box-shadow: inset 0 -1px 0 rgba(241,196,15,0.22);
}

/* ════════════════════════════════════════════════════════════════════════
   LEADERBOARD
   ════════════════════════════════════════════════════════════════════════ */
#leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-row {
    display: grid;
    grid-template-columns: 55px 45px minmax(120px, 1fr) minmax(180px, auto);
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, var(--bg2), rgba(16, 25, 41, 0.8));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.lb-row:hover {
    border-color: rgba(201,146,42,0.25);
    background: linear-gradient(90deg, rgba(201,146,42,0.04), rgba(16,25,41,0.9));
    transform: translateX(2px);
}
.lb-self-row {
    border-color: rgba(201,146,42,0.28);
    background: linear-gradient(90deg, rgba(201,146,42,0.08), rgba(16,25,41,0.92));
}
.lb-self-row:hover {
    transform: none;
}
.lb-rank { text-align: center; font-weight: 700; font-size: 1rem; }
.lb-rank.gold-rank   { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.4); }
.lb-rank.silver-rank { color: #c0c0c0; }
.lb-rank.bronze-rank { color: #cd7f32; }
.lb-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.12); justify-self: center; }
.lb-row .lb-squad-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: none; }
.lb-info { overflow: hidden; min-width: 0; }
.lb-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub { font-size: 0.7rem; color: var(--text-dim); }
.lb-stats { display: grid; grid-template-columns: 50px 50px 90px; gap: 8px; justify-items: center; }
.lb-stat { text-align: center; }
.lb-stat-val { font-weight: 700; font-size: 0.85rem; }
.lb-stat-lbl { font-size: 0.6rem; color: var(--text-dim); }
.lb-header-row { cursor:default; pointer-events:none; background:transparent; border-color:transparent; min-height:20px; padding:2px 14px; }

@media (max-width: 768px) {
    .lb-row { grid-template-columns: 45px 36px 1fr; gap: 8px; }
    .lb-stats { grid-column: 1 / -1; grid-template-columns: 1fr 1fr 1fr; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.05); }
    .lb-stat-val { font-size: 0.75rem; }
}
@media (max-width: 480px) {
    .lb-row { grid-template-columns: 35px 28px 1fr; padding: 8px; }
    .lb-name { font-size: 0.75rem; }
    .lb-sub { font-size: 0.6rem; }
    .lb-stat-val { font-size: 0.7rem; }
}

/* ════════════════════════════════════════════════════════════════════════
   INBOX
   ════════════════════════════════════════════════════════════════════════ */
.inbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}
.inbox-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}
.inbox-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.inbox-tab, .compose-btn {
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-dim); cursor: pointer; font-size: 0.76rem;
    transition: all 0.14s;
}
.inbox-tab:hover, .compose-btn:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); border-color: var(--border-mid); }
.inbox-tab.active { background: rgba(52,143,209,0.12); border-color: rgba(52,143,209,0.32); color: var(--blue); font-weight: 600; }
.msg-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.msg-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}
.msg-row:not(.unread) {
    opacity: 0.64;
}
.msg-row:not(.unread):hover {
    opacity: 0.82;
}
.msg-row.unread {
    background: rgba(155, 89, 182, 0.05);
    border-color: rgba(155, 89, 182, 0.2);
}
.msg-row.unread .msg-subject,
.msg-row.unread .msg-from,
.msg-row.unread .msg-summary-line {
    color: var(--text-bright);
    font-weight: 800;
}
.msg-row.unread .msg-body-full {
    color: rgba(255, 255, 255, 0.92);
}
.msg-row.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #9b59b6;
}
.msg-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.msg-tag {
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}
.tag-mission { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.tag-battle { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.tag-personal { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.msg-date {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
}
.msg-from {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-bright);
}
.unread-from {
    color: #fff;
    text-shadow: 0 0 10px rgba(155, 89, 182, 0.3);
}
.msg-summary-line {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-top: 6px;
}
.msg-subject {
    font-size: 0.88rem;
    color: var(--text-mid);
    margin-top: 8px;
}
.msg-body-full {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-mid);
    white-space: pre-wrap;
}
.msg-actions {
    margin-top: 14px;
    gap: 10px;
}
.gain { color: #2ecc71; font-weight: 600; }
.loss { color: #e74c3c; font-weight: 600; }
.btn-icon-only {
    padding: 6px 10px !important;
    min-width: unset !important;
}

.topbar-menu-btn {
    position: relative;
    /* existing styles... */
}

.topbar-menu-btn.menu-highlight::after {
    content: '!';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid var(--bg1);
    animation: bounce 2s infinite;
    z-index: 10;
}

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

.topbar-menu-action {
    position: relative;
}

.topbar-menu-action.claimable-highlight::after {
    content: '!';
    position: absolute;
    top: 10px;
    right: 15px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 900;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Remove old styles */
.topbar-menu-btn.menu-highlight {
    background: transparent;
    box-shadow: none;
    animation: none;
}

.topbar-menu-action.claimable-highlight {
    border-color: var(--border) !important;
    background: rgba(255,255,255,0.03) !important;
}

.exclamation-point {
    display: none; /* Hide the inline one we added earlier */
}

/* ════════════════════════════════════════════════════════════════════════ */
/*   MODALS                                                                */
/* ════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    /* Must sit above sidebar hub dropdowns (which can be z-index: 99999). */
    z-index: 200000; padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: linear-gradient(145deg, var(--bg2), var(--bg3));
    border: 1px solid var(--border-mid); border-radius: var(--radius-lg); padding: 22px;
    max-width: 520px; width: 100%; max-height: 88vh; overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.04);
}
.profile-modal-box {
    max-width: 760px;
    padding: 12px;
    background: linear-gradient(145deg, rgba(8,12,20,0.98), rgba(9,14,24,0.98));
}
.achievements-modal-box {
    max-width: 760px;
    width: 100%;
}
.achievements-modal-box .modal-header {
    position: sticky; top: 0; z-index: 10;
    background: linear-gradient(145deg, var(--bg2), var(--bg3));
}
.character-switch-modal-box {
    max-width: 720px;
    width: 100%;
}
.topbar-menu-modal-box {
    max-width: 680px;
    width: 100%;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { font-family: 'Cinzel',serif; font-size: 0.98rem; font-weight: 700; color: var(--text-bright); }
.game-dialog-box { max-width: 460px; width: 90%; }
.game-dialog-message {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.game-dialog-message > .squads-card { max-width: 100%; }
@media (max-width: 640px) {
    .game-dialog-box { max-width: 94vw; }
    .game-dialog-message { font-size: 0.82rem; }
}
.game-dialog-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

#weapon-upgrade-dialog {
    max-width: 520px;
    width: 92%;
    max-height: 80vh;
    border: none;
    border-radius: 16px;
    background: var(--bg2);
    color: var(--text);
    padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: fixed;
    inset: 0;
    margin: auto;
}
#weapon-upgrade-dialog::backdrop {
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
}
.feed-row:hover {
    background: rgba(255,255,255,0.08) !important;
}
.btn-danger {
    background: linear-gradient(135deg, rgba(192,57,43,0.92), rgba(146,34,24,0.92));
    color: #fff;
    border: 1px solid rgba(231,76,60,0.38);
    box-shadow: 0 10px 28px rgba(192,57,43,0.24);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(192,57,43,0.3);
}
.topbar-menu-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.topbar-menu-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.topbar-menu-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
    font-weight: 700;
}
.topbar-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.topbar-menu-info-card,
.topbar-menu-action,
.topbar-menu-toggle {
    position: relative;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    padding: 14px 16px;
}
.topbar-menu-info-title {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.46);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.topbar-menu-info-value {
    font-size: 0.95rem;
    color: var(--text-bright);
    font-weight: 700;
}
.topbar-menu-action,
.topbar-menu-toggle {
    text-align: left;
    color: var(--text-bright);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.spirit-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
}
.spirit-dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 10000;
  width: 380px; max-width: 90vw;
  padding: 24px;
  border-radius: 16px;
  background: rgba(10,14,26,0.98);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 12px 60px rgba(0,0,0,0.6);
}
.spirit-dialog-title {
  font-size: 1.1rem; font-weight: 700;
  color: #e2e8f0; margin-bottom: 12px;
}
.spirit-dialog-body {
  font-size: 0.8rem; color: var(--text-dim);
  line-height: 1.6; margin-bottom: 14px;
}
.spirit-dialog-label {
  font-size: 0.75rem; color: #cbd5e1;
  display: block; margin-bottom: 6px;
}
.spirit-dialog-input {
  width: 100%; padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.45);
  color: #e2e8f0; font-size: 0.9rem;
  outline: none; box-sizing: border-box;
}
.spirit-dialog-input:focus {
  border-color: rgba(168,85,247,0.5);
  box-shadow: 0 0 14px rgba(168,85,247,0.25);
}
.spirit-dialog-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.spirit-dialog-actions button {
  flex: 1; padding: 10px; font-size: 0.85rem;
}

.topbar-menu-action:hover,
.topbar-menu-toggle:hover {
    border-color: rgba(201,146,42,0.28);
    background: linear-gradient(180deg, rgba(201,146,42,0.12), rgba(255,255,255,0.03));
    transform: translateY(-1px);
}
.topbar-menu-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 78px;
    justify-content: center;
}
.topbar-menu-meta {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.58);
}
.topbar-menu-referral-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.topbar-menu-referral-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.42);
}
.topbar-menu-referral-code {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gold);
}
.topbar-menu-referral-stats {
    display: grid;
    gap: 8px;
    width: 100%;
}
.topbar-menu-referral-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.05);
}
.topbar-menu-referral-stat-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
}
.topbar-menu-referral-stat-value {
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-bright);
}
.topbar-menu-referral-link-wrap {
    width: 100%;
    display: grid;
    gap: 4px;
}
.topbar-menu-referral-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.topbar-menu-referral-stat-claimable {
    background: rgba(212,168,67,0.08);
    border-color: rgba(212,168,67,0.18);
}
.topbar-menu-inline-btn-claim {
    border-color: rgba(46, 204, 113, 0.3);
    background: linear-gradient(180deg, rgba(46, 204, 113, 0.18), rgba(46, 204, 113, 0.07));
    color: #8df0b4;
}
.topbar-menu-referral-claim-note {
    width: 100%;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.5);
}
.topbar-menu-referral-link-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
}
.topbar-menu-referral-link {
    width: 100%;
    font-size: 0.7rem;
    line-height: 1.45;
    color: rgba(255,255,255,0.44);
    word-break: break-word;
    overflow-wrap: anywhere;
}
.topbar-menu-inline-btn {
    margin-top: 2px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(201,146,42,0.32);
    background: linear-gradient(180deg, rgba(201,146,42,0.16), rgba(201,146,42,0.07));
    color: var(--gold);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}
.topbar-menu-inline-btn:hover {
    border-color: rgba(201,146,42,0.55);
    background: linear-gradient(180deg, rgba(201,146,42,0.24), rgba(201,146,42,0.1));
}
.topbar-menu-flash {
    margin-top: 2px;
    font-size: 0.72rem;
    color: #8ee0a8;
}
.topbar-menu-flash.error {
    color: #ff9b9b;
}
.topbar-menu-action-mp {
    border-color: rgba(155,89,182,0.22);
}
.topbar-menu-action-danger {
    border-color: rgba(224,82,82,0.2);
    color: #ffb4b4;
}
.topbar-menu-action-danger:hover {
    border-color: rgba(224,82,82,0.36);
    background: linear-gradient(180deg, rgba(224,82,82,0.12), rgba(255,255,255,0.03));
}
.topbar-menu-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.topbar-menu-toggle.active {
    border-color: rgba(46,204,113,0.35);
    background: linear-gradient(180deg, rgba(46,204,113,0.14), rgba(255,255,255,0.03));
}
.topbar-menu-toggle-state {
    min-width: 52px;
    text-align: center;
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(255,255,255,0.07);
    font-size: 0.75rem;
    font-weight: 700;
}
.character-switch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.character-switch-title { font-family: 'Cinzel',serif; font-size: 1.05rem; color: var(--text-bright); }
.character-switch-sub { color: var(--text-dim); font-size: 0.78rem; }
.character-switch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.character-switch-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(145deg, rgba(12,18,30,0.9), rgba(10,15,25,0.78));
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.character-switch-card:hover {
    border-color: rgba(201,146,42,0.32);
    background: linear-gradient(145deg, rgba(16,22,36,0.95), rgba(12,18,30,0.82));
    transform: translateY(-1px);
}
.character-switch-card.active,
.character-switch-card:disabled {
    cursor: default;
    border-color: rgba(201,146,42,0.38);
    background: linear-gradient(145deg, rgba(201,146,42,0.12), rgba(18,20,28,0.9));
}
.character-switch-card.empty {
    justify-content: center;
    flex-direction: column;
    min-height: 96px;
    border-style: dashed;
}
.character-switch-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.12);
    flex-shrink: 0;
}
.character-switch-info { min-width: 0; flex: 1; }
.character-switch-name {
    font-weight: 700;
    color: var(--text-bright);
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.character-switch-meta,
.character-switch-empty { color: var(--text-dim); font-size: 0.78rem; }
.character-switch-state { font-size: 0.72rem; font-weight: 700; color: var(--gold); flex-shrink: 0; }

.battle-result-box { max-width: 680px; width: 100%; }
.battle-playback-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.battle-playback-status {
    font-size: 0.76rem;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.battle-skip-btn {
    width: auto;
    min-width: 150px;
    padding: 8px 12px;
}
.battle-outcome {
    font-family: 'Cinzel',serif; font-size: 1.3rem; font-weight: 700;
    margin-bottom: 16px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border); text-align: center;
    opacity: 0.45;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.battle-outcome.won  { color: var(--green); text-shadow: 0 0 25px rgba(39,174,96,0.5); }
.battle-outcome.lost { color: var(--red-light); text-shadow: 0 0 25px rgba(224,82,82,0.4); }
.battle-outcome.draw { color: var(--gold); text-shadow: 0 0 25px rgba(241,196,15,0.5); }
.battle-outcome.battle-outcome-visible { opacity: 1; transform: translateY(0); }
.battle-outcome-pending { color: rgba(255,255,255,0.55); }
.battle-log {
    font-family: 'Courier New',monospace; font-size: 0.76rem;
    color: rgba(255,255,255,0.65); max-height: 320px; overflow-y: auto;
    padding: 12px; background: rgba(0,0,0,0.4); border-radius: var(--radius-sm);
    margin-bottom: 16px; line-height: 1.75; border: 1px solid var(--border);
}
.battle-log-line.separator { color: rgba(255,255,255,0.15); text-align: center; }

.profile-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.profile-name { font-family: 'Cinzel',serif; font-size: 1.35rem; color: var(--text-bright); }
.profile-class { font-style: italic; color: var(--text-dim); font-size: 0.86rem; }
.profile-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}
.profile-scene { position: relative; }
.profile-scene .class-scene-content { padding: 20px; }
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.profile-combat-card {
    grid-column: auto;
}
.profile-card {
    background: linear-gradient(145deg, rgba(12,18,30,0.88), rgba(11,17,29,0.72));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    min-width: 0;
}
.profile-card .stat-row {
    grid-template-columns: 18px 24px minmax(0, 1fr) 42px;
    column-gap: 6px;
    padding: 6px 0;
    width: 100%;
}
.profile-card .stat-bar-wrap {
    width: 100%;
    min-width: 0;
}
.profile-card .stat-bar {
    width: 100%;
}
.profile-card .stat-icon-img {
    width: 16px;
    height: 16px;
    filter: var(--profile-stat-icon-filter, var(--stat-icon-filter, brightness(0) invert(1) opacity(0.96)));
}
.profile-card .stat-icon-fallback {
    font-size: 0.88rem;
}
.profile-card .stat-label {
    font-size: 0.68rem;
    white-space: nowrap;
    text-align: right;
}
.profile-card .stat-val {
    font-size: 0.8rem;
    text-align: right;
    justify-self: end;
    width: auto;
    min-width: 0;
}
.profile-equipment-card { margin-bottom: 12px; }
@media (max-width: 860px) {
    .profile-grid { grid-template-columns: 1fr; }
    .profile-combat-card { grid-column: 1 / -1; }
    .profile-scene .class-scene-content { padding: 14px; }
    .profile-modal-box { padding: 8px; }
    .profile-header > div { min-width: 0; }
    .profile-name { font-size: 1.05rem; line-height: 1.2; word-break: break-word; }
    .profile-class { font-size: 0.78rem; }
    .profile-card .stat-row {
        grid-template-columns: 16px 24px minmax(0, 1fr) 34px;
        column-gap: 4px;
    }
    .profile-card .stat-label {
        font-size: 0.64rem;
    }
    .profile-card .stat-val {
        font-size: 0.75rem;
    }
    .profile-combat-card .stat-row {
        grid-template-columns: 14px 22px minmax(150px, 1fr) 32px;
    }
    .profile-combat-card .stat-bar-wrap {
        min-width: 150px;
        margin-left: 4px;
    }
}
@media (max-width: 560px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
    .profile-combat-card {
        padding: 12px 10px;
    }
    .profile-card .stat-row {
        grid-template-columns: 14px 22px minmax(0, 1fr) 30px;
        column-gap: 4px;
    }
    .profile-combat-card .stat-row {
        grid-template-columns: 12px 20px minmax(120px, 1fr) 28px;
    }
    .profile-combat-card .stat-bar-wrap {
        min-width: 120px;
        margin-left: 4px;
    }
    .profile-card .stat-label {
        font-size: 0.6rem;
    }
    .profile-card .stat-val {
        font-size: 0.72rem;
    }
    .profile-card .stat-icon-img {
        width: 14px;
        height: 14px;
    }
    .profile-grid .profile-card:first-child {
        order: 2;
    }
    .profile-grid .profile-card:nth-child(2) {
        order: 1;
    }
    .profile-actions {
        flex-direction: column;
    }
    .profile-actions > button {
        width: 100%;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   WORLD MAP & MISSIONS
   ════════════════════════════════════════════════════════════════════════ */
.world-map-container {
    position: relative; width: 100%; height: 460px;
    border-radius: var(--radius-lg); overflow: hidden;
    background: radial-gradient(ellipse at 50% 50%, #0d1825, #060d14);
    border: 1px solid var(--border);
    box-shadow: inset 0 0 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,146,42,0.06);
}
.world-map-bg { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-nodes-layer { position: absolute; inset: 0; }

.mission-overlay, .travel-overlay {
    position: absolute; inset: 0; z-index: 50;
    background: rgba(4,6,12,0.92); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    border-radius: 0; padding: 20px;
    box-shadow: none; border: none; pointer-events: all;
}
.mission-overlay.hidden, .travel-overlay.hidden { display: none; }
#tab-missions { position: relative; min-height: 100%; }

.mission-overlay-inner, .travel-overlay-inner {
    display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
    background: linear-gradient(145deg, rgba(12,20,34,0.95), rgba(16,26,44,0.9));
    border: 1px solid rgba(201,146,42,0.25); border-radius: var(--radius-lg);
    padding: 36px 48px; min-width: 300px; max-width: 420px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.04);
}
.mission-overlay-badge {
    font-family: 'Cinzel', serif; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.14em;
    color: var(--gold); text-transform: uppercase;
    background: rgba(201,146,42,0.08); border: 1px solid rgba(201,146,42,0.3);
    padding: 4px 16px; border-radius: 20px; margin-bottom: 4px;
}
.mission-overlay-name { font-family: 'Cinzel', serif; font-size: 1.2rem; font-weight: 700; color: var(--text-bright); }
.mission-overlay-zone { font-size: 0.78rem; color: var(--text-dim); }
.mission-overlay-timer {
    font-family: 'Cinzel', serif; font-size: 2.8rem; font-weight: 700;
    color: var(--gold); letter-spacing: 0.06em; line-height: 1;
    text-shadow: 0 0 30px rgba(201,146,42,0.4);
}
.mission-overlay-progress-track { width: 100%; height: 6px; background: rgba(255,255,255,0.07); border-radius: 3px; overflow: hidden; }
.mission-overlay-progress-fill { height: 100%; background: var(--gold); border-radius: 3px; transition: width 1s linear; }
.mission-overlay-progress-fill.travel { background: var(--blue); }
.mission-overlay-subtext { font-size: 0.75rem; color: var(--text-dim); font-style: italic; }
.travel-overlay-label { font-size: 0.62rem; color: var(--text-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.travel-overlay-name { font-family: 'Cinzel', serif; font-size: 1.2rem; font-weight: 700; color: var(--text-bright); }
.travel-overlay-from { font-size: 0.75rem; color: var(--text-dim); }

/* ===== Arcane Reservoir — auto-complete module ===== */
.arc-relic {
    width: 100%;
    background: linear-gradient(180deg, rgba(34,20,52,0.92), rgba(18,12,34,0.94));
    border: 1px solid rgba(155,89,182,0.42);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(155,89,182,0.14), 0 0 28px rgba(155,89,182,0.2), inset 0 1px 0 rgba(255,255,255,0.07);
    position: relative;
    text-align: left;
}
.arc-relic::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(120deg, rgba(155,89,182,0.16) 0%, transparent 40%, rgba(201,146,42,0.12) 100%);
}
.arc-relic-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; cursor: pointer; position: relative; z-index: 1;
    background: rgba(155,89,182,0.1);
    border-bottom: 1px solid rgba(155,89,182,0.22);
    user-select: none;
}
.arc-relic-head:hover { background: rgba(155,89,182,0.16); }
.arc-relic-rune {
    font-size: 1.1rem; width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 30% 30%, rgba(155,89,182,0.55), rgba(155,89,182,0.12));
    border: 1px solid rgba(155,89,182,0.55); border-radius: 8px;
    box-shadow: 0 0 14px rgba(155,89,182,0.4); text-shadow: 0 0 10px rgba(155,89,182,0.9);
}
.arc-relic-title {
    font-family: 'Cinzel', serif; font-size: 0.86rem; font-weight: 700; letter-spacing: 0.05em; flex: 1;
    background: linear-gradient(90deg, #e8d2ff, #b48be0, #e8d2ff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.arc-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 10px rgba(46,204,113,0.85); animation: arcPulse 1.4s infinite; }
.arc-status-dot.paused { width: 8px; height: 8px; border-radius: 50%; background: #f39c12; box-shadow: 0 0 10px rgba(243,156,18,0.85); animation: none; }
.arc-status-label { font-size: 0.58rem; letter-spacing: 0.1em; text-transform: uppercase; color: #5be88f; }
.arc-chevy { transition: transform 0.25s; color: rgba(255,255,255,0.6); font-size: 0.8rem; }
.arc-relic-head.open .arc-chevy { transform: rotate(180deg); }
.arc-relic-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; padding: 0 14px; }
.arc-relic-head.open + .arc-relic-body { max-height: 420px; padding: 14px; }
.arc-stats { display: flex; gap: 8px; }
.arc-stat {
    flex: 1; min-width: 90px; text-align: center; padding: 9px 6px;
    background: rgba(155,89,182,0.08); border: 1px solid rgba(155,89,182,0.24);
    border-radius: 10px;
}
.arc-stat-val { font-family: 'Cinzel', serif; font-size: 1.05rem; font-weight: 700; color: #e0c3ff; text-shadow: 0 0 14px rgba(155,89,182,0.55); }
.arc-stat-lbl { font-size: 0.56rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.42); margin-top: 2px; }
.arc-last { font-size: 0.72rem; color: var(--text-dim); font-style: italic; margin: 8px 0 2px; }
.arc-stop {
    width: 100%; margin-top: 10px; padding: 9px 12px; border-radius: 10px;
    background: linear-gradient(180deg, rgba(231,76,60,0.3), rgba(231,76,60,0.12));
    border: 1px solid rgba(231,76,60,0.48); color: #ff9185; font-weight: 700; font-size: 0.78rem;
    cursor: pointer; transition: background 0.15s;
}
.arc-stop:hover { background: rgba(231,76,60,0.34); }
.arc-pause-row { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.arc-pause-row .arc-stop { flex: 1; width: auto; margin-top: 0; height: auto; display: flex; align-items: center; justify-content: center; }
.arc-pause { flex: 1; padding: 9px 12px; border-radius: 10px;
    background: linear-gradient(180deg, rgba(241,196,15,0.3), rgba(241,196,15,0.12));
    border: 1px solid rgba(243,156,18,0.5); color: #f7d774; font-weight: 700; font-size: 0.78rem;
    cursor: pointer; transition: background 0.15s;
    display: flex; align-items: center; justify-content: center; }
.arc-pause:hover { background: rgba(241,196,15,0.32); }
.arc-recover {
    width: 100%; margin-top: 8px; padding: 9px 12px; border-radius: 10px;
    background: linear-gradient(180deg, rgba(155,89,182,0.32), rgba(155,89,182,0.14));
    border: 1px solid rgba(155,89,182,0.55); color: #e0c3ff; font-weight: 700; font-size: 0.78rem;
    cursor: pointer; transition: background 0.15s;
}
.arc-recover:hover:not(:disabled) { background: rgba(155,89,182,0.36); }
.arc-recover:disabled { opacity: 0.4; cursor: not-allowed; }
@keyframes arcPulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: 0.55; } }

/* ===== Arcane Reservoir — panel ===== */
.arc-panel {
    position: relative;
    background: linear-gradient(180deg, rgba(34,20,52,0.92), rgba(18,12,34,0.94));
    border: 1px solid rgba(155,89,182,0.42);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(155,89,182,0.14), 0 12px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.07);
    margin-top: 24px;
    text-align: left;
}
.arc-panel::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(120deg, rgba(155,89,182,0.16) 0%, transparent 40%, rgba(201,146,42,0.1) 100%);
}
.arc-panel-head {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(90deg, rgba(155,89,182,0.24), rgba(155,89,182,0.05));
    border-bottom: 1px solid rgba(155,89,182,0.25);
}
.arc-panel-rune {
    font-size: 1.3rem; width: 40px; height: 40px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 30% 30%, rgba(155,89,182,0.55), rgba(155,89,182,0.12));
    border: 1px solid rgba(155,89,182,0.55); border-radius: 10px;
    box-shadow: 0 0 16px rgba(155,89,182,0.45); text-shadow: 0 0 10px rgba(155,89,182,0.9);
}
.arc-panel-title {
    font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 700; letter-spacing: 0.05em;
    background: linear-gradient(90deg, #e8d2ff, #b48be0, #e8d2ff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.arc-panel-sub { font-size: 0.68rem; color: rgba(255,255,255,0.45); margin-top: 2px; }
.arc-panel-body { position: relative; z-index: 1; padding: 14px 16px 16px; }

.arc-picker-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .arc-picker-row { grid-template-columns: 1fr; } }
.arc-field-label {
    font-size: 0.56rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: rgba(255,255,255,0.45); margin-bottom: 5px;
}
.arc-pick {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 10px 12px;
    background: linear-gradient(180deg, rgba(155,89,182,0.18), rgba(155,89,182,0.06));
    border: 1px solid rgba(155,89,182,0.4); border-radius: 10px;
    color: #fff; font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.arc-pick:hover { border-color: rgba(155,89,182,0.8); box-shadow: 0 0 14px rgba(155,89,182,0.25); }
.arc-pick:active { transform: translateY(1px); }
.arc-pick-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 10px rgba(155,89,182,0.3); }
.arc-pick-caret {
    width: 20px; height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; background: rgba(155,89,182,0.25); border: 1px solid rgba(155,89,182,0.5);
    color: #e0c3ff; font-size: 0.7rem;
}

.arc-mp-strip {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; margin-top: 10px; border-radius: 10px;
    background: rgba(52,152,219,0.08); border: 1px solid rgba(52,152,219,0.25);
    font-size: 0.76rem; color: var(--text-dim);
}
.arc-mp-strip strong { color: #fff; }

.arc-pot-title {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(255,255,255,0.45); margin: 14px 0 8px;
}
.arc-pot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.arc-pot-card {
    border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
    background: rgba(0,0,0,0.22); padding: 10px 8px; text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.arc-pot-card.selected { border-color: rgba(155,89,182,0.75); background: rgba(155,89,182,0.16); box-shadow: 0 0 14px rgba(155,89,182,0.2); }
.arc-pot-name { font-size: 0.76rem; font-weight: 600; color: #fff; margin-bottom: 3px; }
.arc-pot-mp { color: #9b59b6; font-weight: 700; font-size: 0.72rem; }
.arc-pot-stock { color: var(--text-dim); font-size: 0.66rem; margin-top: 2px; }
.arc-pot-ctl { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.arc-pot-btn {
    width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.07); color: #fff; font-weight: 700; cursor: pointer; line-height: 1;
    transition: background 0.15s;
}
.arc-pot-btn:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.arc-pot-btn.plus { border-color: rgba(155,89,182,0.55); background: rgba(155,89,182,0.22); }
.arc-pot-btn.plus:hover:not(:disabled) { background: rgba(155,89,182,0.34); }
.arc-pot-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.arc-pot-count { color: #fff; font-weight: 700; min-width: 18px; }

.arc-pool-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.arc-pool-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 20px;
    background: linear-gradient(180deg, rgba(155,89,182,0.3), rgba(155,89,182,0.1));
    border: 1px solid rgba(155,89,182,0.45); font-size: 0.76rem; color: rgba(255,255,255,0.7);
    box-shadow: 0 0 12px rgba(155,89,182,0.18);
}
.arc-pool-chip b { font-family: 'Cinzel', serif; color: #e0c3ff; font-size: 0.9rem; text-shadow: 0 0 10px rgba(155,89,182,0.6); }
.arc-pool-note { font-size: 0.64rem; color: var(--text-dim); }

.arc-start {
    width: 100%; margin-top: 14px; padding: 12px 14px; border-radius: 12px;
    font-family: 'Cinzel', serif; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.05em;
    color: #fff; cursor: pointer; border: 1px solid rgba(155,89,182,0.65);
    background: linear-gradient(180deg, rgba(155,89,182,0.5), rgba(120,60,160,0.28));
    box-shadow: 0 0 18px rgba(155,89,182,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
    transition: box-shadow 0.15s, background 0.15s;
}
.arc-start:hover:not(:disabled) { background: linear-gradient(180deg, rgba(155,89,182,0.6), rgba(120,60,160,0.34)); box-shadow: 0 0 26px rgba(155,89,182,0.45); }
.arc-start:disabled { opacity: 0.5; cursor: not-allowed; }

.arc-cta {
    display: block; width: 100%; margin-top: 10px; padding: 11px 14px; border-radius: 12px;
    font-size: 0.82rem; font-weight: 700; cursor: pointer; text-align: center;
    color: #e8d2ff; border: 1px solid rgba(155,89,182,0.6);
    background: linear-gradient(180deg, rgba(155,89,182,0.35), rgba(155,89,182,0.12));
    box-shadow: 0 0 14px rgba(155,89,182,0.2);
    transition: box-shadow 0.15s, background 0.15s;
}
.arc-cta:hover { background: linear-gradient(180deg, rgba(155,89,182,0.45), rgba(155,89,182,0.16)); box-shadow: 0 0 22px rgba(155,89,182,0.35); }

/* ===== Arcane picker modal ===== */
.arc-picker-box {
    width: 92vw; max-width: 340px;
    background: linear-gradient(180deg, rgba(34,20,52,0.96), rgba(18,12,34,0.97));
    border: 1px solid rgba(155,89,182,0.45); border-radius: 16px;
    box-shadow: 0 0 0 1px rgba(155,89,182,0.16), 0 0 34px rgba(155,89,182,0.3), 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.07);
    overflow: hidden;
    animation: autoOverlayIn 0.25s ease;
}
.arc-picker-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: linear-gradient(90deg, rgba(155,89,182,0.24), rgba(155,89,182,0.05));
    border-bottom: 1px solid rgba(155,89,182,0.25);
}
.arc-picker-close {
    margin-left: auto; width: 28px; height: 28px; border-radius: 8px;
    background: rgba(155,89,182,0.18); border: 1px solid rgba(155,89,182,0.4);
    color: #e0c3ff; font-size: 0.85rem; cursor: pointer; line-height: 1;
    transition: background 0.15s;
}
.arc-picker-close:hover { background: rgba(155,89,182,0.34); }
.arc-picker-list {
    padding: 12px; display: flex; flex-direction: column; gap: 8px;
    max-height: 60vh; overflow-y: auto;
}
.arc-opt {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 14px; border-radius: 10px; text-align: left;
    background: linear-gradient(180deg, rgba(155,89,182,0.16), rgba(155,89,182,0.05));
    border: 1px solid rgba(155,89,182,0.35); color: #fff;
    font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.arc-opt:hover { border-color: rgba(155,89,182,0.7); box-shadow: 0 0 12px rgba(155,89,182,0.22); }
.arc-opt.active { border-color: var(--gold); background: linear-gradient(180deg, rgba(201,146,42,0.22), rgba(201,146,42,0.06)); box-shadow: 0 0 14px rgba(201,146,42,0.25); }
.arc-opt-cost { color: rgba(255,255,255,0.5); font-weight: 400; }
.arc-opt-check { color: var(--gold); font-weight: 700; }

/* ===== Auto-Complete summon transition ===== */
#mission-location-modal { transition: opacity 0.35s ease, transform 0.35s ease; }
#mission-location-modal.auto-closing { opacity: 0; transform: scale(0.96); pointer-events: none; }
.mission-overlay:not(.hidden) { animation: autoOverlayIn 0.45s ease; }
@keyframes autoOverlayIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.mission-overlay-timer.summon { color: #b48be0; font-size: 1.5rem; animation: summonBlink 1.6s infinite; text-shadow: 0 0 24px rgba(155,89,182,0.6); }
@keyframes summonBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(52,143,209,0.5)}50%{box-shadow:0 0 0 8px rgba(52,143,209,0)}}

.mission-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); z-index: 10000; display: flex; align-items: stretch; justify-content: center; }
.mission-modal-overlay.hidden { display: none; }
.mission-modal-inner { position: relative; width: 100%; max-width: 900px; background: var(--bg1); overflow-y: auto; display: flex; flex-direction: column; }
.mission-modal-close {
    position: fixed; top: 14px; right: 18px; z-index: 10;
    background: rgba(5,8,14,0.8); border: 1px solid var(--border-mid);
    color: rgba(255,255,255,0.6); width: 34px; height: 34px;
    border-radius: 50%; font-size: 0.9rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.mission-modal-close:hover { background: rgba(224,82,82,0.3); color: #fff; border-color: rgba(224,82,82,0.5); }
.mz-hero { width: 100%; height: 220px; background-size: cover; background-position: center; position: relative; flex-shrink: 0; }
.mz-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg0) 0%, rgba(5,8,14,0.55) 50%, transparent 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 20px 24px; }
.mz-hero-title { font-family: 'Cinzel',serif; font-size: 1.8rem; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.9); margin-bottom: 4px; }
.mz-hero-desc { font-size: 0.83rem; color: rgba(255,255,255,0.55); margin-bottom: 12px; }
.mz-here-badge { display: inline-block; padding: 6px 16px; background: rgba(201,146,42,0.1); border: 1px solid rgba(201,146,42,0.32); color: var(--gold); border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; }
.mz-travel-btn { display: inline-block; padding: 7px 18px; background: var(--blue-dim); border: 1px solid rgba(52,143,209,0.38); color: var(--blue); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.83rem; font-weight: 600; transition: background 0.15s; }
.mz-travel-btn:hover:not(:disabled) { background: rgba(52,143,209,0.25); }
.mz-travel-btn:disabled {
    opacity: 0.36;
    cursor: not-allowed;
    filter: grayscale(0.35) saturate(0.7);
    box-shadow: none;
}
.mz-section-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.25); padding: 16px 24px 8px; }
.mz-spots-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; padding: 0 24px 16px; }
@media(max-width:640px){ .mz-spots-grid { grid-template-columns: 1fr 1fr; padding: 0 14px 14px; } }
.mz-spot-card { background: rgba(255,255,255,0.025); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all 0.15s; }
.mz-spot-card:hover:not(.mz-spot-locked) { border-color: rgba(201,146,42,0.28); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
.mz-spot-card.mz-spot-locked { opacity: 0.38; cursor: not-allowed; filter: grayscale(0.22) saturate(0.78); }
.mz-spot-img-wrap { position: relative; }
.mz-spot-img { width: 100%; height: 128px; object-fit: cover; display: block; background: var(--bg3); }
.mz-spot-diff-badge { position: absolute; top: 7px; left: 7px; font-size: 0.6rem; font-weight: 700; padding: 3px 8px; border-radius: 5px; letter-spacing: 0.06em; }
.mz-spot-locked-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.65); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; color: rgba(255,255,255,0.6); }
.mz-spot-info { padding: 10px 12px; }
.mz-spot-name { font-size: 0.88rem; font-weight: 600; color: #fff; margin-bottom: 3px; }
.mz-spot-stats { font-size: 0.68rem; color: var(--text-dim); }
.mz-missions-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 13px; padding: 0 24px 32px; }
@media(max-width:500px){ .mz-missions-grid { grid-template-columns: 1fr; padding: 0 14px 24px; } }
.mz-mission-card { background: rgba(255,255,255,0.025); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: all 0.15s; display: flex; flex-direction: column; }
.mz-mission-img-wrap { flex-shrink: 0; }
.mz-mission-info { flex: 1; min-height: 50px; }
.mz-mission-card:hover { border-color: rgba(52,143,209,0.4); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
.mz-mission-img-wrap { position: relative; overflow: hidden; }
.mz-mission-img { width: 100%; height: 148px; object-fit: cover; display: block; background: var(--bg3); transition: transform 0.2s; }
.mz-mission-card:hover .mz-mission-img { transform: scale(1.04); }
.mz-mission-img-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center; transition: background 0.15s; }
.mz-mission-card:hover .mz-mission-img-overlay { background: rgba(52,143,209,0.2); }
.mz-mission-start-btn { background: rgba(52,143,209,0.9); color: #fff; font-size: 0.84rem; font-weight: 700; padding: 7px 20px; border-radius: 18px; opacity: 0; transform: translateY(6px); transition: all 0.15s; }
.mz-mission-card:hover .mz-mission-start-btn { opacity: 1; transform: translateY(0); }
.mz-mission-info { padding: 10px 12px; }
.mz-mission-name { font-size: 0.86rem; font-weight: 600; color: #fff; margin-bottom: 3px; }
.mz-mission-reward { font-size: 0.68rem; font-weight: 600; }

.zone-select-wrap { position: relative; }
.zone-select {
    width: 100%; padding: 7px 10px;
    background: rgba(5,8,14,0.9); border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
    color: #fff; font-size: 0.76rem; cursor: pointer; transition: border-color 0.15s;
    appearance: none; -webkit-appearance: none;
}
.zone-select:focus { outline: none; border-color: rgba(52,143,209,0.45); }
.zone-select:hover { border-color: var(--border-hi); }
.zone-tooltip { font-size: 0.66rem; color: var(--text-dim); padding: 3px 4px 0; line-height: 1.45; min-height: 1.35em; }

/* ════════════════════════════════════════════════════════════════════════
   SHARED UTILITY
   ════════════════════════════════════════════════════════════════════════ */
.msg-bar {
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.78rem;
    border: 1px solid var(--border); background: rgba(255,255,255,0.025);
    color: var(--text-bright); margin-top: 10px; transition: all 0.3s;
}
.msg-bar.hidden { display: none; }
.filter-tabs { display: flex; gap: 5px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-btn {
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-dim); cursor: pointer; font-size: 0.76rem;
    transition: all 0.14s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.filter-btn:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.85); border-color: var(--border-mid); }
.filter-btn.active { background: rgba(52,143,209,0.12); border-color: rgba(52,143,209,0.32); color: var(--blue); font-weight: 600; }
.tab-icon { width: 18px; height: 18px; object-fit: contain; }
.tab-icon-lg { width: 100px; height: 100px; object-fit: contain; }
.loading { color: var(--text-dim); font-style: italic; text-align: center; padding: 24px; font-size: 0.83rem; }
.empty { color: var(--text-dim); font-style: italic; text-align: center; padding: 32px; font-size: 0.83rem; }
.lb-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.lb-search {
    flex: 1; min-width: 150px; padding: 8px 12px;
    background: rgba(255,255,255,0.035); border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm); color: #fff; font-size: 0.8rem; outline: none;
    transition: border-color 0.18s;
}
.lb-search:focus { border-color: rgba(201,146,42,0.4); }
.lb-search::placeholder { color: rgba(180,190,210,0.28); }

.event-banner {
    background: linear-gradient(90deg, rgba(201,146,42,0.12), rgba(201,146,42,0.06), rgba(201,146,42,0.12));
    border-bottom: 1px solid rgba(201,146,42,0.25);
    padding: 8px 20px; text-align: center;
    font-size: 0.8rem; color: var(--gold-light); font-weight: 600;
    animation: bannerPulse 3s ease-in-out infinite;
}
.event-banner.hidden { display: none; }
.event-banner.event-banner--tutorial {
    padding: 8px 14px 0;
    text-align: right;
    background: transparent;
    border-bottom: 0;
    animation: none;
}
@media (max-width: 700px) {
    .event-banner.event-banner--tutorial {
        padding: 8px 10px 0;
    }
    .tutorial-banner {
        width: 100%;
        gap: 8px;
        padding: 9px 10px;
    }
    .tutorial-copy {
        gap: 1px;
    }
    .tutorial-title {
        font-size: 0.76rem;
    }
    .tutorial-msg {
        font-size: 0.66rem;
    }
    .tutorial-progress {
        min-width: 48px;
        padding: 6px 7px;
        font-size: 0.68rem;
    }
    .skip-tutorial-btn, .goto-missions-btn {
        padding: 6px 9px;
        font-size: 0.66rem;
    }
}
@media (max-width: 520px) {
    .tutorial-banner {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start;
    }
    .tutorial-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}
@keyframes bannerPulse { 0%,100%{opacity:0.85}50%{opacity:1} }

.badge { display: inline-block; background: var(--red-light); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 0.62rem; font-weight: 700; margin-left: 4px; }
.badge.hidden { display: none; }

.matchmaking-card {
    background: linear-gradient(145deg, var(--bg2), var(--bg3));
    border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 4px;
}

/* ════════════════════════════════════════════════════════════════════════
   LOADOUT
   ════════════════════════════════════════════════════════════════════════ */
.loadout-figure { width: 100%; opacity: 0.95; }
.loadout-zone-info {
    min-height: 44px; margin-top: 8px; padding: 7px 10px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px; font-size: 0.75rem; color: var(--text-bright); line-height: 1.5;
}

.loadout-figures-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.loadout-figure-col { width: 100%; }
.loadout-dot-grid { width: 100%; }
.loadout-wrap {
    position: relative;
    width: 100%;
    padding-top: 185%;
}
.loadout-wrap img,
.loadout-wrap [data-zone] {
    position: absolute;
}

@media (min-width: 641px) {
    .loadout-figures-row {
        display: flex;
        justify-content: center;
        gap: 16px;
    }
    .loadout-figure-col { width: 280px; flex-shrink: 0; }
    .loadout-wrap {
        padding-top: 0;
        height: 420px;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   BUG REPORT
   ════════════════════════════════════════════════════════════════════════ */
.bug-report-modal {
    max-width: 640px;
    width: min(92vw, 640px);
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        radial-gradient(circle at top, rgba(91,192,222,0.08), transparent 38%),
        linear-gradient(180deg, rgba(17,24,36,0.98), rgba(10,14,22,0.98));
    box-shadow: 0 28px 70px rgba(0,0,0,0.55);
}
.bug-report-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 18px;
}
.bug-report-modal .modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
    color: var(--text-bright);
    font-family: 'Cinzel', serif;
}
.modal-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 20px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
}
.modal-close:hover {
    color: var(--text-bright);
    border-color: rgba(91, 192, 222, 0.35);
    background: rgba(91, 192, 222, 0.08);
}

.bug-report-intro {
    margin-bottom: 20px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(91,192,222,0.08), rgba(155,89,182,0.08));
    border-radius: 12px;
    border: 1px solid rgba(91,192,222,0.14);
}
.bug-report-intro p { margin: 0 0 6px 0; font-size: 0.86rem; line-height: 1.5; }
.bug-report-note { font-size: 0.76rem; color: var(--text-dim); margin-top: 6px; }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(91,192,222,0.55);
    background: rgba(255,255,255,0.05);
    box-shadow: 0 0 0 3px rgba(91,192,222,0.08);
}
.form-group textarea { resize: vertical; font-family: monospace; }

.checkbox-group { display: flex; align-items: center; }
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
}
.checkbox-group input[type="checkbox"] { width: auto; cursor: pointer; }

.screenshot-upload-area { margin-top: 10px; margin-bottom: 16px; }
.upload-dropzone {
    border: 2px dashed rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.03);
}
.upload-dropzone:hover {
    border-color: rgba(91,192,222,0.45);
    background: rgba(91,192,222,0.08);
}
.upload-dropzone span { display: block; }
.upload-dropzone span:first-child { font-size: 32px; margin-bottom: 8px; }
.upload-hint { font-size: 0.7rem; color: var(--text-dim); margin-top: 5px; }

.screenshot-preview { margin-top: 10px; position: relative; display: inline-block; }
.screenshot-preview img { max-width: 100%; max-height: 200px; border-radius: 6px; border: 1px solid var(--border); }
.screenshot-preview button {
    position: absolute; top: -8px; right: -8px;
    background: #e74c3c; border: none; border-radius: 50%;
    width: 24px; height: 24px; cursor: pointer; color: white;
    font-size: 14px; display: flex; align-items: center; justify-content: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.bug-report-status {
    margin-top: 16px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}
.bug-report-status.success { background: rgba(46,204,113,0.2); border: 1px solid #2ecc71; color: #2ecc71; }
.bug-report-status.error   { background: rgba(231,76,60,0.2);  border: 1px solid #e74c3c; color: #e74c3c; }
.bug-report-status.info    { background: rgba(52,152,219,0.2); border: 1px solid #3498db; color: #3498db; }

/* ════════════════════════════════════════════════════════════════════════
   MOBILE TOPBAR OVERRIDES
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
    .topbar {
        height: auto; min-height: unset; flex-direction: column; align-items: stretch;
        padding: 8px 12px 6px; gap: 6px; overflow: visible; justify-content: flex-start; flex-wrap: nowrap;
    }
    .topbar::before { display: none; }
    .topbar-left { width: 100%; flex: none; gap: 10px; align-items: center; }
    .topbar-avatar-wrap { flex-shrink: 0; gap: 8px; }
    .topbar-avatar { width: 38px; height: 38px; }
    .topbar-avatar-info { gap: 2px; }
    .topbar-name { font-size: 0.78rem; }
    .topbar-level { font-size: 0.55rem; padding: 1px 6px; }
    .topbar-bars { flex: 1; max-width: none; min-width: 0; gap: 4px; }
    .topbar-bar-row { gap: 5px; }
    .topbar-bar-track { min-width: 0; height: 7px; padding: 0; order: 2; }
    .topbar-bar-label { font-size: 0.52rem; width: 14px; }
    .topbar-bar-text {
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        order: 3;
        min-width: 62px;
        font-size: 0.5rem;
        font-weight: 700;
        letter-spacing: 0.02em;
        color: rgba(238,242,248,0.9);
        text-align: right;
        padding: 0 0 0 4px;
        border-left: 1px solid rgba(255,255,255,0.08);
        text-shadow: 0 1px 2px rgba(0,0,0,0.65);
    }
    .topbar-bar-num { min-width: 2.9em; text-align: right; }
    .topbar-bar-num-max { min-width: 3em; text-align: left; }
    .topbar-bar-sep { width: 0.7em; }
    .topbar-bar-row:nth-child(1) .topbar-bar-text { color: rgba(176, 242, 193, 0.96); }
    .topbar-bar-row:nth-child(2) .topbar-bar-text { color: rgba(245, 220, 144, 0.96); }
    .topbar-bar-row:nth-child(3) .topbar-bar-text { color: rgba(220, 194, 250, 0.96); }
    .topbar-right {
        width: 100%; flex: none; display: flex; flex-direction: row; align-items: center; gap: 6px;
        overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; padding-bottom: 2px;
    }
    .topbar-right::-webkit-scrollbar { display: none; }
    .topbar-currency { font-size: 0.72rem; padding: 3px 8px; white-space: nowrap; flex-shrink: 0; }
    .topbar-right-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
    .topbar-chat-btn, .topbar-menu-btn { font-size: 0.68rem; padding: 4px 10px; flex-shrink: 0; }
    .topbar-menu-grid { grid-template-columns: 1fr; }
    .topbar-menu-toggle { align-items: flex-start; flex-direction: column; }
    .topbar-menu-toggle-state { min-width: 0; }
    #chat-widget-root {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: auto;
    }
    .chat-widget {
        width: 100%;
        max-height: 100svh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .chat-widget.collapsed {
        width: auto;
    }
    .chat-widget-body {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }
    .chat-widget-messages {
        flex: 1;
        min-height: 60px;
        max-height: none;
        overflow-y: auto;
    }
    .chat-widget-target-row,
    .chat-widget-foot {
        flex-wrap: nowrap;
        flex-shrink: 0;
    }
    .chat-widget-compose {
        flex-shrink: 0;
    }
    .chat-widget-target-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
    .chat-widget-compose {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .chat-widget-header {
        cursor: default;
    }
    .chat-widget-bubble {
        min-width: unset;
        width: auto;
        height: 36px;
        padding: 0 14px;
    }
    .chat-widget-bubble-label {
        font-size: 0.72rem;
    }

    .char-hero-content { flex-direction: row; text-align: left; padding: 18px; gap: 12px; align-items: center; }
    .char-avatar-ring { width: 88px; height: 88px; }
    .char-hero-name { font-size: 1.45rem; }
    .char-hero-left { flex-shrink: 0; }
    .char-hero-right { min-width: 0; }

    .mission-overlay, .travel-overlay { position: absolute; inset: 0; z-index: 500; padding: 20px; }
    .mission-overlay-inner, .travel-overlay-inner { padding: 28px 24px; min-width: unset; width: 90%; max-width: 340px; }
    .mission-overlay-timer { font-size: 2rem; }

    .auth-container { padding: 28px 16px 32px; gap: 14px; }
    .game-logo { max-width: 100%; margin: 0; border-radius: 16px; }
    .game-subtitle { font-size: 0.78rem; letter-spacing: 0.15em; }
    .auth-tabs { gap: 3px; }
    .tab-btn { font-size: 0.76rem; padding: 8px 10px; }
    .input-field { padding: 10px 13px; font-size: 0.86rem; }
    .btn-primary { padding: 11px 18px; font-size: 0.82rem; }
    .class-grid { gap: 8px; }
    .class-card { padding: 16px 10px 14px; }
    .class-icon { font-size: 1.8rem; margin-bottom: 6px; }
    .class-name { font-size: 0.9rem; }
    .class-desc { font-size: 0.76rem; }
}

@media (max-width: 500px) {
    .char-hero-content { padding: 16px; gap: 10px; }
    .char-avatar-ring { width: 78px; height: 78px; }
}
/* Fix for desktop game screen */
@media (min-width: 641px) {
    /* Ensure game body takes full height */
    #screen-game.active {
        height: 100vh;
        overflow: hidden;
    }
    
    .game-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    
    /* Make sure tab content area is visible */
    .tab-content-area {
        flex: 1;
        overflow-y: auto;
        padding: 22px 24px;
    }
    
    /* Ensure sidebar doesn't overflow */
    .sidebar {
        flex-shrink: 0;
        max-width: 100%;
    }
    
    .sidebar-inner {
        width: fit-content;
        margin: 0 auto;
    }
}
/* Battle Result Modal */
.battle-result-box {
    max-width: 700px;
    width: 100%;
    /* Scrolling is handled by .modal-box (this element also has .modal-box). */
    display: block;
}

.battle-result-box .battle-playback-toolbar {
    margin-bottom: 8px;
}

.battle-result-box .battle-outcome {
    margin-bottom: 10px;
    padding-bottom: 10px;
}

.battle-outcome {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.battle-outcome.won {
    color: var(--green);
    text-shadow: 0 0 25px rgba(39,174,96,0.5);
}

.battle-outcome.lost {
    color: var(--red-light);
    text-shadow: 0 0 25px rgba(224,82,82,0.4);
}

.battle-log {
    font-family: 'Courier New', monospace;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.85);
    flex: 0 0 auto;
    overflow: visible;
    max-height: none;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    line-height: 1.24;
    border: 1px solid var(--border);
    overscroll-behavior: auto;
}

.battle-log-line {
    display: flex;
    margin-bottom: 3px;
}

.battle-log-pill {
    display: inline-block;
    max-width: min(88%, 520px);
    padding: 5px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.battle-log-line.separator {
    color: rgba(255,255,255,0.2);
    text-align: center;
    font-size: 0.64rem;
    justify-content: center;
    margin: 1px 0 4px;
}

.battle-log-line.separator .battle-log-pill {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 2px 0;
}

.battle-log-line.battle-log-player {
    justify-content: flex-end;
}

.battle-log-line.battle-log-opponent {
    justify-content: flex-start;
}

.battle-log-line.battle-log-player .battle-log-pill,
.battle-log-pill.battle-log-player {
    background: linear-gradient(135deg, rgba(52,152,219,0.42), rgba(52,152,219,0.16));
    border-left: 3px solid #3498db;
    color: #e2f3ff;
    box-shadow: 0 0 0 1px rgba(52,152,219,0.2), 0 4px 12px rgba(52,152,219,0.18);
    text-align: left;
}

.battle-log-line.battle-log-opponent .battle-log-pill,
.battle-log-pill.battle-log-opponent {
    background: linear-gradient(135deg, rgba(231,76,60,0.42), rgba(231,76,60,0.16));
    border-left: 3px solid #e74c3c;
    color: #ffe5df;
    box-shadow: 0 0 0 1px rgba(231,76,60,0.2), 0 4px 12px rgba(231,76,60,0.18);
    text-align: left;
}
.battle-fighters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.18));
    border-radius: var(--radius);
    flex-wrap: wrap;
    border: 1px solid rgba(255,255,255,0.08);
}

.battle-stats {
    margin-bottom: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0.12));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    overflow: visible;
}
.battle-stats:empty { display: none; }
.battle-stats-grid {
    display: grid;
    /* Align with .battle-fighters mobile grid: left card | middle vs | right card */
    grid-template-columns: minmax(0, 1fr) minmax(120px, 1.15fr) minmax(0, 1fr);
    gap: 0;
}
.battle-stats-h {
    padding: 8px 10px;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-light);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}
.battle-stats-h-mid { text-align: center; }
.battle-stats-k,
.battle-stats-v {
    padding: 6px 10px;
    font-size: 0.78rem;
    border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.battle-stats-k { color: var(--text-dim); }
.battle-stats-k-mid { text-align: center; }
.battle-stats-v { color: var(--text-bright); font-weight: 800; }
.battle-stats-v-left { text-align: right; }
.battle-stats-v-right { text-align: left; }
.battle-stats-grid > :nth-last-child(-n+3) { border-bottom: none; }

@media (max-width: 640px) {
    .battle-result-box.modal-box {
        padding: 12px;
        height: calc(100vh - 20px);
        max-height: calc(100vh - 20px);
    }

    .battle-fighters {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 0;
        margin-bottom: 8px;
        padding: 10px;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: stretch;
    }

    .battle-fighters > .fighter-card {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        align-self: stretch;
        min-width: 0;
        position: relative;
        z-index: 1;
    }

    .battle-fighters > .fighter-card:first-of-type {
        justify-self: end;
        margin-right: -24px;
        z-index: 2;
    }

    .battle-fighters > .fighter-card:last-of-type {
        justify-self: start;
        margin-left: -24px;
    }

    .battle-fighters .fighter-avatar-splash {
        width: 120px;
        height: 172px;
    }

    .battle-fighters .fighter-name {
        width: 100%;
        min-height: 2.2em;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.1;
        padding: 0 4px;
    }

    .battle-fighters .fighter-class {
        width: 100%;
        min-height: 2.6em;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        line-height: 1.15;
        padding: 0 4px;
    }

    .battle-fighters > .fighter-card:first-of-type .fighter-avatar-splash {
        clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
    }

    .battle-fighters > .fighter-card:last-of-type .fighter-avatar-splash {
        clip-path: polygon(12% 0, 100% 0, 100% 100%, 0 100%);
    }

    .fighter-vs {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        z-index: 4;
        background: radial-gradient(circle, rgba(9,14,24,0.96) 0%, rgba(9,14,24,0.88) 58%, rgba(9,14,24,0) 78%);
        padding: 10px 8px;
        min-width: 52px;
        text-align: center;
        pointer-events: none;
        margin: 0 -10px;
        align-self: center;
    }

    .battle-result-box .battle-playback-toolbar {
        gap: 8px;
        margin-bottom: 6px;
    }

    .battle-result-box .battle-outcome {
        margin-bottom: 8px;
        padding-bottom: 8px;
        flex: 0 0 auto;
    }

    .battle-log {
        min-height: unset;
        margin-bottom: 8px;
    }

    .battle-stats {
        margin-bottom: 8px;
        padding: 8px;
    }
    .battle-stats-grid {
        grid-template-columns: minmax(0, 1fr) minmax(96px, 1.1fr) minmax(0, 1fr);
    }
    .battle-stats-h { padding: 7px 8px; font-size: 0.64rem; }
    .battle-stats-k,
    .battle-stats-v { padding: 5px 8px; font-size: 0.7rem; }
}

.fighter-card {
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.fighter-avatar {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 2px solid rgba(201,146,42,0.75);
    background: var(--bg3);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 12px 30px rgba(0,0,0,0.32);
}

.fighter-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.fighter-avatar-splash {
    width: 150px;
    height: 210px;
    border-radius: 18px;
    border-color: rgba(201,146,42,0.45);
    background: radial-gradient(circle at top, rgba(201,146,42,0.12), rgba(8,12,20,0.96) 72%);
}
.battle-fighter-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.8rem;
    background: radial-gradient(circle at top, rgba(201,146,42,0.14), rgba(7,11,18,0.95) 74%);
}

.enemy-avatar {
    background: linear-gradient(135deg, #2c3e50, #1a2632);
}

.enemy-avatar span {
    font-size: 2.5rem;
}

/* For enemy avatar (emoji fallback) */
.fighter-card .fighter-avatar:not(img) {
    font-size: 2.5rem;
    background: rgba(0,0,0,0.3);
}

.fighter-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-bright);
}

.fighter-class {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.fighter-stats {
    font-size: 0.65rem;
    color: var(--gold);
}

.fighter-vs {
    font-family: 'Cinzel', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 16px rgba(212,168,67,0.5);
    letter-spacing: 0.08em;
}
.battle-summary {
    background: linear-gradient(135deg, rgba(0,0,0,0.4), rgba(0,0,0,0.2));
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-stat {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.summary-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
}

.summary-value.win {
    color: var(--green);
}

.summary-value.loss {
    color: var(--red-light);
}
/* Donate Button */
.donate-button-container {
    position: fixed;
    bottom: 130px;  /* Position above bug report button (65px + spacing) */
    right: 20px;
    z-index: 1000;
}

.donate-button-container iframe {
    width: auto !important;
    height: auto !important;
}

/* On mobile, adjust position to not overlap with navigation */
@media (max-width: 640px) {
    .donate-button-container {
        bottom: 80px;  /* Above mobile navigation */
        right: 20px;
    }
    
    .bug-report-floating-btn {
        bottom: 130px;  /* Move bug report button above donate button */
    }
}
/* Footer - SINGLE CLEAN VERSION */
.game-footer {
    margin-top: 40px;
    padding: 24px 20px 32px;
    border-top: 1px solid rgba(201,146,42,0.15);
    background: linear-gradient(180deg, rgba(8,12,22,0.6), rgba(5,8,14,0.8));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    text-align: center;
}

.footer-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.footer-btn:hover {
    transform: translateY(-2px);
}

.bug-report-btn:hover {
    background: rgba(155,89,182,0.15);
    border-color: rgba(155,89,182,0.5);
    color: #9b59b6;
}

.footer-donate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.footer-donate-btn:hover {
    transform: translateY(-2px);
}

.footer-donate-btn iframe {
    height: 42px !important;
    border-radius: var(--radius-sm);
}

.footer-btn-icon {
    font-size: 1.2rem;
}

.footer-btn-text {
    font-size: 0.85rem;
}

.footer-copyright {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.03em;
}

/* Hide floating buttons */
.bug-report-floating-btn {
    display: none;
}
.potion-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #9b59b6;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 0 6px rgba(155,89,182,0.5);
}
.upgrade-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(201,146,42,0.1), rgba(0,0,0,0.3));
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(201,146,42,0.15);
}

.upgrade-item-preview {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.08);
}

.upgrade-item-details { flex: 1; }
.upgrade-item-name { font-family: 'Cinzel', serif; font-size: 1.1rem; font-weight: 700; color: var(--text-bright); margin-bottom: 4px; }
.upgrade-item-level-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; }
.upgrade-item-current { color: var(--text-dim); }
.upgrade-item-arrow { color: var(--gold); }
.upgrade-item-next { color: #2ecc71; }

.upgrade-section-title { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 12px; font-weight: 700; }

.upgrade-components-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 20px;
}

.upgrade-component-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upgrade-component-card:hover:not(.unowned) { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); }
.upgrade-component-card.selected { background: rgba(155,89,182,0.12); border-color: rgba(155,89,182,0.45); box-shadow: 0 0 15px rgba(155,89,182,0.1); }
.upgrade-component-card.unowned { opacity: 0.65; cursor: default; filter: grayscale(0.4); }

.component-icon-wrap { position: relative; }
.component-icon { font-size: 2rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.04); border-radius: 10px; }
.component-owned-badge { position: absolute; top: -6px; right: -6px; background: var(--blue); color: #fff; font-size: 0.65rem; font-weight: 800; padding: 2px 6px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

.component-info { flex: 1; min-width: 0; }
.component-name { font-size: 0.88rem; font-weight: 700; color: var(--text-bright); margin-bottom: 2px; }
.component-bonus-tag { font-size: 0.68rem; color: #2ecc71; margin-left: 6px; font-weight: 600; opacity: 0.85; }
.component-source { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 4px; }
.upgrade-component-recipe { font-size: 0.7rem; color: var(--text-dim); opacity: 0.9; line-height: 1.4; }

#selected-component-details .crimson-stat-btn {
  padding:6px 14px; border:1px solid #3a3a4a; border-radius:6px;
  background:#1a1a28; color:#b0a8a0; cursor:pointer;
  font:inherit; font-size:12px; font-weight:500;
  transition:all .15s; line-height:1.4;
}
#selected-component-details .crimson-stat-btn:hover {
  border-color:#c8a86e; background:#222233; color:#e0dcd0;
}
#selected-component-details .crimson-stat-btn.selected {
  border-color:#c8a86e; background:#2a2a3a; color:#e0dcd0;
}

.btn-craft-direct {
    background: rgba(46,204,113,0.15);
    border: 1px solid rgba(46,204,113,0.35);
    color: #2ecc71;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-craft-direct:hover { background: rgba(46,204,113,0.25); border-color: rgba(46,204,113,0.5); transform: translateY(-1px); }

.upgrade-selected-info { 
    margin-top: 20px; 
    border-top: 1px solid rgba(255,255,255,0.1); 
    padding-top: 16px;
    background: rgba(0,0,0,0.15);
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
    border-radius: 0 0 12px 12px;
    position: sticky;
    bottom: 0;
    backdrop-filter: blur(8px);
}
.upgrade-selected-box { 
    display: flex; 
    flex-direction: column;
    align-items: stretch; 
    gap: 12px; 
}

#selected-component-details { flex: 1; }
.selected-comp-name { font-size: 0.95rem; font-weight: 700; color: var(--text-bright); margin-bottom: 2px; }
.selected-comp-bonus { font-size: 0.8rem; color: #2ecc71; font-weight: 600; }
.selected-comp-owned { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

.btn-confirm-upgrade { 
    width: 100%;
    padding: 12px 28px; 
    font-size: 0.95rem; 
    font-weight: 800;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 15px rgba(155,89,182,0.3); 
}

@media (max-width: 640px) {
    .upgrade-selected-info {
        position: relative;
    }
    .upgrade-selected-box {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 14px;
    }
    .btn-confirm-upgrade {
        padding: 14px;
    }
    .upgrade-item-info {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
}

@media (max-width: 768px) {
    #upgrade-modal {
        align-items: flex-start;
        padding: 10px;
    }
    #upgrade-modal .upgrade-modal-box {
        margin-top: 0;
        max-height: 90vh;
        max-height: 90dvh;
        max-height: calc(100svh - 20px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    #upgrade-modal .modal-header {
        position: sticky;
        top: 0;
        z-index: 3;
        background: linear-gradient(145deg, var(--bg2), var(--bg3));
        padding-bottom: 10px;
    }
}

.selected-component-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #9b59b6;
}
/* Skill tree horizontal scroll */
#skill-tree-root {
    padding: 16px 0;
}

#skill-tree-root [style*="overflow-x:auto"] {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#skill-tree-root [style*="overflow-x:auto"]::-webkit-scrollbar {
    height: 4px;
}
#skill-tree-root [style*="overflow-x:auto"]::-webkit-scrollbar-track {
    background: transparent;
}
#skill-tree-root [style*="overflow-x:auto"]::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(155, 89, 182, 0); }
    100% { box-shadow: 0 0 0 0 rgba(155, 89, 182, 0); }
}
/* Abyss Map Styles */
.abyss-zone {
    filter: drop-shadow(0 0 5px rgba(155, 89, 182, 0.5));
}

.abyss-zone-locked {
    filter: grayscale(0.8) opacity(0.6);
}

.abyss-exit-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.abyss-exit-btn:hover {
    transform: scale(1.05);
}

/* Final equipment lock: shared stable grid for character + profile */
.eq-stage {
    position: relative !important;
    width: fit-content !important;
    max-width: 100% !important;
    margin: 0 auto !important;
}

.eq-grid,
.profile-eq-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(88px, auto)) !important;
    grid-template-rows: auto !important;
    gap: 14px !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    position: relative !important;
    overflow: visible !important;
}

.eq-grid::before,
.profile-eq-grid::before {
    content: none !important;
    background: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    pointer-events: none !important;
}

.eq-grid > *,
.profile-eq-grid > * {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: 1 !important;
}

.eq-grid > :nth-child(1),
.profile-eq-grid > :nth-child(1) { grid-column: 1 !important; grid-row: 1 !important; }
.eq-grid > :nth-child(2),
.profile-eq-grid > :nth-child(2) { grid-column: 1 !important; grid-row: 2 !important; }
.eq-grid > :nth-child(3),
.profile-eq-grid > :nth-child(3) { grid-column: 1 !important; grid-row: 3 !important; }
.eq-grid > :nth-child(4),
.profile-eq-grid > :nth-child(4) { grid-column: 2 !important; grid-row: 1 / 4 !important; }
.eq-grid > :nth-child(5),
.profile-eq-grid > :nth-child(5) { grid-column: 3 !important; grid-row: 1 !important; }
.eq-grid > :nth-child(6),
.profile-eq-grid > :nth-child(6) { grid-column: 3 !important; grid-row: 2 !important; }
.eq-grid > :nth-child(7),
.profile-eq-grid > :nth-child(7) { grid-column: 3 !important; grid-row: 3 !important; }

.eq-avatar-center,
.profile-eq-avatar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    pointer-events: auto !important;
    z-index: 0 !important;
    position: relative !important;
}

.eq-avatar-center img:not(.eq-elemental-spirit),
.profile-eq-avatar img:not(.eq-elemental-spirit) {
    width: 230px !important;
    max-width: 230px !important;
    height: 300px !important;
    object-fit: contain !important;
    pointer-events: none !important;
}

.eq-avatar-center img.eq-elemental-spirit {
    position: absolute !important;
    width: 60px !important;
    height: 60px !important;
    object-fit: contain !important;
    top: 10px !important;
    right: 0px !important;
    z-index: 3 !important;
    filter: drop-shadow(0 0 12px rgba(100,200,255,0.5)) !important;
    animation: elemFloat 3s ease-in-out infinite !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

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

.eq-slot,
.profile-eq-slot {
    width: 100% !important;
    max-width: 110px !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 10px !important;
    border: none !important;
    background: rgba(255,255,255,0.015) !important;
    overflow: hidden !important;
    position: relative !important;
    transform: translateZ(0);
}

.eq-slot::before,
.profile-eq-slot::before {
    content: "" !important;
    position: absolute !important;
    inset: -1px !important;
    background: url('/images/equipment-bg.png') center/112% no-repeat !important;
    opacity: 0.2 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.eq-slot.filled,
.profile-eq-slot.filled {
    background: rgba(255,255,255,0.025) !important;
    border: none !important;
}

.eq-slot-icon,
.profile-eq-slot .eq-slot-icon {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    flex: 1 !important;
    min-height: 0 !important;
}

.eq-slot-icon img,
.profile-eq-slot .eq-slot-icon img {
    width: 76px !important;
    height: 76px !important;
    object-fit: contain !important;
    filter:
        drop-shadow(0 0 10px rgba(255,255,255,0.08))
        drop-shadow(0 0 16px rgba(201,146,42,0.12));
    transition: filter 0.18s ease;
}
.profile-eq-slot .eq-slot-icon img { filter: none !important; }
.profile-eq-slot.filled:hover .eq-slot-icon img { filter: none !important; }
.eq-slot.filled:hover .eq-slot-icon img,
.eq-slot-small.filled:hover .eq-slot-small-icon img {
    filter:
        drop-shadow(0 0 12px rgba(255,255,255,0.1))
        drop-shadow(0 0 20px rgba(201,146,42,0.18));
}

.eq-slot-label {
    position: relative !important;
    z-index: 1 !important;
    font-size: 0.5rem !important;
    color: rgba(255,255,255,0.35) !important;
    text-align: center !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    padding: 0 3px !important;
}

.eq-slot:hover,
.profile-eq-slot:hover,
.eq-slot.filled:hover,
.profile-eq-slot.filled:hover,
.eq-slot-small:hover {
    transform: none !important;
    translate: none !important;
}

.eq-accessory-row,
.profile-eq-accessory-row {
    position: absolute !important;
    top: 14px !important;
    left: 90px !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    padding: 0 !important;
    border-top: none !important;
    margin-top: 0 !important;
    z-index: 2 !important;
}

.eq-slot-small {
    width: 25px !important;
    min-width: 25px !important;
    max-width: 25px !important;
    height: 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.eq-slot-small.filled {
    background: transparent !important;
}

.eq-slot-small::before {
    content: none !important;
    background: none !important;
    pointer-events: none !important;
}

.eq-slot-small > * {
    position: relative !important;
    z-index: 1 !important;
}
.eq-slot-small-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    font-style: normal !important;
}

@media (max-width: 640px) {
    .eq-grid,
    .profile-eq-grid {
        grid-template-columns: repeat(3, minmax(84px, auto)) !important;
        gap: 8px !important;
    }

    .eq-slot,
    .profile-eq-slot {
        max-width: 88px !important;
        padding: 5px !important;
    }

    .eq-slot-icon img,
    .profile-eq-slot .eq-slot-icon img {
        width: 75px !important;
        height: 75px !important;
    }

    .eq-avatar-center img,
    .profile-eq-avatar img {
        max-width: 230px !important;
        height: 300px !important;
    }

    .eq-slot-label {
        font-size: 0.45rem !important;
    }

    .eq-accessory-row,
    .profile-eq-accessory-row {
        top: 6px !important;
        left: 90px !important;
    }

    .eq-slot-small {
        width: 25px !important;
        min-width: 25px !important;
        max-width: 25px !important;
        height: 25px !important;
    }
}

@media (max-width: 480px) {
    .eq-grid,
    .profile-eq-grid {
        grid-template-columns: repeat(3, minmax(80px, auto)) !important;
        gap: 6px !important;
    }

    .eq-slot,
    .profile-eq-slot {
        max-width: 84px !important;
    }

    .eq-slot-icon img,
    .profile-eq-slot .eq-slot-icon img {
        width: 105px !important;
        height: 105px !important;
    }

    .eq-avatar-center img,
    .profile-eq-avatar img {
        max-width: 230px !important;
        height: 300px !important;
    }

    .eq-slot-label {
        display: none !important;
    }

    .eq-accessory-row,
    .profile-eq-accessory-row {
        top: 4px !important;
        left: 78px !important;
    }

    .eq-slot-small {
        width: 25px !important;
        min-width: 25px !important;
        max-width: 25px !important;
        height: 25px !important;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   GAME MESSAGES
   ════════════════════════════════════════════════════════════════════════ */
.game-messages {
    position: absolute;
    top: calc(var(--topbar-h) + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: clamp(300px, 90%, 500px);
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.game-message {
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    color: var(--text-bright);
    background: rgba(10,15,26,0.92);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.game-message--fading {
    opacity: 0;
    transform: translateY(-20px);
}

.game-message--info {
    border-color: rgba(52,152,219,0.3);
    color: #9fd3ff;
}

.game-message--success {
    border-color: rgba(46,204,113,0.3);
    color: #79f2b3;
}

.game-message--error {
    border-color: rgba(231,76,60,0.4);
    color: #ff989e;
}

.game-message--warning {
    border-color: rgba(243,156,18,0.4);
    color: #ffe0a3;
}

/* ════════════════════════════════════════════════════════════════════════
   ELEMENTALS TAB
   ════════════════════════════════════════════════════════════════════════ */
.equipped-badge {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 8px;
    text-transform: uppercase;
}

/* ── Loading Overlay ───────────────────────────────────────────────────── */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 45%, #111a2e 0%, #070b10 65%, #020408 100%);
    transition: opacity 0.8s ease;
    overflow: hidden;
}
#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
#loading-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.07) 2px,
            rgba(0,0,0,0.07) 4px
        );
    pointer-events: none;
    z-index: 10;
}
#loading-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.75) 100%);
    pointer-events: none;
    z-index: 2;
}
#loading-stars {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}
.loading-tendrils {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
}
.tendril {
    position: absolute;
    border-radius: 50%;
}
.tendril-1 {
    width: 600px;
    height: 600px;
    background: conic-gradient(
        transparent 0deg,
        rgba(139,92,246,0.06) 40deg,
        rgba(99,102,241,0.12) 80deg,
        rgba(139,92,246,0.06) 120deg,
        transparent 160deg,
        transparent 200deg,
        rgba(56,189,248,0.07) 240deg,
        rgba(56,189,248,0.04) 280deg,
        transparent 320deg,
        transparent 360deg
    );
    animation: tendril-cw 22s linear infinite;
    filter: blur(18px);
}
.tendril-2 {
    width: 480px;
    height: 480px;
    background: conic-gradient(
        transparent 0deg,
        rgba(236,72,153,0.05) 60deg,
        rgba(168,85,247,0.1) 100deg,
        rgba(236,72,153,0.05) 150deg,
        transparent 200deg,
        rgba(251,191,36,0.05) 260deg,
        rgba(251,191,36,0.08) 300deg,
        transparent 340deg,
        transparent 360deg
    );
    animation: tendril-ccw 17s linear infinite;
    filter: blur(14px);
}
.tendril-3 {
    width: 720px;
    height: 720px;
    background: conic-gradient(
        transparent 0deg,
        rgba(52,211,153,0.04) 90deg,
        rgba(56,189,248,0.07) 130deg,
        rgba(52,211,153,0.03) 170deg,
        transparent 220deg,
        rgba(139,92,246,0.05) 300deg,
        rgba(139,92,246,0.08) 340deg,
        transparent 360deg
    );
    animation: tendril-cw 31s linear infinite;
    filter: blur(24px);
}
@keyframes tendril-cw  { to { transform: rotate(360deg);  } }
@keyframes tendril-ccw { to { transform: rotate(-360deg); } }
.loading-filigree {
    position: absolute;
    width: 120px;
    height: 120px;
    pointer-events: none;
    z-index: 9;
    animation: filigree-pulse 4s ease-in-out infinite;
    display: block !important;
}
.loading-filigree-tl { top: 0;    left: 0;                                                        }
.loading-filigree-tr { top: 0;    right: 0;  transform: scaleX(-1); transform-origin: right top;  }
.loading-filigree-bl { bottom: 0; left: 0;   transform: scaleY(-1); transform-origin: left bottom; }
.loading-filigree-br { bottom: 0; right: 0;  transform: scale(-1);  transform-origin: right bottom;}
@keyframes filigree-pulse {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 1;    }
}
.loading-rings {
    position: relative;
    width: 363px;
    height: 361px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.ring-layer {
    position: absolute;
    width: 363px;
    height: 361px;
    left: 0;
    top: 0;
}
.loading-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    opacity: 0;
}
.ring-ambient-glow { display: none; }
.ring-color-overlay { display: none; }
.outer-ring  { animation: spin-cw   18s linear infinite; transition: filter 2.4s ease, opacity 2.4s ease; filter: drop-shadow(0 0 32px var(--ring-color)) drop-shadow(0 0 80px var(--ring-color)); }
.middle-ring { animation: spin-ccw  13s linear infinite; transition: filter 2.4s ease, opacity 2.4s ease; filter: drop-shadow(0 0 28px var(--ring-color)) drop-shadow(0 0 64px var(--ring-color)); }
.inner-ring  { animation: spin-cw    9s linear infinite; transition: filter 2.4s ease, opacity 2.4s ease; filter: drop-shadow(0 0 22px var(--ring-color)) drop-shadow(0 0 48px var(--ring-color)); }
#loading-particles {
    position: absolute;
    inset: -120px;
    width: calc(100% + 240px);
    height: calc(100% + 240px);
    pointer-events: none;
    z-index: 6;
}
@keyframes spin-cw  { to { transform: rotate( 360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }
.loading-text {
    margin-top: 32px;
    position: relative;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 340px;
}
.loading-title-shimmer {
    font-family: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 10px;
    text-transform: uppercase;
    background: linear-gradient(
        90deg,
        rgba(180,150,255,0.5)  0%,
        rgba(140,100,255,0.5) 20%,
        rgba(255,255,255,0.95) 50%,
        rgba(140,100,255,0.5) 80%,
        rgba(180,150,255,0.5) 100%
    );
    background-size: 250% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer-sweep 3.5s linear infinite;
    filter: drop-shadow(0 0 8px rgba(168,130,255,0.6)) drop-shadow(0 0 20px rgba(139,92,246,0.35));
    white-space: nowrap;
    padding-right: 10px;
}
@keyframes shimmer-sweep {
    from { background-position: 250% center; }
    to   { background-position:   0% center; }
}
#loading-dots {
    display: inline-block;
    width: 1.6rem;
    text-align: left;
    font-family: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
    font-size: 1.35rem;
    letter-spacing: 4px;
    color: rgba(168,130,255,0.6);
    -webkit-text-fill-color: rgba(168,130,255,0.6);
    flex-shrink: 0;
}
.loading-text::before,
.loading-text::after {
    content: '⟡';
    font-size: 0.65rem;
    color: rgba(168,130,255,0.5);
    flex-shrink: 0;
    animation: rune-flicker 2.8s ease-in-out infinite;
}
.loading-text::after {
    animation-delay: 1.4s;
}
@keyframes rune-flicker {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50%       { opacity: 0.9; transform: scale(1.2); }
}

@media (max-width: 680px) {
    .loading-rings, .ring-layer, .loading-ring {
        width: min(363px, 85vw);
        height: min(361px, calc(85vw * 361 / 363));
    }
    .tendril-1 { width: 90vw;  height: 90vw;  }
    .tendril-2 { width: 72vw;  height: 72vw;  }
    .tendril-3 { width: 108vw; height: 108vw; }
    .loading-text { width: 280px; }
    .loading-title-shimmer { font-size: 1.1rem; letter-spacing: 7px; }
    .loading-filigree { width: 80px; height: 80px; }
}
@media (max-width: 480px) {
    .loading-rings, .ring-layer, .loading-ring {
        width: min(363px, 92vw);
        height: min(361px, calc(92vw * 361 / 363));
    }
    .loading-text { width: 240px; }
    .loading-title-shimmer { font-size: 0.95rem; letter-spacing: 5px; }
    .loading-filigree { width: 60px; height: 60px; }
}

/* Hide scrollbars on mobile only — scrolling is gesture-based on phones */
@media (max-width: 680px) {
html { scrollbar-width: none !important; -ms-overflow-style: none !important; }
html::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
body { scrollbar-width: none !important; -ms-overflow-style: none !important; overflow: auto; }
body::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
*::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
* { scrollbar-width: none !important; -ms-overflow-style: none !important; }
}
