/* ═══════════════════════════════════════════════════════════
   ETUDE — Design System
   Dark JRPG aesthetic. Cinematic. Punishing. Rewarding.
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
    /* Palette — deep space with neon accents */
    --rq-bg:            #05050e;
    --rq-bg-raised:     #0b0b18;
    --rq-bg-card:       #080812;
    --rq-border:        #1c1c30;
    --rq-border-subtle: #101020;

    --rq-text:          #d0d0e0;
    --rq-text-dim:      #787890;
    --rq-text-muted:    #3a3a55;

    --rq-accent:        #7B68EE;
    --rq-accent-dim:    #4a3ab0;
    --rq-accent-glow:   #7B68EE55;
    --rq-teal:          #00CED1;
    --rq-teal-glow:     #00CED155;
    --rq-green:         #39FF14;
    --rq-green-muted:   #1a3d1a;
    --rq-green-glow:    #39FF1430;
    --rq-red:           #ff3040;
    --rq-red-muted:     #3a0a0a;
    --rq-red-glow:      #ff304030;
    --rq-gold:          #FFD700;
    --rq-gold-dim:      #4a4a1a;
    --rq-gold-glow:     #FFD70040;

    /* Suit colors */
    --rq-spade:   #e0e0ee;
    --rq-heart:   #ff3040;
    --rq-diamond: #4db8ff;
    --rq-club:    #50fa7b;

    /* Type */
    --rq-font-mono:    'JetBrains Mono', 'Courier New', monospace;
    --rq-font-display: 'Crimson Pro', Georgia, serif;

    /* Spacing */
    --rq-gap: 16px;
    --rq-radius: 8px;
    --rq-radius-lg: 14px;
    --rq-radius-xl: 20px;

    /* Easing */
    --rq-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --rq-ease-snap: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --rq-duration: 0.25s;
}


/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--rq-font-mono);
    background: var(--rq-bg);
    color: var(--rq-text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Atmospheric haze — per-location gradient overlay */
body::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(
            ellipse at 30% 20%,
            rgba(123,104,238,0.06) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at 70% 80%,
            rgba(0,206,209,0.04) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at 50% 30%,
            transparent 40%,
            rgba(0,0,0,0.55) 100%
        );
    pointer-events: none; z-index: 0;
    transition: background 0.8s ease;
}

/* SVG noise texture overlay */
body::after {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    opacity: 0.5;
    pointer-events: none; z-index: 500;
}

a { color: var(--rq-accent); text-decoration: none; }
button { font-family: var(--rq-font-mono); cursor: pointer; }


/* ── Ambient Particles ──────────────────────────────────── */
.particles {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 1;
    overflow: hidden;
}
.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: rq-twinkle var(--dur, 6s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}
.particle--0  { width:2px; height:2px; background:var(--rq-accent); --dur:5s; }
.particle--1  { width:1px; height:1px; background:var(--rq-teal);   --dur:7s; }
.particle--2  { width:3px; height:3px; background:var(--rq-gold);   --dur:9s; }

.particle:nth-child(1)  { left:5%;  top:12%; --delay:0s; }
.particle:nth-child(2)  { left:15%; top:45%; --delay:0.8s; }
.particle:nth-child(3)  { left:25%; top:78%; --delay:1.2s; }
.particle:nth-child(4)  { left:35%; top:23%; --delay:0.3s; }
.particle:nth-child(5)  { left:45%; top:56%; --delay:2.1s; }
.particle:nth-child(6)  { left:55%; top:89%; --delay:0.6s; }
.particle:nth-child(7)  { left:65%; top:34%; --delay:1.8s; }
.particle:nth-child(8)  { left:75%; top:67%; --delay:0.4s; }
.particle:nth-child(9)  { left:85%; top:15%; --delay:2.5s; }
.particle:nth-child(10) { left:92%; top:50%; --delay:1.0s; }
.particle:nth-child(11) { left:10%; top:80%; --delay:1.5s; }
.particle:nth-child(12) { left:40%; top:10%; --delay:0.7s; }
.particle:nth-child(13) { left:60%; top:40%; --delay:2.3s; }
.particle:nth-child(14) { left:80%; top:75%; --delay:0.2s; }
.particle:nth-child(15) { left:50%; top:25%; --delay:1.9s; }


/* ── HUD ────────────────────────────────────────────────── */
.hud {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; gap: var(--rq-gap);
    padding: 10px 24px;
    background: rgba(5,5,14,0.92);
    border-bottom: 1px solid var(--rq-border);
    backdrop-filter: blur(20px);
    /* neon accent line at bottom */
    box-shadow: 0 1px 0 0 var(--rq-accent-glow), 0 4px 20px rgba(0,0,0,0.5);
}

.hud__brand {
    display: flex; align-items: center; gap: 8px;
    color: var(--rq-text); text-decoration: none;
    flex-shrink: 0;
}
.hud__brand-icon {
    color: var(--rq-accent); font-size: 18px;
    filter: drop-shadow(0 0 6px var(--rq-accent));
}
.hud__brand-text {
    font-size: 13px; font-weight: 800;
    letter-spacing: 2px; text-transform: uppercase;
    color: var(--rq-text);
}

.hud__player {
    display: flex; align-items: center; gap: 10px;
    margin-left: auto;
}
.hud__class-icon {
    font-size: 22px;
    filter: drop-shadow(0 0 8px var(--rq-accent));
    animation: rq-float-y 4s ease-in-out infinite;
}
.hud__info { }
.hud__class-name {
    font-size: 8px; letter-spacing: 2px;
    color: var(--rq-accent); text-transform: uppercase;
    text-shadow: 0 0 8px var(--rq-accent);
}
.hud__level { font-size: 14px; font-weight: 800; color: #fff; }

.hud__xp-bar {
    width: 180px; height: 14px;
    background: var(--rq-bg); border-radius: 7px;
    border: 1px solid var(--rq-border);
    position: relative; overflow: hidden;
}
.hud__xp-fill {
    height: 100%; border-radius: 7px;
    background: linear-gradient(90deg, var(--rq-accent) 0%, var(--rq-teal) 70%, var(--rq-green) 100%);
    transition: width 1s var(--rq-ease);
    box-shadow: 0 0 12px var(--rq-accent);
    position: relative; overflow: hidden;
}
/* Shimmer sweep — translateX only (compositor) */
.hud__xp-fill::after {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    will-change: transform;
    animation: rq-shimmer 2.5s ease-in-out infinite;
}
.hud__xp-text {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 700;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 3px #000;
    letter-spacing: 0.5px;
}

.hud__stats { display: flex; gap: 14px; flex-shrink: 0; }
.hud__stat { text-align: center; }
.hud__stat-value {
    display: block; font-size: 18px; font-weight: 800;
    color: var(--rq-accent);
    text-shadow: 0 0 10px var(--rq-accent);
}
.hud__stat-label {
    font-size: 7px; color: var(--rq-text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
}
.hud__mute-btn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; padding: 4px 6px;
    opacity: 0.6; transition: opacity 0.2s;
    align-self: center;
}
.hud__mute-btn:hover { opacity: 1; }
.hud__menu-btn {
    background: none; border: none; cursor: pointer;
    font-size: 18px; padding: 4px 6px;
    opacity: 0.6; transition: opacity 0.2s;
    align-self: center; color: var(--rq-text);
}
.hud__menu-btn:hover { opacity: 1; }

.music-arena__controls {
    display: flex; justify-content: center; margin: 10px 0;
}
.action-btn--replay {
    font-size: 12px; padding: 6px 16px;
    background: rgba(0, 206, 209, 0.12);
    border: 1px solid rgba(0, 206, 209, 0.3);
    color: var(--rq-teal, #00CED1);
}
.action-btn--replay:hover {
    background: rgba(0, 206, 209, 0.22);
    border-color: rgba(0, 206, 209, 0.5);
}


/* ── Main ───────────────────────────────────────────────── */
.main {
    position: relative; z-index: 2;
    max-width: 920px;
    margin: 0 auto;
    padding: 28px var(--rq-gap);
}
/* Hub needs more width for the world map */
.main:has(.hub__columns),
.main:has(.hub__world) {
    max-width: 1100px;
}


/* ── Cards (containers) ─────────────────────────────────── */
.card {
    background: var(--rq-bg-card);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
}
/* Subtle top-edge highlight */
.card::before {
    content: '';
    position: absolute; top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(123,104,238,0.3), transparent);
}
.card__glow {
    position: absolute; top: -60%; left: -60%;
    width: 220%; height: 220%;
    background: radial-gradient(ellipse at 30% 20%, var(--rq-accent) 0%, transparent 55%);
    opacity: 0.025;
    pointer-events: none;
}


/* ── Hub ────────────────────────────────────────────────── */
.hub { display: flex; flex-direction: column; gap: 24px; }

/* Legacy layout — kept for backward compat */
.hub__columns {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}

/* ── New Hub: Map-dominant layout ──────────────── */
.hub__world {
    margin-bottom: 16px;
}
.hub__world .world-map {
    aspect-ratio: 16 / 9;
    min-height: 480px;
}

.hub__identity {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(5,5,14,0.85);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius);
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
}
.identity__who {
    display: flex; align-items: center; gap: 10px;
}
.identity__icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px var(--rq-accent));
}
.identity__name-group {
    display: flex; flex-direction: column;
}
.identity__name {
    font-family: var(--rq-font-display);
    font-size: 18px; font-weight: 900; color: #fff;
}
.identity__class {
    font-size: 9px; letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--rq-accent);
}
.identity__xp {
    flex: 1; min-width: 120px; max-width: 260px;
}
.identity__streak {
    text-align: center;
}
.identity__streak-num {
    font-size: 20px; font-weight: 800;
    color: var(--rq-gold);
    text-shadow: 0 0 10px var(--rq-gold-glow);
    display: block; line-height: 1;
}
.identity__streak-label {
    font-size: 7px; color: var(--rq-text-muted);
    text-transform: uppercase; letter-spacing: 1px;
}
.identity__artifacts {
    display: flex; gap: 4px;
    margin-left: auto;
}

