*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --rose: #c0356a;
    --rose-light: #e8628e;
    --rose-dark: #7a1a40;
    --rose-pale: #f0a0c0;
    --thorn: #1a0a14;
    --thorn-mid: #2d0f22;
    --thorn-light: #4a1a30;
    --gold: #c08040;
    --gold-light: #e0b060;
    --purple: #7a2a90;
    --purple-light: #b070d0;
    --text: #e8d0d8;
    --text-muted: #907080;
    --text-dim: #5a3045;
    --border: rgba(192, 53, 106, 0.25);
    --border-strong: rgba(192, 53, 106, 0.5);
    --bg-dark: #0d0508;
    --transition-speed: 0.35s;
}

html, body {
    height: 100%;
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Crimson Pro', Georgia, serif;
    overflow: hidden;
}

/* ── PAGE LOADER ── */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #090305;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-rose {
    font-family: 'Cinzel Decorative', serif;
    font-size:3.3rem;
    color: var(--rose-light);
    text-shadow: 0 0 15px var(--rose-dark);
    margin-bottom: 20px;
    animation: pulse-glow 2s infinite ease-in-out;
}

.loader-bar {
    width: 200px;
    height: 2px;
    background: rgba(192, 53, 106, 0.1);
    position: relative;
    overflow: hidden;
    border-radius: 1px;
}

.loader-progress {
    position: absolute;
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, transparent, var(--rose-light), transparent);
    animation: loading-bar 1.5s infinite linear;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.98);
        text-shadow: 0 0 10px var(--rose-dark);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
        text-shadow: 0 0 25px var(--rose);
    }
}

@keyframes loading-bar {
    0% {
        left: -50%;
    }
    100% {
        left: 100%;
    }
}

/* ── LAYOUT ── */
.app {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 64px 1fr;
    height: 100vh;
    width: 100vw;
}

/* ── TOP BAR ── */
.topbar {
    grid-column: 1 / -1;
    background: linear-gradient(90deg, #0d0508 0%, #1a0a14 40%, #0d0508 100%);
    border-bottom: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.topbar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0px, transparent 80px, rgba(192, 53, 106, 0.03) 80px, rgba(192, 53, 106, 0.03) 81px);
    pointer-events: none;
}

.topbar-logo {
    font-family: 'Cinzel Decorative', serif;
    font-size:19.8px;
    letter-spacing: 0.3em;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
}

.topbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}

.topbar-title {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    letter-spacing: 0.08em;
    color: var(--rose-pale);
    flex: 1;
}

.topbar-badge {
    font-size:18.7px;
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-strong);
    color: var(--rose-light);
    background: rgba(192, 53, 106, 0.1);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.topbar-tag {
    font-size:19.8px;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid rgba(192, 53, 106, 0.3);
    color: var(--text-muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ── SIDEBAR ── */
.sidebar {
    background: linear-gradient(180deg, #120810 0%, #0d0508 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 3px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--rose-dark);
    border-radius: 2px;
}

.char-card {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
}

.char-avatar-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 1rem;
}

.char-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #4a1a30 0%, #1a0810 100%);
    border: 2px solid var(--rose);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel Decorative', serif;
    font-size:35.2px;
    color: var(--rose-light);
    position: relative;
    overflow: hidden;
}

.char-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(232, 98, 142, 0.15) 0%, transparent 60%);
}

.char-avatar-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    object-position: 60% 15%;
    border: 2px solid var(--rose);
    display: block;
    position: relative;
    z-index: 5;
    transition: transform 0.5s ease;
}

.char-avatar-wrap:hover .char-avatar-img {
    transform: scale(1.05);
}

.avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(192, 53, 106, 0.4);
    animation: ring-pulse 3s ease-in-out infinite;
    z-index: 1;
}

.avatar-ring2 {
    position: absolute;
    inset: -9px;
    border-radius: 50%;
    border: 1px solid rgba(192, 53, 106, 0.2);
    animation: ring-pulse 3s ease-in-out infinite 1s;
    z-index: 1;
}

@keyframes ring-pulse {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.03);
    }
}

.char-name {
    font-family: 'Cinzel Decorative', serif;
    font-size:19.8px;
    color: var(--rose-pale);
    line-height: 1.3;
    margin-bottom: 4px;
}

.char-subtitle {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    letter-spacing: 0.14em;
    color: var(--rose);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
}

.stat-box {
    background: rgba(192, 53, 106, 0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-box:hover {
    background: rgba(192, 53, 106, 0.15);
    border-color: rgba(192, 53, 106, 0.5);
    transform: translateY(-2px);
}

.stat-v {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    color: var(--rose-light);
    display: block;
    line-height: 1;
}

.stat-l {
    font-size:18.7px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: block;
    margin-top: 2px;
}

/* ── SIDEBAR NAV ── */
.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.nav-section-label {
    font-size:18.7px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0.5rem 1.25rem 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 1.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    font-size:18.7px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    user-select: none;
}

.nav-item:hover {
    color: var(--rose-pale);
    background: rgba(192, 53, 106, 0.05);
    padding-left: 1.55rem;
}

.nav-item.active {
    color: var(--rose-pale);
    border-left-color: var(--rose);
    background: rgba(192, 53, 106, 0.08);
}

.nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rose);
    flex-shrink: 0;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.nav-item.active .nav-dot {
    opacity: 1;
    box-shadow: 0 0 8px var(--rose-light);
    background: var(--rose-light);
}

/* ── SIDEBAR IDENTITY TABLE ── */
.id-table {
    padding: 0 1.25rem 1rem;
}

.id-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(192, 53, 106, 0.1);
    font-size:19.8px;
}

.id-row:last-child {
    border-bottom: none;
}

.id-key {
    color: var(--text-muted);
}

.id-val {
    color: var(--text);
    text-align: right;
    max-width: 55%;
}

.id-val.accent {
    color: var(--rose-light);
}

/* ── MAIN CONTENT ── */
.main {
    overflow-y: auto;
    overflow-x: hidden;
    background: #0d0508;
    position: relative;
}

.main::-webkit-scrollbar {
    width: 4px;
}

.main::-webkit-scrollbar-track {
    background: transparent;
}

.main::-webkit-scrollbar-thumb {
    background: var(--rose-dark);
    border-radius: 2px;
}

.main::before {
    content: '';
    position: fixed;
    top: 64px;
    left: 280px;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 80% 10%, rgba(192, 53, 106, 0.06) 0%, transparent 50%), radial-gradient(ellipse at 10% 80%, rgba(122, 42, 144, 0.04) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* ── TAB CONTENT TRANSITIONS ── */
.tab-content {
    display: none;
    padding: 2rem;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.tab-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ── SECTION HEADERS ── */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.section-header h2 {
    font-family: 'Cinzel', serif;
    font-size:19.8px;
    font-weight: 600;
    color: var(--rose-pale);
    letter-spacing: 0.06em;
}

.header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong) 0%, transparent 100%);
}

.header-rose {
    color: var(--rose);
    font-size:19.8px;
}

