/* Franchise faces, self-hosted woff2 (OFL) — §3 forbids CDN fonts. See #54.
   Licences: public/fonts/OFL-*.txt. Generated once, safe to hand-edit. */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/jetbrains-mono-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/jetbrains-mono-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Metamorphous';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/metamorphous-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Metamorphous';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/metamorphous-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/spectral-400-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/spectral-400-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/spectral-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/spectral-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/spectral-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/spectral-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #0e0e14;
    --surface: #1a1a26;
    --surface2: #22223a;
    --accent: #c8a227;
    --accent2: #8b5cf6;
    --danger: #e05252;
    --text: #e2e0f0;
    --muted: #7a7a99;
    --hp-green: #3ecf6a;
    --xp-blue: #3b82f6;
    --border: #2e2e48;
    /* §3 semantic split: display for voice, body for fiction, mono for anything
       a player counts. Shared by every theme — themes vary colour, not type. */
    --font-display: 'Metamorphous', Georgia, serif;
    --font-body: 'Spectral', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

    /* quality tier colors */
    --q-broken:   #555566;
    --q-worn:     #888899;
    --q-crude:    #aaaabb;
    --q-poor:     #ccccdd;
    --q-common:   #e2e0f0;
    --q-fine:     #22c55e;
    --q-superior: #3b82f6;
    --q-rare:     #a855f7;
    --q-epic:     #f97316;
    --q-legendary:#f59e0b;
    --q-mythic:   #e879f9;
    --q-ancient:  #34d399;
    --q-celestial:#67e8f9;
    --q-void:     #c084fc;
    --q-divine:   #fff;
}

.q-broken    { color: var(--q-broken);    }
.q-worn      { color: var(--q-worn);      }
.q-crude     { color: var(--q-crude);     }
.q-poor      { color: var(--q-poor);      }
.q-common    { color: var(--q-common);    }
.q-fine      { color: var(--q-fine);      }
.q-superior  { color: var(--q-superior);  }
.q-rare      { color: var(--q-rare);      }
.q-epic      { color: var(--q-epic);      }
.q-legendary { color: var(--q-legendary); }
.q-mythic    {
  color: var(--q-mythic);
  text-shadow: 0 0 4px rgba(232,121,249,0.6), 0 0 8px rgba(232,121,249,0.25);
}
.q-ancient   {
  color: var(--q-ancient);
  text-shadow: 0 0 5px rgba(52,211,153,0.75), 0 0 12px rgba(52,211,153,0.4), 0 0 20px rgba(52,211,153,0.15);
}
.q-celestial {
  color: var(--q-celestial);
  text-shadow: 0 0 6px rgba(103,232,249,0.85), 0 0 14px rgba(103,232,249,0.5), 0 0 24px rgba(103,232,249,0.2);
}
.q-void      {
  color: var(--q-void);
  text-shadow: 0 0 6px rgba(192,132,252,0.9), 0 0 14px rgba(192,132,252,0.6), 0 0 28px rgba(192,132,252,0.3), 0 0 42px rgba(192,132,252,0.1);
}
@keyframes divine-pulse {
  0%, 100% { text-shadow: 0 0 6px #fff, 0 0 14px #a78bfa, 0 0 26px #818cf8, 0 0 40px rgba(129,140,248,0.4); }
  50%       { text-shadow: 0 0 10px #fff, 0 0 22px #a78bfa, 0 0 40px #818cf8, 0 0 60px rgba(129,140,248,0.6); }
}
.q-divine    {
  color: var(--q-divine);
  font-weight: 600;
  animation: divine-pulse 2s ease-in-out infinite;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
button, select { touch-action: manipulation; }

/* Fantasy display font applied to all headers and key UI labels */
h1, h2, .stab-btn, .mobile-tab-btn span, #attack-btn, #skill-btn, .companion-skill-btn,
.class-btn, .prestige-buy-btn, .guild-buy-btn, button[data-action="prestige"],
button[data-action="venture"], #hard-reset-btn, #hard-reset-yes {
    font-family: var(--font-display), sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body), sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#session-conflict-banner {
    background: color-mix(in srgb, var(--danger) 15%, var(--surface));
    border-bottom: 1px solid var(--danger);
    color: var(--danger);
    font-size: 0.8rem;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
#session-conflict-banner .secondary-btn {
    font-size: 0.75rem;
    padding: 2px 10px;
    flex-shrink: 0;
}
.cloud-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.cloud-status {
    font-size: 0.8rem;
    margin-top: 4px;
    padding: 3px 6px;
    border-radius: 4px;
}
.cloud-status-ok  { color: var(--xp); }
.cloud-status-error { color: var(--danger); }
.small-btn {
    font-size: 0.75rem;
    padding: 2px 10px;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 55;
    overflow: visible;
}

#enemy-sticky {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 5px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

header.enemy-scrolled #enemy-sticky {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#enemy-sticky-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

#enemy-sticky-hp-wrap {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
    position: relative;
}

#enemy-sticky-hp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), #f87171);
    border-radius: 6px;
    transition: width 0.1s linear;
}

header h1 {
    font-size: 1.4rem;
    letter-spacing: 2px;
    color: var(--accent);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

#title-icon {
    height: 2em;
    width: 2em;
    object-fit: cover;
    border-radius: 4px;
    image-rendering: pixelated;
}

#stats-bar {
    display: flex;
    gap: 24px;
    font-size: 0.9rem;
    color: var(--muted);
    align-items: center;
}

#stats-bar span { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
#stats-bar > div { white-space: nowrap; }
#stat-gold { min-width: 6ch; display: inline-block; text-align: right; }

#stat-party-hp-wrap { display: none; }
#stat-party-dps-wrap { display: none; }
#stat-party-hp-wrap { color: var(--hp-green); }
#stat-party-dps-wrap { color: var(--muted); }
#stat-party-hp-wrap span { color: var(--hp-green); }
#stat-party-dps-wrap span { color: var(--accent2, #a78bfa); }

#action-btns { display: contents; }

/* ── Header Avatar ─────────────────────────────────────────────────────── */
#header-avatar-area {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
#header-avatar-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 10px 4px 4px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.15s;
}
#header-avatar-btn:hover { background: var(--surface2); }
.header-avatar-wrap {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.header-avatar-icon { line-height: 1; }
.header-avatar-label {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}
#profile-picker-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    z-index: 200;
    min-width: 260px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pdd-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}
.pdd-stats {
    display: flex;
    gap: 0;
    padding: 6px 8px 2px;
}
.pdd-stats-col {
    flex: 1;
    min-width: 0;
}
.pdd-section-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 5px;
}
.pdd-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.72rem;
    line-height: 1.7;
}
.pdd-key { color: var(--muted); }
.pdd-val { color: var(--text); font-weight: 600; text-align: right; }
.pdd-detail-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: right;
    padding: 2px 10px 6px;
    cursor: pointer;
    align-self: flex-end;
}
.pdd-detail-btn:hover { color: var(--accent); }
.profile-menu-item {
    background: none;
    border: none;
    color: var(--text);
    text-align: left;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    width: 100%;
    transition: background 0.1s;
}
.profile-menu-item:hover { background: rgba(255,255,255,0.08); }

#settings-open-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 1.1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
#settings-open-btn:hover { color: var(--text); border-color: var(--muted); }

/* ── Settings modal ── */
#settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.88);
    align-items: center;
    justify-content: center;
    z-index: 300;
}
#settings-modal.open { display: flex; }
#settings-modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: min(600px, 95vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#settings-modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
#settings-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
#settings-modal-close:hover { color: var(--text); }
#settings-modal-body {
    overflow-y: auto;
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 1280px) {
    #settings-modal-box {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

/* ── Customize modal ── */
#customize-modal, #about-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.88);
    align-items: center;
    justify-content: center;
    z-index: 300;
}
#customize-modal.open, #about-modal.open { display: flex; }
#customize-modal-box, #about-modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: min(600px, 95vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#customize-modal-header, #about-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#customize-modal-header h2, #about-modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
#customize-modal-close, #about-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
#customize-modal-close:hover, #about-modal-close:hover { color: var(--text); }
#customize-modal-body, #about-modal-body {
    overflow-y: auto;
    padding: 16px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#prestige-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #92620e);
    color: #1a1005;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: opacity 0.15s;
    white-space: nowrap;
}
#prestige-btn:hover:not(:disabled) { opacity: 0.85; }
#prestige-btn:disabled { opacity: 0.3; cursor: not-allowed; }

main {
    flex: 1;
    display: grid;
    grid-template-columns: 48px 1fr 280px;
    grid-template-rows: 1fr;
    gap: 16px;
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    align-items: start;
}

/* left column */
#left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#left-col-panels {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

/* ── Enemy panel ── */
#enemy-panel {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 0 12px 3px transparent;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

#enemy-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#party-panel {
    width: 100%;
}

/* ── Boss portrait panel ──────────────────────────────────────────────── */
#monster-portrait-wrap {
    width: 130px;
    flex-shrink: 0;
    align-self: flex-start;
}

/* Fixed-size inner so absolutely-positioned images have a real containing block */
#portrait-inner {
    position: relative;
    width: 130px;
    height: 200px;
    transform-origin: center center;
    visibility: hidden;
}

#monster-portrait-wrap.boss-visible #portrait-inner,
#monster-portrait-wrap.boss-exiting #portrait-inner {
    visibility: visible;
}

#monster-portrait {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    object-fit: cover;
    object-position: center 20%;
    image-rendering: pixelated;
    border-radius: 4px;
}

#monster-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    image-rendering: pixelated;
    pointer-events: none;
}
@keyframes border-enrage-pulse {
    0%, 100% { filter: drop-shadow(0 0 5px var(--bgc)) drop-shadow(0 0 12px var(--bgc-dim)); }
    50%       { filter: drop-shadow(0 0 10px var(--bgc)) drop-shadow(0 0 22px var(--bgc)) drop-shadow(0 0 3px #ffffff88); }
}
#portrait-inner.enraged #monster-border[src*="abyssal"] { --bgc:#a855f7; --bgc-dim:#a855f788; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="ancient"] { --bgc:#9ca3af; --bgc-dim:#9ca3af88; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="dread"]   { --bgc:#dc2626; --bgc-dim:#dc262688; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="eternal"] { --bgc:#f59e0b; --bgc-dim:#f59e0b88; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="forsaken"]{ --bgc:#e2e8f0; --bgc-dim:#e2e8f088; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="infernal"]{ --bgc:#f97316; --bgc-dim:#f9731688; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="ravager"] { --bgc:#b45309; --bgc-dim:#b4530988; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="shadow"]  { --bgc:#94a3b8; --bgc-dim:#94a3b888; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="titan"]   { --bgc:#38bdf8; --bgc-dim:#38bdf888; animation:border-enrage-pulse 2s ease-in-out infinite; }
#portrait-inner.enraged #monster-border[src*="undying"] { --bgc:#4ade80; --bgc-dim:#4ade8088; animation:border-enrage-pulse 2s ease-in-out infinite; }

/* Slide in from the left (depth gauge side) */
@keyframes bossPortraitIn {
    0%   { transform: translateX(-20px) scale(0.88); opacity: 0; }
    55%  { opacity: 1; }
    75%  { transform: translateX(3px) scale(1.02); }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}

/* Collapse to a centre point */
@keyframes bossPortraitOut {
    0%   { transform: scale(1);    opacity: 1; }
    25%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(0);    opacity: 0; }
}

#monster-portrait-wrap.boss-entering #portrait-inner {
    animation: bossPortraitIn 0.55s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#monster-portrait-wrap.boss-exiting #portrait-inner {
    animation: bossPortraitOut 0.38s ease-in forwards;
}


#enemy-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

#enemy-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#enemy-level {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ── Enrage bar ── */
#enemy-enrage-bar-wrap {
    background: var(--surface2);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #b45309;
    position: relative;
    visibility: hidden;
    transition: border-color 0.4s;
}
#enemy-enrage-bar-wrap.active {
    visibility: visible;
}
#enemy-enrage-bar-wrap.enraged {
    animation: enragePulse 0.7s ease-in-out infinite alternate;
}
#enemy-enrage-bar {
    height: 14px;
    background: linear-gradient(90deg, #b45309, #f59e0b);
    transition: width 0.2s linear, background 0.4s;
    border-radius: 3px 3px 0 0;
}
#enemy-enrage-layers {
    display: flex;
    flex-direction: column;
}
.enrage-layer {
    height: 5px;
    width: 100%;
    margin-top: 1px;
}
#enemy-enrage-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    letter-spacing: 0.05em;
    pointer-events: none;
}
@keyframes enragePulse {
    from { box-shadow: 0 0 4px 1px rgba(239,68,68,0.4); }
    to   { box-shadow: 0 0 10px 3px rgba(239,68,68,0.75); }
}
#portrait-inner.enraged {
    animation: enragePortraitGlow 0.7s ease-in-out infinite alternate;
}
@keyframes enragePortraitGlow {
    from { filter: brightness(1); }
    to   { filter: brightness(1.15) saturate(1.3); }
}

.hp-bar-wrap {
    background: var(--surface2);
    border-radius: 6px;
    height: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

#enemy-hp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), #f87171);
    transition: width 0.1s linear;
    border-radius: 6px;
}

#enemy-hp-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
}

/* ── Attack button ── */
#attack-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

#attack-btn {
    flex: 1;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.08s, box-shadow 0.08s;
    box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}

#attack-btn:active { transform: scale(0.96); box-shadow: none; }
#attack-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#auto-attack-btn {
    padding: 8px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
#auto-attack-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#auto-attack-btn.active {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16,185,129,0.5);
    animation: autoAttackPulse 1s ease-in-out infinite;
}
@keyframes autoAttackPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(16,185,129,0.4); }
    50%       { box-shadow: 0 0 14px rgba(16,185,129,0.75); }
}

/* ── Party panel ── */
#party-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

#party-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

#party-panel-header h2 {
    margin-bottom: 0;
}

#party-panel-tabs {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.ptab-btn {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ptab-btn:hover { background: var(--border); color: var(--text); }
.ptab-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

#party-panel h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#party-gear-toggle {
    font-size: 0.8rem;
    opacity: 0.55;
    padding: 1px 5px;
    border-radius: 4px;
    transition: opacity 0.15s;
}
#party-gear-toggle:hover { opacity: 1; }
#party-gear-toggle.active { opacity: 1; color: var(--accent); }

#party-panel.gear-hidden .gear-pdoll-grid {
    display: none;
}

/* When gear is visible: hide artifact row from header — rune squares always shown */
#party-panel:not(.gear-hidden) .char-artifact-row {
    display: none;
}

#party-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.char-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    transition: opacity 0.3s, filter 0.3s;
    display: grid;
    grid-template-columns: 84px 1fr 90px;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 6px;
    align-items: start;
}

.char-card.is-dead {
    opacity: 0.45;
    filter: grayscale(0.85);
    border-color: var(--danger);
    position: relative;
}

.char-card.is-dead .char-dps::before {
    content: "💀 ";
}

.hero-sprite {
    grid-column: 1;
    grid-row: 1;
    width: 84px;
    height: 84px;
    object-fit: cover;
    image-rendering: pixelated;
    border-radius: 4px;
    align-self: center;
    cursor: help;
}