/* ── Hub Lore Whisper ──────────────────────────── */
.hub__lore {
    display: flex; align-items: baseline; gap: 12px;
    padding: 14px 20px;
    margin-top: 12px;
    background: rgba(123,104,238,0.03);
    border-left: 2px solid rgba(123,104,238,0.2);
    border-radius: 0 var(--rq-radius)
        var(--rq-radius) 0;
}
.hub__lore-title {
    font-family: var(--rq-font-display);
    font-size: 14px; font-weight: 700;
    color: var(--rq-accent); white-space: nowrap;
}
.hub__lore-text {
    font-family: var(--rq-font-display);
    font-size: 13px; color: var(--rq-text-dim);
    font-style: italic; line-height: 1.6;
}

/* ── Lorebook (details/summary) ────────────────── */
.hub__lorebook {
    margin-top: 12px;
}
.lorebook__toggle {
    font-size: 9px; color: var(--rq-text-muted);
    letter-spacing: 1px; cursor: pointer;
    padding: 8px 0;
    list-style: none;
}
.lorebook__toggle::marker { content: ''; }
.lorebook__toggle:hover { color: var(--rq-text-dim); }
.lorebook__entries {
    padding: 12px 0;
}

/* (wider hub is handled by .main:has rule above) */

/* ── Hub Fullscreen Mode ─────────────────────── */
/* Map fills the entire viewport, HUD overlays on top */
.hub-fullscreen .main {
    max-width: none;
    padding: 0;
    margin: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.hub-fullscreen .hub {
    gap: 0;
    height: 100vh;
    height: 100dvh;
}
.hub-fullscreen .hub__world {
    margin-bottom: 0;
    height: 100vh;
    height: 100dvh;
}
.hub-fullscreen .hub__world .world-map {
    aspect-ratio: auto;
    min-height: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
}

/* Narrative strip — floating overlay below HUD */
.hub__narrative-overlay {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    max-width: 600px;
    width: 90%;
    text-align: center;
    pointer-events: none;
}

/* Bottom HUD — identity, party, calendar overlay */
.hub__bottom-hud {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 80;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(
        0deg,
        rgba(5,5,14,0.7) 0%,
        rgba(5,5,14,0.3) 60%,
        transparent 100%
    );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}
.hub__bottom-hud > * {
    pointer-events: auto;
}
.hub__bottom-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.hub__bottom-center {
    flex: 1;
    display: flex;
    justify-content: center;
}
.hub__bottom-right {
    display: flex;
    align-items: center;
}

/* Hide old identity bar — replaced by bottom HUD */
.hub-fullscreen .hub__identity {
    display: none;
}

/* Mobile adjustments for fullscreen hub */
@media (max-width: 768px) {
    .hub-fullscreen .hud {
        padding: 4px 8px;
    }
    .hub__bottom-hud {
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        flex-wrap: wrap;
        gap: 6px;
    }
    .hub__bottom-left {
        gap: 8px;
    }
    .hub__bottom-left .identity__name {
        font-size: 14px;
    }
    .hub__bottom-left .identity__icon {
        font-size: 22px;
    }
    .hub__bottom-right {
        width: 100%;
    }
}

/* ── Game HUD Mode (hub-fullscreen) ──────────── */
/* Transforms web-app navbar into transparent game overlay */
.hub-fullscreen .hud {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: none;
    border-bottom: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 12px 16px;
    pointer-events: none;
}
.hub-fullscreen .hud > * {
    pointer-events: auto;
}
/* Hide web-app elements on hub */
.hub-fullscreen .hud__brand { display: none; }
.hub-fullscreen .hud__player { display: none; }
.hub-fullscreen .hud__vitality { display: none; }
.hub-fullscreen .hud__stat--streak { display: none; }
.hub-fullscreen .hud__stat--best { display: none; }
/* Show objective display only on hub */
.hud__objective { display: none; }
.hub-fullscreen .hud__objective {
    display: block;
    position: absolute;
    top: 12px; right: 16px;
    max-width: 280px;
    text-align: right;
    background: rgba(5,5,14,0.45);
    padding: 10px 16px;
    border-right: 2px solid
        var(--ui-accent, var(--rq-accent));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    clip-path: polygon(
        8px 0, 100% 0, 100% 100%, 0 100%
    );
}
.hud__objective-label {
    font-family: var(--rq-font-mono);
    font-size: 8px; letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ui-accent, var(--rq-accent));
    opacity: 0.7; margin-bottom: 4px;
}
.hud__objective-text {
    font-family: var(--rq-font-display);
    font-size: 13px; font-style: italic;
    color: var(--rq-text);
    line-height: 1.4;
}
.hud__objective-text:empty {
    display: none;
}
.hud__objective:has(.hud__objective-text:empty) {
    display: none;
}

/* Icon buttons (journal, mute) */
.hud__icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--rq-text-dim, #787890);
    padding: 6px;
    min-width: 44px;
    min-height: 44px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hud__icon-btn:hover {
    color: var(--rq-text, #d0d0e0);
}
/* Game HUD: float icon buttons to top-left */
.hub-fullscreen .hud__quests { display: none; }
.hub-fullscreen .hud__icon-btn {
    position: fixed;
    z-index: 101;
    width: 44px; height: 44px;
    background: rgba(5,5,14,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.hub-fullscreen .hud__icon-btn#pause-menu-btn {
    top: 12px; left: 16px;
}
.hub-fullscreen .hud__icon-btn#mute-btn {
    top: 12px; left: 68px;
}
.hub-fullscreen .hud__icon-btn:hover {
    border-color: var(--ui-accent, var(--rq-accent));
    color: var(--rq-text, #d0d0e0);
}

/* Left-side party panel (hub only) */
.hub__left-panel {
    position: fixed;
    left: 16px;
    top: 76px;
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: auto;
}
.hub__party-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(5,5,14,0.45);
    border-left: 2px solid
        var(--ui-accent, var(--rq-accent));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    clip-path: polygon(
        0 0, 100% 0,
        calc(100% - 4px) 100%, 0 100%
    );
    min-width: 150px;
}
.hub__party-portrait {
    width: 40px; height: 40px;
    clip-path: polygon(
        50% 0, 100% 50%, 50% 100%, 0 50%
    );
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(123,104,238,0.15);
}
.hub__party-portrait img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.hub__party-info {
    display: flex; flex-direction: column;
    gap: 2px;
}
.hub__party-name {
    font-family: var(--rq-font-display);
    font-size: 13px; font-weight: 700;
    color: var(--rq-text);
}
.hub__party-detail {
    font-family: var(--rq-font-mono);
    font-size: 9px; letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ui-accent, var(--rq-accent));
}
.hub__party-level {
    font-family: var(--rq-font-mono);
    font-size: 11px; font-weight: 800;
    color: #fff;
}
.hub__party-xp {
    width: 60px; height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}
.hub__party-xp-fill {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--rq-accent) 0%,
        var(--rq-teal) 100%
    );
    border-radius: 2px;
}

