/* ============================================================
   WASTELAND REMNANT — Global Stylesheet
   Spec 08 (Color Palette) + Spec 09 (Visual Hierarchy)
   + Spec 12/14 (HUD DOM Overlay + UX Compliance)
   ============================================================ */

/* --- CSS Custom Properties (Spec 08 Palette) --- */
:root {
    --game-aspect-w:    932;
    --game-aspect-h:    430;
    --color-neutral:    #2B2D31;
    --color-neutral-2:  #4A4E56;
    --color-neutral-3:  #5A5E68;
    --color-amber:      #F2A945;
    --color-amber-dim:  #B5811E;
    --color-blue:       #4A6B8C;
    --color-blue-mid:   #7D8F9E;
    --color-red:        #D32F2F;
    --color-green:      #7ED321;

    --font-mono:   'Share Tech Mono', 'Courier New', monospace;
    --font-title:  'Rajdhani', 'Arial', sans-serif;
    --font-main:   'Share Tech Mono', 'Courier New', monospace;

    /* Safe zone margin: ≥8% viewport (Spec 09/14) */
    --safe-margin: 8%;
    --safe-margin-px: max(20px, 3vw);
}

body {
    --font-mono:  'Share Tech Mono', 'Courier New', monospace;
    --font-title: 'Rajdhani', 'Arial', sans-serif;
    --font-main:  'Share Tech Mono', 'Courier New', monospace;
    font-family: var(--font-mono);
}

body.alt-font {
    --font-mono:  'IBM Plex Mono', 'Courier New', monospace;
    --font-title: 'Chakra Petch', 'Arial', sans-serif;
    --font-main:  'IBM Plex Mono', 'Courier New', monospace;
    font-family: var(--font-mono);
}

/* Unit names & titles only wrap by full words, never break mid-word */
.unit-name, .enemy-name, .player-name, .unit-title, .ci-modal-class-name,
.character-name, .boss-name, .unit-label, .hud-resources-header, .ci-district {
    word-break: normal !important;
    overflow-wrap: break-word !important;
    hyphens: manual !important;
    white-space: normal;
}

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

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    width: 100%;
    height: 100%;
    background-color: #0a0c0f; /* Dark background outside the game area */
    overflow: hidden;
    font-family: var(--font-mono);
    color: var(--color-amber);
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    transition: background-image 0.6s ease-in-out, background-color 0.6s ease-in-out;
}

/* ============================================================
   LAYOUT — App Shell
   ============================================================ */
#app {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: calc(100vh * var(--game-aspect-w) / var(--game-aspect-h)); /* Constrain width on wide screens */
    max-height: calc(100vw * var(--game-aspect-h) / var(--game-aspect-w)); /* Constrain height on tall screens */
    background-color: var(--color-neutral);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

/* Phaser Canvas container — Layer 0 (base) */
#game-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* ============================================================
   LOADING OVERLAY — Boot / Preload Phase
   ============================================================ */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999; /* Ensure it overlays everything on the body during boot */
    background: linear-gradient(rgba(10, 12, 15, 0.7), rgba(10, 12, 15, 0.8)), url('assets/loading-bg.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

#loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: min(480px, 80vw);
}

.boot-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-prefix {
    color: var(--color-amber);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    animation: blink 1.2s step-end infinite;
}

.logo-text {
    font-family: var(--font-title);
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--color-amber);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.boot-text {
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    color: var(--color-blue-mid);
    letter-spacing: 0.15em;
    text-align: center;
    min-height: 1.4em;
}

.loading-bar-wrap {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--color-neutral-2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-amber-dim), var(--color-amber));
    border-radius: 2px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 8px var(--color-amber);
}

.loading-pct {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 0.7rem;
    color: var(--color-amber);
    font-family: var(--font-mono);
}

.lore-ticker {
    font-size: clamp(0.65rem, 1.3vw, 0.8rem);
    color: var(--color-blue-mid);
    font-style: italic;
    text-align: center;
    opacity: 0.7;
    min-height: 2.5em;
    line-height: 1.5;
    max-width: 400px;
}

/* ============================================================
   HUD OVERLAY — DOM Layer (Spec 12: z-index 95+, Spec 14: ≥8% margin)
   ============================================================ */
#hud-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    pointer-events: none;
    /* Safe zone padding: ≥8% all sides per spec 09/14 */
    padding: var(--safe-margin);
}

.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* ============================================================
   HUD PANELS — Shared Base
   ============================================================ */
.hud-panel {
    background: rgba(43, 45, 49, 0.88);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    backdrop-filter: blur(4px);
    /* luminance boost per spec 12 */
    filter: brightness(1.05);
}

/* ============================================================
   RESOURCE BAR — Priority 2 HUD (top-left)
   ============================================================ */
#resource-bar {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 6px 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: unset;
    max-width: unset;
    z-index: 1000;
}

.hud-resources-line {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
}

.resource-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 65px;
}

.resource-label {
    font-size: 0.65rem;
    color: var(--color-blue-mid);
    letter-spacing: 0.12em;
    width: auto;
    margin-right: 2px;
    flex-shrink: 0;
}

.resource-track {
    flex: 1;
    height: 5px;
    background: var(--color-neutral-2);
    border-radius: 2px;
    overflow: hidden;
}

.resource-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.2s ease-out;
}

.hp-fill   { background: var(--color-green); }
.mana-fill { background: var(--color-blue); }

.resource-val {
    font-size: 0.65rem;
    color: var(--color-amber);
    width: auto;
    text-align: right;
    margin-left: 2px;
    flex-shrink: 0;
}

.shard-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.shard-icon  { color: var(--color-blue-mid); font-size: 0.85rem; }
.shard-label { font-size: 0.6rem; color: var(--color-blue-mid); letter-spacing: 0.1em; flex: none; }
.shard-val   { font-size: 0.82rem; color: var(--color-blue-mid); font-weight: bold; font-family: monospace; }

/* ============================================================
   SHRINE PANEL — Shard Allocation (center)
   ============================================================ */
.shrine-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(580px, 92vw);
    height: min(370px, 80vh); /* Fixed consistent height across tabs to avoid vertical jitter */
    overflow-y: auto;
    padding: 10px 14px;
    border-color: var(--color-blue);
    z-index: 20000; /* Always on top of all HUD overlays and resource bars */
    animation: shrine-fadein 0.4s ease;
    /* Custom thin scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--color-blue-mid) rgba(16, 18, 24, 0.5);
}

/* Shrine Tabs */
.shrine-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-bottom: 2px;
    margin-bottom: 8px;
}

.shrine-tab-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-neutral-3);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.shrine-tab-btn:hover {
    color: var(--color-blue);
    background: rgba(74, 107, 140, 0.08);
}

.shrine-tab-btn.active {
    color: var(--color-amber);
    border-color: var(--color-amber);
    background: rgba(242, 169, 69, 0.06);
    text-shadow: 0 0 4px rgba(242, 169, 69, 0.2);
}

.shrine-panel::-webkit-scrollbar {
    width: 6px;
}
.shrine-panel::-webkit-scrollbar-track {
    background: rgba(16, 18, 24, 0.5);
}
.shrine-panel::-webkit-scrollbar-thumb {
    background: var(--color-blue-mid);
    border-radius: 3px;
}
.shrine-panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-amber);
}

@keyframes shrine-fadein {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.shrine-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 2px;
    margin-bottom: 6px;
}

.shrine-icon  { color: var(--color-amber); font-size: 1rem; }
.shrine-title {
    font-family: var(--font-title);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-amber);
    letter-spacing: 0.12em;
    flex: 1;
}

.shrine-close {
    background: none;
    border: none;
    color: var(--color-blue-mid);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 2px 6px;
    border-radius: 2px;
    transition: color 0.2s, background 0.2s;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shrine-close:hover  { color: var(--color-amber); background: rgba(242,169,69,0.1); }
.shrine-close:focus-visible {
    outline: 2px solid var(--color-blue);
    box-shadow: 0 0 0 3px rgba(74,107,140,0.4);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    background: var(--color-neutral-2);
    border-radius: 4px;
}

.stat-name {
    font-size: 0.65rem;
    color: var(--color-blue-mid);
    letter-spacing: 0.1em;
}

.stat-val {
    font-family: var(--font-title);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-amber);
}

.stat-up {
    background: none;
    border: 1px solid var(--color-blue);
    color: var(--color-amber);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 2px;
    min-width: 48px; /* Spec 14: ≥48px */
    min-height: 32px;
    transition: background 0.2s, border-color 0.2s;
}
.stat-up:hover { background: rgba(74,107,140,0.2); border-color: var(--color-amber); }
.stat-up:focus-visible {
    outline: 2px solid var(--color-blue);
    box-shadow: 0 0 0 3px rgba(74,107,140,0.4);
}

.shrine-cost {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    margin-top: 4px;
    color: var(--color-blue-mid);
}
.cost-val { color: var(--color-amber); font-weight: bold; }

/* Shrine Redesigned Stats Tab */
.shrine-stats-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
    align-items: start;
}

.shrine-section-subtitle {
    font-size: 0.7rem;
    color: var(--color-blue-mid);
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: bold;
}

.combat-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.cstat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 18, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.cstat-name {
    color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.cstat-val {
    color: #fff;
    font-weight: bold;
}

@media (max-width: 480px) {
    .shrine-stats-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Compact Core Attributes list rows */
.core-attributes-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.stat-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(16, 18, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-mono);
}

.stat-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-row-item .stat-name {
    font-size: 0.7rem;
    color: var(--color-blue-mid);
    letter-spacing: 0.05em;
    font-weight: bold;
}

.stat-row-item .stat-val {
    font-size: 1rem;
    font-weight: bold;
    color: var(--color-amber);
    min-width: 20px;
    text-align: right;
}

.stat-row-item .stat-up {
    background: none;
    border: 1px solid var(--color-blue-mid);
    color: var(--color-blue-mid);
    cursor: pointer;
    font-size: 0.65rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    min-width: 22px;
    min-height: 22px;
    padding: 0;
    transition: all 0.2s ease;
}
.stat-row-item .stat-up:hover {
    border-color: var(--color-amber);
    color: var(--color-amber);
    background: rgba(242, 169, 69, 0.1);
}

.shrine-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    justify-content: space-between;
}

.btn-shrine-primary {
    flex: 2;
    background: rgba(242, 169, 69, 0.08);
    border: 1px solid var(--color-amber);
    color: var(--color-amber);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 32px;
}
.btn-shrine-primary:hover {
    background: rgba(242, 169, 69, 0.18);
    box-shadow: 0 0 8px rgba(242, 169, 69, 0.25);
}

.btn-shrine-danger {
    flex: 1;
    background: rgba(211, 47, 47, 0.08);
    border: 1px solid var(--color-red);
    color: var(--color-red);
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 0.02em;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-height: 32px;
}
.btn-shrine-danger:hover {
    background: rgba(211, 47, 47, 0.18);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.25);
}

/* Primary button */
.btn-primary {
    width: 100%;
    background: var(--color-blue);
    border: none;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    padding: 12px;
    border-radius: 3px;
    cursor: pointer;
    min-height: 48px; /* Spec 14: ≥48px */
    transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover  { background: #5a7c9d; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:focus-visible {
    outline: 2px solid var(--color-amber);
    box-shadow: 0 0 0 3px rgba(242,169,69,0.3);
}

/* ============================================================
   TOP-RIGHT CONTROLS — Mute Button
   ============================================================ */
.top-right-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    z-index: 100000;
    pointer-events: auto;
}

.global-back-btn, .combat-retreat-btn {
    background: rgba(43, 45, 49, 0.8) !important;
    border: 1px solid var(--color-neutral-2) !important;
    border-radius: 4px !important;
    padding: 4px 10px !important;
    font-family: var(--font-mono) !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.15em !important;
    color: var(--color-blue-mid) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    pointer-events: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 28px;
    margin: 0 !important;
    white-space: nowrap;
}

.global-back-btn:hover, .combat-retreat-btn:hover {
    border-color: var(--color-red) !important;
    color: var(--color-red) !important;
}

.fullscreen-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 4px !important;
    cursor: pointer !important;
    height: auto !important;
    width: auto !important;
    font-size: 1rem !important;
    color: #F2A945 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.1s ease, color 0.2s ease !important;
}