.char-name { font-weight: 700; margin-bottom: 2px; }
.char-class { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.char-level { font-size: 0.72rem; color: var(--border); font-weight: 400; }

.char-header {
    display: contents;
}

.char-header-left {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    align-self: center;
}

.char-dps { font-size: 0.95rem; color: var(--accent); font-weight: 700; cursor: help; }

.guild-preview {
    font-size: 0.68rem;
    color: var(--accent2);
    margin-top: 2px;
    font-style: italic;
}

.char-bars {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: center;
}
.char-bars .hp-section,
.char-bars .xp-section { margin-top: 0; }
.char-bars .hp-bar-header,
.char-bars .xp-header { display: none; }

.char-gear {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 0;
}
.char-set-bonuses {
    grid-column: 1 / -1;
    grid-row: 3;
}

.gear-row {
    display: grid;
    grid-template-columns: 18px 1fr auto auto auto;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    padding: 2px 0;
    border-bottom: 1px solid var(--border);
}

.gear-row:last-child { border-bottom: none; }

.gear-row.slot-highlight {
  background: rgba(200, 162, 39, 0.15);
  box-shadow: inset 0 0 0 1px var(--accent);
  border-radius: 3px;
}

@keyframes slot-replaced {
  0%,  15% { background: rgba(200, 162, 39, 0.45); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 3px; }
  25%, 40% { background: transparent; box-shadow: none; }
  50%, 62% { background: rgba(200, 162, 39, 0.35); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 3px; }
  72%, 82% { background: transparent; box-shadow: none; }
  88%, 96% { background: rgba(200, 162, 39, 0.20); box-shadow: inset 0 0 0 1px var(--accent); border-radius: 3px; }
  100%     { background: transparent; box-shadow: none; }
}

.gear-row.slot-flash,
.gear-pdoll-slot.slot-flash {
  animation: slot-replaced 2s ease-out forwards;
}

.char-abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0 2px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  grid-column: 1 / -1;
}

.char-rune-row {
  display: flex;
  gap: 4px;
  margin: 3px 0 0;
}
.tt-rune-slot[data-rune] { cursor: help; }

.char-artifact-row {
  display: flex;
  gap: 4px;
  margin: 3px 0 0;
}
.char-artifact-badge {
  font-size: 0.8rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: default;
}
.char-artifact-badge.empty {
  color: var(--border);
  border-color: var(--border);
  font-size: 0.65rem;
  padding: 2px 5px;
}
.char-artifact-badge.filled {
  background: rgba(167,139,250,0.12);
  border-color: #a78bfa55;
}
.char-artifact-badge.filled.upgraded {
  background: rgba(251,191,36,0.12);
  border-color: #fbbf2455;
}

.ability-badge {
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
  cursor: default;
  position: relative;
}

.ability-badge.unlocked {
  background: color-mix(in srgb, var(--accent2) 20%, var(--surface));
  color: var(--accent2);
  border: 1px solid var(--accent2);
  font-weight: 600;
}

.ability-badge.locked {
  background: transparent;
  color: var(--border);
  border: 1px solid var(--border);
}

/* Tap-to-reveal tooltip — works on desktop hover and mobile tap (via :focus) */
.ability-badge[data-tip]:hover::after,
.ability-badge[data-tip]:focus::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.ability-badge:focus { outline: none; }

.gear-icon { text-align: center; }

.gear-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-bonus { font-weight: 600; white-space: nowrap; }

.gear-unequip-btn {
    padding: 0 3px;
    font-size: 0.65rem;
    line-height: 1.4;
    background: transparent;
    color: var(--border);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}

.gear-unequip-btn:hover { opacity: 1; color: var(--enemy-red); border-color: var(--enemy-red); }

.gear-row.empty .gear-slot-label { color: var(--border); font-style: italic; }

.gear-row-equip {
    grid-template-columns: 18px 1fr auto auto;
}

.gear-loot-select {
    font-size: 0.68rem;
    padding: 1px 2px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gear-equip-from-slot-btn {
    font-size: 0.68rem;
    padding: 2px 6px;
    background: var(--accent-dark, #3a3000);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.hp-section {
    margin-top: 8px;
}

.hp-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.hp-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--hp-green);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hp-numbers {
    font-size: 0.75rem;
    color: var(--muted);
}

.hp-numbers.hp-low { color: var(--danger); font-weight: 700; }

.player-hp-bar-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.player-hp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hp-green), #86efac);
    border-radius: 6px;
    transition: width 0.15s linear;
}

.player-hp-bar.hp-bar-low {
    background: linear-gradient(90deg, var(--danger), #f87171);
    animation: hp-pulse 0.8s ease-in-out infinite;
}

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

.xp-section {
    margin-top: 10px;
}

.xp-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.xp-level-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--xp-blue);
}

.xp-numbers {
    font-size: 0.75rem;
    color: var(--muted);
}

.xp-bar-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 14px;
    overflow: hidden;
    position: relative;
}

.xp-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--xp-blue), #60a5fa);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.xp-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    pointer-events: none;
}

@keyframes levelup {
    0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.7); }
    50%  { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
    100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}

.levelup-flash { animation: levelup 0.6s ease-out; }

/* ── Right sidebar ── */
#sidebar {
    grid-column: 3;
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
}

/* ── Sidebar tab strip ── */
#sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.stab-btn {
    flex: 1;
    padding: 9px 2px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.stab-btn:hover { color: var(--text); }

.stab-btn.active {
    color: var(--accent2);
    border-bottom-color: var(--accent2);
}

.stab-badge {
    position: absolute;
    top: 7px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: var(--danger);
    border-radius: 50%;
}

/* ── Loot sub-tabs ── */
#loot-subtab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin: -16px -16px 14px;
    padding: 0 4px;
}
.loot-stab {
    flex: 1;
    padding: 7px 4px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.loot-stab:hover { color: var(--text); }
.loot-stab.active { color: var(--accent2); border-bottom-color: var(--accent2); }
.loot-stab-count { font-size: 0.65em; color: var(--muted); margin-left: 2px; }
.loot-stab.active .loot-stab-count { color: var(--accent2); }
.loot-stab-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

#loot-runes-sub, #loot-artifacts-sub { padding-top: 4px; }

/* ── Sidebar panels shared ── */
#loot-panel, #upgrades-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

/* Desktop: panels live inside the sidebar card — no individual borders */
@media (min-width: 1281px) {
    #upgrades-panel, #loot-panel, #prestige-panel, #guild-hall-panel, #feats-panel, #log-panel {
        display: none;
        background: none;
        border: none;
        border-radius: 0;
    }
    .stab-visible {
        display: flex !important;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
}

#loot-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

#loot-header-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

#loot-header-top h2 { margin-bottom: 0; flex-shrink: 0; }

#loot-header-actions {
    display: flex;
    gap: 6px;
}

#loot-header-actions .equip-all-btn,
#loot-header-actions .sell-all-btn { flex: 1; }

.equip-all-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--hp-green);
    border: 1px solid var(--hp-green);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.equip-all-btn:hover:not(:disabled) { background: var(--hp-green); color: #0e0e14; }
.equip-all-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.sell-all-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.sell-all-btn:hover:not(:disabled) { background: var(--accent); color: #0e0e14; }
.sell-all-btn:disabled { opacity: 0.3; cursor: not-allowed; }

#loot-panel h2, #upgrades-panel h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

#loot-count { color: var(--accent2); font-weight: 600; }

/* ── Loot ── */
.loot-empty { font-size: 0.8rem; color: var(--border); font-style: italic; }

#loot-items {
    min-height: 340px;
    max-height: 340px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 2px;
}

.loot-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.loot-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
}

.loot-body {
    display: flex;
    align-items: center;
    gap: 6px;
}

.loot-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.loot-slot-badge {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent2);
    flex-shrink: 0;
}

.loot-name {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
}

.loot-dmg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    flex: 1;
    min-width: 0;
}
.loot-stat { white-space: nowrap; }
.ind-up   { color: #4ade80; }
.ind-down { color: var(--danger); }

.equip-btn, .sell-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.1s;
}

.equip-btn { background: var(--accent2); color: #fff; }
.sell-btn  { background: var(--accent);  color: #1a1005; }
.equip-btn:hover, .sell-btn:hover { opacity: 0.8; }
.stash-loot-btn {
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    transition: opacity 0.1s;
}
.stash-loot-btn:hover:not(:disabled) { border-color: var(--accent2); }
.stash-loot-btn:disabled { opacity: 0.3; cursor: default; }

/* ── Upgrades ── */
.upgrade-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.upgrade-char-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.upgrade-row {
    display: grid;
    grid-template-columns: 16px 1fr auto auto;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
}

.upgrade-icon { font-size: 0.85rem; text-align: center; }
.upgrade-label { font-size: 0.76rem; color: var(--text); }
.upgrade-level { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 0.7rem; color: var(--muted); white-space: nowrap; }
.upgrade-bonus { font-size: 0.65rem; color: var(--accent); }

.upgrade-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.upgrade-btn:hover:not(:disabled) { background: var(--accent); color: #1a1005; }
.upgrade-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Mobile upgrade grid (hidden on desktop) ── */
#upgrade-grid { display: none; }

@media (max-width: 1280px) {
    #upgrade-cards { display: none; }
    #upgrade-grid {
        display: grid;
        gap: 3px;
        width: 100%;
    }
    .ug-corner { /* top-left empty cell */ }
    .ug-char-header {
        font-size: 0.62rem;
        font-weight: 700;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: center;
        padding: 4px 2px 3px;
        border-bottom: 1px solid var(--border);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .ug-stat-label {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.68rem;
        color: var(--muted);
        padding: 2px 4px 2px 0;
        white-space: nowrap;
    }
    .ug-btn {
        padding: 6px 2px;
        font-size: 0.68rem;
        font-weight: 700;
        width: 100%;
        border-radius: 4px;
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }
    .ug-btn-meta {
        font-size: 0.58rem;
        font-weight: 400;
        color: var(--muted);
        line-height: 1;
    }
    .ug-empty {
        background: none;
        border: none;
    }
    .ug-empty-header {
        /* placeholder column when chunk has fewer than 3 chars */
    }
    .ug-group-divider {
        height: 10px;
    }
}

/* ── Combat log ── */
#log-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    flex: 1;
    overflow: hidden;
}

#log-panel h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 10px;
}

#combat-log { font-size: 0.82rem; line-height: 1.7; }

.log-line { color: var(--muted); border-bottom: 1px solid var(--border); padding: 2px 0; }
.log-line:first-child { color: var(--text); }

/* ── Character creation overlay ── */
#creation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

#creation-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 36px;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#creation-box h2 {
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    text-align: center;
}

#save-section, #new-game-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#continue-info {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
}

#continue-btn {
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--hp-green), #16a34a);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.1s;
}

#continue-btn:hover { opacity: 0.85; }

.secondary-btn {
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
}

.secondary-btn:hover { color: var(--text); border-color: var(--muted); }

.danger-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.danger-btn:hover { background: var(--danger); color: #fff; }

/* settings-panel no longer exists in sidebar — rules kept for safety */

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.settings-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.settings-desc {
    font-size: 0.75rem;
    color: var(--muted);
}

.about-row { border-color: var(--accent); border-style: dashed; }
.credits-row { border-color: var(--accent2); border-style: dashed; }

.credits-list { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.credit-entry {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}
.credit-entry:last-child { border-bottom: none; }
.credit-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}
.credit-role {
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
    text-align: right;
}

.about-text {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.settings-warn {
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 600;
}

#hard-reset-confirm {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

#creation-box label, #class-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

#char-name-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    padding: 8px 12px;
    outline: none;
    width: 100%;
}

#char-name-input:focus { border-color: var(--accent); }

.creation-divider {
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
    margin: 4px 0;
}

.google-signin-btn {
    width: 100%;
    padding: 10px;
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.google-signin-btn:hover { opacity: 0.88; }

#class-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

#party-class-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#party-class-picker .class-btn { flex: 1 1 calc(33% - 8px); }

.class-btn {
    padding: 8px 4px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface2);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.1s, color 0.1s;
}

.class-btn.selected {
    border-color: var(--accent2);
    color: var(--text);
    background: color-mix(in srgb, var(--accent2) 15%, var(--surface2));
}

.class-btn:hover:not(.selected) { border-color: var(--muted); color: var(--text); }

#class-desc {
    font-size: 0.78rem;
    color: var(--muted);
    min-height: 1.2em;
    text-align: center;
}

#start-btn {
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.1s;
}

#start-btn:hover { opacity: 0.85; }

/* ── Floor progress (monsters left) ── */
#floor-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#monsters-left-text {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
    letter-spacing: 0.5px;
    height: 1.4rem;
    line-height: 1.4rem;
    overflow: hidden;
}

#floor-pip-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.floor-pip {
    width: 14px;
    height: 8px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--surface2);
    transition: background 0.2s;
}

.floor-pip.done {
    background: var(--danger);
    border-color: var(--danger);
}

.floor-pip.boss-pip {
    width: auto;
    padding: 0 4px;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: boss-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes boss-pulse {
    from { opacity: 0.7; transform: scale(0.95); }
    to   { opacity: 1.0; transform: scale(1.05); }
}

.boss-text {
    color: var(--accent) !important;
    font-weight: 700;
    letter-spacing: 2px;
    animation: boss-pulse 0.8s ease-in-out infinite alternate;
}

.elite-text {
    color: #a78bfa;
    font-weight: 700;
    letter-spacing: 1px;
    animation: elite-pulse 1s ease-in-out infinite alternate;
}

@keyframes elite-pulse {
    from { opacity: 0.75; }
    to   { opacity: 1; text-shadow: 0 0 8px #a78bfa; }
}

#enemy-panel.elite-enemy {
    box-shadow: 0 0 12px 3px rgba(167, 139, 250, 0.45);
    border-color: #a78bfa !important;
}

#enemy-panel.elite-enemy #enemy-name {
    color: #a78bfa;
}

#enemy-panel.boss-enemy {
    box-shadow: 0 0 12px 3px rgba(239, 68, 68, 0.45);
    border-color: #ef4444 !important;
}

#enemy-panel.boss-enemy #enemy-name {
    color: #ef4444;
}

#portrait-inner.elite-portrait-frame {
    box-shadow: 0 0 0 5px #a78bfa, 0 0 20px 6px rgba(167, 139, 250, 0.55);
    border-radius: 4px;
}


/* ── Depth gauge ── */
#depth-gauge {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
}

#depth-title {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
}

#depth-label-top, #depth-label-bottom {
    font-size: 0.65rem;
    color: var(--muted);
    white-space: nowrap;
    text-align: center;
}

#depth-track {
    width: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    position: relative;
    min-height: 160px;
    transition: height 0.6s ease;
}

#depth-fill {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    background: rgba(139, 92, 246, 0.25);
    border-radius: 7px 7px 3px 3px;
    transition: height 0.4s ease;
    z-index: 0;
}

.depth-tick {
    position: absolute;
    left: -1px;
    right: -1px;
    height: 1px;
    background: var(--border);
    opacity: 0.6;
}

.depth-tick.checkpoint-tick {
    background: var(--accent);
    opacity: 0.7;
    height: 2px;
}

.depth-tick-label {
    position: absolute;
    right: calc(100% + 3px);
    top: -5px;
    font-size: 0.5rem;
    color: var(--muted);
    white-space: nowrap;
    line-height: 1;
}

.depth-tick.checkpoint-tick .depth-tick-label {
    color: var(--accent);
    font-weight: 700;
}