/* Streak in left panel */
.hub__left-streak {
    position: relative;
    text-align: center;
    padding: 6px 12px;
    background: rgba(5,5,14,0.45);
    border-left: 2px solid
        var(--rq-gold, #FFD700);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Mobile: left panel becomes compact */
@media (max-width: 768px) {
    .hub__left-panel {
        top: auto;
        bottom: 60px;
        left: 8px;
        flex-direction: row;
        gap: 4px;
    }
    .hub__party-card {
        min-width: auto;
        padding: 4px;
    }
    .hub__party-info { display: none; }
    .hub__party-portrait {
        width: 36px; height: 36px;
    }
}

.character__header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 16px;
}
.character__icon {
    font-size: 48px;
    filter: drop-shadow(0 0 16px var(--rq-accent));
}
.character__name {
    font-family: var(--rq-font-display);
    font-size: 32px; font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 20px rgba(123,104,238,0.4);
}
.character__class {
    font-size: 11px; color: var(--rq-accent);
    letter-spacing: 2px; text-transform: uppercase;
    text-shadow: 0 0 10px var(--rq-accent);
}

.character__xp-section { margin-bottom: 20px; }
.character__stats-row { display: flex; gap: 12px; margin-bottom: 20px; }
.character__abilities { margin-top: 8px; }

.abilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
.ability {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: var(--rq-radius);
    border: 1px solid var(--rq-border);
    transition: all var(--rq-duration) ease;
}
.ability--unlocked {
    background: linear-gradient(135deg, rgba(123,104,238,0.08), rgba(0,206,209,0.08));
    border-color: var(--rq-accent);
    box-shadow: 0 0 8px rgba(123,104,238,0.1);
}
.ability--locked { opacity: 0.3; }
.ability__icon { font-size: 16px; }
.ability__name { font-size: 10px; font-weight: 700; }
.ability__req { margin-left: auto; font-size: 8px; color: var(--rq-text-muted); }


/* ── Lore ──────────────────────────────────────────────── */
.character__lore {
    margin-top: 12px; margin-bottom: 12px;
    padding: 12px;
    background: rgba(123,104,238,0.04);
    border: 1px solid rgba(123,104,238,0.12);
    border-radius: var(--rq-radius);
}
.lore-entry {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.lore-entry__level {
    font-size: 8px; font-weight: 800;
    color: var(--rq-gold); letter-spacing: 1px;
    background: rgba(255,215,0,0.1);
    padding: 2px 6px; border-radius: 4px;
}
.lore-entry__title {
    font-family: var(--rq-font-display);
    font-size: 14px; font-weight: 700;
    color: #fff;
}
.lore-entry__text {
    font-family: var(--rq-font-display);
    font-size: 13px; color: var(--rq-text-dim);
    font-style: italic; line-height: 1.6;
}


/* ── World Map ─────────────────────────────────────────── */
.world-map {
    position: relative;
    aspect-ratio: 16 / 9;
    min-height: 480px;
    background: var(--rq-bg-card);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-lg);
    overflow: hidden;
}
/* Canvas fills the map container */
.world-map canvas {
    display: block;
    border-radius: inherit;
}

.world-map__svg {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.map-path {
    stroke-width: 0.25;
    stroke-linecap: round;
    transition: stroke 0.4s ease;
}
.map-path--active {
    stroke: rgba(123,104,238,0.35);
    stroke-dasharray: 1.5 1;
    animation: rq-path-dash 20s linear infinite;
}
.map-path--locked {
    stroke: rgba(255,255,255,0.04);
    stroke-dasharray: 0.8 1.5;
}


/* ── Map Nodes ─────────────────────────────────────────── */
.map-node {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    z-index: 10;
    transition: all 0.3s var(--rq-ease);
}
.map-node__link {
    display: flex; flex-direction: column;
    align-items: center; gap: 4px;
    text-decoration: none; color: inherit;
}

.map-node__ring {
    position: absolute;
    width: 64px; height: 64px;
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: all 0.4s ease;
}

.map-node--unlocked .map-node__ring {
    border: 1px solid rgba(123,104,238,0.35);
    background: radial-gradient(
        circle at 35% 28%,
        rgba(123,104,238,0.12) 0%,
        rgba(123,104,238,0.03) 60%,
        transparent 100%
    );
    box-shadow:
        0 0 24px rgba(123,104,238,0.12),
        0 0 60px rgba(123,104,238,0.04),
        inset 0 0 14px rgba(123,104,238,0.06);
}
.map-node--unlocked:hover .map-node__ring {
    border-color: var(--rq-accent);
    box-shadow:
        0 0 40px rgba(123,104,238,0.25),
        0 0 80px rgba(123,104,238,0.08),
        inset 0 0 20px rgba(123,104,238,0.1);
    transform: translate(-50%, -50%) scale(1.15);
}

.map-node--hub .map-node__ring {
    border-color: rgba(255,215,0,0.35);
    background: radial-gradient(
        circle at 35% 28%,
        rgba(255,215,0,0.1) 0%,
        rgba(255,215,0,0.02) 60%,
        transparent 100%
    );
    box-shadow:
        0 0 24px rgba(255,215,0,0.1),
        0 0 60px rgba(255,215,0,0.03);
}

.map-node--locked .map-node__ring {
    border: 1px solid rgba(255,255,255,0.06);
    background: none;
}
.map-node--locked {
    opacity: 0.25;
    filter: grayscale(0.7) brightness(0.6);
    cursor: default;
}

.map-node__icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px var(--rq-accent));
    z-index: 1;
    animation: rq-node-float 5s ease-in-out infinite;
}
.map-node--hub .map-node__icon {
    font-size: 24px;
    filter: drop-shadow(0 0 12px var(--rq-gold));
}
.map-node--locked .map-node__icon {
    filter: none;
    animation: none;
}

.map-node__name {
    font-size: 9px; font-weight: 800;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--rq-text-dim);
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    white-space: nowrap;
    z-index: 1;
}
.map-node--unlocked:hover .map-node__name {
    color: #fff;
    text-shadow: 0 0 10px var(--rq-accent);
}

.map-node__skill-lvl {
    font-size: 7px; letter-spacing: 1px;
    color: var(--rq-accent); font-weight: 700;
}

.map-node__lock {
    font-size: 8px; color: var(--rq-text-muted);
    letter-spacing: 1px; font-weight: 700;
}


/* ── Map Tooltip ───────────────────────────────────────── */
.map-tooltip {
    position: absolute;
    transform: translate(-50%, -100%);
    background: rgba(5,5,14,0.95);
    border: 1px solid var(--rq-accent);
    border-radius: var(--rq-radius);
    padding: 10px 14px;
    z-index: 100;
    pointer-events: none;
    min-width: 180px; max-width: 260px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8),
                0 0 12px rgba(123,104,238,0.15);
    animation: rq-slide-up 0.2s ease;
}
.map-tooltip__name {
    font-family: var(--rq-font-display);
    font-size: 14px; font-weight: 700;
    color: #fff; letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.map-tooltip__desc {
    font-family: var(--rq-font-display);
    font-size: 12px; color: var(--rq-text-dim);
    font-style: italic; line-height: 1.5;
}


/* ── Starfield Canvas ─────────────────────────────────── */
.world-map__starfield {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ── Fog of War Layers ────────────────────────────────── */
.fog-layer {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 1.5s ease;
}
.fog-layer--pale {
    background: radial-gradient(
        ellipse at 50% 20%,
        rgba(140,160,220,0.04) 0%,
        transparent 50%
    );
}
.fog-layer--threshold {
    background: radial-gradient(
        ellipse at 75% 65%,
        rgba(200,160,80,0.03) 0%,
        transparent 45%
    );
}
.fog-layer--deep {
    background: radial-gradient(
        ellipse at 30% 80%,
        rgba(80,40,120,0.05) 0%,
        transparent 40%
    );
}

/* ── NPC Canvas Portraits on Map ──────────────────────── */
.npc-cv {
    display: block;
    margin: 0 auto -4px;
    z-index: 2;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.map-node--unlocked:hover .npc-cv {
    transform: scale(1.12);
    filter: brightness(1.25);
}
.map-node--locked .npc-cv {
    filter: grayscale(0.7) brightness(0.4);
    pointer-events: none;
}

/* When NPC portrait is present, dim the emoji icon */
.map-node--npc .map-node__icon {
    display: none;
}

/* ── NPC Dialogue Strip (on map) ──────────────────────── */
.npc-dlg {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    background: rgba(5,5,14,0.92);
    border: 1px solid rgba(123,104,238,0.25);
    border-radius: var(--rq-radius);
    padding: 10px 18px;
    max-width: 380px;
    min-width: 220px;
    text-align: center;
    pointer-events: none;
    animation: rq-dialogue-enter 0.5s ease;
    box-shadow: 0 4px 24px rgba(0,0,0,0.6),
                0 0 10px rgba(123,104,238,0.1);
}
.npc-dlg.hidden { display: none; }
.npc-dlg__name {
    font-family: var(--rq-font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--rq-accent);
    margin-bottom: 4px;
}
.npc-dlg__text {
    font-family: var(--rq-font-display);
    font-size: 13px;
    color: var(--rq-text);
    line-height: 1.6;
    font-style: italic;
    transition: opacity 0.6s ease;
}

@keyframes rq-dialogue-enter {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Path Particles (SVG motes) ───────────────────────── */
.path-mote {
    pointer-events: none;
}

/* ── Lorebook ──────────────────────────────────────────── */
.hub__lorebook {
    overflow: hidden;
}
.lorebook__header {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
}
.lorebook__count {
    font-size: 9px; color: var(--rq-text-muted);
    margin-left: auto;
}
.lorebook__body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.4s ease, margin 0.4s ease;
    margin-top: 0;
}
.lorebook--open .lorebook__body {
    max-height: 600px; margin-top: 14px;
    overflow-y: auto;
}
.lorebook--open .config__toggle {
    transform: rotate(180deg);
}
.lorebook__entry {
    padding: 10px 0;
    border-bottom: 1px solid var(--rq-border-subtle);
}
.lorebook__entry:last-child { border-bottom: none; }
.lorebook__entry-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px;
}
.lorebook__entry-text {
    font-family: var(--rq-font-display);
    font-size: 12px; color: var(--rq-text-dim);
    font-style: italic; line-height: 1.6;
}


/* ── Artifacts Grid ────────────────────────────────────── */
.character__artifacts { margin-top: 12px; }
.artifacts-grid {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.artifact {
    width: 36px; height: 36px;
    display: flex; align-items: center;
    justify-content: center;
    background: radial-gradient(
        circle at 35% 28%,
        rgba(255,215,0,0.08) 0%,
        rgba(123,104,238,0.04) 100%
    );
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 6px;
    font-size: 18px;
    transition: all 0.3s ease;
    cursor: default;
    box-shadow: 0 0 8px rgba(255,215,0,0.06);
    animation: rq-artifact-idle 4s ease-in-out
        infinite;
}
.artifact:hover {
    border-color: var(--rq-gold);
    box-shadow: 0 0 18px rgba(255,215,0,0.25),
                0 0 40px rgba(255,215,0,0.08);
    transform: scale(1.15);
}

/* ── Skill Cards (World Map) ────────────────────────────── */
.section-title {
    font-family: var(--rq-font-display);
    font-size: 24px; font-weight: 900;
    color: #fff; margin-bottom: 18px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 12px rgba(255,255,255,0.1);
}
.section-label {
    font-size: 8px; color: var(--rq-text-muted);
    text-transform: uppercase; letter-spacing: 3px;
    margin-bottom: 12px; display: block;
}

.skill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--rq-gap);
}
.skill-card {
    background: var(--rq-bg-card);
    border: 1px solid var(--rq-border);
    border-radius: var(--rq-radius-lg);
    padding: 26px;
    position: relative; overflow: hidden;
    transition: all 0.3s var(--rq-ease-snap);
    cursor: default;
}
.skill-card:not(.skill-card--locked):hover {
    border-color: var(--rq-accent);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(123,104,238,0.15), 0 0 0 1px rgba(123,104,238,0.2);
}
.skill-card--locked { opacity: 0.35; }
.skill-card__link { display: flex; flex-direction: column; color: var(--rq-text); text-decoration: none; }
.skill-card__icon {
    font-size: 36px; margin-bottom: 14px;
    display: block;
    filter: drop-shadow(0 0 12px var(--rq-accent));
}
.skill-card__name { font-size: 18px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.skill-card__desc { font-size: 12px; color: var(--rq-text-dim); margin-bottom: 14px; line-height: 1.6; }
.skill-card__level { font-size: 10px; color: var(--rq-accent); margin-bottom: 8px; letter-spacing: 1px; }
.skill-card__enter {
    font-size: 12px; font-weight: 700;
    color: var(--rq-accent); letter-spacing: 1px;
    text-shadow: 0 0 8px var(--rq-accent);
    display: flex; align-items: center; gap: 6px;
}
.skill-card__locked-badge { font-size: 12px; color: var(--rq-text-muted); }


/* ── Mini Stats ─────────────────────────────────────────── */
.mini-stat {
    display: flex; flex-direction: column;
    align-items: center;
    background: linear-gradient(
        180deg, rgba(0,0,0,0.4) 0%,
        rgba(0,0,0,0.25) 100%
    );
    border-radius: var(--rq-radius);
    border: 1px solid var(--rq-border-subtle);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4),
                inset 0 -1px 0 rgba(255,255,255,0.02);
    padding: 10px 18px;
    min-width: 80px;
}
.mini-stat__value {
    font-size: 22px; font-weight: 800;
    color: var(--rq-accent);
    text-shadow: 0 0 12px var(--rq-accent-glow),
                 0 0 4px var(--rq-accent);
}
.mini-stat__label {
    font-size: 7px; color: var(--rq-text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-top: 2px;
}


/* ── XP Bar ─────────────────────────────────────────────── */
.xp-bar {
    height: 18px; border-radius: 9px;
    background: linear-gradient(
        180deg, #0a0a16 0%, #060610 100%
    );
    border: 1px solid var(--rq-border);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6),
                inset 0 -1px 0 rgba(255,255,255,0.03);
    position: relative; overflow: hidden;
}
.xp-bar--large { height: 24px; border-radius: 12px; }
.xp-bar__fill {
    height: 100%; border-radius: inherit;
    background: linear-gradient(
        90deg, var(--rq-accent),
        var(--rq-teal), var(--rq-green)
    );
    transition: width 1s var(--rq-ease);
    box-shadow: 0 0 14px var(--rq-accent),
                inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative; overflow: hidden;
}
.xp-bar__fill::after {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 60%; height: 100%;
    background: linear-gradient(
        90deg, transparent,
        rgba(255,255,255,0.3), transparent
    );
    will-change: transform;
    animation: rq-shimmer 2s ease-in-out infinite;
}
.xp-bar__text {
    position: absolute; inset: 0;
    display: flex; align-items: center;
    justify-content: center;
    font-size: 9px; font-weight: 700;
    text-shadow: 0 1px 4px #000;
}