.fullscreen-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.fullscreen-btn:hover {
    transform: scale(1.15) !important;
}

.fullscreen-btn.active {
    color: var(--color-green) !important;
}

.mute-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 4px !important;
    cursor: pointer !important;
    height: auto !important;
    width: auto !important;
    font-size: 0.85rem !important;
    color: #F2A945 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    transition: transform 0.1s ease !important;
}

.mute-btn:hover {
    transform: scale(1.15) !important;
}

.mute-btn.muted {
    color: var(--color-red) !important;
}

/* ============================================================
   AUTOPLAY & SWITCHER TOGGLES — bottom-left and bottom-right
   ============================================================ */
.bottom-left-controls {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    z-index: 1000;
}

.autoplay-panel,
.combat-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    z-index: 1000;
}

.autoplay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(16, 18, 24, 0.75);
    border: 1px solid rgba(242, 169, 69, 0.25);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    font-weight: bold;
    color: #F2A945;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    height: 28px;
    min-width: unset;
    min-height: unset;
    margin: 0;
}
.autoplay-btn.active {
    border-color: var(--color-green);
    color: var(--color-green);
    background: rgba(155, 229, 60, 0.1);
}
.autoplay-btn.speed-active {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}
.autoplay-btn:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.15);
    transform: scale(1.03);
}
.autoplay-btn:focus-visible {
    outline: 2px solid var(--color-blue);
}
.autoplay-icon { font-size: 0.75rem; }
.autoplay-state { font-weight: bold; font-size: 0.62rem; }

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

@keyframes amber-pulse {
    0%, 100% { opacity: 0.7; text-shadow: 0 0 12px rgba(242,169,69,0.4); }
    50%       { opacity: 1;   text-shadow: 0 0 24px rgba(242,169,69,0.8); }
}

@keyframes shard-popin {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   TITLE SCENE DOM ELEMENTS
   ============================================================ */
#title-ui {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#title-ui.visible {
    opacity: 1;
    pointer-events: auto;
}

.title-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.title-eyebrow {
    font-size: clamp(0.6rem, 1.5vw, 0.85rem);
    letter-spacing: 0.5em;
    color: var(--color-blue-mid);
    text-transform: uppercase;
}

.title-main {
    font-family: var(--font-title);
    font-size: clamp(2.8rem, 8vw, 6rem);
    font-weight: 700;
    color: var(--color-amber);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 0.9;
    animation: amber-pulse 3s ease-in-out infinite;
    text-shadow: 0 0 40px rgba(242,169,69,0.5), 0 0 80px rgba(242,169,69,0.2);
}

.title-sub {
    font-family: var(--font-title);
    font-size: clamp(1rem, 2.5vw, 1.8rem);
    font-weight: 600;
    color: var(--color-blue-mid);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    margin-top: 4px;
}

.title-version {
    font-size: 0.65rem;
    color: var(--color-neutral-3);
    letter-spacing: 0.2em;
    margin-top: 4px;
}

.title-divider {
    width: min(320px, 60vw);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-blue), transparent);
    margin: 24px 0;
}

.title-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.title-btn {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 14px 48px;
    border: 1px solid var(--color-blue);
    border-radius: 3px;
    background: rgba(43, 45, 49, 0.7);
    color: var(--color-amber);
    cursor: pointer;
    min-width: 220px;
    min-height: 52px; /* Spec 14: ≥48px */
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.title-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(242,169,69,0.08), transparent);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.title-btn:hover {
    border-color: var(--color-amber);
    background: rgba(74,107,140,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(242,169,69,0.15);
}
.title-btn:hover::before { transform: translateX(100%); }
.title-btn:active { transform: scale(0.98); }
.title-btn:focus-visible {
    outline: 2px solid var(--color-blue);
    box-shadow: 0 0 0 3px rgba(74,107,140,0.4);
}

.title-btn.secondary {
    color: var(--color-blue-mid);
    border-color: var(--color-neutral-2);
    font-size: 0.8rem;
    padding: 10px 40px;
    min-height: 48px;
}
.title-btn.secondary:hover {
    border-color: var(--color-blue);
    color: var(--color-amber);
    background: rgba(74,107,140,0.1);
}

.title-lore {
    margin-top: 32px;
    max-width: min(420px, 72vw);
    text-align: center;
    font-size: clamp(0.6rem, 1.2vw, 0.75rem);
    color: var(--color-neutral-3);
    font-style: italic;
    line-height: 1.6;
    letter-spacing: 0.04em;
    border-left: 2px solid var(--color-blue);
    padding-left: 12px;
}

/* Title Scene - Smartphone Landscape Adjustments */
@media (max-height: 480px) and (orientation: landscape) {
    .title-logo-wrap {
        margin-bottom: 6px;
        gap: 2px;
    }
    .title-main {
        font-size: clamp(1.8rem, 5vw, 3.2rem);
    }
    .title-eyebrow {
        font-size: 0.6rem;
        letter-spacing: 0.3em;
    }
    .title-sub {
        font-size: 0.6rem;
    }
    .title-divider {
        margin: 6px auto;
        width: 40%;
    }
    .title-menu {
        gap: 8px;
    }
    .title-btn {
        min-width: 140px;
        padding: 8px 24px;
        font-size: 0.75rem;
    }
    .title-btn.secondary {
        font-size: 0.7rem;
        padding: 6px 20px;
        min-height: 36px;
    }
    .title-lore {
        margin-top: 10px;
        max-width: min(500px, 80vw);
        font-size: 0.65rem;
        line-height: 1.4;
    }
}

/* ============================================================
   BASE CAMP ZONE LABELS (DOM text overlays)
   ============================================================ */
.zone-label {
    position: absolute;
    font-family: var(--font-title);
    font-size: clamp(0.6rem, 1.3vw, 0.8rem);
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-amber);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    text-shadow: 0 0 8px rgba(242,169,69,0.6);
    white-space: nowrap;
    transform: translateX(-50%);
}
.zone-label.visible { opacity: 1; }

/* ============================================================
   RESPONSIVE — Spec 09/14 Breakpoints
   ============================================================ */
@media (max-width: 768px) {
    :root { --safe-margin: 6%; }

    #resource-bar { min-width: 160px; max-width: 200px; }
    .shrine-panel { width: 90vw; }

    .title-main { letter-spacing: 0.04em; }
    .title-btn  { min-width: 180px; padding: 14px 32px; }

    .autoplay-panel { bottom: max(20px, env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 1200px) {
    #resource-bar { min-width: 220px; }
}

/* ============================================================
   STAGE ENTRY SCENE — Fog-of-War Reading + Approach Selector
   ============================================================ */
#stage-entry-ui {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    z-index: 120;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    pointer-events: auto;
    padding: 6px 12px;
    font-family: var(--font-mono);
    overflow: hidden;
}

.se-header {
    text-align: center;
    margin-bottom: 2px;
}
.se-district {
    font-size: 0.75rem;
    color: var(--color-blue-mid);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.se-stage-label {
    font-size: 1.05rem;
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--color-amber);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 1px;
}
.se-boss-warn {
    color: var(--color-red);
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    margin-top: 1px;
    animation: se-pulse 1.2s ease infinite;
}
@keyframes se-pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* Stage Options */
.se-options {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    max-width: 900px;
    width: 100%;
    flex: 1;
    max-height: 250px;
    margin: 2px 0;
}
.se-option {
    background: rgba(43,45,49,0.92);
    border: 1px solid var(--color-neutral-2);
    border-radius: 6px;
    padding: 6px 10px;
    flex: 1;
    max-width: 280px;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
.se-option:hover {
    border-color: var(--color-amber);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(242,169,69,0.2);
}
.se-option.selected {
    border-color: var(--color-amber);
    background: rgba(242,169,69,0.12);
    box-shadow: 0 0 0 1px var(--color-amber);
}
.se-opt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}
.se-opt-label {
    font-family: var(--font-title);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--color-amber);
    letter-spacing: 0.08em;
}
.se-opt-risk { font-size: 0.62rem; letter-spacing: 0.08em; }
.se-opt-desc {
    font-size: 0.68rem;
    color: var(--color-blue-mid);
    line-height: 1.3;
    margin-bottom: 4px;
}
.se-opt-rewards {
    display: flex;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--color-neutral-3);
}

/* Approach Selector */
.se-approach-section {
    background: rgba(20, 22, 28, 0.95);
    border: 1px solid var(--color-neutral-2);
    border-radius: 6px;
    padding: 6px 14px;
    max-width: 900px;
    width: fit-content;
    margin: 0 auto;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
}
.se-approach-title {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--color-blue-mid);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.se-approach-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
}
.se-approach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    background: rgba(43,45,49,0.85);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 4px 10px;
    color: var(--color-blue-mid);
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    flex: 0 0 auto;
}
.se-approach-btn:hover { border-color: var(--color-amber); color: var(--color-amber); }
.se-approach-btn.active {
    border-color: var(--color-amber);
    background: rgba(242,169,69,0.15);
    color: var(--color-amber);
}
.approach-icon { display: inline-block; font-size: 0.85rem; margin-right: 4px; margin-bottom: 0; }
.approach-name { display: inline-block; font-family: var(--font-title); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.approach-stats { display: none; }

.se-commit-btn {
    margin-top: 6px;
    display: block;
    width: 100%;
    padding: 6px;
    background: rgba(242,169,69,0.1);
    border: 1px solid var(--color-amber);
    border-radius: 4px;
    color: var(--color-amber);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.se-commit-btn:hover:not(:disabled) { background: rgba(242,169,69,0.2); }
.se-commit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.se-commit-btn.boss-enter { border-color: var(--color-red); color: var(--color-red); }
.se-boss-ready { font-size: 0.72rem; color: var(--color-blue-mid); margin-bottom: 4px; }

/* Risk Meter */
.se-risk-meter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(26,28,33,0.85);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.65rem;
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
}
.risk-label { color: var(--color-blue-mid); letter-spacing: 0.15em; }
.risk-bar {
    flex: 1;
    height: 6px;
    background: var(--color-neutral-2);
    border-radius: 3px;
    overflow: hidden;
    min-width: 80px;
}
.risk-fill {
    height: 100%;
    background: var(--color-green);
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
}
.risk-tier { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; min-width: 50px; text-align: right; }

/* Stage Entry Scene - Smartphone Landscape Adjustments */
@media (max-height: 480px) and (orientation: landscape) {
    #stage-entry-ui {
        gap: 6px;
        padding: 8px 12px;
    }
    .se-header {
        margin-bottom: 2px;
    }
    .se-district {
        font-size: 0.6rem;
    }
    .se-stage-label {
        font-size: 0.9rem;
        margin-top: 1px;
    }
    .se-boss-warn {
        font-size: 0.65rem;
        margin-top: 1px;
    }
    .se-options {
        gap: 8px;
    }
    .se-option {
        padding: 6px 12px;
        width: min(200px, 28vw);
    }
    .se-opt-header {
        margin-bottom: 2px;
    }
    .se-opt-label {
        font-size: 0.75rem;
    }
    .se-opt-risk {
        font-size: 0.6rem;
    }
    .se-opt-desc {
        font-size: 0.65rem;
        margin-bottom: 4px;
        line-height: 1.2;
    }
    .se-opt-rewards {
        font-size: 0.65rem;
        gap: 6px;
    }
    .se-approach-section {
        padding: 8px 12px;
        margin-top: 0;
    }
    .se-approach-title {
        font-size: 0.6rem;
        margin-bottom: 4px;
    }
    .se-approach-subtitle {
        display: none; /* Hide subtitle to save vertical space */
    }
    .se-approach-buttons {
        gap: 6px;
    }
    .se-approach-btn {
        padding: 4px 8px;
        white-space: nowrap;
        font-size: 0.6rem;
    }
    .approach-icon {
        font-size: 0.85rem;
        margin-right: 4px;
        margin-bottom: 0;
    }
    .approach-name {
        font-size: 0.7rem;
        white-space: nowrap;
    }
    .approach-stats {
        display: none;
    }
    .se-commit-btn {
        margin-top: 6px;
        padding: 8px;
        font-size: 0.75rem;
    }
    .se-boss-ready {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    .se-risk-meter {
        padding: 4px 10px;
        font-size: 0.65rem;
        gap: 6px;
    }
}

/* ============================================================
   COMBAT SCENE — Combat HUD
   ============================================================ */
#combat-hud {
    position: absolute;
    inset: 0;
    z-index: 110;
    pointer-events: none;
    font-family: var(--font-mono);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
}