.depth-death-marker {
    position: absolute;
    left: -1px;
    right: -1px;
    height: 2px;
    background: var(--danger);
    border-radius: 2px;
    z-index: 1;
    opacity: 0.7;
}

.depth-death-label {
    position: absolute;
    left: 18px;
    top: -8px;
    font-size: 0.6rem;
    color: var(--danger);
    white-space: nowrap;
}

#depth-checkpoint-marker {
    position: absolute;
    left: -1px;
    right: -1px;
    height: 3px;
    background: var(--accent);
    border-radius: 4px;
    transition: top 0.4s ease;
    z-index: 1;
    opacity: 0.6;
}

#depth-checkpoint-label {
    position: absolute;
    left: 18px;
    top: -9px;
    font-size: 0.65rem;
    color: var(--accent);
    white-space: nowrap;
}

#depth-highest-marker {
    position: absolute;
    left: -1px;
    right: -1px;
    height: 4px;
    background: var(--accent);
    border-radius: 4px;
    transition: top 0.4s ease;
    z-index: 1;
}

#depth-highest-label {
    position: absolute;
    right: 20px;
    top: -8px;
    font-size: 0.6rem;
    color: var(--accent);
    white-space: nowrap;
    font-weight: 700;
}

#depth-current-marker {
    position: absolute;
    left: -1px;
    right: -1px;
    height: 10px;
    background: var(--accent2);
    border-radius: 6px;
    transition: top 0.4s ease;
    z-index: 2;
    box-shadow: 0 0 6px rgba(139,92,246,0.6);
}

#depth-current-label {
    position: absolute;
    left: 20px;
    top: -7px;
    font-size: 0.65rem;
    color: var(--accent2);
    white-space: nowrap;
    font-weight: 700;
}

/* ── Stats bar additions ── */
#stat-deaths { color: var(--danger) !important; }
#stat-best   { color: var(--accent) !important; }

#mobile-tabs { display: none; }
#mobile-party-hp-bar { display: none; }

/* Combat sub-tab bar — only used on mobile; JS shows/hides via style.display */
#combat-subtabs {
    display: none;
}

@media (max-width: 1280px) {
    #settings-open-btn { display: none; }

    body {
        height: 100dvh;
        min-height: unset;
        overflow: hidden;
    }

    main {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
        padding-left: 56px; /* 44px gauge + 12px gap */
        padding-bottom: calc(96px + var(--enemy-panel-h, 149px)); /* tracks live enemy panel height */
        overflow-y: auto;
    }

    #left-col        { display: contents; }
    #left-col-panels { display: contents; }
    #party-panel     { width: auto; }

    #monster-portrait-wrap { width: 60px; flex-shrink: 0; }
    #portrait-inner { width: 60px; height: 92px; }
    #sidebar   { display: contents; background: none; border: none; border-radius: 0; }
    #sidebar-tabs { display: none; }

    #depth-gauge {
        display: flex;
        position: fixed;
        left: 0;
        top: 0;
        height: 100dvh;
        width: 44px;
        flex-direction: column;
        align-items: center;
        /* top/bottom padding tracks live header + enemy panel heights via JS ResizeObserver */
        padding: var(--header-h, 148px) 4px calc(96px + var(--enemy-panel-h, 149px));
        gap: 4px;
        background: var(--surface);
        border-right: 1px solid var(--border);
        z-index: 45;
    }

    #depth-gauge #depth-track {
        flex: 1;
        min-height: unset;
    }

    #depth-gauge #depth-title { display: none; }

    #enemy-panel {
        display: flex !important;
        position: fixed;
        bottom: 96px; /* sit above party hp bar (60px tab + 36px hp bar) */
        left: 0; right: 0;
        z-index: 50;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-top: 1px solid var(--border);
        padding: 7px 10px;
        gap: 4px;
    }
    #enemy-content { gap: 3px; }

    #mobile-party-hp-bar {
        display: flex;
        position: fixed;
        bottom: 60px;
        left: 0; right: 0;
        height: 36px;
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 51;
        align-items: center;
        overflow: hidden;
    }
    #mobile-party-hp-fill {
        position: absolute;
        top: 0; bottom: 0; left: 0;
        background: linear-gradient(90deg, var(--hp-green), #86efac);
        opacity: 0.35;
        transition: width 0.15s linear;
    }
    #mobile-party-hp-text {
        position: relative;
        z-index: 1;
        padding: 0 12px;
        font-size: 0.82rem;
        font-weight: 600;
        color: var(--hp-green);
    }
    #mobile-party-hp-bar.hp-low #mobile-party-hp-fill {
        background: linear-gradient(90deg, var(--danger), #f87171);
    }
    #mobile-party-hp-bar.hp-low #mobile-party-hp-text {
        color: var(--danger);
    }

    #party-panel,
    #constellation-panel,
    #upgrades-panel,
    #loot-panel,
    #prestige-panel,
    #guild-hall-panel,
    #feats-panel,
    #log-panel { display: none; }

    .tab-visible { display: flex !important; flex-direction: column; width: 100%; }

    header { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
    header h1 { font-size: 1.1rem; order: 1; }
    #header-avatar-area { order: 2; margin-left: auto; }
    #stats-bar { order: 3; width: 100%; flex-wrap: wrap; gap: 10px; font-size: 0.8rem; }

    /* Avatar sized to match h1 icon (2em × 1.1rem = 2.2rem) */
    .header-avatar-wrap { width: 2.2rem; height: 2.2rem; font-size: 1.6rem; }
    .header-avatar-label { display: none; }
    #header-avatar-btn { padding: 0; border-radius: 50%; border-color: transparent; }
    #stat-party-dps-wrap { display: flex; }
    /* HP is shown in the bottom bar on mobile — hide the redundant header version */
    #stat-party-hp-wrap { display: none; }
    /* Settings has a dedicated nav tab on mobile — hide it from the profile dropdown */
    .profile-menu-item[data-action="open-settings-modal"] { display: none; }

    /* Keep prestige+venture on one stable row so HP changes don't shift them */
    #action-btns {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    #action-btns #prestige-btn,
    #action-btns #venture-btn {
        flex: 1;
        text-align: center;
    }

    #creation-box { width: min(340px, 92vw); }

    #party-cards { grid-template-columns: 1fr; }

    /* Mobile char-card: tighter columns than desktop */
    .char-card {
        grid-template-columns: 52px 1fr 72px;
        column-gap: 8px;
        row-gap: 4px;
    }
    .hero-sprite {
        width: 52px;
        height: 52px;
    }

    .loot-item { gap: 8px; }

    footer { display: none; }

    #enemy-name  { font-size: 0.85rem; }
    #enemy-level { font-size: 0.68rem; }
    .hp-bar-wrap { height: 14px; }
    #enemy-hp-text { font-size: 0.62rem; }
    #floor-progress {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px 6px;
    }
    #monsters-left-text { font-size: 0.64rem; flex: 0 0 auto; text-align: left; height: 1.2rem; line-height: 1.2rem; }
    #floor-pip-row { flex: 1; justify-content: center; gap: 2px; }
    .floor-pip { width: 7px; height: 4px; }
    #checkpoint-display { display: none; }
    #attack-btn { padding: 6px 10px; font-size: 0.9rem; margin-top: 0; }
    #attack-row { margin-top: 0; gap: 5px; }

    #party-panel { order: 1; }
    #loot-panel  { order: 2; }

    #prestige-panel.prestige-locked  { display: none !important; }
    #guild-hall-panel.guild-locked   { display: none !important; }

    /* Let panels expand to full content height so main's scroll handles the whole shop tab.
       flex-shrink:0 prevents the flex algorithm from capping panel heights.
       !important needed because global panel rules are declared after this block. */
    #upgrades-panel,
    #prestige-panel,
    #guild-hall-panel {
        overflow-y: visible !important;
        max-height: none !important;
        flex-shrink: 0;
        height: auto;
    }

    /* Combat sub-tab bar */
    #combat-subtabs {
        position: sticky;
        top: 0;
        z-index: 40;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        border-radius: 8px 8px 0 0;
        margin-bottom: 8px;
        flex-shrink: 0;
    }
    .combat-stab {
        flex: 1;
        padding: 9px 0;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--muted);
        font-size: 0.82rem;
        letter-spacing: 0.3px;
        cursor: pointer;
        transition: color 0.15s, border-color 0.15s;
    }
    .combat-stab.active {
        color: var(--accent2);
        border-bottom-color: var(--accent2);
    }
    /* Hide inactive panel based on combat sub-tab selection */
    main[data-combat-sub="party"] #loot-panel.tab-visible { display: none !important; }
    main[data-combat-sub="equipment"] #party-panel.tab-visible { display: none !important; }

    #mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 100;
        height: 60px;
    }

    .mobile-tab-btn {
        flex: 1;
        padding: 8px 4px;
        background: none;
        border: none;
        border-top: 3px solid transparent;
        color: var(--muted);
        font-size: 1rem;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        transition: color 0.15s, border-color 0.15s;
    }

    .mobile-tab-btn span:not(.tab-badge) {
        font-size: 0.6rem;
        letter-spacing: 0.2px;
    }

    .mobile-tab-btn.active {
        color: var(--accent2);
        border-top-color: var(--accent2);
    }

    .mobile-tab-btn { position: relative; }

    .tab-badge {
        position: absolute;
        top: 6px;
        right: calc(50% - 18px);
        width: 8px;
        height: 8px;
        background: var(--danger);
        border-radius: 50%;
        border: 1px solid var(--bg);
        animation: badge-pulse 1.5s ease-in-out infinite;
    }

    @keyframes badge-pulse {
        0%, 100% { opacity: 1; transform: scale(1); }
        50%       { opacity: 0.7; transform: scale(1.3); }
    }
}

/* ── Prestige panel ── */
#prestige-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    overflow-y: auto;
}

#prestige-panel h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 10px;
}

#prestige-points-display {
    color: var(--accent);
    font-weight: 700;
}