/* ── Trainer Layout ─────────────────────────────────────── */
.trainer { display: flex; flex-direction: column; gap: var(--rq-gap); }

/* ── Encounter — Dealer-centric arena ────────────────── */
.encounter {
    text-align: center;
    padding: 32px 24px 28px;
}
.encounter__dealer {
    width: 120px;
    margin: 0 auto 8px;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}
.encounter__dealer:has(.char-img) {
    width: 200px;
}
.encounter__dealer:hover { opacity: 1; }
.encounter__dealer .char-svg {
    --char-fill: rgba(57,255,20,0.18);
    --char-glow: rgba(57,255,20,0.3);
    --char-eye: #39FF14;
    --char-accent: rgba(57,255,20,0.6);
}
.encounter__dealer .char-img {
    filter: drop-shadow(
        0 0 16px rgba(57,255,20,0.3)
    );
    border-radius: 8px;
}
.encounter__dialogue {
    font-family: var(--rq-font-display);
    font-style: italic;
    font-size: 13px;
    color: var(--rq-text-dim);
    min-height: 1.6em;
    margin-bottom: 16px;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.encounter__dialogue--visible {
    opacity: 1;
}
.encounter__situation {
    display: flex; gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}
.encounter__cards {
    display: flex; gap: 20px;
    justify-content: center;
    margin-bottom: 16px;
    min-height: 140px;
    perspective: 600px;
}
.encounter__hand {
    font-family: var(--rq-font-display);
    font-size: 22px; font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px var(--rq-accent-glow);
    margin-bottom: 20px;
    letter-spacing: 1px;
}
.encounter__actions {
    display: flex; gap: 16px;
    justify-content: center; flex-wrap: wrap;
}

/* ── Inline Session Stats ─────────────────────────────── */
.encounter__session {
    display: flex; align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-size: 11px;
    color: var(--rq-text-muted);
    letter-spacing: 0.5px;
}
.encounter__stat {
    font-weight: 800;
    color: var(--rq-text-dim);
}
.encounter__stat--xp {
    color: var(--rq-accent);
}
.encounter__divider {
    color: var(--rq-border);
}

/* ── Config & Log as details/summary ──────────────────── */
.encounter__config,
.encounter__log-details {
    margin-top: 4px;
}
.encounter__config-toggle {
    font-size: 9px; color: var(--rq-text-muted);
    letter-spacing: 1px; cursor: pointer;
    padding: 6px 0;
    list-style: none;
    text-transform: uppercase;
}
.encounter__config-toggle::marker { content: ''; }
.encounter__config-toggle:hover {
    color: var(--rq-text-dim);
}
.encounter__config-body {
    padding: 12px 0;
}


/* ── Config Panel ───────────────────────────────────────── */
.config__header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.config__title { font-size: 12px; font-weight: 700; color: var(--rq-text-dim); letter-spacing: 1px; text-transform: uppercase; }
.config__toggle { font-size: 12px; color: var(--rq-text-muted); transition: transform var(--rq-duration) ease; }
.config__toggle--collapsed { transform: rotate(-90deg); }
.config__body { margin-top: 16px; transition: all var(--rq-duration) ease; }
.config__body--collapsed { max-height: 0; overflow: hidden; margin-top: 0; opacity: 0; }
.config__group { margin-bottom: 14px; }
.config__label { font-size: 9px; color: var(--rq-text-muted); text-transform: uppercase; letter-spacing: 2px; margin-bottom: 8px; display: block; }
.config__options { display: flex; gap: 6px; flex-wrap: wrap; }
.config__btn {
    padding: 6px 14px; border-radius: 6px;
    background: var(--rq-bg);
    border: 1px solid var(--rq-border-subtle);
    color: var(--rq-text-muted);
    font-size: 11px; font-weight: 700;
    transition: all 0.15s ease;
    letter-spacing: 0.5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.config__btn--active {
    border-color: var(--rq-accent);
    color: var(--rq-accent);
    background: rgba(123,104,238,0.1);
    box-shadow: 0 0 6px rgba(123,104,238,0.2);
}
.config__btn:hover { border-color: var(--rq-accent); color: var(--rq-accent); }


/* ── Arena ──────────────────────────────────────────────── */
.arena__scenario { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }

.badge {
    padding: 5px 16px; border-radius: 20px;
    font-size: 11px; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase;
}
.badge--position { background: rgba(123,104,238,0.12); border: 1px solid rgba(123,104,238,0.35); color: var(--rq-accent); }
.badge--depth    { background: rgba(0,206,209,0.10);   border: 1px solid rgba(0,206,209,0.3);   color: var(--rq-teal); }
.badge--scenario { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--rq-text-muted); }


/* ── Playing Cards ──────────────────────────────────────── */
.arena__cards {
    display: flex; gap: 20px; justify-content: center;
    margin-bottom: 20px;
    min-height: 140px;
    perspective: 600px;
}

.playing-card {
    width: 90px; height: 128px;
    border-radius: 12px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    flex-shrink: 0;
}
.playing-card--empty {
    background: linear-gradient(
        145deg, #13102a, #0a0820
    );
    border: 1.5px solid var(--rq-border);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03),
                0 4px 12px rgba(0,0,0,0.4);
}
.playing-card--dealt {
    background: linear-gradient(
        160deg, #1a1a3e, #10102c, #161638
    );
    border: 1.5px solid rgba(123,104,238,0.25);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.06),
        0 6px 20px rgba(0,0,0,0.5),
        0 0 30px rgba(123,104,238,0.06);
    animation: rq-card-deal 0.5s var(--rq-ease) both;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 0 var(--suit-glow, transparent);
}