.combat-top-bar {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    pointer-events: none;
}
.combat-player-stats {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(43,45,49,0.9);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 6px 10px;
    min-width: 160px;
}
.cstat-label {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--color-blue-mid);
    min-width: 20px;
}
.cstat-bar {
    flex: 1;
    height: 8px;
    background: var(--color-neutral-2);
    border-radius: 4px;
    overflow: hidden;
}
.cstat-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.hp-fill  { background: linear-gradient(90deg, #7ED321, #a8e063); }
.mp-fill  { background: linear-gradient(90deg, #4A6B8C, #6a9fc0); }
.cstat-val { font-size: 0.65rem; color: var(--color-amber); min-width: 60px; text-align: right; }

.combat-info-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 12px;
    text-align: center;
    padding: 6px 10px;
    background: rgba(43,45,49,0.8);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
}
.ci-district { display: block; font-size: 0.6rem; color: var(--color-blue-mid); letter-spacing: 0.15em; }
.ci-stage    { display: block; font-size: 0.7rem; color: var(--color-amber); letter-spacing: 0.1em; }

.combat-status-effects {
    display: flex;
    gap: 4px;
    padding: 4px 12px;
    pointer-events: none;
}
.se-badge {
    font-size: 1rem;
    background: rgba(43,45,49,0.8);
    border-radius: 4px;
    padding: 2px 4px;
    border: 1px solid var(--color-neutral-2);
}

/* Combat Log */
.combat-log {
    position: absolute;
    bottom: 90px;
    left: 12px;
    width: 220px;
    box-sizing: border-box;
    background: rgba(43,45,49,0.85);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    overflow: hidden;
    pointer-events: none;
}
.cl-header {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--color-blue-mid);
    padding: 5px 10px;
    border-bottom: 1px solid var(--color-neutral-2);
    text-transform: uppercase;
}
.cl-entries {
    max-height: 100px;
    overflow-y: auto;
    padding: 4px 8px;
}
.cl-entry {
    font-size: 0.68rem;
    line-height: 1.5;
    padding: 1px 0;
}

/* Combat Actions */
.combat-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    pointer-events: auto;
    z-index: 1000;
}
.ca-autoplay {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(43,45,49,0.9);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 6px 12px;
}
.ca-autoplay-label { font-size: 0.65rem; letter-spacing: 0.15em; color: var(--color-blue-mid); }
.ca-toggle-btn {
    background: rgba(43,45,49,0.8);
    border: 1px solid var(--color-neutral-2);
    border-radius: 3px;
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-blue-mid);
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1em;
}
.ca-toggle-btn.active { border-color: var(--color-green); color: var(--color-green); }

.ca-manual-actions {
    display: flex;
    gap: 6px;
    transition: opacity 0.2s ease;
}
.ca-btn {
    background: rgba(43,45,49,0.9);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-amber);
    min-width: 80px;
    text-align: center;
}
.ca-btn:hover { border-color: var(--color-amber); background: rgba(242,169,69,0.1); }
.ca-btn.attack { border-color: var(--color-red); color: var(--color-red); }
.ca-btn.defend { border-color: var(--color-blue); color: var(--color-blue); }
.ca-btn.skill  { border-color: #9b2dc8; color: #c07af0; }
.ca-btn.potion { border-color: var(--color-green); color: var(--color-green); }

.combat-retreat-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    right: auto;
    background: rgba(43,45,49,0.8);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 6px 14px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--color-blue-mid);
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}
.combat-retreat-btn:hover { border-color: var(--color-red); color: var(--color-red); }

/* ============================================================
   POST RUN DEBRIEF SCENE
   ============================================================ */
#debrief-ui {
    position: absolute;
    inset: 0;
    z-index: 130;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    font-family: var(--font-mono);
    animation: debrief-fade-in 0.4s ease forwards;
}
@keyframes debrief-fade-in { from{opacity:0; transform:scale(0.97)} to{opacity:1; transform:scale(1)} }

.debrief-cols { display: flex; flex-direction: row; justify-content: center; align-items: stretch; gap: 24px; }
.debrief-col { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.debrief-panel {
    background: rgba(26,28,33,0.98);
    border: 1px solid var(--color-neutral-2);
    border-radius: 8px;
    padding: 32px 40px;
    max-width: min(720px, 90vw);
    width: 100%;
    text-align: center;
    box-shadow: 0 0 60px rgba(0,0,0,0.7);
}

.debrief-state-label {
    font-family: var(--font-title);
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.debrief-divider {
    width: 60%;
    height: 1px;
    background: var(--color-neutral-2);
    margin: 12px auto 20px;
}

.debrief-stats { margin-bottom: 16px; }
.ds-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(74,78,86,0.3);
    font-size: 0.8rem;
    animation: ds-slide-in 0.3s ease both;
}
@keyframes ds-slide-in { from{opacity:0;transform:translateX(-10px)} to{opacity:1;transform:none} }
.ds-label { color: var(--color-blue-mid); letter-spacing: 0.1em; }
.ds-val { color: var(--color-amber); font-weight: 600; }
.ds-val.amber { color: var(--color-amber); }

.debrief-context {
    font-size: 0.7rem;
    color: var(--color-neutral-3);
    margin: 12px 0;
    letter-spacing: 0.1em;
}

/* Boss choice buttons */
.debrief-boss-choice { margin-top: 16px; }
.dbc-title { font-size: 0.7rem; letter-spacing: 0.2em; color: var(--color-blue-mid); margin-bottom: 10px; }
.dbc-btn {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
    text-align: center;
}
.dbc-btn small { display: block; font-size: 0.65rem; opacity: 0.7; margin-top: 2px; }
.dbc-btn.return  { background: rgba(43,45,49,0.9); border: 1px solid var(--color-blue); color: var(--color-blue); }
.dbc-btn.return:hover { background: rgba(74,107,140,0.2); }
.dbc-btn.descend { background: rgba(43,45,49,0.9); border: 1px solid var(--color-amber); color: var(--color-amber); }
.dbc-btn.descend:hover { background: rgba(242,169,69,0.15); }

/* CTA button */
.debrief-cta-btn {
    margin-top: 16px;
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(242,169,69,0.1);
    border: 1px solid var(--color-amber);
    border-radius: 4px;
    color: var(--color-amber);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}
.debrief-cta-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.debrief-cta-btn.ready:hover { background: rgba(242,169,69,0.22); }

/* Post-Run Debrief Scene - Smartphone Landscape Adjustments */
@media (max-height: 480px) and (orientation: landscape) {
    .debrief-panel {
        padding: 10px 20px;
        max-width: min(720px, 95vw); /* Allow wider layout to fit columns side-by-side */
    }
    .debrief-state-label {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    .debrief-divider {
        margin: 4px auto 8px;
    }
    .debrief-stats {
        margin-bottom: 6px;
    }
    .ds-row {
        padding: 2px 0;
        font-size: 0.65rem;
    }
    .debrief-context {
        font-size: 0.65rem;
        margin: 4px 0;
    }
    .debrief-descent-choice {
        margin-top: 4px;
        gap: 4px;
    }
    .dbc-btn {
        padding: 6px;
        font-size: 0.68rem;
        margin-bottom: 4px;
    }
    .debrief-cta-btn {
        padding: 8px;
        font-size: 0.72rem;
        margin-top: 4px;
    }
    /* Lore Fragment container adjustments inside debrief */
    .debrief-panel > div[style*="margin-top"] {
        margin-top: 6px !important;
        padding: 4px 8px !important;
        font-size: 0.6rem !important;
        line-height: 1.3 !important;
        max-height: 45px;
        overflow-y: auto;
    }
}

/* ============================================================
   WORKBENCH SCENE — Loadout & Auto-play Config
   ============================================================ */
#workbench-ui {
    position: absolute;
    inset: 0;
    z-index: 125;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    padding: 20px;
    pointer-events: auto;
    animation: debrief-fade-in 0.35s ease forwards;
}

.wb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    max-width: min(820px, 95vw);
    width: 100%;
}
.wb-icon { font-size: 1.2rem; color: var(--color-amber); }
.wb-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    letter-spacing: 0.15em;
    color: var(--color-amber);
    flex: 1;
}
.wb-close {
    background: none;
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 4px 10px;
    color: var(--color-blue-mid);
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s ease;
}
.wb-close:hover { border-color: var(--color-red); color: var(--color-red); }

.wb-body {
    display: flex;
    gap: 16px;
    max-width: min(820px, 95vw);
    width: 100%;
    flex-wrap: wrap;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    padding-right: 4px;
}
.wb-body::-webkit-scrollbar {
    width: 4px;
}
.wb-body::-webkit-scrollbar-track {
    background: rgba(10, 12, 15, 0.3);
}
.wb-body::-webkit-scrollbar-thumb {
    background: var(--color-neutral-3);
    border-radius: 2px;
}
.wb-body::-webkit-scrollbar-thumb:hover {
    background: var(--color-amber);
}

.wb-section {
    flex: 1;
    min-width: 280px;
    background: rgba(43,45,49,0.92);
    border: 1px solid var(--color-neutral-2);
    border-radius: 6px;
    padding: 16px;
}
.wb-section-title {
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    color: var(--color-blue-mid);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.wb-section-desc {
    font-size: 0.65rem;
    color: var(--color-neutral-3);
    margin-bottom: 12px;
    line-height: 1.4;
}

/* Priority list drag-drop */
.wb-priority-list { display: flex; flex-direction: column; gap: 6px; }
.wb-priority-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(26,28,33,0.8);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: grab;
    transition: all 0.15s ease;
    user-select: none;
}
.wb-priority-item:hover { border-color: var(--color-amber); }
.wb-priority-item.dragging { opacity: 0.5; border-style: dashed; }
.wbp-rank {
    font-size: 0.7rem;
    color: var(--color-amber);
    min-width: 14px;
    text-align: center;
}
.wbp-icon { font-size: 1rem; }
.wbp-info { flex: 1; }
.wbp-label { display: block; font-size: 0.75rem; color: var(--color-amber); }
.wbp-desc { display: block; font-size: 0.62rem; color: var(--color-neutral-3); }
.wbp-drag { color: var(--color-neutral-2); font-size: 1rem; cursor: grab; }

/* Parameters */
.wb-param { margin-bottom: 14px; }
.wb-param-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--color-blue-mid);
    margin-bottom: 6px;
    text-transform: uppercase;
}
.wb-param-val { color: var(--color-amber); }
.wb-param-hint { font-size: 0.6rem; color: var(--color-neutral-3); margin-top: 4px; }

.wb-slider {
    width: 100%;
    accent-color: var(--color-amber);
    cursor: pointer;
    height: 4px;
}

.wb-radio-group { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.wb-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(26,28,33,0.8);
    border: 1px solid var(--color-neutral-2);
    border-radius: 3px;
    padding: 5px 10px;
    font-size: 0.7rem;
    color: var(--color-blue-mid);
    cursor: pointer;
    transition: all 0.15s ease;
}
.wb-radio input[type="radio"] { display: none; }
.wb-radio:hover { border-color: var(--color-amber); color: var(--color-amber); }
.wb-radio.checked { border-color: var(--color-amber); color: var(--color-amber); background: rgba(242,169,69,0.08); }

.wb-footer {
    display: flex;
    gap: 10px;
    max-width: min(820px, 95vw);
    width: 100%;
    margin-top: 12px;
    justify-content: flex-end;
}
.wb-btn-reset {
    background: rgba(43,45,49,0.9);
    border: 1px solid var(--color-neutral-2);
    border-radius: 4px;
    padding: 10px 20px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--color-blue-mid);
    cursor: pointer;
    transition: all 0.2s ease;
}
.wb-btn-reset:hover { border-color: var(--color-red); color: var(--color-red); }

.wb-btn-save {
    background: rgba(242,169,69,0.1);
    border: 1px solid var(--color-amber);
    border-radius: 4px;
    padding: 10px 24px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    color: var(--color-amber);
    cursor: pointer;
    transition: all 0.2s ease;
}
.wb-btn-save:hover { background: rgba(242,169,69,0.2); }

/* ============================================================
   SHRINE LORE FRAGMENTS VIEWER — Task 1
   Spec 02: lore-narrative-backbone.md
   ============================================================ */