.prestige-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.prestige-item-meta { flex: 1; min-width: 0; }
.prestige-item-name { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.prestige-item-desc { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.shop-current-stat { font-size: 0.68rem; color: var(--hp-green); margin-top: 2px; }

.prestige-buy-btn {
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
    flex-shrink: 0;
}
.prestige-buy-btn:hover:not(:disabled) { background: var(--accent); color: #1a1005; }
.prestige-buy-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.prestige-buy-btn.auto-prestige-active { background: var(--accent); color: #1a1005; }
.prestige-auto-card .prestige-item-meta { flex: 1; }
.prestige-auto-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.prestige-auto-threshold { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; font-size: 0.72rem; }

/* Eternal Cycle settings row at top of prestige shop */
.prestige-setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
.prestige-setting-label { font-size: 0.8rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.prestige-setting-desc { font-size: 0.72rem; color: var(--muted); flex: 1; min-width: 120px; }

/* ── Venture button ── */
#venture-btn {
    padding: 5px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent2, #a78bfa);
    border: 1px solid var(--accent2, #a78bfa);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}
#venture-btn:hover:not(:disabled) { background: var(--accent2, #a78bfa); color: #1a1005; }
#venture-btn:disabled { opacity: 0.3; cursor: not-allowed; }

#stat-idle-gold { color: var(--accent2, #a78bfa); font-weight: 600; }
#stat-corruption { color: #f87171; font-weight: 700; animation: corruption-pulse 2s ease-in-out infinite; }
@keyframes corruption-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
#stat-party-gold-bonus { color: #fcd34d; font-weight: 600; font-size: 0.8em; }

/* ── Guild Hall panel ── */
#guild-hall-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    overflow-y: auto;
}

#guild-hall-panel h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 10px;
}

/* Guild hall reuses .prestige-item / .prestige-item-meta / .prestige-item-name / .prestige-item-desc */
.guild-buy-btn {
    padding: 6px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent2, #a78bfa);
    border: 1px solid var(--accent2, #a78bfa);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
    flex-shrink: 0;
}
.guild-buy-btn:hover:not(:disabled) { background: var(--accent2, #a78bfa); color: #1a1005; }
.guild-buy-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.guild-prereq-locked { opacity: 0.55; }
.guild-prereq-notice { font-size: 0.65rem; color: var(--danger); margin-top: 3px; font-style: italic; }

/* ── Feats panel ── */
#feats-panel { overflow-y: auto; }

/* ── Filter tabs ── */
.feats-filter-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.feats-filter-btn {
    padding: 4px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--text);
}
.feats-filter-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* ── Category ── */
.feat-category { margin-bottom: 18px; }
.feat-category-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    padding-bottom: 5px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 5px;
}
.feat-cat-count { font-weight: 400; color: var(--muted); margin-left: auto; font-size: 0.65rem; }
.feat-cat-count.complete { color: var(--accent2, #4ade80); font-weight: 700; }

/* ── Cards ── */
.feat-card {
    background: var(--card);
    border-radius: 6px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    padding: 9px 10px;
    margin-bottom: 6px;
}
.feat-card--active { border-left-color: var(--accent2, #a78bfa); }
.feat-card--done   { border-left-color: var(--accent, #4ade80); opacity: 0.65; }
.feat-card--locked { }

.feat-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.feat-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}
.feat-name--hidden { color: var(--muted); font-style: italic; }
.feat-done-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent, #4ade80);
    background: color-mix(in srgb, var(--accent, #4ade80) 15%, transparent);
    border: 1px solid var(--accent, #4ade80);
    border-radius: 10px;
    padding: 1px 6px;
    flex-shrink: 0;
}
.feat-desc { font-size: 0.68rem; color: var(--muted); line-height: 1.35; }

/* ── Reward chips ── */
.feat-rewards { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.feat-reward-chip {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent2, #a78bfa) 12%, transparent);
    color: var(--accent2, #a78bfa);
    border: 1px solid color-mix(in srgb, var(--accent2, #a78bfa) 35%, transparent);
}
.feat-reward-chip.reward-bronze { background: color-mix(in srgb, #cd7f32 15%, transparent); color: #cd7f32; border-color: color-mix(in srgb, #cd7f32 40%, transparent); }
.feat-reward-chip.reward-silver { background: color-mix(in srgb, #c0c0c0 15%, transparent); color: #c0c0c0; border-color: color-mix(in srgb, #c0c0c0 40%, transparent); }
.feat-reward-chip.reward-gold   { background: color-mix(in srgb, #ffd700 15%, transparent); color: #c8a800; border-color: color-mix(in srgb, #ffd700 40%, transparent); }

/* ── Tier pips ── */
.feat-tiers { display: flex; gap: 5px; margin-top: 7px; }
.feat-tier-pip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1.5px solid var(--border);
    background: var(--bg);
    min-width: 36px;
    cursor: default;
}
.feat-tier-letter { font-size: 0.6rem; font-weight: 700; color: var(--muted); line-height: 1; }
.feat-tier-thresh { font-size: 0.58rem; color: var(--muted); line-height: 1; }
.feat-tier-pip.bronze-done { background: color-mix(in srgb, #cd7f32 20%, transparent); border-color: #cd7f32; }
.feat-tier-pip.bronze-done .feat-tier-letter,
.feat-tier-pip.bronze-done .feat-tier-thresh { color: #cd7f32; }
.feat-tier-pip.silver-done { background: color-mix(in srgb, #c0c0c0 20%, transparent); border-color: #c0c0c0; }
.feat-tier-pip.silver-done .feat-tier-letter,
.feat-tier-pip.silver-done .feat-tier-thresh { color: #c0c0c0; }
.feat-tier-pip.gold-done { background: color-mix(in srgb, #ffd700 20%, transparent); border-color: #c8a800; }
.feat-tier-pip.gold-done .feat-tier-letter,
.feat-tier-pip.gold-done .feat-tier-thresh { color: #c8a800; }

/* ── Progress ── */
.feat-progress-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 6px;
}
.feat-progress-bar {
    flex: 1;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.feat-progress-fill {
    height: 100%;
    background: var(--accent2, #a78bfa);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.feat-progress-text { font-size: 0.6rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.feat-empty { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 24px 0; }

/* ── Achievement toast notifications ── */
#achievement-toast-container {
    position: fixed;
    top: 70px;
    right: 16px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.achievement-toast {
    background: var(--surface);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    animation: toast-in 0.3s ease, toast-out 0.4s ease 2.6s forwards;
    pointer-events: none;
}
.toast-title { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); margin-bottom: 2px; }
.toast-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.toast-reward { font-size: 0.68rem; color: var(--accent2); margin-top: 2px; font-style: italic; }
.homecoming-toast {
    border-color: #c9a227;
    box-shadow: 0 4px 16px rgba(201,162,39,0.25);
    animation: toast-in 0.3s ease, toast-out 0.4s ease 4.1s forwards;
}
.homecoming-toast .toast-title { color: #c9a227; }
.homecoming-toast .toast-name { font-size: 0.78rem; font-weight: 400; font-style: italic; line-height: 1.4; }
.homecoming-toast .toast-reward { color: #c9a227; }
.death-toast {
    border-color: #9f2020;
    box-shadow: 0 4px 16px rgba(159,32,32,0.3);
    animation: toast-in 0.3s ease, toast-out 0.4s ease 4.1s forwards;
}
.death-toast .toast-title { color: #e05252; }
.death-toast .toast-name { font-size: 0.78rem; font-weight: 400; font-style: italic; line-height: 1.4; }
.death-toast .toast-reward { color: #e05252; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateY(-6px); }
}

/* earned title on character card */

/* ── Active skill button ── */
#skill-row {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    align-items: stretch;
}
#skill-btn {
    flex: 1;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent2, #a78bfa);
    border: 1px solid var(--accent2, #a78bfa);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
#skill-btn:hover:not(:disabled) { background: var(--accent2, #a78bfa); color: #1a1005; }
#skill-btn:disabled { opacity: 0.35; cursor: not-allowed; }
#skill-btn.active {
    background: var(--accent2, #a78bfa);
    color: #1a1005;
    box-shadow: 0 0 8px var(--accent2, #a78bfa);
    animation: skill-pulse 1s ease-in-out infinite alternate;
}
@keyframes skill-pulse {
    from { box-shadow: 0 0 4px var(--accent2, #a78bfa); }
    to   { box-shadow: 0 0 14px var(--accent2, #a78bfa); }
}
#auto-skill-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#auto-skill-btn:hover { border-color: var(--accent2, #a78bfa); color: var(--accent2, #a78bfa); }
#auto-skill-btn.active {
    background: var(--accent2, #a78bfa);
    color: #1a1005;
    border-color: var(--accent2, #a78bfa);
}

/* ── Companion skill buttons ── */
#companion-skills { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: stretch; }

.companion-skill-cell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.companion-skill-btn {
    width: 100%;
    flex: 1;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface);
    color: var(--accent2, #a78bfa);
    border: 1px dashed var(--accent2, #a78bfa);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.companion-skill-btn:hover:not(:disabled) { background: var(--accent2, #a78bfa); color: #1a1005; }
.companion-skill-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.companion-skill-btn.active {
    background: var(--accent2, #a78bfa);
    color: #1a1005;
    border-style: solid;
    box-shadow: 0 0 8px var(--accent2, #a78bfa);
    animation: skill-pulse 1s ease-in-out infinite alternate;
}
/* ── Stats modal ── */
#stats-modal, #party-class-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.85);
    z-index: 400 !important;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
#stats-modal.open, #party-class-modal.open { display: flex; }

#stats-box, #party-class-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(380px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#stats-body {
    overflow-y: auto;
    padding: 16px 22px;
}

#stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#stats-header h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

#stats-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
}
#stats-close:hover { color: var(--text); background: var(--surface2); }


.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--muted); }
.stat-row span:last-child { color: var(--text); font-weight: 600; }

#lt-enemy-section {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

#lt-enemy-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 4px;
}

#lt-enemy-kills {
    max-height: 220px;
    overflow-y: auto;
}

#lt-enemy-kills .stat-row {
    font-size: 0.82rem;
    padding: 5px 0;
}

/* ── Party class modal ── */
#party-class-box {
    padding: 24px 28px;
    gap: 14px;
    display: flex;
    flex-direction: column;
    width: min(340px, 92vw);
}

#party-class-box h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    text-align: center;
}

#party-class-desc {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
    min-height: 2em;
}

#party-class-confirm, #party-class-cancel {
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    font-weight: 600;
}

#party-class-confirm {
    background: var(--accent2);
    color: var(--text);
}
#party-class-confirm:hover { opacity: 0.85; }

/* ── Footer / version badge ── */
footer {
    text-align: center;
    padding: 10px;
}

#version-btn {
    background: none;
    border: none;
    color: var(--border);
    font-size: 0.7rem;
    cursor: pointer;
    letter-spacing: 1px;
    transition: color 0.15s;
    padding: 4px 8px;
}

#version-btn:hover { color: var(--muted); }

#privacy-link {
    color: var(--border);
    font-size: 0.7rem;
    text-decoration: none;
    letter-spacing: 1px;
    padding: 4px 8px;
    transition: color 0.15s;
}
#privacy-link:hover { color: var(--muted); }

#copyright {
    color: var(--border);
    font-size: 0.7rem;
    letter-spacing: 1px;
    padding: 4px 8px;
}

#stats-btn {
    background: none;
    border: none;
    color: var(--border);
    font-size: 0.7rem;
    cursor: pointer;
    letter-spacing: 1px;
    transition: color 0.15s;
    padding: 4px 8px;
}
#stats-btn:hover { color: var(--muted); }

/* ── Changelog modal ── */
#save-conflict-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.92);
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#save-conflict-modal.open { display: flex; }

#save-conflict-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 28px 24px 24px;
    max-width: 480px;
    width: 90%;
    text-align: center;
}

#save-conflict-box h2 { margin: 0 0 8px; font-size: 1.15rem; }
#save-conflict-box > p { color: var(--muted); font-size: 0.88rem; margin: 0 0 20px; }

#save-conflict-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.save-conflict-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-conflict-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.save-conflict-stats {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.6;
    flex: 1;
}

#changelog-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(14,14,20,0.85);
    align-items: center;
    justify-content: center;
}

#changelog-modal.open { display: flex; }

#changelog-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(520px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#changelog-header h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

#changelog-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
}

#changelog-close:hover { color: var(--text); background: var(--surface2); }

#changelog-body {
    overflow-y: auto;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cl-entry {}

.cl-version {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent2);
    margin-bottom: 2px;
}

.cl-date {
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.cl-changes {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cl-changes li {
    font-size: 0.82rem;
    color: var(--text);
    padding-left: 14px;
    position: relative;
    line-height: 1.5;
}

.cl-changes li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: var(--muted);
}

/* Drop rate chart modal */
#drop-chart-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.85);
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#drop-chart-modal.open { display: flex; }

#drop-chart-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(440px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#drop-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#drop-chart-header h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

#drop-chart-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
}

#drop-chart-close:hover { color: var(--text); background: var(--surface2); }

#drop-chart-body {
    overflow-y: auto;
    padding: 14px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.drop-chart-row {
    display: grid;
    grid-template-columns: 80px 1fr 50px;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
}

.drop-chart-label {
    text-align: right;
    text-transform: capitalize;
    font-weight: 600;
}

.drop-chart-bar-wrap {
    background: var(--surface2);
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.drop-chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.drop-chart-pct {
    color: var(--muted);
    font-size: 0.75rem;
    text-align: right;
}

.drop-chart-locked .drop-chart-label { opacity: 0.35; }
.drop-chart-locked .drop-chart-pct   { opacity: 0.35; font-style: italic; }

#drop-chart-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

#drop-chart-btn:hover { opacity: 1; }

/* Checkpoint indicator */
#checkpoint-display {
    display: block;
    font-size: 0.8rem;
    margin-top: 4px;
}

.checkpoint-active {
    color: var(--accent);
    font-weight: 600;
}

/* Auto Seller config */
#auto-seller-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

#loot-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 10px 0 6px;
}

#auto-seller-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

#auto-toggles-section {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.auto-toggle-btn {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.3);
    color: var(--text-muted, #888);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.auto-toggle-btn.on {
    border-color: var(--hp-green);
    color: var(--hp-green);
    background: rgba(80, 200, 80, 0.08);
}

.auto-seller-config {
    padding: 6px 8px;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.auto-sell-row {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 2px 0;
}

.auto-sell-row input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.auto-sell-name {
    font-weight: 500;
}

.auto-sell-next {
    width: 100%;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
}

/* ═══════════════════════════════════════
   FANTASY THEMES
   ═══════════════════════════════════════ */

/* ── Grimdark ── */
[data-theme="grimdark"] {
    --bg: #090605;
    --surface: #120c0a;
    --surface2: #1c1210;
    --border: #4a2018;
    --accent: #c0392b;
    --accent2: #a0522d;
    --danger: #ff3030;
    --text: #d4c5b5;
    --muted: #7a5a4a;
    --hp-green: #5a9e3a;
    --xp-blue: #4a7abf;
}

[data-theme="grimdark"] h1 {
    font-family: var(--font-display), serif;
    letter-spacing: 0.18em;
}

/* ── Arcane ── */
[data-theme="arcane"] {
    --bg: #07070f;
    --surface: #0e0e1c;
    --surface2: #151528;
    --border: #28285a;
    --accent: #c8a227;
    --accent2: #8b5cf6;
    --danger: #e05252;
    --text: #e8e0f8;
    --muted: #6a6a99;
    --hp-green: #3ecf6a;
    --xp-blue: #3b82f6;
}

/* ── Torchlight ── */
/*
 * Torchlight — the GerdQuest house look (franchise bible §3): a character sheet
 * lit by torchlight in a dark stone room. Warm parchment on near-black, gold for
 * anything interactive, red reserved for harm. Colours below are the §3 tokens
 * verbatim; keep them in sync with the bible rather than tuning them locally.
 *
 * Shipped as "tavern" until v2.34.0. Saved values migrate in src/theme.ts.
 */
[data-theme="torchlight"] {
    --bg: #0a0807;          /* §3 --bg-0 */
    --surface: #17110d;     /* §3 --bg-1 */
    --surface2: #221812;
    --border: #b8862f;      /* §3 --gold */
    --accent: #d9791f;      /* §3 --torch-mid */
    --accent2: #2d7a3a;
    --danger: #a63c1d;      /* §3 --danger */
    --text: #e9ddc2;        /* §3 --parchment */
    --muted: #5a4b38;       /* §3 --ink-soft */
    --hp-green: #3a8a3a;
    --xp-blue: #4a6abf;
}

/* ── Inferno ── */
[data-theme="inferno"] {
    --bg: #0b0600;
    --surface: #160c04;
    --surface2: #221206;
    --border: #6e2e08;
    --accent: #ff6520;
    --accent2: #e02010;
    --danger: #ff1500;
    --text: #f5dbb5;
    --muted: #8a5028;
    --hp-green: #3a9838;
    --xp-blue: #4080e8;
}

[data-theme="inferno"] h1 {
    font-family: var(--font-display), serif;
    letter-spacing: 0.18em;
    text-shadow: 0 0 16px #ff6520, 0 0 38px rgba(255,101,32,0.55), 0 0 80px rgba(255,60,0,0.2);
}

[data-theme="inferno"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 90% 55% at 50% 105%, rgba(200,50,0,0.14) 0%, transparent 65%);
}

[data-theme="inferno"] header {
    background: linear-gradient(180deg, #1e0e04 0%, #110800 100%);
    border-bottom: 1px solid #6e2e08;
    box-shadow: 0 2px 24px rgba(255,101,32,0.18);
}

/* Fiery attack button */
[data-theme="inferno"] #attack-btn {
    background: linear-gradient(135deg, #e85010 0%, #9c1a00 100%);
    box-shadow: 0 4px 18px rgba(232,80,16,0.5);
}
[data-theme="inferno"] #attack-btn:active { box-shadow: none; }

/* Ember depth fill */
[data-theme="inferno"] #depth-fill {
    background: linear-gradient(180deg, rgba(255,101,32,0.12) 0%, rgba(200,50,0,0.38) 100%);
}

/* Prestige + venture buttons */
[data-theme="inferno"] #prestige-btn {
    background: linear-gradient(135deg, #ff6520, #9c1a00);
}
[data-theme="inferno"] #venture-btn {
    background: color-mix(in srgb, var(--accent2) 20%, var(--surface));
    color: var(--accent2);
    border-color: var(--accent2);
}

/* Ember glow on all panels */
[data-theme="inferno"] #enemy-panel,
[data-theme="inferno"] #party-panel,
[data-theme="inferno"] #upgrades-panel,
[data-theme="inferno"] #loot-panel,
[data-theme="inferno"] #prestige-panel,
[data-theme="inferno"] #guild-hall-panel,
[data-theme="inferno"] #log-panel,
[data-theme="inferno"] #settings-panel {
    border-color: #6e2e08;
    box-shadow: 0 0 18px rgba(255,80,0,0.1), inset 0 0 32px rgba(0,0,0,0.5);
}

/* ── Void Rift ── */
[data-theme="void-rift"] {
    --bg: #030308;
    --surface: #08080f;
    --surface2: #0d0d1a;
    --border: #2a1060;
    --accent: #7c3aed;
    --accent2: #06b6d4;
    --danger: #c026d3;
    --text: #e4e0ff;
    --muted: #5a4a8a;
    --hp-green: #10b981;
    --xp-blue: #3b82f6;
}
[data-theme="void-rift"] h1 {
    text-shadow: 0 0 16px #7c3aed, 0 0 40px rgba(6,182,212,0.4), 0 0 80px rgba(124,58,237,0.2);
}
[data-theme="void-rift"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 50% at 50% 100%, rgba(124,58,237,0.1) 0%, transparent 70%);
}
[data-theme="void-rift"] #enemy-panel,
[data-theme="void-rift"] #party-panel,
[data-theme="void-rift"] #upgrades-panel,
[data-theme="void-rift"] #loot-panel,
[data-theme="void-rift"] #prestige-panel,
[data-theme="void-rift"] #guild-hall-panel,
[data-theme="void-rift"] #settings-panel {
    border-color: #2a1060;
    box-shadow: 0 0 20px rgba(124,58,237,0.12), inset 0 0 30px rgba(0,0,0,0.6);
}

/* ── Bloodmoon ── */
[data-theme="bloodmoon"] {
    --bg: #060102;
    --surface: #100205;
    --surface2: #1a040a;
    --border: #5a0f1e;
    --accent: #dc143c;
    --accent2: #b45309;
    --danger: #ff0033;
    --text: #f4d0d8;
    --muted: #8a3a48;
    --hp-green: #16a34a;
    --xp-blue: #1d4ed8;
}
[data-theme="bloodmoon"] h1 {
    font-family: var(--font-display), serif;
    letter-spacing: 0.18em;
    text-shadow: 0 0 16px #dc143c, 0 0 40px rgba(220,20,60,0.4), 0 0 80px rgba(180,10,30,0.2);
}
[data-theme="bloodmoon"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 70% 40% at 50% 0%, rgba(220,20,60,0.12) 0%, transparent 70%);
}
[data-theme="bloodmoon"] header {
    background: linear-gradient(180deg, #1a0308 0%, #100205 100%);
    border-bottom: 1px solid #5a0f1e;
    box-shadow: 0 2px 24px rgba(220,20,60,0.2);
}
[data-theme="bloodmoon"] #enemy-panel,
[data-theme="bloodmoon"] #party-panel,
[data-theme="bloodmoon"] #upgrades-panel,
[data-theme="bloodmoon"] #loot-panel,
[data-theme="bloodmoon"] #prestige-panel,
[data-theme="bloodmoon"] #guild-hall-panel,
[data-theme="bloodmoon"] #settings-panel {
    border-color: #5a0f1e;
    box-shadow: 0 0 18px rgba(220,20,60,0.1), inset 0 0 32px rgba(0,0,0,0.5);
}

/* ── Frost Crypt ── */
[data-theme="frost-crypt"] {
    --bg: #010308;
    --surface: #040a14;
    --surface2: #081220;
    --border: #1e3a60;
    --accent: #38bdf8;
    --accent2: #818cf8;
    --danger: #fb7185;
    --text: #e0f2fe;
    --muted: #4a7a9a;
    --hp-green: #2dd4bf;
    --xp-blue: #60a5fa;
}
[data-theme="frost-crypt"] h1 {
    letter-spacing: 0.15em;
    text-shadow: 0 0 14px #38bdf8, 0 0 36px rgba(56,189,248,0.35), 0 0 70px rgba(129,140,248,0.2);
}
[data-theme="frost-crypt"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 90% 55% at 50% 105%, rgba(56,189,248,0.08) 0%, transparent 65%);
}
[data-theme="frost-crypt"] #enemy-panel,
[data-theme="frost-crypt"] #party-panel,
[data-theme="frost-crypt"] #upgrades-panel,
[data-theme="frost-crypt"] #loot-panel,
[data-theme="frost-crypt"] #prestige-panel,
[data-theme="frost-crypt"] #guild-hall-panel,
[data-theme="frost-crypt"] #settings-panel {
    border-color: #1e3a60;
    box-shadow: 0 0 18px rgba(56,189,248,0.08), inset 0 0 32px rgba(0,0,0,0.55);
}

/* ── Necropolis ── */
[data-theme="necropolis"] {
    --bg: #010601;
    --surface: #030d04;
    --surface2: #061508;
    --border: #1a3a1a;
    --accent: #4ade80;
    --accent2: #a3e635;
    --danger: #dc2626;
    --text: #d4f0d4;
    --muted: #4a7a4a;
    --hp-green: #22c55e;
    --xp-blue: #60a5fa;
}
[data-theme="necropolis"] h1 {
    font-family: var(--font-display), serif;
    letter-spacing: 0.18em;
    text-shadow: 0 0 16px #4ade80, 0 0 40px rgba(74,222,128,0.35), 0 0 80px rgba(163,230,53,0.15);
}
[data-theme="necropolis"] body {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 50% at 50% 110%, rgba(74,222,128,0.08) 0%, transparent 65%);
}
[data-theme="necropolis"] #enemy-panel,
[data-theme="necropolis"] #party-panel,
[data-theme="necropolis"] #upgrades-panel,
[data-theme="necropolis"] #loot-panel,
[data-theme="necropolis"] #prestige-panel,
[data-theme="necropolis"] #guild-hall-panel,
[data-theme="necropolis"] #settings-panel {
    border-color: #1a3a1a;
    box-shadow: 0 0 18px rgba(74,222,128,0.08), inset 0 0 32px rgba(0,0,0,0.6);
}

/* ── Locked theme button ── */
.theme-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    flex-direction: column;
    gap: 2px;
}
.theme-btn.locked .theme-lock {
    font-size: 0.6rem;
    color: var(--muted);
    font-weight: 400;
    letter-spacing: 0;
}

/* ── Shared fantasy decorations (active on any theme) ── */
[data-theme] body {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

[data-theme] header h1 {
    text-shadow: 0 0 20px var(--accent), 0 0 40px rgba(200,162,39,0.3);
    letter-spacing: 0.12em;
}

[data-theme] section h2,
[data-theme] #prestige-panel h2,
[data-theme] #guild-hall-panel h2,
[data-theme] #settings-panel h2,
[data-theme] #log-panel h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
[data-theme] section h2::before,
[data-theme] #prestige-panel h2::before,
[data-theme] #guild-hall-panel h2::before,
[data-theme] #settings-panel h2::before,
[data-theme] #log-panel h2::before {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border));
}
[data-theme] section h2::after,
[data-theme] #prestige-panel h2::after,
[data-theme] #guild-hall-panel h2::after,
[data-theme] #settings-panel h2::after,
[data-theme] #log-panel h2::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(to left, transparent, var(--border));
}

[data-theme] #enemy-panel,
[data-theme] #party-panel,
[data-theme] #upgrades-panel,
[data-theme] #loot-panel,
[data-theme] #prestige-panel,
[data-theme] #guild-hall-panel,
[data-theme] #log-panel,
[data-theme] #settings-panel {
    outline: 1px solid var(--border);
    outline-offset: -4px;
}

[data-theme] #enemy-name {
    letter-spacing: 0.06em;
}

/* ── Theme picker ── */
#theme-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-display), sans-serif;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-btn:hover { color: var(--text); border-color: var(--accent); }
.theme-btn.active {
    background: var(--accent);
    color: #0a0807;
    border-color: var(--accent);
    font-weight: 700;
}

/* ── Item Tooltip ── */
.item-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    width: 240px;
    background: rgba(8, 6, 18, 0.97);
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(200,162,39,0.08);
    font-family: var(--font-body), sans-serif;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.1s ease, transform 0.1s ease;
    will-change: opacity, transform;
}
.item-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}
.tt-hero-portrait {
    display: block;
    width: calc(100% + 28px);
    margin: -12px -14px 12px -14px;
    height: 200px;
    object-fit: cover;
    object-position: center 30%;
    image-rendering: pixelated;
    border-radius: 6px 6px 0 0;
}

.tt-name {
    font-family: var(--font-display), serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.3;
    margin-bottom: 3px;
    display: block;
}
.tt-rarity {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.tt-subtitle {
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.tt-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    margin: 7px 0;
    opacity: 0.4;
}
.tt-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tt-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.76rem;
}
.tt-stat-label {
    color: var(--muted);
    font-size: 0.71rem;
    letter-spacing: 0.03em;
}
.tt-stat-val {
    color: var(--text);
    font-weight: 700;
    font-size: 0.78rem;
}
.tt-stat-val.tt-dps    { color: #f97316; }
.tt-stat-val.tt-hp     { color: var(--hp-green); }
.tt-stat-val.tt-click  { color: var(--accent); }
.tt-stat-val.tt-def    { color: var(--xp-blue); }
.tt-stat-val.tt-crit   { color: #facc15; }
.tt-stat-val.tt-gold   { color: var(--accent); }
.tt-stat-val.tt-life   { color: #f43f5e; }
.tt-stat-val.tt-haste  { color: #a78bfa; }
.tt-stat-val.tt-xp     { color: var(--xp-blue); }
.tt-sell {
    font-size: 0.70rem;
    color: var(--accent);
    text-align: right;
    font-weight: 600;
    margin-top: 2px;
}
.tt-set-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: #c9a227;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.tt-set-bonus {
    font-size: 0.70rem;
    display: flex;
    gap: 4px;
    margin-bottom: 2px;
}
.tt-set-threshold {
    font-weight: 700;
    flex-shrink: 0;
}
.tt-set-bonus.active {
    color: #f0c040;
}
.tt-set-bonus.active .tt-set-threshold {
    color: #f0c040;
}
.tt-set-bonus.inactive {
    color: var(--muted);
    opacity: 0.55;
}

/* gear rows, loot items, and char names show cursor:help to hint tooltip */
.gear-row.filled   { cursor: help; }
.loot-item         { cursor: help; }
.char-name         { cursor: help; }
#party-panel h2    { cursor: help; }
[data-active-skill] { cursor: help; }

.skill-tooltip {}
.skill-tooltip-name {
    font-family: var(--font-display), sans-serif;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 4px;
}
.skill-tooltip-desc {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
}
.skill-tooltip-cd {
    font-size: 0.75rem;
    color: var(--muted);
}
.skill-tooltip-status {
    font-size: 0.78rem;
    margin-top: 6px;
    font-weight: 600;
}
.skill-status-ready   { color: var(--accent2); }
.skill-status-active  { color: var(--accent); }
.skill-status-cooldown{ color: var(--muted); }

.tt-rune-row {
    display: flex;
    gap: 4px;
    padding: 4px 0 2px;
}
.tt-rune-slot {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    border: 1px solid var(--border);
    background: transparent;
    flex-shrink: 0;
    cursor: default;
}
.tt-rune-slot.lesser   { background: rgba(200,180,120,0.35); border-color: rgba(200,180,120,0.7); }
.tt-rune-slot.greater  { background: #6d28d9; border-color: #a78bfa; }
.tt-rune-slot.flawless { background: #0ea5e9; border-color: #7dd3fc; }
.tt-rune-slot.ancient  { background: #f59e0b; border-color: #fcd34d; }

.tt-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 2px;
}
.tt-ability {
    font-size: 0.68rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    color: var(--text);
}

@media (max-width: 1280px) {
    .item-tooltip { display: none; }
}

/* ── Mobile Item Card (bottom sheet) ── */
.mic-overlay {
    display: none;
}
@media (max-width: 1280px) {
    .mic-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9998;
        pointer-events: none;
        visibility: hidden;
    }
    .mic-overlay.open {
        pointer-events: all;
        visibility: visible;
    }
    .mic-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0);
        transition: background 0.25s ease;
    }
    .mic-overlay.open .mic-backdrop {
        background: rgba(0, 0, 0, 0.65);
    }
    .mic-sheet {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(160deg, #0e0c1e 0%, #0a0814 100%);
        border-top: 1px solid var(--accent);
        border-radius: 18px 18px 0 0;
        padding: 12px 20px 36px;
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
    }
    .mic-overlay.open .mic-sheet {
        transform: translateY(0);
    }
    .mic-handle {
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 0 auto 14px;
    }
    .mic-close {
        position: absolute;
        top: 14px;
        right: 16px;
        background: none;
        border: none;
        color: var(--muted);
        font-size: 1rem;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
    }
    .mic-content .tt-name {
        font-size: 1rem;
    }
    .mic-content .tt-rarity {
        font-size: 0.78rem;
        margin-bottom: 3px;
    }
    .mic-content .tt-subtitle {
        font-size: 0.73rem;
        margin-bottom: 10px;
    }
    .mic-content .tt-stat-row {
        font-size: 0.85rem;
        padding: 3px 0;
    }
    .mic-content .tt-stat-label {
        font-size: 0.78rem;
    }
    .mic-content .tt-stat-val {
        font-size: 0.88rem;
    }
    .mic-content .tt-sell {
        font-size: 0.78rem;
        margin-top: 4px;
    }
    .mic-content .tt-divider {
        margin: 10px 0;
    }
}

/* ── Rune Inventory (Guild Hall) ── */
.rune-inv-section {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.rune-inv-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent2);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.rune-inv-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 440px;
    max-height: 440px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 2px;
}
.rune-empty {
    font-size: 0.75rem;
    color: var(--muted);
    font-style: italic;
}
.rune-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 9px;
}

.rune-item-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rune-item-selects {
    display: flex;
    gap: 6px;
}

.rune-item-selects .rune-char-select,
.rune-item-selects .rune-slot-select {
    flex: 1;
}

.rune-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.rune-tier-badge {
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 3px;
    padding: 1px 4px;
    flex-shrink: 0;
}
.rune-tier-badge.lesser   { background: #252525; color: #9ca3af; border: 1px solid #4b5563; }
.rune-tier-badge.greater  { background: #3b1d6e; color: #d8b4fe; border: 1px solid #6d28d9; }
.rune-tier-badge.flawless { background: #0c4a6e; color: #7dd3fc; border: 1px solid #0ea5e9; }
.rune-tier-badge.ancient  { background: #78350f; color: #fcd34d; border: 1px solid #f59e0b; }
.rune-item.lesser   { border-left: 3px solid #4b5563; }
.rune-item.greater  { border-left: 3px solid #8b5cf6; }
.rune-item.flawless { border-left: 3px solid #0ea5e9; }
.rune-item.ancient  { border-left: 3px solid #f59e0b; }
.rune-icon { font-size: 1rem; flex-shrink: 0; }
.rune-name {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}
.rune-stat {
    font-size: 0.72rem;
    color: var(--hp-green);
    white-space: nowrap;
}
.rune-char-select, .rune-slot-select {
    font-size: 0.72rem;
    padding: 2px 4px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    max-width: 90px;
}
.rune-item-btns { display: flex; gap: 4px; }
.rune-brand-btn, .rune-sell-btn, .rune-sell-all-btn {
    font-size: 0.72rem;
    padding: 3px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
}
.rune-brand-btn     { background: var(--accent2); color: #fff; }
.rune-sell-btn      { background: #374151; color: #fbbf24; border: 1px solid #4b5563; }
.rune-sell-all-btn  { background: #374151; color: #fbbf24; border: 1px solid #4b5563; font-size: 0.7rem; text-transform: none; letter-spacing: 0; }
.rune-brand-btn:hover, .rune-sell-btn:hover, .rune-sell-all-btn:hover { filter: brightness(1.15); }
.rune-forge-artifact-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 8px;
    background: rgba(167,139,250,0.08);
    border: 1px solid #a78bfa55;
    border-radius: 6px;
}
.rune-forge-artifact-label {
    font-size: 0.73rem;
    font-weight: 700;
    color: #a78bfa;
    white-space: nowrap;
}
.rune-forge-artifact-cost {
    font-size: 0.7rem;
    color: var(--muted);
    flex: 1;
}
.rune-forge-artifact-btn {
    font-size: 0.73rem;
    padding: 3px 12px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}
.rune-forge-artifact-btn:hover:not(:disabled) { filter: brightness(1.2); }
.rune-forge-artifact-btn:disabled { background: var(--border); color: var(--muted); cursor: default; }

.rune-combine-section {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.rune-combine-label {
    font-size: 0.73rem;
    color: var(--muted);
    white-space: nowrap;
}
.rune-combine-select {
    font-size: 0.73rem;
    flex: 1;
    min-width: 180px;
    padding: 3px 6px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.rune-combine-btn {
    font-size: 0.73rem;
    padding: 3px 10px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}
.rune-combine-btn:hover { filter: brightness(1.15); }
.rune-combine-all-btn {
    font-size: 0.73rem;
    padding: 3px 10px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}
.rune-combine-all-btn:hover { filter: brightness(1.15); }
.rune-combine-hint {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--muted);
    font-style: italic;
}

/* ── Party rune panel ── */
#party-rune-panel,
#party-artifact-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.prune-char-block {
    background: radial-gradient(ellipse 120% 80% at 50% 0%, rgba(60,40,10,0.55) 0%, var(--surface2) 60%);
    border: 1px solid rgba(160,120,40,0.35);
    border-radius: 10px;
    padding: 12px 14px 14px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,220,100,0.06), 0 2px 12px rgba(0,0,0,0.35);
}
.prune-char-block::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: radial-gradient(ellipse 70% 30% at 50% 0%, rgba(180,130,40,0.07) 0%, transparent 70%);
    pointer-events: none;
}

.prune-char-name {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent2);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(160,120,40,0.25);
    text-shadow: 0 0 10px rgba(200,160,60,0.3);
}

.char-mini-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(160,120,40,0.2);
}
.char-mini-sprite {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.char-mini-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}
.char-mini-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.char-mini-class {
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: capitalize;
}
.char-mini-dps {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}
.char-mini-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 4px;
}
.char-mini-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.char-mini-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.char-mini-bar.hp-fill {
    background: linear-gradient(90deg, var(--hp-green), #86efac);
}
.char-mini-bar.hp-fill.hp-bar-low {
    background: linear-gradient(90deg, #ef4444, #f87171);
}
.char-mini-bar.xp-fill {
    background: linear-gradient(90deg, var(--xp-blue), #60a5fa);
}

.prune-slots {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.prune-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

/* Paper doll grid */
.pdoll-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
        ". helmet ."
        "main_hand chest off_hand"
        "ring1 gloves ring2"
        ". legs ."
        ". shoes .";
    gap: 8px;
    place-items: center;
    padding: 10px 0 4px;
}
.pdoll-grid [data-slot="helmet"]    { grid-area: helmet; }
.pdoll-grid [data-slot="chest"]     { grid-area: chest; }
.pdoll-grid [data-slot="main_hand"] { grid-area: main_hand; }
.pdoll-grid [data-slot="off_hand"]  { grid-area: off_hand; }
.pdoll-grid [data-slot="gloves"]    { grid-area: gloves; }
.pdoll-grid [data-slot="legs"]      { grid-area: legs; }
.pdoll-grid [data-slot="shoes"]     { grid-area: shoes; }
.pdoll-grid [data-slot="ring1"]     { grid-area: ring1; }
.pdoll-grid [data-slot="ring2"]     { grid-area: ring2; }

.pdoll-slot-cell {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.pdoll-slot-label {
    font-size: 0.58rem;
    color: rgba(180,140,55,0.65);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1;
    white-space: nowrap;
}

.pdoll-slot {
    width: 52px; height: 52px; border-radius: 50%;
    background: radial-gradient(circle at 38% 36%, rgba(255,255,255,0.07) 0%, rgba(0,0,0,0.55) 100%);
    border: 2px solid var(--border);
    font-size: 1.35rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s, background 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), inset 0 -1px 2px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}
.pdoll-slot::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.05);
    pointer-events: none;
}
.pdoll-slot.empty {
    opacity: 0.35;
    border-style: dashed;
    border-color: rgba(255,255,255,0.15);
}
.pdoll-slot:hover:not(.empty) { filter: brightness(1.2); transform: scale(1.05); }
.pdoll-slot:active   { transform: scale(0.88); }
.pdoll-slot[aria-expanded="true"] {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    filter: brightness(1.25);
}

.pdoll-slot.equipped.lesser {
    border-color: var(--accent2);
    background: radial-gradient(circle at 38% 36%, rgba(200,160,60,0.18) 0%, rgba(0,0,0,0.55) 100%);
    box-shadow: 0 0 10px rgba(200,160,60,0.5), 0 0 3px rgba(200,160,60,0.7), inset 0 1px 0 rgba(255,220,100,0.1);
}
.pdoll-slot.equipped.greater {
    border-color: #8b5cf6;
    background: radial-gradient(circle at 38% 36%, rgba(139,92,246,0.2) 0%, rgba(0,0,0,0.55) 100%);
    box-shadow: 0 0 10px rgba(139,92,246,0.5), 0 0 3px rgba(139,92,246,0.7), inset 0 1px 0 rgba(180,150,255,0.08);
}
.pdoll-slot.equipped.flawless {
    border-color: #0ea5e9;
    background: radial-gradient(circle at 38% 36%, rgba(14,165,233,0.2) 0%, rgba(0,0,0,0.55) 100%);
    box-shadow: 0 0 10px rgba(14,165,233,0.5), 0 0 3px rgba(14,165,233,0.7), inset 0 1px 0 rgba(100,200,255,0.08);
}
.pdoll-slot.equipped.ancient {
    border-color: #f59e0b;
    background: radial-gradient(circle at 38% 36%, rgba(245,158,11,0.2) 0%, rgba(0,0,0,0.55) 100%);
    box-shadow: 0 0 12px rgba(245,158,11,0.55), 0 0 4px rgba(245,158,11,0.8), inset 0 1px 0 rgba(255,200,80,0.1);
}

.pdoll-stats-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; min-height: 22px; }
.pdoll-stat-chip {
    font-size: 0.68rem; padding: 3px 9px;
    background: linear-gradient(135deg, rgba(60,200,60,0.08) 0%, rgba(20,80,20,0.12) 100%);
    border: 1px solid rgba(80,200,80,0.25);
    border-radius: 12px; color: var(--hp-green);
    text-shadow: 0 0 8px rgba(80,200,80,0.35);
    letter-spacing: 0.02em;
}
.pdoll-stats-empty { font-size: 0.68rem; color: var(--muted); font-style: italic; }

/* Rune slot detail modal */
#rune-slot-detail-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#rune-slot-detail-modal.open { display: flex; }
#rune-slot-detail-box {
    background: radial-gradient(ellipse 120% 80% at 50% 0%, rgba(50,35,8,0.9) 0%, var(--surface) 60%);
    border: 1px solid rgba(160,120,40,0.4);
    border-radius: 12px;
    width: min(320px, 88vw);
    display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,220,100,0.06);
}
#rsd-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; border-bottom: 1px solid rgba(160,120,40,0.2);
}
#rsd-header h2 { margin: 0; font-size: 0.92rem; color: var(--accent2); letter-spacing: 0.06em; text-transform: uppercase; }
#rsd-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
#rsd-body { padding: 14px 16px 16px; }
.pdoll-detail-rune  { font-size: 0.88rem; color: var(--text); margin-bottom: 4px; }
.pdoll-detail-stat  { font-size: 0.78rem; color: var(--hp-green); margin-bottom: 14px; }
.pdoll-detail-empty { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-bottom: 14px; }
.pdoll-detail-actions { display: flex; gap: 8px; }
.pdoll-remove-btn {
    flex: 1; padding: 5px 0; font-size: 0.75rem;
    background: none; border: 1px solid var(--danger, #ef4444);
    color: var(--danger, #ef4444); border-radius: 5px; cursor: pointer;
}
.pdoll-replace-btn {
    flex: 1; padding: 5px 0; font-size: 0.75rem;
    background: var(--accent2); border: none; color: #fff; border-radius: 5px; cursor: pointer;
}

/* Rune replace modal */
#rune-replace-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#rune-replace-modal.open { display: flex; }
#rune-replace-box {
    background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(50,35,8,0.9) 0%, var(--surface) 55%);
    border: 1px solid rgba(160,120,40,0.4);
    border-radius: 12px;
    width: min(360px, 92vw); max-height: 70vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,220,100,0.06);
}
#rune-replace-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; border-bottom: 1px solid rgba(160,120,40,0.2);
}
#rune-replace-header h2 { margin: 0; font-size: 0.92rem; color: var(--accent2); letter-spacing: 0.06em; text-transform: uppercase; }
#rune-replace-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
#rune-replace-body { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.rr-rune-item {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    text-align: left; cursor: pointer; font-size: 0.78rem; color: var(--text); width: 100%;
    transition: border-color 0.1s;
}
.rr-rune-item:hover   { border-color: var(--accent2); }
.rr-rune-item.selected { border-color: var(--accent2); background: rgba(200,160,60,0.1); }
.rr-tier-badge { font-size: 0.7rem; }
.rr-rune-stat { margin-left: auto; color: var(--hp-green); font-size: 0.72rem; }

.prune-inv-section {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.prune-inv-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.prune-inv-items { display: flex; flex-direction: column; gap: 5px; }

.prune-empty {
    font-size: 0.73rem;
    color: var(--muted);
    font-style: italic;
    grid-column: 1 / -1;
}


/* ── Log panel header ── */
#log-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
#log-panel-header h2 { margin: 0; }
#log-history-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--muted);
}
#log-history-btn:hover { color: var(--text); border-color: var(--muted); }

/* ── Combat log history modal ── */
#log-history-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.85);
    align-items: center;
    justify-content: center;
    z-index: 200;
}
#log-history-modal.open { display: flex; }
#log-history-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(480px, 92vw);
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#log-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#log-history-header h2 { margin: 0; font-size: 1rem; }
#log-history-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
}
#log-history-body {
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ── Title picker (Feats panel) ── */
.title-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.title-chip {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
}
.title-chip:hover { border-color: var(--accent2); color: var(--text); }
.title-chip.active {
    background: var(--accent2);
    border-color: var(--accent2);
    color: #fff;
    font-weight: 600;
}

/* ── Gear Stash ─────────────────────────────────────────────── */
#stash-section {
    margin-top: 4px;
}
#stash-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
#stash-header h3 {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
}
#stash-count {
    font-size: 0.75rem;
    color: var(--muted);
}
#stash-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.stash-item {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.stash-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.stash-item-name {
    font-weight: 600;
    font-size: 0.8rem;
}
.stash-item-slot {
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
}
.stash-item-stats {
    color: var(--muted);
    font-size: 0.72rem;
}
.stash-item-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    flex-wrap: wrap;
}
.stash-char-select {
    font-size: 0.72rem;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 1px 3px;
    flex: 1;
    min-width: 0;
}
.stash-equip-btn, .stash-sell-btn {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.stash-equip-btn:hover {
    border-color: var(--accent2);
    color: var(--accent2);
}
.stash-sell-btn:hover {
    border-color: var(--hp-green);
    color: var(--hp-green);
}
.stash-empty {
    font-size: 0.8rem;
    color: var(--border);
    font-style: italic;
}

/* ── Named Gear Sets ─────────────────────────────────────── */
.set-piece {
    border-color: #c9a227 !important;
    background: rgba(201,162,39,0.06) !important;
}
.set-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: #c9a227;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}
.char-set-bonuses {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 4px 4px;
}
.set-bonus-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    border: 1px solid #c9a227;
    color: #c9a227;
    background: rgba(201,162,39,0.08);
    cursor: help;
}
.set-bonus-badge.set-3pc {
    border-color: #f0c040;
    color: #f0c040;
    background: rgba(240,192,64,0.12);
}