/* Corner indices */
.playing-card__corner {
    position: absolute;
    display: flex; flex-direction: column; align-items: center;
    line-height: 1;
}
.playing-card__corner--top    { top: 7px; left: 8px; }
.playing-card__corner--bottom { bottom: 7px; right: 8px; transform: rotate(180deg); }
.playing-card__corner-rank { font-size: 13px; font-weight: 900; }
.playing-card__corner-suit { font-size: 10px; margin-top: 1px; }

/* Center content */
.playing-card__center {
    display: flex; flex-direction: column; align-items: center;
    z-index: 1;
}
.playing-card__rank { font-size: 34px; font-weight: 900; line-height: 1; }
.playing-card__suit { font-size: 26px; margin-top: 1px; }

/* Radial glow overlay */
.playing-card__glow {
    position: absolute; inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.7;
}


/* ── Hand Label ─────────────────────────────────────────── */
.arena__hand-label {
    text-align: center;
    font-size: 18px; font-weight: 800;
    color: var(--rq-text-dim);
    letter-spacing: 3px;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(123,104,238,0.3);
}


/* ── Action Buttons ─────────────────────────────────────── */
.arena__actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.arena__actions--multi { gap: 10px; max-width: 600px; margin: 0 auto; }

.action-btn {
    padding: 16px 40px; border-radius: var(--rq-radius);
    min-height: 44px;
    font-size: 14px; font-weight: 900;
    letter-spacing: 2.5px; text-transform: uppercase;
    border: 1px solid;
    transition: all 0.15s var(--rq-ease-snap);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    position: relative; overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* Shine sweep on hover */
.action-btn::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent);
    transition: left 0.4s ease;
}
.action-btn:hover::before { left: 100%; }
.action-btn:active { transform: scale(0.96); }

.action-btn__key {
    font-size: 9px; padding: 2px 6px;
    background: rgba(255,255,255,0.08); border-radius: 3px;
    font-weight: 400; letter-spacing: 0;
}

.action-btn--raise {
    background: linear-gradient(135deg, #152e15, #1a3d1a);
    border-color: rgba(57,255,20,0.5); color: var(--rq-green);
    box-shadow: 0 0 0 0 var(--rq-green-glow);
}
.action-btn--raise:hover {
    background: linear-gradient(135deg, #1f441f, #2a5a2a);
    box-shadow: 0 0 28px var(--rq-green-glow), 0 0 0 1px rgba(57,255,20,0.3);
    border-color: rgba(57,255,20,0.8);
    color: #7fff50;
}

.action-btn--fold {
    background: linear-gradient(135deg, #2a0a0a, #3a1010);
    border-color: rgba(255,48,64,0.4); color: var(--rq-red);
    box-shadow: 0 0 0 0 var(--rq-red-glow);
}
.action-btn--fold:hover {
    background: linear-gradient(135deg, #441010, #5a1a1a);
    box-shadow: 0 0 28px var(--rq-red-glow), 0 0 0 1px rgba(255,48,64,0.3);
    border-color: rgba(255,48,64,0.8);
}

.action-btn--next {
    background: rgba(255,255,255,0.04);
    border-color: var(--rq-border);
    color: var(--rq-text-dim);
    padding: 14px 36px;
}
.action-btn--next:hover {
    border-color: var(--rq-accent);
    color: var(--rq-accent);
    box-shadow: 0 0 16px var(--rq-accent-glow);
}

/* Music-style multi-choice buttons */
.action-btn--choice {
    background: rgba(0,206,209,0.05);
    border-color: rgba(0,206,209,0.25); color: var(--rq-teal);
    padding: 14px 20px; font-size: 12px; letter-spacing: 1px;
    flex: 1; min-width: 140px;
}
.action-btn--choice:hover {
    background: rgba(0,206,209,0.12);
    border-color: rgba(0,206,209,0.7);
    box-shadow: 0 0 20px rgba(0,206,209,0.2);
}
.action-btn--choice-correct {
    background: rgba(57,255,20,0.1);
    border-color: var(--rq-green); color: var(--rq-green);
    box-shadow: 0 0 20px var(--rq-green-glow);
}
.action-btn--choice-wrong {
    background: rgba(255,48,64,0.1);
    border-color: var(--rq-red); color: var(--rq-red);
    opacity: 0.7;
}
.action-btn--choice-reveal {
    background: rgba(57,255,20,0.06);
    border-color: rgba(57,255,20,0.4); color: var(--rq-green);
    opacity: 0.7;
}


/* ── Result Panel ───────────────────────────────────────── */
.arena__result {
    text-align: center;
    animation: rq-slide-up 0.3s var(--rq-ease);
}
.result__badge {
    display: inline-block;
    padding: 8px 32px; border-radius: 20px;
    font-size: 13px; font-weight: 900;
    letter-spacing: 3px; text-transform: uppercase;
    margin-bottom: 14px;
}
.result__badge--correct {
    background: rgba(57,255,20,0.1); border: 1px solid rgba(57,255,20,0.5);
    color: var(--rq-green);
    box-shadow: 0 0 20px rgba(57,255,20,0.15), inset 0 0 20px rgba(57,255,20,0.05);
    text-shadow: 0 0 10px var(--rq-green);
}
.result__badge--mixed {
    background: rgba(255,215,0,0.1); border: 1px solid rgba(255,215,0,0.5);
    color: var(--rq-gold);
    text-shadow: 0 0 10px var(--rq-gold);
}
.result__badge--wrong {
    background: rgba(255,48,64,0.1); border: 1px solid rgba(255,48,64,0.4);
    color: var(--rq-red);
    text-shadow: 0 0 10px var(--rq-red);
}
.result__message {
    font-size: 14px; color: var(--rq-text-dim);
    font-style: italic; margin-bottom: 8px;
    font-family: var(--rq-font-display);
    font-size: 16px;
}
.result__detail { font-size: 11px; color: var(--rq-text-muted); margin-bottom: 8px; letter-spacing: 0.5px; }
.result__xp {
    font-size: 14px; font-weight: 800;
    color: var(--rq-accent); margin-bottom: 18px;
    text-shadow: 0 0 12px var(--rq-accent);
    letter-spacing: 1px;
}


/* ── Floating XP Number ─────────────────────────────────── */
.xp-float {
    position: fixed;
    pointer-events: none; z-index: 1000;
    font-family: var(--rq-font-mono);
    font-size: 22px; font-weight: 900;
    color: var(--rq-green);
    text-shadow: 0 0 16px var(--rq-green), 0 0 30px var(--rq-green);
    animation: rq-xp-float 1.4s ease-out forwards;
    transform: translateX(-50%);
    white-space: nowrap;
}


/* ── Pulse Ring (correct hit) ───────────────────────────── */
.pulse-ring {
    position: absolute;
    width: 160px; height: 160px;
    margin: auto; left: 0; right: 0;
    border-radius: 50%;
    border: 2px solid var(--rq-green);
    pointer-events: none;
    animation: rq-pulse-ring 0.9s ease-out forwards;
}


/* ── Session Stats ──────────────────────────────────────── */
.session__stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }


/* ── Battle Log ─────────────────────────────────────────── */
.log__entries { max-height: 220px; overflow-y: auto; }
.log__entries::-webkit-scrollbar { width: 4px; }
.log__entries::-webkit-scrollbar-track { background: transparent; }
.log__entries::-webkit-scrollbar-thumb { background: var(--rq-border); border-radius: 2px; }
.log__empty { font-size: 11px; color: var(--rq-text-muted); font-style: italic; text-align: center; padding: 20px 0; }
.log__entry {
    display: flex; justify-content: space-between;
    align-items: center; padding: 6px 0;
    border-bottom: 1px solid var(--rq-border-subtle);
    font-size: 11px;
    animation: rq-slide-up 0.2s ease;
}
.log__entry-hand { color: var(--rq-text-dim); }
.log__entry-result { display: flex; align-items: center; gap: 8px; }
.log__entry-action { font-weight: 700; font-size: 9px; letter-spacing: 1px; }
.log__entry-action--raise { color: var(--rq-green); }
.log__entry-action--fold  { color: var(--rq-red); }
.log__entry-action--music { color: var(--rq-teal); }
.log__entry-verdict { font-size: 12px; }
.log__entry-verdict--correct { color: var(--rq-green); text-shadow: 0 0 6px var(--rq-green); }
.log__entry-verdict--mixed   { color: var(--rq-gold); }
.log__entry-verdict--wrong   { color: var(--rq-red); }
.log__entry-xp { color: var(--rq-accent); font-size: 9px; font-weight: 700; }


/* ── Range Grid ─────────────────────────────────────────── */
.grid__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.grid__context { font-size: 10px; color: var(--rq-text-muted); }
.range-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 1px; font-size: 7.5px; }
.range-grid__cell {
    text-align: center; padding: 3px 0; border-radius: 2px;
    font-weight: 600; transition: all 0.15s ease; cursor: default;
}
.range-grid__cell--raise { background: rgba(57,255,20,0.15);   color: var(--rq-text); }
.range-grid__cell--mixed { background: rgba(255,215,0,0.12);   color: var(--rq-text); }
.range-grid__cell--fold  { background: rgba(255,255,255,0.02); color: var(--rq-text-muted); }
.range-grid__cell--active { outline: 2px solid var(--rq-gold); font-weight: 900; z-index: 1; }
.grid__legend { display: flex; gap: 16px; justify-content: center; margin-top: 12px; }
.grid__legend-item { display: flex; align-items: center; gap: 5px; font-size: 9px; color: var(--rq-text-muted); }
.grid__swatch { width: 10px; height: 10px; border-radius: 2px; }
.grid__swatch--raise { background: rgba(57,255,20,0.25); }
.grid__swatch--mixed { background: rgba(255,215,0,0.2); }
.grid__swatch--fold  { background: rgba(255,255,255,0.05); }


/* ── Music Module ───────────────────────────────────────── */
.music-arena__notes {
    display: flex; align-items: center; justify-content: center;
    gap: 24px; margin-bottom: 28px;
}

.note-card {
    width: 100px; height: 110px;
    border-radius: 14px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #0a1a1a, #081414);
    border: 1.5px solid rgba(0,206,209,0.3);
    box-shadow: 0 0 20px rgba(0,206,209,0.08), inset 0 1px 0 rgba(0,206,209,0.1);
    transition: all 0.3s var(--rq-ease);
    position: relative; overflow: hidden;
}
.note-card--root {
    border-color: rgba(0,206,209,0.5);
    box-shadow: 0 0 30px rgba(0,206,209,0.15), inset 0 1px 0 rgba(0,206,209,0.1);
}
.note-card--target.revealed {
    border-color: rgba(57,255,20,0.5);
    box-shadow: 0 0 30px rgba(57,255,20,0.15);
}
.note-card--target.wrong-reveal {
    border-color: rgba(255,48,64,0.5);
    box-shadow: 0 0 30px rgba(255,48,64,0.1);
}

.note-card__label {
    font-size: 8px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--rq-text-muted); margin-bottom: 6px;
}
.note-card__note {
    font-size: 40px; font-weight: 900; color: var(--rq-teal);
    text-shadow: 0 0 20px var(--rq-teal);
    line-height: 1;
    font-family: var(--rq-font-display);
}
.note-card--target .note-card__note { color: var(--rq-text-dim); }
.note-card--target.revealed .note-card__note {
    color: var(--rq-green);
    text-shadow: 0 0 20px var(--rq-green);
}

.note-card__sub {
    font-size: 9px; color: var(--rq-text-muted); margin-top: 4px; letter-spacing: 1px;
}

.music-arrow {
    font-size: 24px; color: var(--rq-text-muted);
    flex-shrink: 0;
}

.music-arena__semitones {
    text-align: center; margin-bottom: 16px;
    font-size: 11px; color: var(--rq-text-muted); letter-spacing: 1px;
}


/* ── Toast System ───────────────────────────────────────── */
.toast-container {
    position: fixed; top: 70px; right: 20px;
    z-index: 300; display: flex;
    flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--rq-radius);
    background: rgba(8,8,18,0.95);
    border: 1px solid var(--rq-border);
    min-width: 260px; max-width: 320px;
    animation: rq-toast-in 0.4s var(--rq-ease), rq-toast-out 0.3s ease 3.5s forwards;
    box-shadow: 0 12px 40px rgba(0,0,0,0.8);
    backdrop-filter: blur(12px);
    display: flex; gap: 12px; align-items: flex-start;
    border-left: 3px solid var(--rq-accent);
}
.toast--xp      { border-left-color: var(--rq-accent); }
.toast--level   { border-left-color: var(--rq-gold); box-shadow: 0 12px 40px rgba(0,0,0,0.8), 0 0 20px var(--rq-gold-glow); }
.toast--ability { border-left-color: var(--rq-teal); }
.toast__icon    { font-size: 20px; flex-shrink: 0; line-height: 1.2; }
.toast__content { flex: 1; }
.toast__title   { font-size: 12px; font-weight: 800; color: #fff; margin-bottom: 2px; letter-spacing: 0.5px; }
.toast__body    { font-size: 10px; color: var(--rq-text-dim); }


/* ── Arena Effects ──────────────────────────────────────── */
.arena--shake { animation: rq-shake 0.45s ease; }
.arena--flash { animation: rq-correct-flash 0.6s ease; }
.arena--flash-wrong { animation: rq-wrong-flash 0.5s ease; }


/* ── Utility ────────────────────────────────────────────── */
.hidden { display: none !important; }


/* ── Keyframes ──────────────────────────────────────────── */
@keyframes rq-twinkle {
    0%, 100% { opacity: 0; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.5); }
}
@keyframes rq-float-y {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}
@keyframes rq-shimmer {
    0%   { transform: translateX(-160%); }
    100% { transform: translateX(260%); }
}
@keyframes rq-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes rq-card-deal {
    0%   { transform: translateY(-40px) rotateY(-40deg) scale(0.85); opacity: 0; }
    60%  { transform: translateY(4px) rotateY(5deg) scale(1.02); opacity: 1; }
    100% { transform: translateY(0)    rotateY(0)    scale(1);    opacity: 1; }
}
@keyframes rq-shake {
    0%, 100% { transform: translateX(0); }
    15%  { transform: translateX(-10px); }
    35%  { transform: translateX(10px); }
    55%  { transform: translateX(-6px); }
    75%  { transform: translateX(6px); }
}
@keyframes rq-correct-flash {
    0%   { box-shadow: 0 0 0 0 rgba(57,255,20,0); }
    40%  { box-shadow: 0 0 80px 20px rgba(57,255,20,0.06); }
    100% { box-shadow: 0 0 0 0 rgba(57,255,20,0); }
}
@keyframes rq-wrong-flash {
    0%   { box-shadow: 0 0 0 0 rgba(255,48,64,0); }
    40%  { box-shadow: 0 0 60px 10px rgba(255,48,64,0.06); }
    100% { box-shadow: 0 0 0 0 rgba(255,48,64,0); }
}
@keyframes rq-toast-in {
    from { transform: translateX(80px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes rq-toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(30px) scale(0.95); }
}
@keyframes rq-xp-float {
    0%   { opacity: 1;   transform: translateX(-50%) translateY(0)    scale(1); }
    20%  { opacity: 1;   transform: translateX(-50%) translateY(-20px) scale(1.1); }
    100% { opacity: 0;   transform: translateX(-50%) translateY(-90px) scale(0.9); }
}
@keyframes rq-node-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}
@keyframes rq-artifact-idle {
    0%, 100% { opacity: 0.7; }
    50%      { opacity: 1; }
}
@keyframes rq-path-dash {
    0%   { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -50; }
}
@keyframes rq-pulse-ring {
    0%   { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(2.8); opacity: 0; }
}
@keyframes rq-number-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}