.shrine-lore-section { margin-top: 16px; border-top: 1px solid var(--color-neutral-2); padding-top: 12px; }
.shrine-section-title { font-size: 0.6rem; letter-spacing: 0.2em; color: var(--color-blue-mid); text-transform: uppercase; margin-bottom: 8px; }
.shrine-lore-count { font-size: 0.68rem; color: var(--color-amber); margin-bottom: 8px; }
.shrine-lore-list { max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.shrine-lore-entry { font-size: 0.62rem; color: #7ab5d9; font-style: italic; line-height: 1.4; padding: 4px 0; border-bottom: 1px solid rgba(74,107,140,0.2); }

/* Last Run Summary */
.shrine-run-summary-section {
    margin-top: 14px;
    border-top: 1px solid var(--color-neutral-2);
    padding-top: 12px;
}
.shrine-run-summary-content {
    font-size: 0.65rem;
    color: var(--color-neutral-3);
    line-height: 1.5;
}
.shrine-run-summary-empty {
    font-style: italic;
    color: var(--color-neutral-4);
    text-align: center;
    padding: 8px 0;
}
.shrine-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(74, 107, 140, 0.1);
    font-family: var(--font-mono);
}
.shrine-summary-row:last-child {
    border-bottom: none;
}
.summary-val {
    color: var(--color-amber);
    font-weight: bold;
}
.summary-val.outcome-boss_defeated {
    color: #7ED321;
    text-shadow: 0 0 4px rgba(126, 211, 33, 0.3);
}
.summary-val.outcome-stage_clear {
    color: #56CCF2;
}
.summary-val.outcome-death {
    color: #D32F2F;
    text-shadow: 0 0 4px rgba(211, 47, 47, 0.3);
}
.summary-val.outcome-retreat {
    color: #F2C94C;
}
.summary-val.outcome-starvation {
    color: #F2A945;
}

/* Combat Logs Accordion styling */
.shrine-logs-header {
    background: rgba(74, 107, 140, 0.1);
    border: 1px solid rgba(74, 107, 140, 0.2);
    border-radius: 4px;
    padding: 6px 10px;
    margin-top: 10px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
    user-select: none;
}
.shrine-logs-header:hover {
    background: rgba(74, 107, 140, 0.2);
}
.shrine-logs-content {
    border-left: 1px solid rgba(74, 107, 140, 0.2);
    border-right: 1px solid rgba(74, 107, 140, 0.2);
    border-bottom: 1px solid rgba(74, 107, 140, 0.2);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    padding: 8px 10px;
    max-height: 150px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(10, 12, 15, 0.4);
}
.shrine-log-line {
    word-break: break-word;
    white-space: normal;
    text-align: left;
}
.shrine-log-time {
    color: #7D8F9E;
    margin-right: 6px;
}

.debrief-descent-choice { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.descent-choice-label { font-size: 0.65rem; letter-spacing: 0.2em; color: var(--color-blue-mid); text-transform: uppercase; }
.descent-choice-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.debrief-cta-btn.return-btn { border-color: var(--color-blue, #7AB5D9); color: var(--color-blue, #7AB5D9); background: rgba(122,181,217,0.12); }
.debrief-cta-btn.return-btn:hover { background: rgba(122,181,217,0.25); }
.debrief-cta-btn.descent-btn { border-color: var(--color-amber, #F2A945); color: var(--color-amber, #F2A945); background: rgba(242,169,69,0.12); }
.debrief-cta-btn.descent-btn:hover { background: rgba(242,169,69,0.25); }
#title-ui { position: absolute; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; font-family: var(--font-mono); }

/* Task 1 */
.shrine-skills { margin-top: 14px; border-top: 1px solid var(--color-neutral-2); padding-top: 12px; }
.shrine-skill-desc { font-size: 0.6rem; color: var(--color-neutral-3); margin-bottom: 10px; line-height: 1.4; }
.shrine-stat-rows { display: flex; flex-direction: column; gap: 8px; }
.shrine-skill-row { display: flex; align-items: center; gap: 8px; }
.skill-icon { font-size: 1rem; min-width: 20px; }
.skill-info { flex: 1; display: flex; flex-direction: column; }
.skill-label { font-size: 0.72rem; color: var(--color-amber); }
.skill-subdesc { font-size: 0.6rem; color: var(--color-neutral-3); }
.skill-controls { display: flex; align-items: center; gap: 6px; }
.skill-cost { font-size: 0.65rem; color: var(--color-blue-mid); min-width: 30px; text-align: right; }
.skill-up-btn { background: rgba(242,169,69,0.12); border: 1px solid var(--color-amber); border-radius: 3px; padding: 3px 10px; color: var(--color-amber); font-size: 1rem; cursor: pointer; transition: all 0.15s ease; }
.skill-up-btn.can-afford:hover { background: rgba(242,169,69,0.25); }
.skill-up-btn.no-afford { opacity: 0.3; cursor: not-allowed; border-color: var(--color-neutral-2); color: var(--color-neutral-2); }

/* Task 2 */
.c-descent-row { display: flex; align-items: center; gap: 6px; font-size: 0.62rem; margin-top: 4px; }
.c-descent-label, .c-resonance-label { color: var(--color-neutral-3); letter-spacing: 0.1em; text-transform: uppercase; }
.c-descent-val { color: #7ab5d9; font-weight: bold; }
.c-resonance-val { color: var(--color-amber); font-weight: bold; }
.scanlines { position: absolute; inset: 0; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)); background-size: 100% 4px, 6px 100%; pointer-events: none; z-index: -1; }
@keyframes title-flicker { 0%, 100% { opacity: 1; text-shadow: 0 0 8px rgba(242,169,69,0.3); } 92% { opacity: 1; } 93% { opacity: 0.5; } 94% { opacity: 1; } 96% { opacity: 0.2; } 98% { opacity: 1; } }

/* Shrine danger zone - RESET SAVE */
.shrine-danger-zone { margin-top: 16px; border-top: 1px solid rgba(211,47,47,0.3); padding-top: 12px; text-align: center; }
.shrine-reset-btn { background: none; border: 1px solid rgba(211,47,47,0.4); border-radius: 3px; padding: 6px 16px; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em; color: rgba(211,47,47,0.6); cursor: pointer; transition: all 0.2s ease; width: 100%; }
.shrine-reset-btn:hover { border-color: #D32F2F; color: #D32F2F; background: rgba(211,47,47,0.06); }

/* =========================================================
   Stage Entry Scene - Enhanced Encounter Options
   ========================================================= */

/* Option accent border via CSS variable */
.se-option {
    border-left: 3px solid var(--opt-accent, var(--color-amber));
    transition: border-color 0.2s ease, background 0.2s ease;
}
.se-option:hover, .se-option.selected {
    background: color-mix(in srgb, var(--opt-accent, var(--color-amber)) 10%, transparent);
}

.se-opt-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.se-opt-icon {
    font-size: 1.1rem;
    min-width: 22px;
    text-align: center;
}
.se-opt-badges {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}
.se-opt-badge {
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: var(--font-mono);
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 1px 5px;
    opacity: 0.85;
}

/* Mysterious Place: pulsing purple glow */
.se-option-mysterious_place {
    animation: mystery-pulse 2.4s ease-in-out infinite;
}
@keyframes mystery-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(155,89,182,0); }
    50% { box-shadow: 0 0 12px 2px rgba(155,89,182,0.2); }
}

/* Unique Enemy: red glow */
.se-option-unique_enemy {
    animation: unique-glow 1.8s ease-in-out infinite alternate;
}
@keyframes unique-glow {
    from { box-shadow: inset 0 0 0 0 rgba(211,47,47,0); }
    to   { box-shadow: inset 0 0 8px 1px rgba(211,47,47,0.15); }
}

/* Stage progress bar at top of StageEntry */
.se-stage-progress {
    position: relative;
    display: flex;
    gap: 20px; /* larger gap so nodes look distinct */
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    width: fit-content;
    padding: 6px 20px;
}
.se-stage-progress::before {
    content: '';
    position: absolute;
    left: 27px; /* padding 20px + half width 7px = 27px (center of first node) */
    right: 27px; /* center of last node */
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background: rgba(74, 107, 140, 0.2);
    z-index: 1;
}
.se-stage-pip {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a1c21;
    border: 2px solid rgba(74, 107, 140, 0.4);
    position: relative;
    z-index: 2; /* Sit on top of the line */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0px; /* Hide text by default */
}
.se-stage-pip.done {
    background: #7ED321;
    border-color: #7ED321;
    box-shadow: 0 0 6px rgba(126, 211, 33, 0.5);
}
.se-stage-pip.current {
    background: var(--color-amber);
    border-color: var(--color-amber);
    box-shadow: 0 0 8px var(--color-amber);
    transform: scale(1.2);
}
.se-stage-pip.boss {
    background: #1a1c21;
    border: 2px solid #D32F2F;
    width: 22px;
    height: 22px;
    font-size: 10px;
    color: #D32F2F;
    box-shadow: 0 0 6px rgba(211, 47, 47, 0.3);
}
.se-stage-pip.boss.done {
    background: #D32F2F;
    border-color: #D32F2F;
    color: #ffffff;
    box-shadow: 0 0 10px #D32F2F;
}
.se-stage-pip.boss.current {
    background: #D32F2F;
    border-color: var(--color-amber);
    color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 0 12px #D32F2F;
}

/* =========================================================
   Stage Entry Scene - Simplified flow (no COMMIT button)
   ========================================================= */

/* Subtitle under approach title */
.se-approach-subtitle {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--color-neutral-3);
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

/* CTA hint on option cards */
.se-opt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}
.se-opt-cta {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    color: var(--color-neutral-3);
    font-family: var(--font-mono);
    opacity: 0.7;
    transition: opacity 0.2s;
}
.se-opt-cta-instant {
    color: #7ED321;
}
.se-option:hover .se-opt-cta {
    opacity: 1;
}

/* Approach buttons pulse on hover to signal they commit immediately */
.se-approach-btn {
    position: relative;
    overflow: hidden;
}
.se-approach-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.15s;
}
.se-approach-btn:hover::after { opacity: 0.06; }
.se-approach-btn:active::after { opacity: 0.14; }

/* Selected option - dim others */
.se-options:has(.se-option.selected) .se-option:not(.selected) {
    opacity: 0.45;
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════
   STATUS EFFECTS PANEL (below resource bar)
   ═══════════════════════════════════════════════════════════ */
.status-effects-panel {
    position: absolute;
    top: 90px;
    left: 12px;
    background: rgba(20, 22, 28, 0.85);
    border: 1px solid rgba(200, 162, 100, 0.2);
    border-radius: 6px;
    padding: 4px 6px;
    z-index: 120;
    backdrop-filter: blur(4px);
}
.status-effects-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 200px;
}
.status-effect-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    position: relative;
    border: 1px solid rgba(255,255,255,0.15);
    transition: transform 0.15s ease;
}
.status-effect-icon:hover {
    transform: scale(1.2);
    z-index: 10;
}
.status-effect-icon .se-duration {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 9px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    border-radius: 3px;
    padding: 0 2px;
    line-height: 1;
}
.status-effect-icon.buff { background: rgba(76, 175, 80, 0.3); }
.status-effect-icon.debuff { background: rgba(244, 67, 54, 0.3); }
.status-effect-icon.dot { background: rgba(255, 152, 0, 0.3); }

/* Pulse animation for active effects */
@keyframes se-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,255,255,0.1); }
    50% { box-shadow: 0 0 8px rgba(255,200,100,0.4); }
}
.status-effect-icon.active { animation: se-pulse 2s ease-in-out infinite; }

.combat-log-panel {
    position: absolute;
    top: 58px;
    left: 8px;
    right: auto;
    width: 240px;
    box-sizing: border-box;
    margin: 0;
    background: rgba(16, 18, 24, 0.92);
    border: 1px solid rgba(200, 162, 100, 0.15);
    border-radius: 8px;
    z-index: 120;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
    transition: all 0.2s ease;
}
.combat-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(200, 162, 100, 0.12);
}
.combat-log-title {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 8px;
    font-weight: 700;
    color: rgba(200, 162, 100, 0.8);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.combat-log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}