/* ── LORE TAB ── */
.lore-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.lore-block {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.lore-block-title {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rose);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.lore-body {
    font-size:19.8px;
    line-height: 1.9;
    color: #c0a0a8;
}

.lore-body strong {
    color: var(--text);
    font-weight: 600;
}

.lore-body em {
    color: var(--rose-light);
    font-style: italic;
}

.lore-full {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.quote-block {
    border-left: 2px solid var(--rose);
    padding: 0.75rem 1.25rem;
    margin: 1rem 0;
    font-style: italic;
    font-size:18.7px;
    color: var(--rose-pale);
    background: rgba(192, 53, 106, 0.05);
    border-radius: 0 6px 6px 0;
}

.warning-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(160, 40, 40, 0.1);
    border: 1px solid rgba(200, 60, 60, 0.3);
    border-radius: 6px;
    padding: 12px 16px;
    font-size:18.7px;
    color: #c09090;
}

.warning-icon {
    color: #e06060;
    flex-shrink: 0;
    font-size:19.8px;
    margin-top: 1px;
}

/* ── ABILITIES TAB ── */
.ability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.ability-card {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.1rem 1.35rem;
    border-left: 3px solid var(--rose);
    transition: all 0.3s ease;
}

.ability-card:hover {
    background: rgba(28, 12, 22, 0.9);
    border-color: rgba(232, 98, 142, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.ability-card.ultimate {
    border-left-color: #e060a0;
}

.ability-card.passive {
    border-left-color: #3a8060;
}

.ability-card.curse {
    border-left-color: var(--purple);
}

.ability-card.signature {
    border-left-color: var(--gold);
}

.ab-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 8px;
}

.ab-name {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    color: var(--text);
    line-height: 1.3;
}

.ab-tag {
    font-size:18.7px;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.tag-active {
    background: rgba(192, 53, 106, 0.15);
    border-color: var(--rose);
    color: var(--rose-light);
}

.tag-ultimate {
    background: rgba(200, 60, 150, 0.15);
    border-color: #e060a0;
    color: #f080c0;
}

.tag-passive {
    background: rgba(40, 100, 70, 0.15);
    border-color: #3a8060;
    color: #60b090;
}

.tag-curse {
    background: rgba(100, 40, 120, 0.15);
    border-color: var(--purple);
    color: var(--purple-light);
}

.tag-signature {
    background: rgba(160, 100, 20, 0.15);
    border-color: var(--gold);
    color: var(--gold-light);
}

.ab-kanji {
    font-size:18.7px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-style: italic;
}

.ab-desc {
    font-size:18.7px;
    color: #c0a0a8;
    line-height: 1.9;
}

.ab-note {
    font-size:18.7px;
    color: var(--rose);
    margin-top: 6px;
    font-style: italic;
}

/* ── PROGRESSION ── */
.prog-track {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
}

.prog-node {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-right: none;
    position: relative;
    transition: background 0.2s;
}

.prog-node:first-child {
    border-radius: 8px 0 0 8px;
}

.prog-node:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 8px 8px 0;
}

.prog-node.current {
    background: rgba(192, 53, 106, 0.12);
    border-color: var(--rose);
    border-right: 1px solid var(--rose);
}

.prog-node.current + .prog-node {
    border-left: none;
}

.prog-node.locked {
    opacity: 0.5;
}

.prog-tier {
    font-size:18.7px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    display: block;
    margin-bottom: 3px;
}

.prog-name {
    font-family: 'Cinzel', serif;
    font-size:19.8px;
    color: var(--text-muted);
    display: block;
}

.prog-node.current .prog-name {
    color: var(--rose-light);
}

.prog-node.current .prog-tier {
    color: var(--rose);
}

.prog-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--rose);
    margin: 6px auto 0;
    box-shadow: 0 0 8px var(--rose);
    animation: ring-pulse 2s infinite;
}

/* ── LOCATION TAB ── */
.location-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.loc-card {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.loc-header {
    background: rgba(192, 53, 106, 0.08);
    border-bottom: 1px solid var(--border);
    padding: 12px 1.35rem;
    font-family: 'Cinzel', serif;
    font-size:19.8px;
    letter-spacing: 0.08em;
    color: var(--rose-pale);
    display: flex;
    align-items: center;
    gap: 8px;
}

.loc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 6px var(--rose);
    flex-shrink: 0;
}

.loc-body {
    padding: 1.25rem;
    font-size:18.7px;
    color: #c0a0a8;
    line-height: 1.85;
}

.map-placeholder {
    background: rgba(10, 4, 8, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
}

.map-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 35% 55%, rgba(192, 53, 106, 0.2) 0%, transparent 30%), radial-gradient(circle at 75% 30%, rgba(122, 42, 144, 0.1) 0%, transparent 25%), radial-gradient(circle at 20% 20%, rgba(80, 20, 40, 0.15) 0%, transparent 20%);
}