/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 800px) {
    .hub__columns {
        grid-template-columns: 1fr;
    }
    .hub__identity {
        gap: 10px; padding: 10px 14px;
    }
    .hub__world .world-map {
        aspect-ratio: 4 / 3;
        min-height: 320px;
    }
    .world-map {
        min-height: 300px;
    }
    .map-node__icon { font-size: 22px; }
    .map-node__name { font-size: 8px; }
    .map-node__ring { width: 50px; height: 50px; }
}
@media (max-width: 640px) {
    .hud { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
    .hud__xp-bar { width: 130px; }
    .hud__stats { gap: 10px; }
    .arena__actions { flex-direction: column; align-items: center; }
    .action-btn { width: 100%; max-width: 220px; }
    .session__stats { flex-wrap: wrap; }
    .character__stats-row { flex-wrap: wrap; }
    .music-arena__notes { gap: 14px; }
    .note-card { width: 80px; height: 90px; }
    .note-card__note { font-size: 32px; }
}


/* ── Dungeon Run Gate ──────────────────────────────────── */
.trainer__run-gate {
    text-align: center;
    padding: 48px 32px;
    margin-bottom: 16px;
}
.run-gate__title {
    font-family: var(--rq-font-display);
    font-size: 26px;
    color: var(--rq-accent);
    margin-bottom: 12px;
}
.run-gate__desc {
    color: var(--rq-text-dim);
    font-size: 14px;
    margin-bottom: 28px;
    line-height: 1.6;
}
.run-gate__desc strong {
    color: var(--rq-gold);
}
.run-gate__actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ── Run Progress Bar ──────────────────────────────────── */
.trainer__run-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--rq-bg-card);
    border: 1px solid var(--rq-border);
    border-radius: 8px;
    margin-bottom: 12px;
}
.run-progress__bar {
    flex: 1;
    height: 8px;
    background: var(--rq-bg);
    border-radius: 4px;
    overflow: hidden;
}
.run-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--rq-accent), var(--rq-teal));
    border-radius: 4px;
    transition: width 0.4s ease;
}
.run-progress__text {
    font-size: 12px;
    color: var(--rq-text-dim);
    min-width: 50px;
    text-align: right;
}
.run-progress__acc {
    font-size: 12px;
    color: var(--rq-gold);
    min-width: 36px;
    text-align: right;
}