/* ── Gear Locking ────────────────────────────────────────── */
.gear-lock-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.35;
    padding: 0 2px;
    line-height: 1;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.gear-lock-btn:hover,
.gear-lock-btn.locked {
    opacity: 1;
}
.gear-row.gear-locked {
    border-left: 2px solid #c9a227;
    background: rgba(201,162,39,0.04);
}

/* ── Artifact System ─────────────────────────────────────── */
.artifact-empty {
    font-size: 0.8rem;
    color: var(--border);
    font-style: italic;
    padding: 6px 0;
}
.artifact-divider { border-color: var(--border); margin: 8px 0; }

/* Inventory panel (sidebar) */
.artifact-inv-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.artifact-inv-row:last-child { border-bottom: none; }
.artifact-inv-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.artifact-inv-info { flex: 1; min-width: 0; }
.artifact-inv-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.artifact-level-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,0.15);
  border: 1px solid #fbbf2455;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 3px;
  vertical-align: middle;
}
.artifact-levelup-row { margin: 3px 0; }
.artifact-levelup-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}
.artifact-levelup-btn:hover:not(:disabled) { filter: brightness(1.2); }
.artifact-levelup-btn:disabled { background: var(--border); color: var(--muted); cursor: default; }
.artifact-levelup-cost { font-weight: 400; opacity: 0.8; }
.artifact-inv-desc { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.artifact-sell-btn {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--hp-green);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}
.artifact-sell-btn:hover { border-color: var(--hp-green); filter: brightness(1.2); }
.artifact-equip-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}
.artifact-char-slot-select {
    font-size: 0.72rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 1px 3px;
    flex: 1;
    min-width: 0;
}
.artifact-no-slot {
    font-size: 0.7rem;
    color: var(--muted);
    font-style: italic;
    margin-top: 5px;
    display: block;
}