.map-grid {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(192, 53, 106, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(192, 53, 106, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

.map-pin {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 12px var(--rose), 0 0 24px rgba(192, 53, 106, 0.4);
    animation: ring-pulse 2s infinite;
}

.map-pin::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(192, 53, 106, 0.4);
}

.map-label {
    position: absolute;
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    letter-spacing: 0.1em;
    color: var(--rose-pale);
    text-transform: uppercase;
    white-space: nowrap;
}

.map-label2 {
    position: absolute;
    font-size:18.7px;
    color: var(--text-muted);
    white-space: nowrap;
}

.map-caption {
    position: relative;
    z-index: 1;
    font-family: 'Cinzel', serif;
    font-size:19.8px;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ── DREAMEATER TAB ── */
.dreameater-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.de-card {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    border-top: 3px solid var(--purple);
    transition: all 0.3s ease;
}

.de-card:hover {
    transform: translateY(-3px);
    border-top-color: var(--purple-light);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.de-header {
    background: rgba(122, 42, 144, 0.1);
    padding: 12px 1.1rem;
    border-bottom: 1px solid rgba(122, 42, 144, 0.2);
}

.de-name {
    font-family: 'Cinzel', serif;
    font-size:19.8px;
    color: var(--purple-light);
    display: block;
    margin-bottom: 2px;
}

.de-threat {
    font-size:19.8px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.de-body {
    padding: 1rem;
    font-size:18.7px;
    color: #c0a0a8;
    line-height: 1.85;
}

.de-counter {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(122, 42, 144, 0.2);
    font-size:18.7px;
    color: var(--rose-light);
    font-style: italic;
}

/* ── PARTY TAB ── */
.party-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.party-card {
    background: rgba(18, 8, 16, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 320px;
}

.party-card:hover {
    border-color: var(--rose);
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(192, 53, 106, 0.15);
}

.party-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel Decorative', serif;
    font-size:22px;
    border: 2px solid;
    transition: transform 0.3s ease;
}

.party-card:hover .party-avatar {
    transform: scale(1.1);
}

.party-name {
    font-family: 'Cinzel', serif;
    font-size:18.7px;
    color: var(--text);
    margin-bottom: 3px;
}

.party-role {
    font-size:19.8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.party-desc {
    font-size:16.5px;
    color: #a08090;
    line-height: 1.6;
    flex-grow: 1;
}

.party-tag {
    display: inline-block;
    font-size:18.7px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
    margin-top: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    align-self: center;
}

/* ── DECORATIVE ELEMENTS ── */
.petal-separator {
    text-align: center;
    color: var(--rose-dark);
    letter-spacing: 12px;
    font-size:19.8px;
    margin: 1rem 0;
    opacity: 0.5;
}

.thorn-line {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border-strong) 20%, var(--border-strong) 80%, transparent 100%);
    margin: 1.25rem 0;
    position: relative;
}

.thorn-line::before {
    content: '✦';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #0d0508;
    padding: 0 8px;
    color: var(--rose);
    font-size:19.8px;
}


/* ── MAP INTERACTIVE MODAL ── */
.map-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.map-container:hover {
    transform: scale(1.02);
    border-color: var(--rose-light);
    box-shadow: 0 0 20px rgba(192, 53, 106, 0.4);
}

.map-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 3, 5, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.map-modal.show {
    display: flex;
    opacity: 1;
}

.modal-content-wrapper {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    background: #120810;
    border: 2px solid var(--rose);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 0 35px rgba(192, 53, 106, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.map-modal.show .modal-content-wrapper {
    transform: scale(1);
}

.modal-map-box {
    width: 100%;
    height: 100%;
    position: relative;
}

.modal-map-box .map-container {
    width: 100% !important;
    height: 100% !important;
    cursor: default;
}

.modal-map-box .map-container:hover {
    transform: none;
padding: 1rem;
    font-size:18.7px;
    color: #c0a0a8;
    line-height: 1.85;
}

.de-counter {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(122, 42, 144, 0.2);
    font-size:18.7px;
    color: var(--rose-light);
    font-style: italic;
}

/* ── DUNGEON MINIGAME TAB ── */
.game-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
    height: calc(100vh - 120px);
    min-height: 420px;
}

.game-board-panel {
    background: rgba(10, 4, 8, 0.95);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    justify-self: center;
    position: relative;
    overflow: hidden;
}

.board-scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom Scrollbar for Board Scroll Wrapper */
.board-scroll-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.board-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(18, 8, 16, 0.3);
    border-radius: 4px;
}
.board-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(192, 53, 106, 0.3);
    border: 1px solid rgba(192, 53, 106, 0.5);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.board-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(192, 53, 106, 0.6);
    border-color: rgba(192, 53, 106, 0.8);
}

/* Zoom Controls Overlay */
.board-zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(20, 8, 16, 0.85);
    border: 1px solid rgba(192, 53, 106, 0.4);
    border-radius: 6px;
    padding: 4px 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(192, 53, 106, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.board-zoom-controls button {
    background: rgba(192, 53, 106, 0.15);
    border: 1px solid rgba(192, 53, 106, 0.35);
    color: var(--rose-pale);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    user-select: none;
}

.board-zoom-controls button:hover {
    background: var(--rose);
    border-color: var(--rose-light);
    color: var(--text);
    box-shadow: 0 0 8px var(--rose);
}

.board-zoom-controls button:active {
    transform: scale(0.95);
}

.zoom-value-label {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: var(--rose-pale);
    min-width: 44px;
    text-align: center;
    font-weight: bold;
    user-select: none;
}


.dungeon-board {
    width: 600px;
    height: 600px;
    border: 1px solid var(--border);
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    transform: scale(1.12);
    margin: 36px;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
}

.dungeon-board-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-color: transparent;
    background-image: 
        linear-gradient(rgba(192, 53, 106, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(192, 53, 106, 0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    transition: filter 0.5s ease;
}

.board-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    transition: background 0.2s ease;
}

.board-overlay.flash-red {
    background: rgba(180, 40, 40, 0.4);
}

.board-overlay.flash-white {
    background: rgba(255, 255, 255, 0.6);
}

.board-overlay.flash-magenta {
    background: rgba(232, 98, 142, 0.4);
}

.game-token {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: absolute;
    z-index: 5;
    transition: left 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), top 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.2s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-token {
    width: 76px !important;
    height: 76px !important;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--rose-light);
    box-shadow: 0 0 12px var(--rose);
}

.player-token img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.monster-token {
    border: 2px solid var(--purple-light);
    background: #250a30;
    box-shadow: 0 0 10px var(--purple);
    font-size:35.2px;
    color: var(--purple-light);
    display: none;
}

.token-glow {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(192, 53, 106, 0.3);
    animation: ring-pulse 2s infinite ease-in-out;
    pointer-events: none;
}

.monster-token .token-glow {
    border-color: rgba(176, 112, 208, 0.3);
}

/* Controls Panel */
.game-controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    justify-content: space-between;
    overflow-y: auto;
    padding-right: 4px;
}

.game-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.game-stat-card {
    background: rgba(18, 8, 16, 0.85);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.game-stat-card .stat-title {
    font-size: 16.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 2px;
}

.game-stat-card .stat-value {
    font-family: 'Cinzel', serif;
    font-size: 26px;
    color: var(--rose-pale);
    font-weight: bold;
}

/* Dice Roller Section */
.dice-section {
    background: rgba(18, 8, 16, 0.85);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.d20-container {
    width: 80px;
    height: 80px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.d20-container:hover {
    transform: scale(1.08);
}

.d20-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 5px rgba(192, 53, 106, 0.5));
    transition: filter 0.2s ease;
}

.d20-container:hover .d20-svg {
    filter: drop-shadow(0 0 8px var(--rose-light));
}

.d20-svg.roll-animation {
    animation: spin-dice 0.8s ease-out;
}

.dice-number {
    position: absolute;
    font-family: 'Cinzel', serif;
    font-size:24.2px;
    font-weight: bold;
    color: var(--text);
    text-shadow: 0 2px 4px #000;
    pointer-events: none;
    z-index: 2;
}

@keyframes spin-dice {
    0% { transform: rotate(0deg) scale(0.8); }
    30% { transform: rotate(360deg) scale(1.2); }
    70% { transform: rotate(720deg) scale(0.9); }
    100% { transform: rotate(1080deg) scale(1); }
}

.action-btn-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 1rem;
}

.action-btn {
    width: 100%;
    max-width: 180px;
    background: linear-gradient(135deg, var(--rose-dark) 0%, var(--rose) 100%);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-family: 'Cinzel', serif;
    font-size: 19px;
    letter-spacing: 0.1em;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    text-transform: uppercase;
}

.action-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--rose) 0%, var(--rose-light) 100%);
    box-shadow: 0 4px 15px rgba(192,53,106,0.3);
    transform: translateY(-2px);
}

.action-btn:active:not(:disabled) {
    transform: translateY(0);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #2b141d;
    border-color: rgba(192, 53, 106, 0.1);
}

/* Combat Log Section */
.combat-log-container {
    background: rgba(10, 4, 8, 0.95);
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 180px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.combat-log-container .log-header {
    background: rgba(192, 53, 106, 0.08);
    border-bottom: 1px solid var(--border);
    padding: 6px 12px;
    font-family: 'Cinzel', serif;
    font-size: 15.5px;
    letter-spacing: 0.1em;
    color: var(--rose-pale);
    text-transform: uppercase;
}

.combat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 17.5px;
    line-height: 1.4;
    text-align: left;
}