/* ── Run Summary Overlay ───────────────────────────────── */
.trainer__run-summary {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 14, 0.92);
    animation: rq-fade-in 0.5s ease;
}
.run-summary__card {
    max-width: 420px;
    width: 90%;
    padding: 40px 32px;
    text-align: center;
}
.run-summary__badge {
    font-family: var(--rq-font-display);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 24px;
}
.run-summary__badge--cleared {
    color: var(--rq-success);
    text-shadow: 0 0 20px rgba(127, 255, 0, 0.4);
}
.run-summary__badge--failed {
    color: var(--rq-fail);
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
}
.run-summary__stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}
.run-summary__nemesis {
    margin-bottom: 24px;
    text-align: left;
}
.run-nemesis__hand {
    display: inline-block;
    background: var(--rq-bg);
    border: 1px solid var(--rq-fail);
    color: var(--rq-fail);
    padding: 4px 10px;
    margin: 4px;
    border-radius: 4px;
    font-size: 11px;
}
.run-summary__actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* ── Artifact Acquisition Overlay ──────────────────────── */
.artifact-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 14, 0.95);
    animation: rq-fade-in 0.6s ease;
}
.artifact-overlay__card {
    text-align: center;
    padding: 48px 40px;
    max-width: 380px;
    border: 1px solid var(--rq-gold);
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.15),
                0 0 120px rgba(255, 215, 0, 0.06);
    animation: rq-artifact-glow 2s ease infinite;
}
.artifact-overlay__icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
    animation: rq-float 2s ease-in-out infinite;
}
.artifact-overlay__name {
    font-family: var(--rq-font-display);
    font-size: 24px;
    color: var(--rq-gold);
    margin-bottom: 12px;
}
.artifact-overlay__flavor {
    color: var(--rq-text-dim);
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
    margin-bottom: 24px;
}
.artifact-overlay__dismiss {
    cursor: pointer;
    background: none;
    border: 1px solid var(--rq-gold);
    color: var(--rq-gold);
    padding: 8px 28px;
    border-radius: 4px;
    font-family: var(--rq-font-mono);
    font-size: 12px;
    transition: all 0.2s ease;
}
.artifact-overlay__dismiss:hover {
    background: rgba(255, 215, 0, 0.1);
}

@keyframes rq-artifact-glow {
    0%, 100% { box-shadow: 0 0 60px rgba(255,215,0,0.15), 0 0 120px rgba(255,215,0,0.06); }
    50%      { box-shadow: 0 0 80px rgba(255,215,0,0.25), 0 0 160px rgba(255,215,0,0.10); }
}

@keyframes rq-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes rq-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}


/* ═══════════════════════════════════════════════════════════
   CHARACTERS — Luminous SVG silhouettes
   ═══════════════════════════════════════════════════════════ */
.char-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    user-select: none;
}

.char-wrapper {
    width: 100%;
    max-width: 120px;
    animation: rq-float 6s ease-in-out infinite;
    filter: drop-shadow(
        0 0 20px var(--char-glow,
            rgba(123,104,238,0.3))
    );
    transition: filter 0.6s ease;
}
/* When PNG art is present, allow larger display */
.char-wrapper:has(.char-img) {
    max-width: 220px;
}

.char-svg {
    width: 100%;
    height: auto;
    --char-fill: rgba(123,104,238,0.25);
    --char-glow: rgba(123,104,238,0.4);
    --char-eye: #7B68EE;
    --char-accent: #7B68EE;
    transition: all 0.5s ease;
}

/* PNG character art (replaces SVG when deployed) */
.char-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(
        0 0 18px rgba(123,104,238,0.35)
    );
    transition: filter 0.5s ease;
}
.char-img.char--correct {
    filter: drop-shadow(
        0 0 24px rgba(57,255,20,0.5)
    );
}
.char-img.char--wrong {
    filter: drop-shadow(
        0 0 24px rgba(255,48,64,0.45)
    );
}

/* State-reactive glow */
.char--correct {
    --char-fill: rgba(57,255,20,0.25);
    --char-glow: rgba(57,255,20,0.5);
    --char-eye: #39FF14;
    --char-accent: #39FF14;
}
.char--wrong {
    --char-fill: rgba(255,48,64,0.2);
    --char-glow: rgba(255,48,64,0.4);
    --char-eye: #ff3040;
    --char-accent: #ff3040;
}

/* Dialogue strip */
.char-dialogue {
    text-align: center;
    font-family: var(--rq-font-display);
    font-style: italic;
    font-size: 12px;
    color: var(--rq-text-dim);
    min-height: 2em;
    max-width: 220px;
    line-height: 1.5;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.char-dialogue--fade {
    animation: rq-dialogue-fade 6s ease forwards;
}
@keyframes rq-dialogue-fade {
    0%   { opacity: 0; transform: translateY(4px); }
    10%  { opacity: 1; transform: translateY(0); }
    80%  { opacity: 1; }
    100% { opacity: 0.4; }
}


/* ═══════════════════════════════════════════════════════════
   PER-LOCATION ATMOSPHERE
   Apply via body[data-location="xxx"]
   ═══════════════════════════════════════════════════════════ */

/* Crossroads (Hub) — blue-white, open, starlit */
body[data-location="crossroads"]::before {
    background:
        radial-gradient(
            ellipse at 30% 20%,
            rgba(123,104,238,0.08) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at 70% 70%,
            rgba(0,206,209,0.05) 0%,
            transparent 45%
        ),
        radial-gradient(
            ellipse at 50% 30%,
            transparent 40%,
            rgba(10,8,30,0.6) 100%
        );
}

/* Card Table (Poker) — green felt, smoke haze */
body[data-location="card-table"]::before {
    background:
        radial-gradient(
            ellipse at 50% 60%,
            rgba(20,80,20,0.1) 0%,
            transparent 45%
        ),
        radial-gradient(
            ellipse at 30% 30%,
            rgba(57,255,20,0.03) 0%,
            transparent 40%
        ),
        radial-gradient(
            ellipse at 50% 40%,
            transparent 30%,
            rgba(5,15,5,0.65) 100%
        );
}

/* Harmonic Sanctum (Music) — teal/amber crystal */
body[data-location="sanctum"]::before {
    background:
        radial-gradient(
            ellipse at 40% 25%,
            rgba(0,206,209,0.07) 0%,
            transparent 45%
        ),
        radial-gradient(
            ellipse at 65% 75%,
            rgba(255,215,0,0.04) 0%,
            transparent 40%
        ),
        radial-gradient(
            ellipse at 50% 35%,
            transparent 40%,
            rgba(5,12,22,0.6) 100%
        );
}

/* Oracle Chamber (Chat) — deep violet, mystical */
body[data-location="oracle"]::before {
    background:
        radial-gradient(
            ellipse at 50% 25%,
            rgba(123,104,238,0.1) 0%,
            transparent 40%
        ),
        radial-gradient(
            ellipse at 30% 70%,
            rgba(180,130,255,0.05) 0%,
            transparent 45%
        ),
        radial-gradient(
            ellipse at 50% 30%,
            transparent 35%,
            rgba(20,5,40,0.65) 100%
        );
}

/* Conservatory (DAW) — warm amber, creative */
body[data-location="conservatory"]::before {
    background:
        radial-gradient(
            ellipse at 45% 30%,
            rgba(255,215,0,0.06) 0%,
            transparent 45%
        ),
        radial-gradient(
            ellipse at 60% 70%,
            rgba(255,180,100,0.04) 0%,
            transparent 40%
        ),
        radial-gradient(
            ellipse at 50% 35%,
            transparent 40%,
            rgba(20,12,5,0.6) 100%
        );
}


/* ── Character placement per location ────────────────────── */

/* Hub: Lyra stands beside the character panel */
.hub__character-figure {
    position: absolute;
    bottom: 0; right: -60px;
    width: 120px;
    opacity: 0.7;
    z-index: 5;
}
.hub__character-figure:has(.char-img) {
    width: 240px;
    right: -100px;
    opacity: 0.9;
}

/* Trainer: character in top-right of arena */
.trainer__character {
    position: absolute;
    top: 12px; right: 12px;
    width: 80px;
    z-index: 5;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}
.trainer__character:has(.char-img) {
    width: 160px;
    top: auto; bottom: 40px;
    right: 16px;
    opacity: 0.85;
}
.trainer__character:hover {
    opacity: 0.9;
}
.trainer__character .char-svg {
    --char-fill: rgba(57,255,20,0.18);
    --char-glow: rgba(57,255,20,0.3);
    --char-eye: #39FF14;
    --char-accent: rgba(57,255,20,0.6);
}
.trainer__character .char-img {
    filter: drop-shadow(
        0 0 16px rgba(57,255,20,0.3)
    );
    border-radius: 8px;
}

/* Music: character floats beside the note cards */
.music-trainer__character {
    position: absolute;
    top: 20px; left: 12px;
    width: 80px;
    z-index: 5;
    opacity: 0.6;
}
.music-trainer__character:has(.char-img) {
    width: 160px;
    top: auto; bottom: 40px;
    left: 16px;
    opacity: 0.85;
}
.music-trainer__character .char-svg {
    --char-fill: rgba(0,206,209,0.25);
    --char-glow: rgba(0,206,209,0.4);
    --char-eye: #00CED1;
    --char-accent: #00CED1;
}
.music-trainer__character .char-img {
    filter: drop-shadow(
        0 0 16px rgba(0,206,209,0.35)
    );
    border-radius: 8px;
}

/* Chat: Lyra is more prominent */
.chat__character {
    width: 100px;
    margin: 0 auto 16px;
    opacity: 0.8;
}
.chat__character:has(.char-img) {
    width: 180px;
    opacity: 1;
}
.chat__character .char-img {
    filter: drop-shadow(
        0 0 20px rgba(123,104,238,0.4)
    );
    border-radius: 8px;
}


/* ═══════════════════════════════════════════════════════════
   NARRATIVE STRIP — Cinematic dialogue delivery
   ═══════════════════════════════════════════════════════════ */
.narrative-strip {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 24px 28px;
    background: linear-gradient(
        135deg,
        rgba(123,104,238,0.04) 0%,
        rgba(5,5,14,0.95) 40%,
        rgba(5,5,14,0.98) 100%
    );
    border: 1px solid rgba(123,104,238,0.15);
    border-left: 3px solid var(--rq-accent);
    border-radius: var(--rq-radius-lg);
    position: relative;
    overflow: hidden;
    min-height: 100px;
    animation: rq-narrative-enter 0.6s ease;
}
.narrative-strip::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 100%; height: 1px;
    background: linear-gradient(
        90deg, transparent,
        rgba(123,104,238,0.3),
        transparent
    );
}