/* Combine section */
.artifact-combine-section { margin-bottom: 4px; }
.artifact-combine-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    padding: 4px 0;
}
.artifact-combine-arrow { color: var(--muted); }
.artifact-combine-btn {
    margin-left: auto;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid #a78bfa;
    background: rgba(167,139,250,0.1);
    color: #a78bfa;
    cursor: pointer;
}
.artifact-combine-btn:hover { filter: brightness(1.2); }

/* Character artifact slots (party panel) — square slot grid */
.artifact-char-block {
    background: radial-gradient(ellipse 120% 80% at 50% 0%, rgba(60,30,80,0.55) 0%, var(--surface2) 60%);
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: 10px;
    padding: 12px 14px 14px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(167,139,250,0.06), 0 2px 12px rgba(0,0,0,0.35);
}

.art-pdoll-row {
    display: flex;
    padding: 6px 0 2px;
    justify-content: space-evenly;
}

.art-slot-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.art-pdoll-slot {
    width: 64px; height: 64px;
    border-radius: 8px;
    background: radial-gradient(circle at 38% 36%, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.5) 100%);
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s, background 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 2px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}
.art-pdoll-slot.empty {
    opacity: 0.4;
    border-style: dashed;
    border-color: rgba(255,255,255,0.15);
}
.art-pdoll-slot.empty:disabled { cursor: not-allowed; opacity: 0.2; }
.art-pdoll-slot.filled {
    border-color: #a78bfa88;
    background: radial-gradient(circle at 38% 36%, rgba(139,92,246,0.18) 0%, rgba(0,0,0,0.5) 100%);
    box-shadow: 0 0 10px rgba(139,92,246,0.35), inset 0 1px 0 rgba(180,150,255,0.08);
}
.art-pdoll-slot:hover:not(.empty):not(:disabled) { filter: brightness(1.2); transform: scale(1.05); }
.art-pdoll-slot:active:not(:disabled) { transform: scale(0.9); }

.art-slot-icon { font-size: 1.6rem; line-height: 1; }

.art-slot-level {
    position: absolute;
    top: 3px; right: 5px;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--accent2);
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    pointer-events: none;
}

/* Artifact slot picker modal */
#artifact-slot-pick-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#artifact-slot-pick-modal.open { display: flex; }
#artifact-slot-pick-box {
    background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(40,20,60,0.9) 0%, var(--surface) 55%);
    border: 1px solid rgba(139,92,246,0.35);
    border-radius: 12px;
    width: min(380px, 92vw); max-height: 70vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 1px 0 rgba(167,139,250,0.06);
}
#asp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; border-bottom: 1px solid rgba(139,92,246,0.2);
}
#asp-header h2 { margin: 0; font-size: 0.92rem; color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; }
#asp-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
#asp-body { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.asp-artifact-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    text-align: left; cursor: pointer; width: 100%;
    transition: border-color 0.1s;
}
.asp-artifact-item:hover { border-color: var(--accent); }
.asp-artifact-icon { font-size: 1.3rem; flex-shrink: 0; }
.asp-artifact-info { display: flex; flex-direction: column; gap: 2px; }
.asp-artifact-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.asp-artifact-stat { font-size: 0.68rem; color: var(--hp-green); }
.artifact-inv-select {
    font-size: 0.72rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 3px;
    padding: 1px 3px;
    flex: 1;
    min-width: 0;
}
.artifact-equip-btn {
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--accent2);
    background: rgba(255,255,255,0.05);
    color: var(--accent2);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.artifact-equip-btn:hover { filter: brightness(1.15); }