.combat-log::-webkit-scrollbar {
    width: 3px;
}

.combat-log::-webkit-scrollbar-thumb {
    background: var(--rose-dark);
}

.log-entry {
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.log-entry.system {
    color: var(--text-muted);
    border-left-color: var(--text-dim);
}

.log-entry.explore {
    color: var(--gold-light);
    border-left-color: var(--gold);
}

.log-entry.encounter {
    color: var(--purple-light);
    border-left-color: var(--purple);
    font-weight: 600;
}

.log-entry.roll {
    color: var(--text);
    border-left-color: var(--text-muted);
}

.log-entry.cast-fumble {
    color: #c09090;
    border-left-color: #8b2525;
}

.log-entry.cast-average {
    color: #60b090;
    border-left-color: #3a8060;
}

.log-entry.cast-strong {
    color: var(--purple-light);
    border-left-color: var(--purple);
}

.log-entry.cast-critical {
    color: var(--gold-light);
    border-left-color: var(--gold);
}

.log-entry.cast-ultimate {
    color: #f080c0;
    border-left-color: #e060a0;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(240, 128, 192, 0.4);
}

.log-entry.victory {
    color: var(--rose-light);
    border-left-color: var(--rose);
    font-weight: bold;
}

.log-entry.defeat {
    color: #ff4040;
    border-left-color: #aa0000;
    font-weight: bold;
}

/* Floating Effects Layer */
.effect-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.floating-text {
    position: absolute;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size:17.6px;
    color: #ff4040;
    text-shadow: 0 2px 4px #000;
    animation: float-up 1.2s ease-out forwards;
}

.floating-text.heal {
    color: #40ff40;
}

.floating-text.spell {
    color: var(--rose-light);
    font-size:19.8px;
    text-shadow: 0 0 8px var(--rose);
}

@keyframes float-up {
    0% { transform: translateY(0) scale(0.8); opacity: 0; }
    20% { transform: translateY(-10px) scale(1.2); opacity: 1; }
    80% { transform: translateY(-30px) scale(1); opacity: 0.8; }
    100% { transform: translateY(-40px) scale(0.9); opacity: 0; }
}

/* Graphic Spell Visual Elements */
.spell-effect-vfx {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9;
}

.vfx-spin {
    border: 2px dashed var(--rose-light);
    box-shadow: 0 0 15px var(--rose);
    animation: vfx-spinning 0.6s linear forwards;
}

.vfx-root {
    background: radial-gradient(circle, rgba(122, 42, 144, 0.3) 0%, transparent 70%);
    border-radius: 0;
    animation: vfx-root-explode 0.6s ease-out forwards;
}

.vfx-lightning {
    background: transparent;
    border-left: 3px solid var(--gold-light);
    box-shadow: -2px 0 10px var(--gold);
    animation: vfx-lightning-strike 0.4s ease-in-out forwards;
    border-radius: 0;
}

.vfx-ultimate {
    background: radial-gradient(circle, rgba(232, 98, 142, 0.6) 0%, rgba(122, 42, 144, 0.4) 50%, transparent 70%);
    box-shadow: 0 0 30px var(--rose);
    animation: vfx-ult-explode 1.0s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes vfx-spinning {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.2); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1.8); opacity: 0; }
}

@keyframes vfx-root-explode {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

@keyframes vfx-lightning-strike {
    0% { height: 0; transform: translate(-50%, -100%); opacity: 0; }
    30% { opacity: 1; }
    70% { opacity: 1; }
    100% { height: 100px; transform: translate(-50%, 0); opacity: 0; }
}

@keyframes vfx-ult-explode {
    0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}


/* HP & SP Progress Bars */
.game-bars-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: -4px;
}

.bar-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bar-label {
    font-size: 15px;
    font-family: 'Cinzel', serif;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
}

.progress-bar-wrap {
    height: 10px;
    background: rgba(20, 10, 15, 0.9);
    border: 1px solid rgba(192, 53, 106, 0.15);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.hp-bar .bar-fill {
    background: linear-gradient(90deg, var(--rose-dark), var(--rose-light));
    box-shadow: 0 0 8px var(--rose-light);
}

.sp-bar .bar-fill {
    background: linear-gradient(90deg, #501570, #a050d0);
    box-shadow: 0 0 8px #b070d0;
}

/* Active Weapon Row */
.game-weapon-row {
    background: rgba(18, 8, 16, 0.5);
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size:14.3px;
}

.weapon-label {
    font-family: 'Cinzel', serif;
    color: var(--text-muted);
}

.weapon-value {
    font-family: 'Cinzel', serif;
    color: var(--gold-light);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(224, 176, 96, 0.3);
}

/* Soul Consume Section */
.soul-cast-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.soul-btn {
    background: rgba(30, 10, 20, 0.6);
    border: 1px solid rgba(192, 53, 106, 0.3);
    color: var(--rose-pale);
    font-family: 'Cinzel', serif;
    font-size:12.1px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.soul-btn:hover:not(:disabled) {
    background: rgba(192, 53, 106, 0.15);
    border-color: var(--rose-light);
    box-shadow: 0 0 8px rgba(192, 53, 106, 0.2);
    transform: translateY(-1px);
}

.soul-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(192, 53, 106, 0.1);
}

/* Spell Selection Deck */
.spell-selection-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spell-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-right: 0;
}

.spell-btn {
    background: rgba(18, 8, 16, 0.85);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    text-align: center;
    min-height: 90px;
}

.spell-btn:hover:not(:disabled) {
    border-color: var(--rose-strong);
    background: rgba(30, 12, 22, 0.85);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(192, 53, 106, 0.15);
}

.spell-btn.selected {
    background: rgba(192, 53, 106, 0.7) !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 128, 192, 0.8), inset 0 0 10px rgba(192, 53, 106, 0.6) !important;
    transform: scale(1.03);
}

.spell-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.4);
}

.spell-icon {
    font-size: 24px;
}

.spell-name {
    font-family: 'Cinzel', serif;
    font-size: 11.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.25;
    text-align: center;
}

.spell-cost {
    font-size: 13px;
    font-family: 'Cinzel', serif;
    opacity: 0.9;
    color: var(--rose-pale);
}

/* ── Spell type badges ── */
.spell-type-tag {
    font-family: 'Cinzel', serif;
    font-size: 8px;
    font-weight: bold;
    letter-spacing: 0.06em;
    border-radius: 3px;
    padding: 1px 5px;
    text-transform: uppercase;
    white-space: nowrap;
    margin-top: -2px;
}

.aoe-tag {
    background: rgba(30, 180, 100, 0.18);
    border: 1px solid rgba(40, 200, 110, 0.5);
    color: #50e090;
    text-shadow: 0 0 4px rgba(40, 200, 110, 0.5);
}

.single-tag {
    background: rgba(180, 50, 90, 0.12);
    border: 1px solid rgba(192, 53, 106, 0.3);
    color: #d08090;
}

.lifesteal-tag {
    background: rgba(220, 60, 120, 0.15);
    border: 1px solid rgba(240, 80, 140, 0.4);
    color: #f080b0;
    text-shadow: 0 0 4px rgba(240, 80, 140, 0.4);
}