.combat-log-btn {
    background: none;
    border: none;
    color: rgba(200, 162, 100, 0.6);
    font-size: 9px;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.2s ease, transform 0.2s ease;
}
.combat-log-btn:hover { color: rgba(200, 162, 100, 1); }

/* Compact mode: 3 lines maximum, hide scrollbar, overflow hidden */
.combat-log-panel.compact .combat-log-body {
    max-height: 52px;
    overflow: hidden;
}

/* Expanded mode: scrollable full body */
.combat-log-panel.expanded .combat-log-body {
    max-height: 220px;
    overflow-y: auto;
}

/* Minimized mode: shrink entire panel to a single 36x36 circular button */
.combat-log-panel.minimized {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: rgba(16, 18, 24, 0.95);
    border-color: rgba(200, 162, 100, 0.4);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.combat-log-panel.minimized:hover {
    border-color: var(--color-amber);
}
.combat-log-panel.minimized .combat-log-title,
.combat-log-panel.minimized .combat-log-body,
.combat-log-panel.minimized #combat-log-expand {
    display: none !important;
}
.combat-log-panel.minimized .combat-log-header {
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: none;
}
.combat-log-panel.minimized #combat-log-minimize {
    font-size: 16px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-amber);
    padding: 0;
    margin: 0;
}



.combat-log-body {
    overflow-y: auto;
    max-height: 250px;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,162,100,0.3) transparent;
}
.combat-log-body::-webkit-scrollbar { width: 4px; }
.combat-log-body::-webkit-scrollbar-thumb {
    background: rgba(200, 162, 100, 0.3);
    border-radius: 2px;
}