.narrative__portrait {
    width: 64px;
    flex-shrink: 0;
    filter: drop-shadow(
        0 0 12px rgba(123,104,238,0.4)
    );
    animation: rq-float 5s ease-in-out infinite;
}
.narrative__portrait:has(.char-img) {
    width: 80px;
}
.narrative__portrait .char-svg {
    width: 100%;
    height: auto;
}
.narrative__portrait .char-img {
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.narrative__body {
    flex: 1;
    min-width: 0;
}

.narrative__speaker {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--rq-accent);
    text-shadow: 0 0 10px var(--rq-accent);
    margin-bottom: 8px;
}

.narrative__lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.narrative__line {
    font-family: var(--rq-font-display);
    font-size: 15px;
    color: var(--rq-text);
    line-height: 1.65;
    opacity: 0;
    animation: rq-line-appear 0.3s ease forwards;
}
.narrative__line:first-child {
    font-size: 17px;
    color: #fff;
}

@keyframes rq-narrative-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rq-line-appear {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.narrative__cursor {
    color: var(--rq-accent);
    animation: rq-cursor-blink 0.8s step-end infinite;
    font-weight: 400;
    font-size: 14px;
    margin-left: 1px;
}

@keyframes rq-cursor-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}


/* ═══════════════════════════════════════════════════════════
   TRAVEL TRANSITION — Location-to-location movement
   ═══════════════════════════════════════════════════════════ */
.travel-overlay {
    position: fixed; inset: 0;
    z-index: 400;
    background: var(--rq-bg);
    display: flex;
    align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.travel-overlay--active {
    opacity: 1;
    pointer-events: auto;
}
.travel-overlay__name {
    font-family: var(--rq-font-display);
    font-size: 24px; font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.5s ease 0.3s;
}
.travel-overlay--active .travel-overlay__name {
    opacity: 1;
    transform: translateY(0);
}
.travel-overlay__trace {
    width: 40px; height: 2px;
    background: var(--rq-accent);
    box-shadow: 0 0 12px var(--rq-accent);
    opacity: 0;
    transition: all 0.4s ease 0.15s;
}
.travel-overlay--active .travel-overlay__trace {
    opacity: 1;
    width: 120px;
}


/* ═══════════════════════════════════════════════════════════
   CLASS ICON GLOW — Pulsing glow on character panel
   ═══════════════════════════════════════════════════════════ */
.character__icon {
    animation: rq-icon-pulse 3s ease-in-out infinite;
}
@keyframes rq-icon-pulse {
    0%, 100% {
        filter: drop-shadow(
            0 0 16px var(--rq-accent)
        );
    }
    50% {
        filter: drop-shadow(
            0 0 28px var(--rq-accent)
        ) drop-shadow(
            0 0 8px rgba(123,104,238,0.3)
        );
    }
}


/* ── Mobile Responsive ─────────────────────────────────── */

/* Dynamic viewport height for mobile address bar */
.main, .hub, .hub__world,
.arena, .expedition-container,
.practice-container, .daw-container {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
}

/* Prevent unwanted browser behaviors on game elements */
.game-container, .hub, .arena,
.location-canvas-wrap,
.expedition-container {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

@media (max-width: 768px) {

    /* === GENERAL TOUCH TARGETS === */
    .touch-primary button,
    .touch-primary a,
    .touch-primary .action-btn,
    .touch-primary .config__btn,
    .touch-primary .menu-item,
    .touch-primary .dlg-choice {
        min-height: 44px;
        min-width: 44px;
    }

    body { font-size: 14px; }

    /* === TOP HUD === */
    .hud {
        padding: 4px 8px;
        font-size: 11px;
        gap: 6px;
        flex-wrap: nowrap;
    }
    .hud__player { gap: 4px; }
    .hud__xp-bar { width: 90px; }
    .hud__stat { min-width: auto; }
    .hud__brand-text { display: none; }

    /* === WORLD MAP === */
    .hub__world {
        height: calc(100vh - 48px);
        height: calc(100dvh - 48px);
    }
    .wm-viewport {
        min-height: 0;
        aspect-ratio: auto;
        height: 100%;
    }
    .map-node__ring {
        width: 44px;
        height: 44px;
    }
    .map-node__name {
        font-size: 9px;
        max-width: 70px;
    }
    .wm-minimap { display: none; }
    .wm-breadcrumb {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* === LOCATION SCENE === */
    .loc-scene {
        flex-direction: column;
    }
    .loc-scene__portrait {
        max-height: 30vh;
        width: 100%;
        object-fit: contain;
    }
    .loc-scene__menu {
        width: 100%;
        max-height: 40vh;
        overflow-y: auto;
    }
    .loc-scene__menu .menu-item {
        font-size: 15px;
        padding: 12px 16px;
    }

    /* === BATTLE === */
    .btl-menu {
        font-size: 14px;
    }
    .btl-menu__item {
        padding: 12px 16px;
        min-height: 44px;
    }
    .btl-hp-panel {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* === DIALOG === */
    .dlg-wrap {
        padding: 0;
    }
    .dlg-box {
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        padding: 16px 20px;
    }
    .dlg-portrait {
        width: 60px;
        height: 60px;
    }
    .dlg-text {
        font-size: 15px;
        line-height: 1.5;
    }
    .dlg-choice {
        padding: 12px 16px;
        font-size: 15px;
        margin-bottom: 6px;
    }

    /* === PAUSE MENU === */
    .pause-menu__tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-direction: row;
    }
    .pause-menu__tabs::-webkit-scrollbar {
        display: none;
    }
    .pause-menu__tab {
        min-width: 70px;
        flex-shrink: 0;
        padding: 8px 10px;
        font-size: 11px;
    }
    .pause-menu__content {
        padding: 10px;
        font-size: 13px;
    }

    /* === POKER / MUSIC === */
    .arena__actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .action-btn {
        width: 100%;
        max-width: none;
        padding: 14px 16px;
        font-size: 16px;
    }
    .note-card {
        width: 70px;
        height: 80px;
    }

    /* === EXPEDITION === */
    .expedition-node {
        min-width: 36px;
        min-height: 36px;
    }

    /* === HD-2D CONTROLS HINT === */
    .le-controls { display: none; }

    /* === NPC DIALOGUE STRIP === */
    .npc-dlg {
        bottom: 72px;
        max-width: 280px;
        min-width: 160px;
        padding: 8px 14px;
        font-size: 12px;
    }

    /* === MAP TOOLTIP === */
    .map-tooltip {
        max-width: 200px;
        min-width: 140px;
        padding: 8px 10px;
    }
    .map-tooltip__name { font-size: 13px; }
    .map-tooltip__desc { font-size: 11px; }

    /* === OBJECTIVE DISPLAY === */
    .hub-fullscreen .hud__objective {
        top: 8px; right: 8px;
        max-width: 180px;
        padding: 6px 10px;
    }
    .hud__objective-text { font-size: 11px; }

    /* === LEFT PARTY PANEL === */
    .hub__left-panel {
        bottom: 72px;
        left: 6px;
    }

    /* === QUICK BATTLE BUTTON === */
    #quick-battle-btn {
        bottom: 72px !important;
        right: 10px !important;
        padding: 10px 16px !important;
        font-size: 13px !important;
    }

    /* === DAILY BRIEFING === */
    .daily-briefing {
        padding: 16px;
    }
    .commission-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* === VERY SMALL SCREENS === */
@media (max-width: 400px) {
    .hud { font-size: 10px; }
    .hud__xp-bar { width: 70px; }
    .dlg-text { font-size: 14px; }
    .action-btn { font-size: 14px; }
    .btl-menu__item { font-size: 13px; }

    .hub-fullscreen .hud__objective {
        max-width: 140px;
        padding: 4px 8px;
    }
    .hud__objective-text { font-size: 10px; }
    .npc-dlg {
        max-width: 220px;
        min-width: 120px;
        font-size: 11px;
    }
    .hub__party-portrait {
        width: 30px; height: 30px;
    }
    #quick-battle-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* === LANDSCAPE PHONE === */
@media (max-height: 500px) and (orientation: landscape) {
    .hud {
        height: 30px;
        font-size: 10px;
        padding: 2px 8px;
    }
    .dlg-box { max-height: 45vh; }
    .hub__world {
        height: calc(100vh - 32px);
        height: calc(100dvh - 32px);
    }
    .hub__bottom-hud {
        padding: 4px 10px;
        padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }
    .hub__left-panel {
        top: 36px;
        bottom: auto;
        flex-direction: column;
    }
    .npc-dlg {
        bottom: 52px;
        max-width: 240px;
    }
    #quick-battle-btn {
        bottom: 52px !important;
    }
}