/* ── AoE spell button accent ── */
.spell-btn.spell-aoe {
    border-left: 3px solid rgba(40, 200, 110, 0.7);
    background: rgba(14, 30, 20, 0.90);
}

.spell-btn.spell-aoe:hover:not(:disabled) {
    border-color: rgba(40, 220, 120, 0.9);
    box-shadow: 0 0 10px rgba(40, 200, 110, 0.25), inset 0 0 8px rgba(40, 200, 110, 0.08);
    background: rgba(20, 45, 28, 0.95);
}

.spell-btn.spell-aoe.selected {
    background: rgba(40, 200, 110, 0.6) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 15px rgba(120, 255, 160, 0.8), inset 0 0 10px rgba(40, 200, 110, 0.6) !important;
    transform: scale(1.03);
}

/* ── Lifesteal spell button accent ── */
.spell-btn.spell-single:hover:not(:disabled) {
    border-color: var(--rose-strong);
    box-shadow: 0 2px 8px rgba(192, 53, 106, 0.2);
}

/* Game Over & Loot Overlays */
.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 4, 8, 0.95);
    backdrop-filter: blur(8px);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.3s ease forwards;
}

.overlay-content {
    width: 90%;
    max-width: 360px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overlay-content h3 {
    font-family: 'Cinzel Decorative', serif;
    font-size:19.8px;
    color: var(--rose-pale);
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px var(--rose);
    margin-bottom: 4px;
}

.overlay-content h2 {
    font-family: 'Cinzel Decorative', serif;
    font-size:24.2px;
    color: var(--rose-light);
    text-shadow: 0 0 12px var(--rose-dark);
}

.loot-section-title {
    font-family: 'Cinzel', serif;
    font-size:12.1px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.loot-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.loot-card {
    background: rgba(20, 10, 16, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.loot-card:hover {
    border-color: var(--rose-light);
    box-shadow: 0 0 10px rgba(192,53,106,0.35);
    transform: translateY(-2px);
    background: rgba(40, 15, 25, 0.9);
}

.loot-card.selected {
    border-color: var(--gold-light) !important;
    background: rgba(60, 40, 20, 0.5) !important;
    box-shadow: 0 0 15px rgba(224, 176, 96, 0.4) !important;
}

.loot-icon {
    font-size:26.4px;
}

.loot-name {
    font-family: 'Cinzel', serif;
    font-size:14.3px;
    font-weight: bold;
    color: var(--text);
}

.loot-desc {
    font-size:12.1px;
    color: var(--gold-light);
}

.upgrade-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    margin: 8px 0;
}

.upgrade-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.upgrade-btn {
    background: linear-gradient(135deg, #1f0c15, #3a1222);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    color: var(--text);
    font-family: 'Cinzel', serif;
    font-size:13.2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-btn:hover {
    border-color: var(--rose-light);
    box-shadow: 0 0 8px rgba(192, 53, 106, 0.3);
    transform: translateY(-1px);
}

.upgrade-btn.selected {
    border-color: var(--rose-light) !important;
    background: rgba(122, 26, 64, 0.4) !important;
    box-shadow: 0 0 10px var(--rose) !important;
}

.overlay-desc {
    font-size:15.4px;
    color: var(--text-muted);
    line-height: 1.5;
}

.end-stats {
    background: rgba(18, 8, 16, 0.7);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Cinzel', serif;
    font-size:14.3px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.scoreboard-entry-form input {
    width: 100%;
    background: #12060b;
    border: 1px solid var(--border-strong);
    padding: 10px;
    border-radius: 4px;
    color: var(--text);
    font-family: 'Cinzel', serif;
    text-align: center;
    font-size:15.4px;
}

.scoreboard-entry-form input:focus {
    outline: none;
    border-color: var(--rose-light);
    box-shadow: 0 0 8px rgba(192,53,106,0.3);
}

/* Leaderboard / Annals — 30-day log */
.leaderboard-section {
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* Header row */
.annals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2px 6px;
}

.annals-title {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rose);
}

.annals-meta {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    font-style: italic;
}

/* Always-visible panel */
.leaderboard-box {
    background: rgba(10, 4, 8, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 6px;
    animation: fade-in 0.25s ease;
}

.annals-open {
    display: block !important;
    max-height: 200px;
    overflow-y: auto;
}

.annals-open::-webkit-scrollbar { width: 2px; }
.annals-open::-webkit-scrollbar-track { background: transparent; }
.annals-open::-webkit-scrollbar-thumb { background: var(--rose-dark); border-radius: 1px; }

/* Table */
.scoreboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size:13.2px;
    text-align: left;
}

.scoreboard-table th {
    font-family: 'Cinzel', serif;
    color: var(--rose-pale);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.scoreboard-table td {
    padding: 5px 0;
    color: #c0a0a8;
}

.scoreboard-table tr:hover td {
    color: var(--text);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 1rem;
        height: auto !important;
    }
    .game-controls-panel {
        width: 100%;
        max-width: 400px;
        height: auto !important;
        overflow-y: visible !important;
    }
}

/* Path Selection Modal Styling */
.path-overlay {
    z-index: 18;
}

.path-card {
    background: rgba(20, 10, 16, 0.95);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.path-card:hover {
    border-color: var(--rose-light);
    box-shadow: 0 0 12px rgba(192, 53, 106, 0.45);
    transform: translateY(-3px) scale(1.02);
    background: rgba(45, 12, 28, 0.9);
}

.path-dir {
    font-family: 'Cinzel', serif;
    font-size:12.1px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.path-name {
    font-family: 'Cinzel', serif;
    font-size:14.3px;
    font-weight: bold;
    color: var(--rose-pale);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.path-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size:12.1px;
    color: var(--text-dim);
    width: 100%;
    border-top: 1px dashed rgba(192, 53, 106, 0.2);
    padding-top: 6px;
}

.path-risk.low {
    color: #60c090;
    font-weight: bold;
}

.path-risk.medium {
    color: #40a0ff;
    font-weight: bold;
}

.path-risk.high {
    color: var(--rose-light);
    font-weight: bold;
    animation: text-pulse 1.5s infinite alternate;
}

.path-risk.mythic {
    color: #ffd700;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    animation: text-pulse 1s infinite alternate;
}

@keyframes text-pulse {
    from { text-shadow: 0 0 2px rgba(192, 53, 106, 0.2); }
    to { text-shadow: 0 0 6px rgba(192, 53, 106, 0.8); }
}

/* Level Clear Relic Choices Styling */
.relic-card {
    background: rgba(20, 10, 16, 0.95);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
    position: relative;
}

.relic-card:hover {
    transform: translateY(-3px) scale(1.02);
}

.relic-card.epic-card {
    border-color: rgba(144, 42, 192, 0.35);
}
.relic-card.epic-card:hover {
    border-color: #a050f0;
    box-shadow: 0 0 10px rgba(160, 80, 240, 0.45);
    background: rgba(35, 15, 45, 0.9);
}

.relic-card.legendary-card {
    border-color: rgba(192, 144, 42, 0.35);
}
.relic-card.legendary-card:hover {
    border-color: #e0a040;
    box-shadow: 0 0 12px rgba(224, 160, 64, 0.45);
    background: rgba(45, 30, 15, 0.9);
}

.relic-card.mythic-card {
    border-color: rgba(192, 42, 106, 0.35);
    animation: border-pulse-mythic 2s infinite alternate;
}
.relic-card.mythic-card:hover {
    border-color: #ff5080;
    box-shadow: 0 0 15px rgba(255, 80, 128, 0.6);
    background: rgba(50, 12, 30, 0.9);
}

@keyframes border-pulse-mythic {
    from { border-color: rgba(192, 42, 106, 0.35); }
    to { border-color: rgba(240, 70, 150, 0.7); }
}

.relic-rarity {
    font-family: 'Cinzel', serif;
    font-size:8.8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.relic-rarity.epic {
    background: rgba(144, 42, 192, 0.15);
    border: 1px solid rgba(160, 80, 240, 0.4);
    color: #c080ff;
}

.relic-rarity.legendary {
    background: rgba(192, 144, 42, 0.15);
    border: 1px solid rgba(224, 160, 64, 0.4);
    color: #ffd080;
}

.relic-rarity.mythic {
    background: rgba(192, 42, 106, 0.15);
    border: 1px solid rgba(240, 70, 150, 0.4);
    color: #ff80b0;
    animation: text-glow-mythic 1.5s infinite alternate;
}

@keyframes text-glow-mythic {
    from { text-shadow: 0 0 1px rgba(255, 128, 176, 0.2); }
    to { text-shadow: 0 0 4px rgba(255, 128, 176, 0.7); }
}

.relic-name {
    font-family: 'Cinzel', serif;
    font-size:12.1px;
    font-weight: bold;
    color: var(--text);
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.relic-desc {
    font-size:9.9px;
    color: var(--text-muted);
    line-height: 1.3;
}

.relic-badge {
    font-family: 'Cinzel', serif;
    font-size:9.9px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: default;
}

.relic-badge.epic {
    background: rgba(144, 42, 192, 0.1);
    border-color: rgba(160, 80, 240, 0.3);
    color: #c080ff;
}

.relic-badge.legendary {
    background: rgba(192, 144, 42, 0.1);
    border-color: rgba(224, 160, 64, 0.3);
    color: #ffd080;
}

.relic-badge.mythic {
    background: rgba(192, 42, 106, 0.1);
    border-color: rgba(240, 70, 150, 0.3);
    color: #ff80b0;
    text-shadow: 0 0 3px rgba(255, 128, 176, 0.4);
}

/* ── Equipped Items Grid ── */
.game-equip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
    background: rgba(18, 8, 16, 0.4);
    border: 1px solid rgba(192, 53, 106, 0.25);
    border-radius: 8px;
    padding: 8px;
}

.equip-slot {
    background: rgba(30, 10, 20, 0.65);
    border: 1px solid rgba(192, 53, 106, 0.2);
    border-radius: 6px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: help;
    transition: all 0.2s ease-in-out;
    min-width: 0;
}

.equip-slot:hover {
    border-color: rgba(192, 53, 106, 0.5);
    background: rgba(45, 15, 30, 0.85);
    box-shadow: 0 0 8px rgba(192, 53, 106, 0.3);
    transform: translateY(-1px);
}

.equip-slot-icon {
    font-size: 22px;
}

.equip-slot-label {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.equip-slot-name {
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: bold;
    color: var(--gold-light);
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95%;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ── Ring Swap Select Buttons ── */
.ring-swap-btn {
    background: rgba(18, 8, 16, 0.7);
    border: 1px solid rgba(192, 53, 106, 0.3);
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size:11px;
    padding: 6px 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ring-swap-btn:hover {
    background: rgba(192, 53, 106, 0.15);
    border-color: var(--rose-light);
    color: var(--text);
}

.ring-swap-btn.active-ring-choice {
    background: rgba(192, 53, 106, 0.35);
    border-color: var(--rose-light);
    color: var(--rose-pale);
    box-shadow: 0 0 8px rgba(192, 53, 106, 0.4);
    font-weight: bold;
}

/* ── Mob Health Bar Overlay ── */
.mob-hp-container {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    background: rgba(10, 4, 8, 0.95);
    border: 1px solid rgba(192, 53, 106, 0.3);
    border-radius: 3px;
    padding: 1px 2px;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mob-hp-label {
    font-size:7.7px;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    text-align: center;
    white-space: nowrap;
}

.mob-hp-bar-wrap {
    height: 4px;
    background: rgba(20, 10, 15, 0.9);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.mob-hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #902ac0, #d050a0);
    width: 100%;
    transition: width 0.2s ease;
}

/* ── Targeted & Dead Mob States ── */
.monster-token.targeted-mob {
    border-color: var(--gold-light) !important;
    box-shadow: 0 0 15px var(--gold), 0 0 5px var(--gold-light) !important;
    transform: scale(1.08);
}

.monster-token.targeted-mob .token-glow {
    border-color: rgba(224, 176, 96, 0.6) !important;
}

.monster-token.dead-mob {
    opacity: 0.35;
    filter: grayscale(1) blur(0.5px);
    pointer-events: none;
}

.monster-token.dead-mob .mob-hp-container {
    display: none;
}

/* ── Epic Monster Styling ── */
.epic-token {
    width: 120px !important;
    height: 120px !important;
    border-radius: 14px !important;
    font-size: 72px !important;
}

.epic-token .token-glow {
    border-radius: 18px !important;
}

.epic-token .mob-hp-container {
    width: 100px;
    bottom: -28px;
}

.epic-token .mob-hp-label {
    font-size: 9px;
}

.epic-token .mob-hp-bar-wrap {
    height: 6px;
}

/* Boss/epic name label — larger offset since token is 120px tall */
/* (Positioning is handled via JS inline styles, no override needed) */

/* ── ABILITY CARD HOVER EFFECTS & SPARK VFX ── */
.ability-card {
    position: relative;
    overflow: visible !important;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.ability-card:hover {
    transform: translateY(-4px) scale(1.01) !important;
    border-color: var(--rose-light) !important;
    box-shadow: 0 10px 20px rgba(192, 53, 106, 0.2) !important;
}

.ability-card::after {
    content: "✦ Click to Cast ✦";
    position: absolute;
    top: 10px;
    right: 10px;
    font-family: 'Cinzel', serif;
    font-size:8.8px;
    letter-spacing: 0.15em;
    color: var(--rose-pale);
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(18, 8, 16, 0.85);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    z-index: 8;
}

.ability-card:hover::after {
    opacity: 1;
}

/* Card Cast Pulse Glow */
.card-cast-active {
    animation: card-pulse-glow 0.6s ease-out;
}

@keyframes card-pulse-glow {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(192, 53, 106, 0); }
    30% { transform: scale(1.03); box-shadow: 0 0 25px rgba(232, 98, 142, 0.8); border-color: var(--rose-light); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(192, 53, 106, 0); }
}

/* New Rich Visual Effect Overlays */
.vfx-rose-growth {
    background: radial-gradient(circle, rgba(16, 180, 80, 0.4) 0%, rgba(192, 53, 106, 0.3) 50%, transparent 70%);
    box-shadow: 0 0 25px rgba(16, 180, 80, 0.6);
    animation: vfx-ult-explode 1.0s ease-out forwards;
}

.vfx-passive-roses {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.5) 0%, rgba(192, 53, 106, 0.4) 60%, transparent 80%);
    border: 1px dashed var(--rose);
    animation: vfx-spinning 0.8s ease-out forwards;
}

.vfx-harvest-glow {
    background: radial-gradient(circle, rgba(16, 180, 80, 0.3) 0%, rgba(176, 112, 208, 0.3) 50%, transparent 70%);
    box-shadow: 0 0 20px rgba(176, 112, 208, 0.5);
    animation: vfx-root-explode 0.8s ease-out forwards;
}

.vfx-skyburst {
    background: radial-gradient(circle, rgba(255, 128, 192, 0.6) 0%, rgba(122, 42, 144, 0.4) 60%, transparent 80%);
    box-shadow: 0 0 35px rgba(255, 128, 192, 0.8);
    animation: vfx-ult-explode 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

.vfx-coop {
    background: radial-gradient(circle, rgba(232, 98, 142, 0.6) 0%, rgba(16, 120, 240, 0.3) 50%, transparent 80%);
    box-shadow: 0 0 40px var(--rose);
    border: 2px double var(--rose-light);
    animation: vfx-ult-explode 1.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* VFX Particles Emitter */
.vfx-particle {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    user-select: none;
    font-size:15.4px;
    animation: vfx-particle-burst 1.0s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes vfx-particle-burst {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(var(--scale)) rotate(var(--rot));
        opacity: 0;
    }
}

/* Screen Shake Animation */
@keyframes screen-shake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-4px, 2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-3px, -3px); }
    40% { transform: translate(3px, 3px); }
    50% { transform: translate(-4px, 2px); }
    60% { transform: translate(4px, 1px); }
    70% { transform: translate(-2px, -3px); }
    80% { transform: translate(3px, 2px); }
    90% { transform: translate(-1px, -1px); }
    100% { transform: translate(0, 0); }
}

.shake-screen {
    animation: screen-shake 0.5s ease-in-out;
}

.board-overlay.flash-gold {
    background: rgba(224, 176, 96, 0.45);
}

/* ── RESPONSIVE GRID LAYOUTS ── */
.quote-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: center;
}

.lore-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.lore-grid-two-sub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.ability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
}

.location-grid-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ── MOBILE SIDEBAR toggle button & OVERLAY styles ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
}

.sidebar-toggle-btn span {
    width: 24px;
    height: 2px;
    background-color: var(--rose-pale);
    border-radius: 1px;
    transition: all 0.3s linear;
}

/* ── RESPONSIVE OVERRIDES ── */
@media (max-width: 768px) {
    /* Layout */
    .app {
        grid-template-columns: 1fr;
    }
    
    /* Topbar */
    .topbar-badge, .topbar-tag, .topbar-divider {
        display: none !important;
    }
    .topbar {
        padding: 0 1rem;
        gap: 0.5rem;
        justify-content: space-between;
    }
    .topbar-logo {
        font-size: 14.3px;
        letter-spacing: 0.15em;
    }
    .topbar-title {
        font-size: 13.2px;
        text-align: right;
        margin-right: 0.5rem;
        
        .action-btn-container {
            display: flex;
            flex-direction: column;
        }
    }
    
    /* Hamburger Menu Button */
    .sidebar-toggle-btn {
        display: flex;
    }
    
    /* Sidebar as fixed drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100%;
        z-index: 1001;
        transition: left 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.6);
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* Tab padding */
    .tab-content {
        padding: 1rem 0.5rem;
    }
    
    /* Grid system collapses */
    .quote-grid, .lore-grid-two, .lore-grid-two-sub, .ability-grid, .location-grid-three, .dreameater-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Party Grid */
    .party-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .party-grid {
        grid-template-columns: 1fr;
    }
    .topbar-title {
        display: none; /* Hide title on very small screens to fit logo */
    }
    .spell-name {
        font-size: 11px;
    }
    .spell-name span {
        font-size: 8px !important;
    }
    .spell-cost {
        font-size: 11px;
    }
    .spell-icon {
        font-size: 18px;
    }
    .spell-btn {
        min-height: 75px;
        padding: 6px 2px;
    }
    .equip-slot-icon {
        font-size: 16px;
    }
    .equip-slot-label {
        font-size: 9px;
    }
    .equip-slot-name {
        font-size: 10px;
    }
}

/* ── MOBILE COMBAT CONSOLE & TOGGLE BUTTON ── */
.game-board-panel {
    position: relative; /* Ensure absolute positioning works for combat console child */
}

.combat-console-toggle-btn {
    display: block;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--rose-dark) 0%, var(--rose) 100%);
    border: 2px solid var(--rose-light);
    color: var(--text);
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.08em;
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    z-index: 14;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7), 0 0 10px rgba(192, 53, 106, 0.4);
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
}

.combat-console-toggle-btn:hover {
    background: linear-gradient(135deg, var(--rose) 0%, var(--rose-light) 100%);
    box-shadow: 0 4px 20px rgba(192, 53, 106, 0.6);
    transform: translate(-50%, -2px) scale(1.03);
}

.combat-console-toggle-btn:active {
    transform: translate(-50%, 0) scale(1.0);
}

.mobile-combat-console {
    display: none;
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(10, 3, 7, 0.97);
    border: 1px solid var(--rose-light);
    border-radius: 10px;
    padding: 12px;
    z-index: 15;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.9), inset 0 0 12px rgba(192, 53, 106, 0.25);
    animation: slide-up 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.mobile-combat-console.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(192, 53, 106, 0.25);
    padding-bottom: 6px;
    margin-bottom: 4px;
}

.console-header span {
    font-family: 'Cinzel Decorative', serif;
    font-size: 12px;
    color: var(--rose-pale);
    letter-spacing: 0.1em;
}

.close-console-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.close-console-btn:hover {
    color: var(--rose-light);
}

.console-content {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.mobile-console-grid {
    flex-grow: 1;
}

.mobile-console-dice {
    flex-shrink: 0;
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overrides inside the mobile combat console to ensure fits on 360px width screens */
.mobile-combat-console .spell-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
}

.mobile-combat-console .spell-btn {
    min-height: 52px !important;
    padding: 4px 2px !important;
    gap: 2px !important;
}

.mobile-combat-console .spell-icon {
    font-size: 15px !important;
}

.mobile-combat-console .spell-name {
    font-size: 9px !important;
    line-height: 1.1 !important;
}

.mobile-combat-console .spell-name span {
    display: none !important; /* Hide description tag to fit name */
}

.mobile-combat-console .spell-cost {
    font-size: 8px !important;
}

.mobile-combat-console .d20-container {
    width: 65px !important;
    height: 65px !important;
}

.mobile-combat-console .dice-number {
    font-size: 17px !important;
}

@keyframes slide-up {
    from { transform: translateY(80px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── active status overlays on board ── */
.board-status-effects {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    z-index: 15;
    pointer-events: none;
}

.status-effect-badge {
    background: rgba(18, 8, 16, 0.85);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    color: var(--rose-pale);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 0 10px rgba(192, 53, 106, 0.4);
    animation: pulse-glow 2s infinite ease-in-out;
    backdrop-filter: blur(5px);
}

/* Relic Buff Badges in HUD */
.status-effect-badge.relic-buff.epic {
    border-color: rgba(160, 80, 240, 0.4);
    box-shadow: 0 0 10px rgba(160, 80, 240, 0.3);
    color: #c080ff;
}
.status-effect-badge.relic-buff.legendary {
    border-color: rgba(224, 160, 64, 0.4);
    box-shadow: 0 0 10px rgba(224, 160, 64, 0.3);
    color: #ffd080;
}
.status-effect-badge.relic-buff.mythic {
    border-color: rgba(240, 70, 150, 0.5);
    box-shadow: 0 0 12px rgba(240, 70, 150, 0.4);
    color: #ff80b0;
}

/* ── Avatar Selection Modal ── */
.avatar-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 3, 5, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.avatar-modal.show {
    display: flex;
    opacity: 1;
}

.avatar-modal-content {
    background: rgba(18, 8, 16, 0.95);
    border: 2px solid var(--rose);
    border-radius: 12px;
    padding: 24px;
    width: 90vw;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 35px rgba(192, 53, 106, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.avatar-modal.show .avatar-modal-content {
    transform: scale(1);
}

.avatar-modal-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 18px;
    color: var(--rose-pale);
    text-align: center;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(192, 53, 106, 0.3);
    padding-bottom: 10px;
}

.avatar-modal-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    color: var(--rose);
    margin: 12px 0 6px 0;
    letter-spacing: 0.1em;
    border-left: 2px solid var(--rose);
    padding-left: 6px;
    font-weight: bold;
}

.avatar-row-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.avatar-select-card {
    position: relative;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    background: rgba(0,0,0,0.3);
}

.avatar-select-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.2s ease;
}

.avatar-select-card:hover img {
    transform: scale(1.05);
}

.avatar-select-card:hover {
    border-color: var(--rose-strong);
    box-shadow: 0 0 8px rgba(192, 53, 106, 0.4);
}

.avatar-select-card.selected {
    border-color: var(--rose-light) !important;
    box-shadow: 0 0 14px rgba(192, 53, 106, 0.8) !important;
}

.avatar-select-card .avatar-number {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--rose-pale);
    background: rgba(18, 8, 16, 0.85);
    border-radius: 3px;
    padding: 1px 4px;
    border: 1px solid var(--border);
    pointer-events: none;
}

/* Hover Change Avatar Trigger on Sidebar Card */
.char-avatar-wrap {
    position: relative;
    cursor: pointer;
}

.char-avatar-wrap::after {
    content: "Change Portrait";
    position: absolute;
    inset: 0;
    background: rgba(18, 8, 16, 0.8);
    color: var(--rose-pale);
    font-family: 'Cinzel', serif;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 50%;
    z-index: 5;
    border: 2px dashed var(--rose);
    box-sizing: border-box;
}

.char-avatar-wrap:hover::after {
    opacity: 1;
}

/* Token image overrides */
.game-token img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Stats Board HUD Overlay */
.board-stats-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 15;
    background: rgba(10, 4, 8, 0.85);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    gap: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 10px rgba(192, 53, 106, 0.25);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: none;
}

.board-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.board-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.board-stat-value {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: bold;
    color: var(--rose-pale);
    text-shadow: 0 0 5px rgba(192, 53, 106, 0.4);
}

/* Floating HP/SP Bars below Player Token */
.player-bars-container {
    position: absolute;
    bottom: -36px; /* Stacked below Vespia's circular portrait */
    left: 50%;
    transform: translateX(-50%);
    width: 80px; /* Slightly wider than the 76px player token for clean layout */
    background: rgba(10, 4, 8, 0.95);
    border: 1px solid rgba(192, 53, 106, 0.3);
    border-radius: 4px;
    padding: 2px 3px;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 8px rgba(192, 53, 106, 0.2);
}

.player-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
}

.player-bar-label {
    font-size: 7.5px;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
}

.player-bar-progress {
    height: 4px;
    background: rgba(20, 10, 15, 0.9);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

/* ── Monster Name Label (board-level sibling, not inside token) ── */
.mob-name-label {
    font-family: 'Cinzel', serif;
    font-size: 7.5px;
    font-weight: bold;
    color: #c8a8d4;
    white-space: nowrap;
    background: rgba(10, 4, 8, 0.85);
    border: 1px solid rgba(140, 70, 180, 0.3);
    border-radius: 3px;
    padding: 1px 4px;
    letter-spacing: 0.03em;
    text-shadow: 0 0 5px rgba(140, 70, 200, 0.5);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.mob-name-label.boss-label {
    color: #ffd080;
    border-color: rgba(230, 150, 30, 0.45);
    text-shadow: 0 0 6px rgba(230, 150, 30, 0.6);
    font-size: 8px;
    background: rgba(28, 10, 4, 0.92);
}

/* ── Avatar Lock Overlay ── */
.avatar-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 3, 6, 0.72);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 5;
    color: rgba(200, 140, 180, 0.8);
    font-family: 'Cinzel', serif;
    font-size: 18px;
    gap: 2px;
    pointer-events: none;
    border-radius: 4px;
}

.avatar-select-card.avatar-locked {
    border-color: rgba(100, 60, 80, 0.25) !important;
    cursor: not-allowed;
}

.avatar-select-card.avatar-locked:hover {
    border-color: rgba(100, 60, 80, 0.35) !important;
    box-shadow: none !important;
}


/* Targeting UI Effects */
.pulse-target {
    animation: pulse-target 1.5s infinite;
    cursor: crosshair !important;
}

@keyframes pulse-target {
    0% { box-shadow: 0 0 5px rgba(255, 60, 100, 0.4), inset 0 0 5px rgba(255, 60, 100, 0.2); border-color: rgba(255, 60, 100, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 60, 100, 1), inset 0 0 10px rgba(255, 60, 100, 0.8); border-color: rgba(255, 60, 100, 1); }
    100% { box-shadow: 0 0 5px rgba(255, 60, 100, 0.4), inset 0 0 5px rgba(255, 60, 100, 0.2); border-color: rgba(255, 60, 100, 0.5); }
}

.target-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(122, 26, 64, 0.9);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    border: 1px solid var(--rose-light);
    box-shadow: 0 0 10px rgba(192, 53, 106, 0.6);
    z-index: 25;
    pointer-events: none;
    animation: float-banner 2s ease-in-out infinite;
}

@keyframes float-banner {
    0%, 100% { top: 10px; }
    50% { top: 15px; }
}

/* Rarity Colors */
.rarity-common { color: #a0a0a0 !important; }
.rarity-uncommon { color: #40c870 !important; }
.rarity-rare { color: #40a0ff !important; }
.rarity-epic { color: #b060ff !important; }
.rarity-mythic { color: #ffd700 !important; text-shadow: 0 0 5px rgba(255, 215, 0, 0.5) !important; }
.rarity-cursed { color: #ff2020 !important; text-shadow: 0 0 6px rgba(255,30,30,0.7) !important; font-weight: bold !important; }