.combat-log-entry {
    padding: 2px 6px;
    font-size: 8px;
    font-family: 'Fira Code', 'Consolas', monospace;
    line-height: 1.35;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    animation: log-fadein 0.3s ease;
}
@keyframes log-fadein {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}
.combat-log-entry.type-player { color: #8bc34a; }
.combat-log-entry.type-enemy  { color: #f44336; }
.combat-log-entry.type-system { color: rgba(200, 162, 100, 0.7); }
.combat-log-entry.type-crit   { color: #ffc107; font-weight: 700; }
.combat-log-entry .log-time {
    color: rgba(255,255,255,0.25);
    margin-right: 4px;
    font-size: 7px;
}

/* ═══════════════════════════════════════════════════════════
   COMBAT SKILL BUTTONS (bottom-center)
   ═══════════════════════════════════════════════════════════ */
.combat-skills-panel {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 18, 24, 0.9);
    border: 1px solid rgba(200, 162, 100, 0.2);
    border-radius: 8px;
    padding: 3px 8px;
    height: 42px; /* Exactly 1.5x of Auto button height (28px * 1.5 = 42px) */
    box-sizing: border-box;
    z-index: 130;
    backdrop-filter: blur(6px);
}
.skill-btn {
    width: 54px;
    height: 34px; /* Fits inside 42px panel */
    border: 1px solid rgba(200, 162, 100, 0.25);
    border-radius: 6px;
    background: rgba(30, 32, 40, 0.8);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    overflow: hidden;
    padding: 0 4px;
}
.skill-btn:hover {
    border-color: rgba(200, 162, 100, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(200, 162, 100, 0.15);
}
.skill-btn:active {
    transform: translateY(0) scale(0.95);
}
.skill-btn:focus-visible {
    outline: 2px solid rgba(200, 162, 100, 0.8);
    outline-offset: 2px;
}
.skill-btn.on-cooldown {
    opacity: 0.5;
    cursor: not-allowed;
}
.skill-btn.on-cooldown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
}
.skill-icon {
    font-size: 16px;
    line-height: 1;
}
.skill-name {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: rgba(200, 162, 100, 0.8);
    margin-top: 0;
}
.skill-cd {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 10px;
    color: #f44336;
    font-weight: 700;
}
.skill-potion {
    border-color: rgba(76, 175, 80, 0.3);
}
.skill-potion:hover {
    border-color: rgba(76, 175, 80, 0.6);
}

/* Boss enrage screen flash effect */
@keyframes boss-enrage-flash {
    0% { background: transparent; }
    15% { background: rgba(244, 67, 54, 0.15); }
    100% { background: transparent; }
}
.enrage-flash {
    animation: boss-enrage-flash 0.8s ease-out;
}

/* Boss enrage tint overlay */
.boss-enrage-tint {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(244, 67, 54, 0.08) 100%);
    z-index: 100;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile adjustments for combat HUD
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .combat-log-panel {
        width: 240px;
        max-height: 200px;
        top: 58px;
        left: 8px;
        right: auto;
        margin: 0;
    }
    .combat-log-entry { font-size: 10px; }

    .combat-skills-panel {
        bottom: 8px;
        gap: 5px;
        padding: 6px 8px;
    }
    .skill-btn {
        width: 44px;
        height: 44px;
    }
    .skill-icon { font-size: 18px; }
    .skill-name { font-size: 8px; }

    .status-effects-panel { top: 75px; }
}

/* ═══════════════════════════════════════════════════════════
   INVENTORY UI OVERLAY
   ═══════════════════════════════════════════════════════════ */
.inv-overlay {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.inv-panel {
    position: relative;
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    background: rgba(20, 22, 30, 0.97);
    border: 1px solid rgba(200, 162, 100, 0.25);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.inv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(200, 162, 100, 0.15);
    background: rgba(30, 32, 40, 0.5);
}
.inv-title {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: rgba(200, 162, 100, 0.9);
    letter-spacing: 2px;
    margin: 0;
}
.inv-tabs {
    display: flex;
    gap: 4px;
}
.inv-tab {
    background: none;
    border: 1px solid rgba(200, 162, 100, 0.2);
    border-radius: 4px;
    color: rgba(200, 162, 100, 0.5);
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.inv-tab:hover { color: rgba(200, 162, 100, 0.8); border-color: rgba(200, 162, 100, 0.4); }
.inv-tab.active { background: rgba(200, 162, 100, 0.15); color: rgba(200, 162, 100, 1); border-color: rgba(200, 162, 100, 0.5); }
.inv-close {
    background: none;
    border: none;
    color: rgba(200, 162, 100, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s ease;
}
.inv-close:hover { color: #f44336; }

.inv-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.inv-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(200,162,100,0.2) transparent;
}
.inv-sidebar {
    width: 180px;
    border-left: 1px solid rgba(200, 162, 100, 0.1);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Inventory Grid */
.inv-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}
.inv-slot {
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(30, 32, 40, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.1s ease;
    min-height: 44px;
}
.inv-slot.filled:hover {
    transform: scale(1.08);
    z-index: 5;
    box-shadow: 0 0 12px rgba(200, 162, 100, 0.2);
}
.inv-slot.empty {
    opacity: 0.3;
    cursor: default;
}
.inv-item-icon { font-size: 20px; }
.inv-stack {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    padding: 0 3px;
    font-weight: 700;
}

/* Equipment Slots */
.inv-equip-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: rgba(200, 162, 100, 0.6);
    letter-spacing: 1.5px;
    text-align: center;
    margin-bottom: 4px;
}
.inv-equip-slot {
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-bottom: 3px;
    transition: border-color 0.2s ease;
}
.inv-equip-slot.filled { background: rgba(200, 162, 100, 0.06); }
.inv-equip-label {
    font-size: 9px;
    color: rgba(200, 162, 100, 0.5);
    display: block;
}
.inv-equip-item {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
}
.inv-equip-slot.empty .inv-equip-item { color: rgba(255, 255, 255, 0.2); }

/* Tooltip */
.inv-tooltip {
    background: rgba(10, 12, 18, 0.98);
    border: 1px solid rgba(200, 162, 100, 0.3);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 8px;
}
.tt-name { font-weight: 700; font-size: 13px; }
.tt-rarity { font-size: 10px; color: rgba(255,255,255,0.4); margin-bottom: 4px; text-transform: uppercase; }
.tt-desc { font-size: 11px; color: rgba(255,255,255,0.6); margin-bottom: 6px; line-height: 1.3; }
.tt-stat { font-size: 11px; color: rgba(76, 175, 80, 0.9); }
.tt-val { font-weight: 700; }
.tt-sell { font-size: 10px; color: rgba(255, 193, 7, 0.7); margin-top: 4px; }

/* Crafting Tab */
.inv-craft-list { display: flex; flex-direction: column; gap: 8px; }
.inv-craft-recipe {
    padding: 10px;
    border: 1px solid rgba(200, 162, 100, 0.15);
    border-radius: 6px;
    background: rgba(30, 32, 40, 0.5);
}
.inv-craft-recipe.locked { opacity: 0.6; }
.craft-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.craft-name { font-weight: 700; font-size: 13px; color: rgba(200, 162, 100, 0.9); }
.craft-btn {
    background: rgba(200, 162, 100, 0.15);
    border: 1px solid rgba(200, 162, 100, 0.3);
    color: rgba(200, 162, 100, 0.9);
    font-family: 'Rajdhani', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.craft-btn:hover:not(:disabled) { background: rgba(200, 162, 100, 0.25); }
.craft-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.craft-desc { font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.craft-ings { display: flex; gap: 8px; flex-wrap: wrap; }
.craft-ing { font-size: 10px; color: rgba(255,255,255,0.5); }
.craft-ing.have { color: rgba(76, 175, 80, 0.8); }
.craft-ing.missing { color: rgba(244, 67, 54, 0.8); }

@media (max-width: 768px) {
    .inv-panel { width: 95vw; }
    .inv-grid { grid-template-columns: repeat(6, 1fr); }
    .inv-sidebar { width: 140px; }
    .inv-body { flex-direction: column; }
    .inv-sidebar { width: 100%; border-left: none; border-top: 1px solid rgba(200, 162, 100, 0.1); }
}

/* ═══════════════════════════════════════════════════════════
   FOG-OF-WAR GRID UI
   ═══════════════════════════════════════════════════════════ */
.fog-overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}
.fog-panel {
    background: rgba(16, 18, 24, 0.95);
    border: 1px solid rgba(200, 162, 100, 0.2);
    border-radius: 12px;
    padding: 14px;
    max-width: 500px;
    width: 90vw;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.fog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.fog-title {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: rgba(200, 162, 100, 0.9);
    letter-spacing: 1.5px;
}
.fog-risk-meter {
    display: flex;
    align-items: center;
    gap: 4px;
}
.fog-risk-label {
    font-size: 10px;
    color: rgba(200, 162, 100, 0.5);
    letter-spacing: 1px;
}
.fog-risk-val {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

.fog-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
}
.fog-tile {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 40px;
    border: 1px solid rgba(255,255,255,0.05);
}
.fog-tile.hidden {
    background: rgba(40, 42, 50, 0.8);
    color: rgba(255,255,255,0.3);
}
.fog-tile.hidden:hover {
    background: rgba(50, 52, 60, 0.9);
    border-color: rgba(200, 162, 100, 0.3);
    transform: scale(1.05);
}
.fog-tile.revealed {
    background: rgba(30, 32, 40, 0.6);
    animation: fog-reveal 0.4s ease;
}
@keyframes fog-reveal {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.fog-tile-icon { font-size: 18px; line-height: 1; }
.fog-audio-clue {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 9px;
    opacity: 0.5;
}
.fog-crack {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 9px;
    opacity: 0.7;
}

/* Ambient light tints */
.fog-tile-warm { border-color: rgba(255, 193, 7, 0.2); }
.fog-tile-cold { border-color: rgba(33, 150, 243, 0.2); }
.fog-tile-neutral { border-color: rgba(255,255,255,0.05); }
.fog-tile-warm.revealed { background: rgba(255, 193, 7, 0.05); }
.fog-tile-cold.revealed { background: rgba(33, 150, 243, 0.05); }

/* Legend */
.fog-legend {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    flex-wrap: wrap;
}
.fog-leg-item {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
}

/* ═══════════════════════════════════════════════════════════
   VENDOR & SHOP INTERFACE UI
   ═══════════════════════════════════════════════════════════ */
.vendor-overlay {
    position: absolute;
    inset: 0;
    z-index: 501;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
}
.vendor-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(5px);
}
.vendor-panel {
    position: relative;
    width: 780px;
    max-width: 95vw;
    height: 520px;
    max-height: 90vh;
    background: rgba(24, 26, 32, 0.98);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 75px rgba(0, 0, 0, 0.7);
}
.vendor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.vendor-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vendor-faction-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}
.vendor-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1.5px;
    margin: 0;
    text-transform: uppercase;
}
.vendor-tabs {
    display: flex;
    gap: 6px;
}
.vendor-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 5px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.vendor-tab:hover { color: #ffffff; background: rgba(255, 255, 255, 0.1); }
.vendor-tab.active { background: rgba(255, 255, 255, 0.15); color: #ffffff; border-color: rgba(255, 255, 255, 0.3); }
.vendor-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}
.vendor-close:hover { color: #f44336; }

.vendor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.vendor-left-pane {
    flex: 1.2;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.vendor-right-pane {
    flex: 0.8;
    padding: 20px;
    background: rgba(18, 20, 24, 0.95);
    overflow-y: auto;
}

.vendor-section-header {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}
.vendor-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    overflow-y: auto;
    max-height: 320px;
    padding-bottom: 10px;
}
.vendor-slot {
    aspect-ratio: 1;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    background: rgba(30, 32, 40, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
}
.vendor-slot.filled:hover {
    transform: scale(1.06);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}
.vendor-slot.filled.selected {
    border-color: #ffffff !important;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 12px currentColor;
}
.vendor-slot.sold-out {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.15);
    font-size: 10px;
    font-weight: 700;
    cursor: default;
}
.vendor-slot.empty {
    opacity: 0.2;
    cursor: default;
}
.vendor-item-icon { font-size: 22px; }
.vendor-stack {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    padding: 0 4px;
    font-weight: 700;
}

.vendor-player-gold-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}
.vendor-player-gold {
    color: #ffc107;
    font-size: 18px;
    text-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
}

/* Details Pane */
.vendor-details-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    font-size: 13px;
}
.vd-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fade-in 0.25s ease;
}
.vd-name { font-size: 20px; font-weight: 700; }
.vd-rarity { font-size: 11px; text-transform: uppercase; opacity: 0.5; margin-top: -6px; }
.vd-desc { font-size: 13px; color: rgba(255, 255, 255, 0.7); line-height: 1.4; }
.vd-stats-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    padding-left: 10px;
}
.vd-stat { font-size: 13px; color: rgba(255, 255, 255, 0.8); }
.vd-val { font-weight: 700; color: #4caf50; }

.vd-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.vd-price-label { font-size: 12px; color: rgba(255, 255, 255, 0.5); font-weight: 700; }
.vd-price-val { font-size: 18px; font-weight: 700; }

.vendor-action-btn {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Compare panel */
.vendor-compare-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 5px;
}
.vcp-header { font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.4); margin-bottom: 6px; }
.vcp-row { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 6px; opacity: 0.8; }
.vcp-col { width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcp-net { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; }
.vcp-stat { display: flex; align-items: center; }
.vcp-stat.positive { color: #4caf50; font-weight: 700; }
.vcp-stat.negative { color: #f44336; font-weight: 700; }

@media (max-width: 768px) {
    .vendor-panel { height: 90vh; }
    .vendor-body { flex-direction: column; }
    .vendor-left-pane { border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
    .vendor-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   VISUAL SKILL TREE LAYOUT (Shrine Panel)
   ═══════════════════════════════════════════════════════════ */
.skill-tree-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 10px;
    padding: 10px;
}
.skill-tree-root {
    display: flex;
    justify-content: center;
    width: 100%;
}
.skill-tree-connectors {
    width: 100%;
    height: 30px;
    position: relative;
    opacity: 0.8;
}
.skill-tree-branches {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

/* Skill Tree Node Styling */
.skill-node {
    width: 155px;
    background: rgba(30, 34, 45, 0.95);
    border: 1px solid rgba(200, 162, 100, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}
.skill-node:hover {
    border-color: rgba(200, 162, 100, 0.6);
    box-shadow: 0 4px 16px rgba(200, 162, 100, 0.15);
    transform: translateY(-2px);
}
.skill-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.skill-node-icon {
    font-size: 16px;
    color: #ffb300;
}
.skill-node-info {
    display: flex;
    flex-direction: column;
}
.skill-node-label {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}
.skill-node-level {
    font-size: 9px;
    font-weight: 700;
    color: #ffb300;
}
.skill-node-desc {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 6px;
    min-height: 24px;
}
.skill-node-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 6px;
}
.skill-node-cost {
    font-size: 11px;
    color: #ffb300;
    font-weight: 700;
}
.skill-node-up-btn {
    background: rgba(200, 162, 100, 0.15);
    border: 1px solid rgba(200, 162, 100, 0.3);
    color: rgba(200, 162, 100, 0.9);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.skill-node-up-btn:hover:not(:disabled) {
    background: rgba(200, 162, 100, 0.3);
    border-color: rgba(200, 162, 100, 0.6);
}
.skill-node-up-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Combat countdown overlay */
.combat-countdown-overlay {
    position: absolute;
    top: 90px; /* Below the top HUD bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000; /* on top of everything in HUD */
    font-family: 'Rajdhani', sans-serif;
    color: #ffffff;
    pointer-events: none; /* let clicks pass through */
    transition: opacity 0.3s ease;
}

.combat-countdown-content {
    background: rgba(13, 16, 21, 0.75);
    border: 1px solid rgba(224, 112, 48, 0.25);
    border-radius: 6px;
    padding: 10px 24px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    text-align: center;
}

.combat-countdown-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #a5b4fc; /* indigo-300 */
    text-shadow: 0 0 8px rgba(165, 180, 252, 0.4);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.combat-countdown-timer {
    font-size: 48px;
    font-weight: 700;
    font-family: 'Share Tech Mono', monospace;
    color: #e07030;
    text-shadow: 0 0 15px rgba(224, 112, 48, 0.6);
    margin: 5px 0;
    animation: ccd-pulse 1s infinite alternate;
}

.combat-countdown-subtitle {
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

@keyframes ccd-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.85;
    }
    100% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* 🌐 LANGUAGE SWITCHER WIDGET */
.lang-switcher {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(16, 18, 24, 0.75);
    border: 1px solid rgba(242, 169, 69, 0.25);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    font-weight: bold;
    color: #F2A945;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    height: 28px;
}
.lang-switcher:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.15);
    transform: scale(1.03);
}

/* 🔤 FONT SWITCHER WIDGET */
.font-switcher, #font-switcher-btn {
    display: none !important; /* Hidden as requested; change to inline-flex to restore */
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(16, 18, 24, 0.75);
    border: 1px solid rgba(242, 169, 69, 0.25);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    font-weight: bold;
    color: #F2A945;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0,0,0,0.5);
    height: 28px;
}
.font-switcher:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.15);
    transform: scale(1.03);
}

/* ============================================================
   HUD RESOURCE BAR HEADER
   ============================================================ */
.hud-resources-header {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}
.player-class-type {
    font-weight: bold;
    color: var(--color-blue-mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.player-level {
    color: #F2A945;
    font-weight: bold;
}

/* ============================================================
   CHARACTER SELECTION SYSTEM
   ============================================================ */
.char-select-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center; /* Centered vertically for balanced top and bottom spacing */
    justify-content: center;
    padding: 24px 0 12px 0; /* Ensures clean clearance below top-right header control buttons */
    z-index: 99990;
}

.char-select-container {
    width: min(780px, 94%);
    max-height: min(390px, 90%);
    background: rgba(18, 20, 26, 0.96);
    border: 1px solid rgba(242, 169, 69, 0.35);
    border-radius: 10px;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(242, 169, 69, 0.05);
    display: flex;
    flex-direction: column;
    padding: 12px 18px;
    font-family: var(--font-mono);
    animation: window-fade-in 0.3s ease;
    overflow-y: auto;
    position: relative;
}

.char-select-title {
    text-align: center;
    font-size: 0.92rem;
    color: #F2A945;
    letter-spacing: 0.08em;
    margin: 0 0 6px 0;
    border-bottom: 1px solid rgba(242, 169, 69, 0.2);
    padding-bottom: 3px;
    text-shadow: 0 0 6px rgba(242, 169, 69, 0.3);
}

.char-select-body-split {
    display: flex;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 4px;
}

.char-select-controls-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: space-between;
}

.variant-section {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.variant-buttons {
    display: flex;
    gap: 10px;
}

.variant-btn {
    flex: 1;
    padding: 8px 10px;
    background: rgba(16, 18, 24, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 0.76rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.variant-btn.active {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.2);
    color: #F2A945;
    box-shadow: 0 0 10px rgba(242, 169, 69, 0.2);
}

.char-select-left-actions {
    display: flex;
    gap: 10px;
    margin-top: 2px;
}

.char-select-left-actions .title-btn {
    flex: 1;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 8px !important;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Single Maximized Square Character Preview Box (Top aligned with Class Cards, Bottom aligned with Confirm button) */
.char-preview-panel {
    flex: 0 0 215px;
    width: 215px;
    height: 215px;
    background: radial-gradient(circle at center, rgba(30, 35, 45, 0.8) 0%, rgba(10, 12, 16, 0.95) 100%);
    border: 1px solid rgba(242, 169, 69, 0.4);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(242, 169, 69, 0.05);
    position: relative;
    overflow: hidden;
}

/* Frameless Eye Icon Button (No Border, No Box, No Background) */
.preview-inspect-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    width: 28px;
    height: 28px;
    font-size: 1.15rem;
    color: #F2A945;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: none !important;
    padding: 0;
}

.preview-inspect-btn:hover {
    background: transparent !important;
    border: none !important;
    transform: scale(1.25);
    opacity: 0.9;
}

#char-preview-canvas {
    width: 100%;
    height: 180px;
    image-rendering: pixelated;
}

.preview-char-stats {
    color: #F2A945;
    font-weight: bold;
    font-size: 0.65rem;
    text-align: center;
    width: 100%;
    background: rgba(10, 12, 16, 0.85);
    padding: 3px 0;
    border-top: 1px dashed rgba(242, 169, 69, 0.25);
    border-radius: 0 0 6px 6px;
}

/* Tier Animation Inspection Popover Modal */
.tier-picker-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 14, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 10px;
    animation: window-fade-in 0.25s ease;
}

.tier-picker-container {
    width: min(540px, 92%);
    background: rgba(22, 25, 33, 0.98);
    border: 1px solid #F2A945;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.95);
}

.tier-picker-header {
    text-align: center;
}

.tier-picker-title {
    font-size: 0.9rem;
    color: #F2A945;
    margin: 0;
    letter-spacing: 0.08em;
}

.tier-picker-subtitle {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.04em;
}

.inspect-body-split {
    display: flex;
    gap: 16px;
    align-items: center;
}

.tier-picker-buttons {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tier-picker-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 10px;
    background: rgba(16, 18, 24, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tier-picker-btn:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.1);
}

.tier-picker-btn.active {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.2);
    box-shadow: 0 0 12px rgba(242, 169, 69, 0.25);
}

.tier-btn-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-badge-label {
    background: rgba(242, 169, 69, 0.2);
    color: #F2A945;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: bold;
}

.tier-picker-btn .tier-name {
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
}

.tier-picker-btn.active .tier-name {
    color: #F2A945;
}

.tier-picker-btn .tier-sub {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.inspect-preview-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: rgba(12, 14, 18, 0.7);
    border: 1px solid rgba(242, 169, 69, 0.25);
    border-radius: 6px;
    padding: 8px;
}

.inspect-viewport-box {
    width: 140px;
    height: 140px;
    background: radial-gradient(circle at center, rgba(30, 35, 45, 0.8) 0%, rgba(10, 12, 16, 0.95) 100%);
    border: 1px solid rgba(74, 107, 140, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#inspect-preview-canvas {
    width: 140px;
    height: 140px;
    image-rendering: pixelated;
}

.inspect-meta-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inspect-char-title {
    font-size: 0.82rem;
    color: #F2A945;
    margin: 0;
}

.inspect-char-stats {
    font-size: 0.62rem;
    color: #F2A945;
    font-weight: bold;
}

.inspect-char-desc {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.2;
}

.tier-picker-close-btn {
    align-self: center;
    padding: 5px 24px;
    background: #F2A945;
    color: #000;
    font-weight: bold;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.tier-picker-close-btn:hover {
    background: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* Mobile Landscape Responsive Overrides (e.g. iPhone 14 Pro Max Landscape 932x430) */
@media (max-height: 500px) {
    .char-select-container {
        padding: 8px 12px;
        max-height: 96vh;
    }
    .char-select-title {
        font-size: 0.85rem;
        margin: 0 0 6px 0;
        padding-bottom: 2px;
    }
    .char-select-body-split {
        gap: 10px;
    }
    .class-card {
        padding: 8px;
    }
    .class-name-lbl {
        font-size: 0.8rem;
    }
    .class-desc {
        font-size: 0.62rem;
    }
    .char-preview-viewport {
        width: 170px;
        height: 170px;
    }
    #char-preview-canvas {
        width: 170px;
        height: 170px;
    }
    .preview-char-name {
        font-size: 0.82rem;
    }
}


/* ═══════════════════════════════════════════════════════════
   MAP SCENE UI OVERLAY (Spec 26)
   ═══════════════════════════════════════════════════════════ */
.map-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(16, 18, 26, 0.96) 0%, rgba(8, 10, 14, 0.99) 100%);
    backdrop-filter: blur(6px);
    z-index: 999999; /* Always on top of all HUD overlays and panels */
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono), monospace;
    color: #fff;
    overflow: hidden;
    animation: window-fade-in 0.3s ease;
}

.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    border-bottom: 1px solid rgba(242, 169, 69, 0.25);
    background: rgba(24, 28, 36, 0.9);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.map-title-wrap {
    display: flex;
    flex-direction: column;
}

.map-title-main {
    font-size: 0.95rem;
    font-weight: 700;
    color: #F2A945;
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px rgba(242, 169, 69, 0.4);
    margin: 0;
}

.map-title-sub {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 1px;
}

.map-tabs {
    display: flex;
    gap: 8px;
}

.map-tab-btn {
    background: rgba(16, 18, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 5px 12px;
    color: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
    outline: none;
}

.map-tab-btn:hover {
    border-color: rgba(242, 169, 69, 0.4);
    color: #fff;
    background: rgba(242, 169, 69, 0.05);
}

.map-tab-btn.active {
    border-color: #F2A945;
    color: #F2A945;
    background: rgba(242, 169, 69, 0.12);
    box-shadow: 0 0 10px rgba(242, 169, 69, 0.2);
}

.map-viewport {
    flex: 1;
    position: relative;
    overflow: auto; /* Enable vertical and horizontal scrolling */
    background: 
        radial-gradient(circle, transparent 20%, rgba(8, 10, 14, 0.98) 70%),
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    background-position: center, center, center;
}

.map-canvas-container {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 1;
    display: none;
}

.map-nodes-layer {
    position: absolute;
    width: 200%; /* Double sized canvas scrollable space */
    height: 200%;
    left: 0;
    top: 0;
    z-index: 2;
    box-sizing: border-box;
}

/* Status-based node visual states */
.map-node.status-locked {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.map-node.status-fog {
    opacity: 0.45;
    border-style: dashed;
    filter: saturate(0.5);
}

.map-node.status-cleared {
    background: rgba(46, 160, 67, 0.2);
    border-color: #2ea043;
    box-shadow: 0 0 12px rgba(46, 160, 67, 0.4);
}

.map-node.status-basecamp {
    background: rgba(242, 169, 69, 0.2);
    border-color: #F2A945;
    box-shadow: 0 0 16px rgba(242, 169, 69, 0.6);
    animation: basecamp-pulse 2s infinite ease-in-out;
}

@keyframes basecamp-pulse {
    0% { scale: 1; box-shadow: 0 0 16px rgba(242, 169, 69, 0.6); }
    50% { scale: 1.05; box-shadow: 0 0 24px rgba(242, 169, 69, 0.8), inset 0 0 8px rgba(242, 169, 69, 0.3); }
    100% { scale: 1; box-shadow: 0 0 16px rgba(242, 169, 69, 0.6); }
}

/* Civilization-style Hexagonal Nodes */
.map-node.hex-node {
    position: absolute;
    border: none !important;
    background: #334155; /* Acts as outer border color */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: none !important;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
    transition: all 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
}

.map-node.hex-node::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    background: #0f172a; /* Dark interior fill */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: 1;
    transition: background 0.22s ease, opacity 0.22s ease;
}

/* Rarity border colors */
.map-node.hex-node.rarity-normal { background: #64748b; }
.map-node.hex-node.rarity-rare { background: #38bdf8; filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.45)); }
.map-node.hex-node.rarity-epic { background: #a855f7; filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.5)); }
.map-node.hex-node.rarity-legend { background: #f85149; filter: drop-shadow(0 0 10px rgba(248, 81, 73, 0.6)); }

/* STATUS 1: REVEALED (Active, exploreable node) */
.map-node.hex-node.status-revealed::before {
    background: #1e293b;
}

/* STATUS 2: CLEARED (Secured district) */
.map-node.hex-node.status-cleared {
    background: #2ea043 !important;
    filter: drop-shadow(0 0 8px rgba(46, 160, 67, 0.5));
    opacity: 1 !important;
}
.map-node.hex-node.status-cleared::before {
    background: #14321a !important;
    opacity: 1 !important;
}

/* STATUS 3: BASECAMP (Home sector) */
.map-node.hex-node.status-basecamp {
    background: #f2a945 !important;
    filter: drop-shadow(0 0 12px rgba(242, 169, 69, 0.65));
    animation: hex-basecamp-pulse 2.2s infinite ease-in-out;
}
.map-node.hex-node.status-basecamp::before {
    background: #2d2212 !important;
}

@keyframes hex-basecamp-pulse {
    50% { transform: scale(1.04); filter: drop-shadow(0 0 14px rgba(242, 169, 69, 0.75)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(242, 169, 69, 0.55)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)); }
}

/* Hover behaviors */
.map-node.hex-node:hover:not(.status-locked) {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.45)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    z-index: 12;
}

/* Selected behaviors (pop out and rise effect without changing colors) */
.map-node.hex-node.selected {
    transform: scale(1.08) translateY(-6px) !important;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.45)) !important;
    z-index: 20;
}

/* Locked / Fog styling */
.map-node.hex-node.status-locked {
    opacity: 0.9; /* Clearly visible ivory fog cell */
    background: #d0cbc0 !important; /* Ivory border */
    cursor: not-allowed;
    pointer-events: none; /* Disables click interaction */
}

.map-node.hex-node.status-locked::before {
    background: #fbf9f3 !important; /* Ivory white fog interior fill */
    opacity: 1 !important;
}

.map-node.hex-node.status-locked .hex-title {
    color: #4e4a3d !important;
    text-shadow: none !important;
}

.map-node.hex-node.status-locked .hex-meta {
    color: #6e695a !important;
    text-shadow: none !important;
}

.map-node.hex-node.status-locked .hex-icon {
    color: #4e4a3d !important;
    text-shadow: none !important;
    opacity: 0.7;
}

.map-node.hex-node.status-locked .map-node-label {
    opacity: 1;
}

/* Hex content positioning & hierarchy */
.hex-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    padding: 8px 4px;
    box-sizing: border-box;
    pointer-events: none;
    line-height: 1.2;
}

.hex-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-bottom: 2px;
}