/* ── Artifact detail modal ── */
#artifact-detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(14,14,20,0.85);
    align-items: center;
    justify-content: center;
    z-index: 300;
}
#artifact-detail-modal.open { display: flex; }
#artifact-detail-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(400px, 92vw);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#artifact-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#artifact-detail-header h2 { margin: 0; font-size: 1rem; }
#artifact-detail-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
}
#artifact-detail-close:hover { color: var(--text); }
#artifact-detail-body {
    overflow-y: auto;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.amodal-hero-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.amodal-icon { font-size: 2rem; line-height: 1; }
.amodal-name { font-size: 1rem; font-weight: 700; }
.amodal-copies { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.amodal-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.45;
}
.amodal-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.amodal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 8px;
}
.amodal-fuel-progress-wrap { margin: 6px 0 10px; }
.amodal-fuel-progress-label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.amodal-fuel-bar-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.amodal-fuel-bar-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); border-radius: 3px; transition: width 0.3s ease; }
.amodal-fuel-ready { color: #4ade80; font-weight: 600; }
.amodal-fuel-short { color: var(--muted); }
.amodal-fuel-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    max-height: 160px;
    overflow-y: auto;
}
.amodal-fuel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.1s;
}
.amodal-fuel-item:hover { background: rgba(255,255,255,0.05); }
.amodal-fuel-item input[type="checkbox"] { accent-color: #7c3aed; width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.amodal-fuel-item:has(input:checked) { background: rgba(124,58,237,0.12); border-color: #7c3aed55; }
.amodal-fuel-label { flex: 1; }
.amodal-fuel-select-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 6px; opacity: 0.85; }
.amodal-fuel-select-all .amodal-fuel-label { font-weight: 600; }
.amodal-no-fuel { font-size: 0.8rem; color: var(--muted); margin-bottom: 10px; }
.amodal-fuel-unit { font-size: 0.72rem; color: #4ade80; margin-left: auto; flex-shrink: 0; }
.amodal-addfuel-btn { display: block; width: 100%; padding: 8px 12px; background: #16a34a; color: #fff; border: none; border-radius: 6px; font-size: 0.88rem; font-weight: 700; cursor: pointer; text-align: center; margin-top: 8px; }
.amodal-addfuel-btn:hover:not(:disabled) { filter: brightness(1.2); }
.amodal-addfuel-btn:disabled { background: var(--border); color: var(--muted); cursor: default; }
.amodal-sell-section { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.amodal-levelup-btn {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}
.amodal-levelup-btn:hover:not(:disabled) { filter: brightness(1.2); }
.amodal-levelup-btn:disabled { background: var(--border); color: var(--muted); cursor: default; }
.amodal-equip-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.amodal-equip-row .artifact-char-slot-select { flex: 1; }
.amodal-sell-section { display: flex; justify-content: flex-end; }
.amodal-sell-btn {
    font-size: 0.8rem;
    padding: 5px 14px;
}
/* Clickable artifact rows and slots */
.artifact-inv-row { cursor: pointer; transition: background 0.1s; }
.artifact-inv-row:hover { background: rgba(255,255,255,0.04); }
.artifact-inv-row--levelup { border-left: 2px solid #7c3aed; }
.artifact-slot.filled { cursor: pointer; transition: background 0.1s; }
.artifact-slot.filled:hover { background: rgba(255,255,255,0.04); }
.amodal-equipped-note {
    font-size: 0.75rem;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 6px 10px;
}
.amodal-equipped-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.amodal-switch-btn {
    flex: 1;
    padding: 7px 12px;
    background: rgba(139,92,246,0.15);
    color: #a78bfa;
    border: 1px solid rgba(139,92,246,0.4);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}
.amodal-switch-btn:hover { background: rgba(139,92,246,0.28); border-color: #a78bfa; }
.amodal-remove-btn {
    padding: 7px 10px;
    background: none;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: color 0.1s, border-color 0.1s;
    flex-shrink: 0;
}
.amodal-remove-btn:hover { color: #ef4444; border-color: rgba(239,68,68,0.5); }

/* ── Player Profile Widget ─────────────────────────────────────────────── */
.player-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border-radius: 8px;
  margin-bottom: 12px;
}
.profile-avatar-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  position: relative;
  flex-shrink: 0;
}
.profile-avatar-icon { line-height: 1; }
.profile-info { flex: 1; min-width: 0; }
.profile-title { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-avatar-name { font-size: 0.72rem; color: var(--muted); }
.profile-customize-btn {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 4px 10px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Border Styles ─────────────────────────────────────────────────────── */
.border-none    { border: 2px solid var(--border); }
.border-iron    { border: 3px solid #6b7280; box-shadow: 0 0 6px #6b728066; }
.border-silver  { border: 3px solid #9ca3af; box-shadow: 0 0 8px #9ca3af88; }
.border-gold    { border: 3px solid #f59e0b; box-shadow: 0 0 10px #f59e0b88; }
.border-blood   { border: 3px solid #dc2626; box-shadow: 0 0 10px #dc262688; }
.border-arcane  { border: 3px solid #8b5cf6; box-shadow: 0 0 12px #8b5cf6aa; animation: arcane-pulse 2s ease-in-out infinite; }
.border-ancient { border: 3px solid #b45309; box-shadow: 0 0 12px #b45309aa, inset 0 0 8px #b4530944; }
.border-void    { border: 3px solid #1e1b4b; box-shadow: 0 0 14px #6366f188, inset 0 0 6px #1e1b4b88; animation: void-pulse 3s ease-in-out infinite; }

@keyframes arcane-pulse { 0%,100% { box-shadow: 0 0 12px #8b5cf6aa; } 50% { box-shadow: 0 0 20px #8b5cf6ff; } }
@keyframes void-pulse   { 0%,100% { box-shadow: 0 0 14px #6366f188; } 50% { box-shadow: 0 0 22px #6366f1cc; } }

.border-crimson   { border: 3px solid #be123c; box-shadow: 0 0 10px #be123c88; }
.border-ember     { border: 3px solid #ea580c; box-shadow: 0 0 10px #ea580c88; }
.border-bronze    { border: 3px solid #c27c3e; box-shadow: 0 0 8px #c27c3e66; }
.border-shadow    { border: 3px solid #374151; box-shadow: 0 0 8px #4b556388, inset 0 0 6px rgba(0,0,0,0.5); }
.border-emerald   { border: 3px solid #10b981; box-shadow: 0 0 10px #10b98188; }
.border-frost     { border: 3px solid #38bdf8; box-shadow: 0 0 10px #38bdf888; }
.border-twilight  { border: 3px solid #6366f1; box-shadow: 0 0 12px #6366f1aa; animation: twilight-pulse 2.5s ease-in-out infinite; }
.border-relic     { border: 3px solid #d97706; box-shadow: 0 0 10px #d9770688, inset 0 0 6px #d9770622; }
.border-celestial { border: 3px solid #818cf8; box-shadow: 0 0 14px #818cf8bb; animation: celestial-pulse 3s ease-in-out infinite; }
.border-obsidian  { border: 3px solid #312e81; box-shadow: 0 0 14px #4338caaa, inset 0 0 8px #1e1b4b66; }
.border-platinum  { border: 3px solid #cbd5e1; box-shadow: 0 0 12px #cbd5e1aa; }
.border-sovereign { border: 3px solid #0891b2; box-shadow: 0 0 10px #0891b288; }
.border-mystic    { border: 3px solid #7c3aed; box-shadow: 0 0 10px #7c3aed88; }
.border-storm     { border: 3px solid #fbbf24; box-shadow: 0 0 12px #fbbf24aa; animation: storm-pulse 1.5s ease-in-out infinite; }
.border-runic     { border: 3px solid #06b6d4; box-shadow: 0 0 12px #06b6d4aa; animation: runic-pulse 2s ease-in-out infinite; }
.border-spellfire { border: 3px solid #ec4899; box-shadow: 0 0 12px #ec489988; }

@keyframes twilight-pulse  { 0%,100% { box-shadow: 0 0 12px #6366f1aa; } 50% { box-shadow: 0 0 20px #6366f1ff; } }
@keyframes celestial-pulse { 0%,100% { box-shadow: 0 0 14px #818cf8bb; } 50% { box-shadow: 0 0 22px #818cf8ff; } }
@keyframes storm-pulse     { 0%,100% { box-shadow: 0 0 12px #fbbf24aa; } 50% { box-shadow: 0 0 20px #fbbf24ff; } }
@keyframes runic-pulse     { 0%,100% { box-shadow: 0 0 12px #06b6d4aa; } 50% { box-shadow: 0 0 20px #06b6d4ff; } }

/* ── Profile Picker ────────────────────────────────────────────────────── */
.profile-picker { margin-bottom: 10px; }
.profile-picker-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.profile-tab-btn {
  padding: 4px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
}
.profile-tab-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }
.profile-picker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.profile-pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.profile-pick-btn:hover:not(:disabled) { border-color: var(--accent); }
.profile-pick-btn.active { border-color: var(--accent); background: rgba(234,179,8,0.1); }
.profile-pick-btn.locked { opacity: 0.35; cursor: default; }
.pick-icon { font-size: 1.4rem; }
.pick-name { font-size: 0.62rem; color: var(--muted); text-align: center; line-height: 1.2; }
.pick-border-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}


/* ── Retire button in avatar dropdown ─────────────────────────────────────── */
.retire-btn { color: var(--danger, #ef4444) !important; }
.retire-btn:disabled { opacity: 0.35; cursor: not-allowed; color: var(--muted) !important; }

/* ── Locked class buttons ──────────────────────────────────────────────────── */
.class-btn.locked-class { opacity: 0.38; cursor: not-allowed; }
.class-btn.locked-class:hover { border-color: var(--border); color: var(--muted); }

/* ── Hall of Fame modal ────────────────────────────────────────────────────── */
#hall-of-fame-modal, #retire-confirm-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(14,14,20,0.88);
  align-items: center; justify-content: center;
  z-index: 300;
}
#hall-of-fame-modal.open, #retire-confirm-modal.open { display: flex; }
#hall-of-fame-box, #retire-confirm-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(560px, 95vw);
  max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#hall-of-fame-header, #retire-confirm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
#hall-of-fame-header h2, #retire-confirm-header h2 {
  margin: 0; font-size: 1.05rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: 1.5px;
}
#hall-of-fame-close, #retire-confirm-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
#hall-of-fame-close:hover, #retire-confirm-close:hover { color: var(--text); }
#hall-of-fame-body, #retire-confirm-body {
  overflow-y: auto; padding: 16px 24px 24px;
  display: flex; flex-direction: column; gap: 8px;
}
.hof-empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 20px 0; }
.hof-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.82rem;
}
.hof-rank { font-weight: 700; color: var(--accent); min-width: 2rem; }
.hof-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hof-name { font-weight: 700; color: var(--text); }
.hof-class { color: var(--muted); font-size: 0.74rem; text-transform: capitalize; }
.hof-stats { display: flex; gap: 8px; color: var(--muted); font-size: 0.76rem; }
.hof-score { font-weight: 700; color: var(--accent2); }
.hof-date { color: var(--muted); font-size: 0.74rem; }
/* ── Retire confirmation ───────────────────────────────────────────────────── */
.retire-warning { color: var(--text); font-size: 0.86rem; line-height: 1.6; margin: 0; }
.retire-warning strong { color: var(--danger, #ef4444); }
#retire-confirm-actions { display: flex; gap: 10px; margin-top: 16px; }
#retire-confirm-yes, #retire-confirm-cancel { flex: 1; padding: 10px; font-size: 0.86rem; }
.retire-unlock-box {
  background: rgba(234,179,8,0.08); border: 1px solid rgba(234,179,8,0.3);
  border-radius: 8px; padding: 12px 16px; margin-top: 12px;
}
.retire-unlock-title { font-size: 0.76rem; color: var(--accent); font-weight: 700; margin-bottom: 6px; letter-spacing: 1px; }
.retire-unlock-item { font-size: 0.82rem; color: var(--text); margin: 3px 0; }
.retire-unlock-none { color: var(--muted); font-size: 0.8rem; text-align: center; padding: 8px 0; border-color: var(--border); background: none; }

@media (max-width: 1280px) {
    #party-rune-panel, #party-artifact-panel { grid-template-columns: 1fr; }
}

/* ── Left-col sub-tabs (Party / Stars toggle) ────────────────────────────── */
#left-col-subtabs {
    display: flex;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.lcol-stab {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.lcol-stab:last-child { border-right: none; }
.lcol-stab.active {
    color: var(--accent2);
    background: rgba(200,160,60,0.08);
}
.lcol-stab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.04); }

/* Toggle visibility based on data-left-sub attribute on <main> */
main[data-left-sub="party"] #constellation-panel { display: none !important; }
main[data-left-sub="stars"] #party-panel { display: none !important; }
@media (max-width: 1280px) {
    main[data-left-sub="stars"] #loot-panel { display: none !important; }
}

/* ── Constellation Panel ─────────────────────────────────────────────────── */
#constellation-panel { width: 100%; padding: 12px 14px; position: relative; }
#constellation-panel h2 { color: var(--accent2); margin: 0 0 10px; font-size: 0.95rem; letter-spacing: 0.08em; }

.cdoll-shard-header {
    font-size: 0.88rem; font-weight: 700; color: var(--accent2);
    margin-bottom: 12px; letter-spacing: 0.04em;
    text-shadow: 0 0 10px rgba(200,160,60,0.35);
}

.cdoll-svg-wrap {
    width: 100%; margin: 0 auto;
    overflow: auto; display: block; border-radius: 8px;
    background: radial-gradient(ellipse at 50% 50%, rgba(30,20,8,0.7) 0%, rgba(14,14,20,0.95) 80%);
    border: 1px solid rgba(160,120,40,0.2);
}

/* SVG edges */
.cdoll-edge { stroke-linecap: round; }
.cdoll-edge.both-unlocked { stroke: rgba(200,160,60,0.6); stroke-width: 1.5; }
.cdoll-edge.one-unlocked  { stroke: rgba(130,100,40,0.3); stroke-width: 1; }
.cdoll-edge.locked        { stroke: rgba(50,50,70,0.55); stroke-width: 1; }

/* SVG nodes */
.cdoll-node { cursor: pointer; transition: filter 0.15s, transform 0.15s; transform-box: fill-box; transform-origin: center; }
.cdoll-node-group:hover .cdoll-node { filter: brightness(1.5) drop-shadow(0 0 6px rgba(200,160,60,0.7)); transform: scale(1.18); }
.cdoll-node-group:active .cdoll-node { transform: scale(0.94); }
.cdoll-node.center.unlocked  { fill: #7c3aed; stroke: #c4b5fd; stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(167,139,250,0.7)); }
.cdoll-node.center.locked    { fill: rgba(30,20,50,0.95); stroke: rgba(167,139,250,0.4); stroke-width: 2; stroke-dasharray: 4 2; }
.cdoll-node.unlocked.minor   { fill: rgba(200,160,60,0.45); stroke: var(--accent2); stroke-width: 2; }
.cdoll-node.unlocked.notable { fill: #6d28d9; stroke: #a78bfa; stroke-width: 2; }
.cdoll-node.unlocked.keystone {
    fill: #b45309; stroke: #f59e0b; stroke-width: 3;
    filter: drop-shadow(0 0 8px rgba(245,158,11,0.65));
}
.cdoll-node.unlocked.start { fill: rgba(200,160,60,0.6); stroke: var(--accent2); stroke-width: 2; }
.cdoll-node.locked { fill: rgba(20,18,30,0.92); stroke: rgba(90,90,120,0.4); stroke-width: 1.5; }
.cdoll-node.locked.start { stroke-dasharray: 4 2; stroke: rgba(200,160,60,0.5); }

/* Node labels */
.cdoll-node-text {
    font-size: 7px; fill: rgba(180,160,100,0.65);
    pointer-events: none; user-select: none;
}
.cdoll-node-level {
    font-size: 7px; font-weight: 700;
    fill: var(--accent2); paint-order: stroke fill;
    stroke: rgba(10,8,20,0.9); stroke-width: 2px;
    pointer-events: none; user-select: none;
}

/* Hover tooltip */
#cdoll-tooltip {
    position: fixed; z-index: 200; pointer-events: none;
    background: rgba(14,12,22,0.97);
    border: 1px solid rgba(160,120,40,0.45);
    border-radius: 8px; padding: 9px 12px;
    max-width: 220px; min-width: 140px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.55);
    animation: cdoll-tt-in 0.08s ease-out;
}
@keyframes cdoll-tt-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.cdoll-tt-name { font-size: 0.82rem; font-weight: 700; color: var(--accent2); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.cdoll-tt-sub { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.cdoll-tt-desc { font-size: 0.74rem; color: var(--text); line-height: 1.4; }
.cdoll-tt-badge { font-size: 0.6rem; padding: 1px 5px; border-radius: 3px; font-weight: 600; }
.cdoll-tt-badge.unlocked { background: rgba(200,160,60,0.2); color: var(--accent2); border: 1px solid rgba(200,160,60,0.4); }
.cdoll-tt-badge.locked { background: rgba(139,92,246,0.15); color: #a78bfa; border: 1px solid rgba(139,92,246,0.3); }

/* Node detail modal */
#cdoll-node-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#cdoll-node-modal.open { display: flex; }
#cdoll-node-modal-box {
    background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(50,35,8,0.95) 0%, var(--surface) 55%);
    border: 1px solid rgba(160,120,40,0.4);
    border-radius: 12px;
    width: min(380px, 92vw);
    box-shadow: 0 8px 32px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,220,100,0.06);
    overflow: hidden;
}
#cdoll-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 16px 16px 10px; border-bottom: 1px solid rgba(160,120,40,0.2);
    gap: 12px;
}
#cdoll-modal-title { margin: 0; font-size: 1rem; color: var(--accent2); letter-spacing: 0.06em; }
#cdoll-modal-subtitle { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 3px; }
#cdoll-modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; flex-shrink: 0; padding: 2px; }
#cdoll-modal-body { padding: 14px 16px 18px; }
.cdoll-modal-desc { font-size: 0.82rem; color: var(--text); line-height: 1.5; margin-bottom: 10px; }
.cdoll-modal-level { font-size: 0.78rem; color: var(--accent2); margin-bottom: 14px; letter-spacing: 0.04em; }
.cdoll-unlock-btn {
    padding: 5px 14px; font-size: 0.78rem;
    background: var(--accent2); border: none; color: #000; border-radius: 5px; cursor: pointer;
    font-weight: 600;
}
.cdoll-unlock-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* Respec button */
.cdoll-respec-btn {
    margin-top: 12px; width: 100%; padding: 7px; font-size: 0.75rem;
    background: none; border: 1px solid rgba(239,68,68,0.5);
    color: rgba(239,68,68,0.8); border-radius: 5px; cursor: pointer;
    transition: border-color 0.1s, color 0.1s;
}
.cdoll-respec-btn:hover { border-color: #ef4444; color: #ef4444; }

/* ── Gear pdoll squares ──────────────────────────────────────────────────── */
.gear-pdoll-grid {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 6px 0 4px;
}

.gear-pdoll-cell {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}

.gear-pdoll-slot {
    width: 48px; height: 48px; border-radius: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.45) 100%);
    border: 2px solid var(--border);
    font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.12s, background 0.2s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 4px rgba(0,0,0,0.3);
    position: relative;
}

.gear-pdoll-slot.empty {
    opacity: 0.35;
    border-style: dashed;
    border-color: rgba(255,255,255,0.15);
    cursor: default;
}

.gear-pdoll-slot.has-loot {
    border-color: var(--accent);
    border-style: dashed;
    opacity: 0.85;
    animation: loot-pulse 1.8s ease-in-out infinite;
}

@keyframes loot-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(200,162,39,0.3); }
  50%       { box-shadow: 0 0 10px rgba(200,162,39,0.65); }
}

.gear-pdoll-slot.filled {
    border-color: rgba(255,255,255,0.3);
    cursor: pointer;
}

.gear-pdoll-slot.filled.q-fine      { border-color: var(--q-fine);      background: rgba(34,197,94,0.07);   box-shadow: 0 0 6px rgba(34,197,94,0.4); }
.gear-pdoll-slot.filled.q-superior  { border-color: var(--q-superior);  background: rgba(59,130,246,0.07);  box-shadow: 0 0 6px rgba(59,130,246,0.4); }
.gear-pdoll-slot.filled.q-rare      { border-color: var(--q-rare);      background: rgba(168,85,247,0.08);  box-shadow: 0 0 8px rgba(168,85,247,0.5); }
.gear-pdoll-slot.filled.q-epic      { border-color: var(--q-epic);      background: rgba(249,115,22,0.08);  box-shadow: 0 0 8px rgba(249,115,22,0.5); }
.gear-pdoll-slot.filled.q-legendary { border-color: var(--q-legendary); background: rgba(245,158,11,0.09);  box-shadow: 0 0 10px rgba(245,158,11,0.6); }
.gear-pdoll-slot.filled.q-mythic    { border-color: var(--q-mythic);    background: rgba(232,121,249,0.09); box-shadow: 0 0 10px rgba(232,121,249,0.6); }
.gear-pdoll-slot.filled.q-ancient   { border-color: var(--q-ancient);   background: rgba(52,211,153,0.08);  box-shadow: 0 0 10px rgba(52,211,153,0.55); }
.gear-pdoll-slot.filled.q-celestial { border-color: var(--q-celestial); background: rgba(103,232,249,0.08); box-shadow: 0 0 10px rgba(103,232,249,0.55); }
.gear-pdoll-slot.filled.q-void      { border-color: var(--q-void);      background: rgba(192,132,252,0.08); box-shadow: 0 0 10px rgba(192,132,252,0.6); }
.gear-pdoll-slot.filled.q-divine    { border-color: #fff;               background: rgba(255,255,255,0.07); box-shadow: 0 0 12px rgba(255,255,255,0.7); }

/* Set piece: second border as outline in the set's accent color */
.gear-pdoll-slot.set-piece {
    outline: 2px solid var(--set-color, transparent);
    outline-offset: -1px;
}

/* Highlight all set pieces in the same set when hovering one of them */
.gear-pdoll-slot.set-piece.set-hl {
    outline-width: 2.5px;
    filter: brightness(1.3);
    transition: filter 0.1s, outline-width 0.1s;
}

.gear-pdoll-slot:hover:not(.empty):not(:disabled) { filter: brightness(1.2); transform: scale(1.05); }
.gear-pdoll-slot:active:not(:disabled)            { transform: scale(0.88); }

.gear-pdoll-slot.gear-locked {
    opacity: 0.9;
}

.gear-pdoll-slot.slot-highlight {
    background: rgba(200,162,39,0.12);
    box-shadow: inset 0 0 0 1px var(--accent);
    border-color: var(--accent);
}

.gear-pdoll-icon { font-size: 1.1rem; line-height: 1; pointer-events: none; }

.gear-pdoll-lock {
    position: absolute;
    bottom: 2px; right: 3px;
    font-size: 0.55rem; line-height: 1;
    pointer-events: none;
    opacity: 0.75;
}

.gear-pdoll-count {
    position: absolute;
    top: 2px; right: 4px;
    font-size: 0.58rem; font-weight: 700;
    color: var(--accent);
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}

.gear-pdoll-label {
    font-size: 0.55rem;
    color: rgba(180,140,55,0.6);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    line-height: 1;
    white-space: nowrap;
}

/* Gear slot detail modal */
#gear-slot-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#gear-slot-modal.open { display: flex; }
#gear-slot-modal-box {
    background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(20,20,40,0.95) 0%, var(--surface) 55%);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(340px, 92vw); max-height: 70vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#gear-slot-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
    gap: 10px;
}
#gear-slot-modal-title { margin: 0; font-size: 1rem; letter-spacing: 0.05em; }
#gear-slot-modal-subtitle { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.09em; margin-top: 3px; }
#gear-slot-modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; flex-shrink: 0; padding: 2px; }
#gear-slot-modal-body { padding: 14px 16px 18px; }

.gear-sm-stats { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.gear-sm-actions { display: flex; gap: 8px; }

.gear-sm-lock-btn {
    flex: 1; padding: 6px 10px; font-size: 0.76rem; border-radius: 6px;
    border: 1px solid var(--border); background: var(--surface2); color: var(--text);
    cursor: pointer; transition: border-color 0.1s;
}
.gear-sm-lock-btn:hover { border-color: var(--accent); }

.gear-sm-unequip-btn {
    flex: 1; padding: 6px 10px; font-size: 0.76rem; border-radius: 6px;
    border: 1px solid rgba(239,68,68,0.4); background: none; color: rgba(239,68,68,0.8);
    cursor: pointer; transition: border-color 0.1s, color 0.1s;
}
.gear-sm-unequip-btn:hover { border-color: #ef4444; color: #ef4444; }

/* Gear loot picker modal */
#gear-loot-picker-modal {
    display: none; position: fixed; inset: 0; z-index: 300;
    background: rgba(14,14,20,0.85); align-items: center; justify-content: center;
}
#gear-loot-picker-modal.open { display: flex; }
#gear-loot-picker-box {
    background: radial-gradient(ellipse 120% 60% at 50% 0%, rgba(20,20,40,0.95) 0%, var(--surface) 55%);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(360px, 92vw); max-height: 70vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#gear-loot-picker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
#gear-loot-picker-title { margin: 0; font-size: 0.92rem; color: var(--accent2); letter-spacing: 0.06em; text-transform: uppercase; }
#gear-loot-picker-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
#gear-loot-picker-body { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }

.gear-loot-pick-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px;
    background: var(--surface2); border: 1px solid var(--border);
    text-align: left; cursor: pointer; width: 100%;
    transition: border-color 0.1s;
}
.gear-loot-pick-item:hover { border-color: var(--accent); }
.gear-loot-pick-quality { font-size: 0.75rem; flex-shrink: 0; }
.gear-loot-pick-name    { font-size: 0.8rem; font-weight: 600; flex: 1; min-width: 0; }
.gear-loot-pick-stat    { font-size: 0.68rem; color: var(--hp-green); flex-shrink: 0; white-space: nowrap; }

/* ── Pixel sprites (16x16.png) ───────────────────────────────────────────── */
.spr {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url('16x16.png');
  background-repeat: no-repeat;
  image-rendering: pixelated;
  vertical-align: -3px;
  flex-shrink: 0;
}
.spr-sword     { background-position:    0px  -720px; } /* r45 c0  crossed swords */
.spr-shield    { background-position:  -64px  -848px; } /* r53 c4  orange shield  */
.spr-skull     { background-position: -208px  -848px; } /* r53 c13 gray skull     */
.spr-gem       { background-position:    0px  -160px; } /* r10 c0  blue gem       */
.spr-trophy    { background-position:    0px   -64px; } /* r4  c0  gold trophy    */
.spr-bag       { background-position: -208px  -144px; } /* r9  c13 money bag      */
.spr-coin      { background-position:    0px  -128px; } /* r8  c0  coin           */
.spr-clover    { background-position:  -16px  -112px; } /* r7  c1  green clover   */
.spr-flame     { background-position:  -48px  -752px; } /* r47 c3  orange flame   */
.spr-book      { background-position:    0px  -288px; } /* r18 c0  red book       */
.spr-chest     { background-position: -128px     0px; } /* r0  c8  blue chest     */
.spr-castle    { background-position:  -32px   -32px; } /* r2  c2  dungeon tower  */
.spr-flag      { background-position: -144px   -32px; } /* r2  c9  green pennant  */
.spr-redflag   { background-position: -176px   -32px; } /* r2  c11 red pennant    */
.spr-crown     { background-position: -112px  -704px; } /* r44 c7  gold crown     */
.spr-eye       { background-position: -224px  -704px; } /* r44 c14 red eye        */
.spr-boot      { background-position: -192px -1840px; } /* r115 c12 dark boot     */
.spr-robe      { background-position:    0px -2080px; } /* r130 c0  orange robe   */
.spr-moon      { background-position: -112px     0px; } /* r0  c7  crescent moon  */
.spr-sparkle   { background-position: -144px  -960px; } /* r60 c9  4-point star   */
.spr-warning   { background-position:    0px  -672px; } /* r42 c0  skull+cross    */
.spr-bow       { background-position:  -80px -1744px; } /* r109 c5 dark bow       */
.spr-dagger    { background-position:  -16px   -80px; } /* r5  c1  dagger         */
.spr-orb       { background-position:  -96px  -704px; } /* r44 c6  blue orb       */
.spr-lightning { background-position:    0px -1024px; } /* r64 c0  lightning bolt */
.spr-herb      { background-position:  -48px  -240px; } /* r15 c3  herb/plant     */
.spr-blood     { background-position:  -80px  -736px; } /* r46 c5  blood drop     */
.spr-scroll    { background-position: -128px   -96px; } /* r6  c8  scroll         */
.spr-armor     { background-position:    0px   -96px; } /* r6  c0  pauldron       */
.spr-heart     { background-position:  -32px  -656px; } /* r41 c2  red heart      */
.spr-ring      { background-position:  -80px -1840px; } /* r115 c5 ring+gem       */
.spr-helmet    { background-position:    0px -2000px; } /* r125 c0 orange hat     */

/* ── §3: anything a player counts ──────────────────────────────────────────
   Mono, tabular figures so digits don't jitter as values tick. See #54. */
#stat-gold, #stat-idle-rate, #stat-dungeon-num, #stat-level, #stat-best,
#stat-kills, #stat-deaths, #stat-corruption-dps, #stat-party-hp, #stat-party-dps,
#enemy-hp-text, #mobile-party-hp-text,
#depth-label-top, #depth-label-bottom, #depth-current-label, #depth-highest-label,
#lt-kills, #lt-deaths, #lt-best, #lt-prestiges, #lt-dungeon,
.pdd-val, .stat-row span:last-child {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