/* Redefine label to sit inside hex */
.map-node.hex-node .map-node-label {
    position: static !important;
    transform: none !important;
    width: 95% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1px;
    pointer-events: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.hex-title {
    font-size: 0.62rem;
    font-weight: 400; /* Thin font-weight */
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    text-align: center;
    max-width: 100%;
    white-space: normal; /* Allow text wordwrap */
    word-break: break-word;
    overflow-wrap: break-word;
}

.hex-meta {
    font-size: 0.52rem;
    font-weight: 400; /* Thin font-weight */
    color: #cccccc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.hex-id-label {
    font-size: 0.46rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Make sure tile ID is visible in light status-locked cells */
.map-node.hex-node.status-locked .hex-id-label {
    color: rgba(78, 74, 61, 0.6) !important;
}

/* Enabled explore-ready cells: white background, outer enabled border, inner difficulty border */
.map-node.hex-node.status-revealed {
    background: #0288d1 !important; /* Outer cyber-blue border signifying enabled to explore */
    opacity: 1 !important;
}

/* Adjust size for ::before to acts as inner border */
.map-node.hex-node.status-revealed::before {
    top: 2px !important;
    left: 2px !important;
    width: calc(100% - 4px) !important;
    height: calc(100% - 4px) !important;
    opacity: 1 !important;
}

/* Override inner border (::before) backgrounds by rarity/difficulty */
.map-node.hex-node.status-revealed.rarity-normal::before { background: #8a9dac !important; }
.map-node.hex-node.status-revealed.rarity-rare::before { background: #2196f3 !important; }
.map-node.hex-node.status-revealed.rarity-epic::before { background: #9c27b0 !important; }
.map-node.hex-node.status-revealed.rarity-legend::before { background: #f44336 !important; }

/* White interior cell fill layer */
.map-node.hex-node.status-revealed::after {
    content: '';
    position: absolute;
    top: 5px; /* Leaves 2px outer + 3px inner border */
    left: 5px;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    background: #ffffff !important; /* Solid white background */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    z-index: -1;
}

/* High-contrast dark typography inside light white explore-ready hexes */
.map-node.hex-node.status-revealed .hex-title {
    color: #1a1a24 !important;
    text-shadow: none !important;
}

.map-node.hex-node.status-revealed .hex-meta {
    color: #5c5c68 !important;
    text-shadow: none !important;
}

.map-node.hex-node.status-revealed .hex-icon {
    color: #1a1a24 !important;
    text-shadow: none !important;
}

.map-node.hex-node.status-revealed .hex-id-label {
    color: rgba(26, 26, 36, 0.5) !important;
}
.rarity-text-epic { color: #64b5f6; }
.rarity-text-legend { color: #e57373; }

/* Semi-transparent slide-over side panel on the right */
.map-side-panel {
    position: absolute;
    top: 50px; /* Positions below the header */
    right: 12px;
    width: 290px;
    height: calc(100% - 62px); /* Fits perfectly between header and bottom screen edge */
    background: rgba(14, 16, 22, 0.82); /* Semi-transparent */
    backdrop-filter: blur(12px); /* Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(242, 169, 69, 0.3);
    border-radius: 6px;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.6);
    animation: side-slide-in 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes side-slide-in {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.side-panel-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.map-info-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
    letter-spacing: 0.03em;
}

.map-info-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
}

.map-info-desc {
    flex: 1;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
    overflow-y: auto;
    padding-right: 4px;
}

.map-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.map-explore-btn {
    width: 100%;
    background: #F2A945;
    border: none;
    border-radius: 4px;
    padding: 10px;
    color: #10121a;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 4px 12px rgba(242, 169, 69, 0.3);
}

.map-explore-btn:hover:not(:disabled) {
    background: #ffb854;
    box-shadow: 0 4px 18px rgba(242, 169, 69, 0.5);
    transform: translateY(-1px);
}

.map-explore-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    cursor: not-allowed;
}

.map-close-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.map-close-btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Indicators and tags */
.map-tag {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    width: fit-content;
}

.map-tag.tag-rarity-normal { background: rgba(138, 157, 172, 0.15); color: #8a9dac; border: 1px solid rgba(138, 157, 172, 0.25); }
.map-tag.tag-rarity-rare { background: rgba(33, 150, 243, 0.15); color: #2196f3; border: 1px solid rgba(33, 150, 243, 0.25); }
.map-tag.tag-rarity-epic { background: rgba(156, 39, 176, 0.15); color: #9c27b0; border: 1px solid rgba(156, 39, 176, 0.25); }
.map-tag.tag-rarity-legend { background: rgba(244, 67, 54, 0.15); color: #f44336; border: 1px solid rgba(244, 67, 54, 0.25); }

/* Difficulty Stars and Colors */
.map-diff-stars {
    color: #ff9800;
    letter-spacing: 2px;
}

/* Base Camp Upgrade Shrine Tab Layout */
.upgrade-layout-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    color: #fff;
}

.upgrade-header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.upgrade-title-main {
    font-size: 1.1rem;
    color: #F2A945;
    margin: 0;
}

.upgrade-grid-bonuses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.upgrade-bonus-card {
    background: rgba(16, 18, 24, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.upgrade-bonus-lbl {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.5);
}

.upgrade-bonus-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: #4caf50;
}

.upgrade-costs-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upgrade-cost-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
}

.upgrade-cost-row.insufficient {
    color: #f44336;
}

.upgrade-cost-row.sufficient {
    color: #4caf50;
}

.shrine-upgrade-action-btn {
    background: #F2A945;
    border: none;
    border-radius: 4px;
    padding: 10px;
    color: #10121a;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    margin-top: 8px;
}

.shrine-upgrade-action-btn:hover:not(:disabled) {
    background: #ffb854;
    transform: translateY(-1px);
}

.shrine-upgrade-action-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* ============================================================
   CHARACTER LOAD SCREEN LAYOUT
   ============================================================ */
.char-load-container {
    max-width: 550px !important;
    padding: 14px 20px !important;
}

.char-load-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom scrollbar for character load list */
.char-load-list::-webkit-scrollbar {
    width: 6px;
}
.char-load-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.char-load-list::-webkit-scrollbar-thumb {
    background: var(--color-neutral-2);
    border-radius: 3px;
}
.char-load-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-amber-dim);
}

.char-load-slot {
    background: rgba(16, 18, 24, 0.7);
    border: 1px solid rgba(242, 169, 69, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.char-load-slot:hover {
    background: rgba(242, 169, 69, 0.05);
    border-color: var(--color-amber);
    box-shadow: 0 0 10px rgba(242, 169, 69, 0.15);
}

.char-load-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.char-load-row-1 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.char-load-class-badge {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.char-load-level-badge {
    background: rgba(74, 107, 140, 0.3);
    color: #9abed6;
    border: 1px solid rgba(74, 107, 140, 0.5);
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
}

.char-load-row-2 {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 12px;
}

.char-load-shards {
    color: var(--color-amber);
}

.char-load-district {
    color: #7d8f9e;
}

.char-load-time {
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.3);
}

.char-load-actions {
    display: flex;
    gap: 8px;
}

.char-load-select-btn {
    background: var(--color-amber-dim);
    color: #fff;
    border: 1px solid var(--color-amber);
    border-radius: 4px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.char-load-select-btn:hover {
    background: var(--color-amber);
    color: #10121a;
}

.char-load-delete-btn {
    background: rgba(211, 47, 47, 0.1);
    color: var(--color-red);
    border: 1px solid rgba(211, 47, 47, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.char-load-delete-btn:hover {
    background: var(--color-red);
    color: #fff;
    border-color: var(--color-red);
}

/* Level Up Toast Notification */
.level-up-toast {
    position: absolute;
    top: 15%;
    left: 50%;
    transform: translate(-50%, -20px) scale(0.9);
    background: linear-gradient(135deg, rgba(26, 20, 10, 0.95), rgba(45, 30, 15, 0.95));
    border: 2px solid #F59E0B;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6), inset 0 0 10px rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 16px 24px;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    font-family: inherit;
}

.level-up-toast.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.level-up-toast-header {
    font-size: 1.25rem;
    font-weight: 800;
    color: #F59E0B;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.level-up-toast-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #FDE68A;
    font-weight: 600;
}

/* ============================================================
   CHARACTER INFO MODAL & CLICKABLE HUD BADGES
   ============================================================ */
.ci-clickable-badge {
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
}
.ci-clickable-badge:hover {
    background: rgba(242, 169, 69, 0.15);
    color: #F2A945 !important;
    text-shadow: 0 0 8px rgba(242, 169, 69, 0.6);
    transform: scale(1.02);
}

.char-info-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 18, 0.85);
    backdrop-filter: blur(8px);
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ci-fadeIn 0.25s ease-out;
}

@keyframes ci-fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.char-info-modal-container {
    background: #181A20;
    border: 2px solid #F2A945;
    box-shadow: 0 0 30px rgba(242, 169, 69, 0.3), inset 0 0 15px rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    width: min(650px, 94%);
    max-height: min(390px, 90%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #E2E8F0;
    font-family: inherit;
}

.char-info-modal-header {
    background: linear-gradient(90deg, rgba(242, 169, 69, 0.2), rgba(74, 107, 140, 0.2));
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(242, 169, 69, 0.3);
}

.char-info-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-info-icon {
    font-size: 1.8rem;
    color: #F2A945;
    background: rgba(242, 169, 69, 0.15);
    border: 1px solid rgba(242, 169, 69, 0.4);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.char-info-class-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #F2A945;
    letter-spacing: 0.1em;
}

.char-info-archetype {
    font-size: 0.75rem;
    color: #94A3B8;
}

.char-info-badge-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-info-level-badge {
    background: rgba(74, 107, 140, 0.3);
    border: 1px solid #4A6B8C;
    color: #38BDF8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.char-info-close-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s ease;
}
.char-info-close-btn:hover {
    color: #F2A945;
}

.char-info-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Details Container */
.ci-details-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ci-section {
    background: rgba(26, 29, 38, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px 14px;
}

.ci-section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #4A6B8C;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(74, 107, 140, 0.2);
    padding-bottom: 4px;
}

.ci-attr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

.ci-attr-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
}
.ci-attr-card.primary {
    border-color: rgba(242, 169, 69, 0.4);
    background: rgba(242, 169, 69, 0.06);
}

.ci-attr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ci-attr-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #CBD5E1;
}

.ci-attr-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: #F2A945;
}

.ci-attr-breakdown {
    font-size: 0.65rem;
    color: #64748B;
    margin-bottom: 4px;
}

.ci-attr-effect {
    font-size: 0.68rem;
    color: #38BDF8;
    line-height: 1.3;
}

.ci-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.ci-stat-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ci-stat-box.highlight {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.ci-stat-lbl {
    font-size: 0.65rem;
    color: #94A3B8;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.ci-stat-num {
    font-size: 1.1rem;
    font-weight: 800;
    color: #F8FAFC;
}

.ci-stat-sub {
    font-size: 0.65rem;
    color: #64748B;
}

.crit-text { color: #EC4899; }

/* ============================================================
   SETTINGS MENU OVERLAY & STYLING (Spec UI: Settings Menu)
   ============================================================ */
.settings-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25000;
}

.settings-panel {
    width: min(720px, 90%);
    height: min(390px, 90%);
    background: rgba(20, 22, 28, 0.95);
    border: 1px solid rgba(242, 169, 69, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    animation: window-fade-in 0.3s ease;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(16, 18, 24, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #F2A945;
    letter-spacing: 0.1em;
    margin: 0;
}

.settings-close {
    background: none;
    border: none;
    color: #94A3B8;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.settings-close:hover {
    color: #EF4444;
}

.settings-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.settings-tabs {
    width: 160px;
    background: rgba(16, 18, 24, 0.4);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    gap: 4px;
}

.settings-tab-btn {
    background: none;
    border: none;
    color: #94A3B8;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.settings-tab-btn:hover {
    color: #F8FAFC;
    background: rgba(255, 255, 255, 0.03);
}

.settings-tab-btn.active {
    color: #F2A945;
    background: rgba(242, 169, 69, 0.08);
    border-left-color: #F2A945;
}

.settings-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94A3B8;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.settings-label {
    color: #CBD5E1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-desc {
    font-size: 0.7rem;
    color: #64748B;
}

.settings-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #334155;
    outline: none;
    cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #F2A945;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(242, 169, 69, 0.6);
}

.settings-slider-val {
    font-size: 0.8rem;
    color: #F8FAFC;
    min-width: 32px;
    text-align: right;
}

/* Custom Checkbox/Switch */
.settings-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 20px;
}

.settings-switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #94A3B8;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .settings-switch-slider {
    background-color: rgba(242, 169, 69, 0.6);
}

input:checked + .settings-switch-slider:before {
    transform: translateX(16px);
    background-color: #F2A945;
    box-shadow: 0 0 6px rgba(242, 169, 69, 0.6);
}

/* Dropdowns */
.settings-select {
    background: #1e293b;
    color: #F8FAFC;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

.settings-select:focus {
    border-color: #F2A945;
}

/* Remap Controls Grid */
.settings-remap-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.settings-remap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.78rem;
}

.settings-remap-btn {
    background: #1e293b;
    border: 1px solid #475569;
    color: #F2A945;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    min-width: 60px;
    text-align: center;
    transition: all 0.2s;
}

.settings-remap-btn:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.08);
}

.settings-remap-btn.waiting {
    border-color: #EF4444;
    color: #EF4444;
    animation: ccd-pulse 1s infinite alternate;
}

/* Data Buttons */
.settings-btn-primary {
    background: rgba(242, 169, 69, 0.15);
    border: 1px solid #F2A945;
    color: #F2A945;
    border-radius: 4px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 8px;
}

.settings-btn-primary:hover {
    background: #F2A945;
    color: #101218;
}

.settings-btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #EF4444;
    color: #EF4444;
    border-radius: 4px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.settings-btn-danger:hover {
    background: #EF4444;
    color: #F8FAFC;
}

.settings-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(16, 18, 24, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-btn-footer {
    background: #1e293b;
    border: 1px solid #475569;
    color: #F8FAFC;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn-footer:hover {
    border-color: #94A3B8;
}

.settings-btn-footer.apply {
    background: #F2A945;
    border-color: #F2A945;
    color: #101218;
    font-weight: bold;
}

.settings-btn-footer.apply:hover {
    background: #f4b660;
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 15, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 24000;
}

.pause-panel {
    width: min(300px, 80vw);
    background: rgba(20, 22, 28, 0.95);
    border: 1px solid rgba(242, 169, 69, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 12px;
    font-family: 'Share Tech Mono', monospace;
    text-align: center;
    animation: window-fade-in 0.25s ease;
}

.pause-title {
    font-size: 1.2rem;
    color: #F2A945;
    letter-spacing: 0.15em;
    margin: 0 0 8px 0;
}

.pause-btn {
    background: #1e293b;
    border: 1px solid #475569;
    color: #F8FAFC;
    border-radius: 4px;
    padding: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pause-btn:hover {
    border-color: #F2A945;
    background: rgba(242, 169, 69, 0.08);
    color: #F2A945;
}

.pause-btn.danger {
    border-color: rgba(239, 68, 68, 0.4);
    color: #EF4444;
}

.pause-btn.danger:hover {
    border-color: #EF4444;
    background: rgba(239, 68, 68, 0.08);
    color: #EF4444;
}

.settings-btn {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    padding: 4px !important;
    cursor: pointer !important;
    height: auto !important;
    width: auto !important;
    font-size: 1.1rem !important;
    color: #F2A945 !important;
    margin: 0 !important;
    pointer-events: auto !important;
    transition: transform 0.1s ease !important;
}

.settings-btn:hover {
    transform: scale(1.15) !important;
}

/* Rotate Device Overlay for Mobile Portrait Mode & Small Screens */
#rotate-device-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999999;
    background: rgba(10, 12, 15, 0.98);
    color: #F2A945;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    box-sizing: border-box;
    font-family: var(--font-mono, monospace);
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.rotate-device-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 340px;
    pointer-events: none;
}

.rotate-icon {
    font-size: 3rem;
    animation: rotate-icon-anim 2s infinite ease-in-out;
}

.rotate-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #F2A945;
    text-shadow: 0 0 10px rgba(242, 169, 69, 0.5);
}

.rotate-sub {
    font-size: 0.78rem;
    color: #4A6B8C;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

.rotate-btn-prompt {
    margin-top: 14px;
    padding: 8px 20px;
    border: 1px solid rgba(242, 169, 69, 0.6);
    border-radius: 20px;
    background: rgba(242, 169, 69, 0.15);
    color: #F2A945;
    font-weight: bold;
    font-size: 0.85rem;
    animation: se-pulse-glow 2s infinite ease-in-out;
}

@keyframes rotate-icon-anim {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

@media screen and (orientation: portrait) and (max-width: 900px), screen and (max-width: 667px) {
    #rotate-device-overlay {
        display: flex !important;
    }
}

/* --- Shared Autoplay Countdown Text Label (StageEntry, Debrief, Venture Further, VictoryPrep) --- */
.se-autoplay-countdown {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 4px;
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
    font-weight: 400;
    color: #F2A945;
    letter-spacing: 0.4px;
    box-shadow: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
    animation: se-text-pulse 2s infinite ease-in-out;
}

.se-autoplay-countdown span {
    color: #FFFFFF;
    font-size: 0.84rem;
    font-weight: 500;
    text-shadow: 0 0 6px rgba(242, 169, 69, 0.6);
}

@keyframes se-text-pulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1.0; }
}




