:root {
    --bg-dark: #0a0a0c;
    --accent-red: #ff3e3e;
    --accent-neon: #00f3ff;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --glass-bg: rgba(20, 20, 25, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-header: 'Orbitron', sans-serif;
    --font-ui: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Scene Management */
.scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
}

.scene.active {
    display: flex;
}

/* Splash Screen */
#scene-splash {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('dustlands_background_1776154820149.png');
    background-size: cover;
}

.hero-title {
    text-align: center;
}

.glitch-text {
    font-family: var(--font-header);
    font-size: 5rem;
    color: var(--accent-red);
    text-shadow: 3px 3px var(--accent-neon);
    margin-bottom: 0.5rem;
    letter-spacing: 5px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    letter-spacing: 10px;
    margin-bottom: 3rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Save Slots */
.save-slots {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 0;
}

.save-slot {
    width: 150px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-slot:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-neon);
    transform: translateY(-5px);
}

.slot-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Battle Scene */
#scene-battle {
    background: #000;
}

.battle-arena {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: url('dustlands_background_1776154820149.png') no-repeat center;
    background-size: cover;
}

.battle-arena.shake {
    animation: shake 0.3s ease-in-out;
}

.sprite {
    position: absolute;
    bottom: 100px;
    width: 256px;
    height: 256px;
    background-size: contain;
    background-repeat: no-repeat;
    background-color: transparent;
    mix-blend-mode: normal; /* reset multiply to avoid see-through sprites */
    /* Add drop shadow to give separation from background without forcing a boxed background */
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.6));
    opacity: 1;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.sprite.hero {
    left: 10%;
    background-image: url('pigsy_swaggie_sprite_1776154791063.png');
}

.sprite.enemy {
    right: 10%;
    transform: scaleX(-1);
}

.battle-ui {
    width: 90%;
    max-width: 800px;
    height: 200px;
    margin-bottom: 2rem;
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
}

.battle-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 150px;
}

.battle-log {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Inventory Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.active {
    display: flex;
}

.inventory-panel {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
}

.inventory-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    height: calc(100% - 60px);
    margin-top: 1rem;
}

.mixing-slots {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.mix-slot, .equip-slot, .inventory-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 2px dashed var(--glass-border);
    border-radius: 8px;
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: var(--font-header);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-red);
    color: white;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(255, 62, 62, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(255, 62, 62, 0.7);
    transform: scale(1.05);
}

.btn-battle {
    background: transparent;
    border: 1px solid var(--accent-neon);
    color: var(--accent-neon);
    padding: 0.5rem;
    border-radius: 4px;
}

.btn-battle:hover {
    background: var(--accent-neon);
    color: black;
}

.btn-close {
    background: transparent;
    color: white;
    font-size: 1.5rem;
}

/* Progress Bars */
.bar-bg {
    width: 200px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    width: 100%;
    height: 100%;
    background: var(--accent-red);
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* Glass alias for inline usage */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Map Scene */
.map-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('dustlands_background_1776154820149.png');
    background-size: cover;
    background-position: center;
}

.map-node {
    padding: 1rem 2rem;
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-header);
    font-size: 0.85rem;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.map-node:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 20px rgba(255, 62, 62, 0.5);
}

/* Top Bar */
.ui-top-bar {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 10;
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.stat .label {
    font-family: var(--font-header);
    font-size: 0.7rem;
    color: var(--accent-neon);
    letter-spacing: 2px;
}

.btn-icon {
    background: transparent;
    font-size: 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
}

.btn-icon:hover {
    border-color: var(--accent-neon);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.8rem 2rem;
    font-size: 0.9rem;
    border-radius: 4px;
}

.btn-secondary:hover {
    border-color: var(--accent-neon);
    color: var(--accent-neon);
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.item-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.item-selection-panel {
    max-width: 400px;
    padding: 2rem;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.item-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.item-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-neon);
}

.item-effect {
    margin-left: auto;
    color: var(--accent-neon);
    font-size: 0.9rem;
}

/* Shop UI */
.shop-panel { max-width: 900px; }
.shop-list { display:flex; flex-direction:column; gap:0.6rem; max-height:320px; overflow:auto; }
.shop-item { display:flex; justify-content:space-between; align-items:center; padding:0.6rem; border:1px solid rgba(255,255,255,0.04); border-radius:8px; background: rgba(0,0,0,0.35); }
.shop-item .item-name { font-family: var(--font-header); color:var(--accent-neon); }
.shop-item .item-price { color:var(--text-secondary); margin-right:0.8rem; }

/* Cheat Menu */
.cheat-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.cheat-menu-panel {
    max-width: 500px;
    padding: 2rem;
}

.cheat-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.cheat-options button {
    padding: 0.5rem;
    font-size: 0.8rem;
}

.panel-header h2 {
    font-family: var(--font-header);
    font-size: 1.2rem;
    letter-spacing: 3px;
    color: var(--accent-neon);
}

/* Options Panel */
.options-panel {
    width: 420px;
}

.options-panel label {
    font-family: var(--font-ui);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.options-panel .version-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Reuse overlay rules */
.options-overlay { z-index: 350; }


/* Equipment Slots */
.equipment-slots {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.equip-slot {
    position: relative;
}

.equip-slot::after {
    content: attr(title);
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-family: var(--font-header);
    letter-spacing: 1px;
}

/* Save Container */
.save-container {
    text-align: center;
}

.save-container h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    letter-spacing: 5px;
    color: var(--accent-neon);
}

/* Item Icons - Emoji Based */
.item-icon {
    cursor: grab;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 0.3rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.item-icon:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--accent-neon);
    transform: scale(1.05);
}

.item-icon:active {
    cursor: grabbing;
}

.item-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.item-label {
    font-size: 0.5rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.1;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-header);
    letter-spacing: 0.5px;
}

/* Mixing Section */
.mixing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mixing-section .btn-primary {
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
}

/* Battle HUD - Health Bars */
.battle-hud-left, .battle-hud-right {
    position: absolute;
    top: 20px;
    z-index: 10;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    min-width: 200px;
}

.battle-hud-left {
    left: 20px;
}

.battle-hud-right {
    right: 20px;
}

.hud-name {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 3px;
    color: var(--accent-neon);
    margin-bottom: 6px;
}

.hud-bar-bg {
    width: 100%;
    height: 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.4s ease;
}

.hud-bar-fill.hp {
    width: 100%;
    background: linear-gradient(90deg, #ff3e3e, #ff6b6b);
    box-shadow: 0 0 8px rgba(255, 62, 62, 0.5);
}

.hud-bar-fill.enemy-hp {
    width: 100%;
    background: linear-gradient(90deg, #9b59b6, #e74c3c);
    box-shadow: 0 0 8px rgba(155, 89, 182, 0.5);
}

.hud-hp-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: right;
    font-family: var(--font-ui);
}

/* Enemy sprite - remove old filter */
.sprite.enemy {
    right: 10%;
    transform: scaleX(-1);
    filter: none;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(4px, 2px); }
    50% { transform: translate(-3px, -1px); }
    75% { transform: translate(2px, -2px); }
}

.shake {
    animation: shake 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.scene.active {
    animation: fadeIn 0.4s ease;
}

/* XP Bar */
.xp-fill {
    background: linear-gradient(90deg, #f39c12, #f1c40f);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.5);
}

.bar-bg.xp-bar-bg {
    width: 100px;
}

/* Battle buttons disabled state */
.btn-battle:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Game Over Overlay */
.game-over-overlay {
    z-index: 500;
}

.game-over-panel {
    text-align: center;
    max-width: 450px;
}

.game-over-title {
    font-family: var(--font-header);
    font-size: 3rem;
    color: var(--accent-red);
    text-shadow: 0 0 20px rgba(255, 62, 62, 0.7);
    margin-bottom: 1rem;
    letter-spacing: 5px;
}

.game-over-sub {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Map node type layout */
.map-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.node-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.map-node.completed {
    opacity: 0.5;
}

/* ============ Scrap & Sinew update ============ */

/* Boss node */
.map-node.boss-node {
    border-color: #ff8c00;
    box-shadow: 0 0 14px rgba(255, 140, 0, 0.4);
    animation: bossPulse 2s ease-in-out infinite;
}
.map-node.boss-node:hover { background: #ff8c00; }
@keyframes bossPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 140, 0, 0.3); }
    50% { box-shadow: 0 0 22px rgba(255, 140, 0, 0.6); }
}

/* Floating battle numbers */
.float-num {
    position: absolute;
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 30;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    animation: floatUp 1.1s ease-out forwards;
}
.float-hit   { color: #ffffff; }
.float-crit  { color: #ffd23f; font-size: 2.2rem; }
.float-hurt  { color: var(--accent-red); }
.float-heal  { color: #4ade80; }
.float-bleed { color: #ff5c8a; }
.float-thorns{ color: var(--accent-neon); }
.float-miss  { color: var(--text-secondary); font-size: 1.2rem; }
@keyframes floatUp {
    0%   { transform: translateY(0) scale(0.6); opacity: 0; }
    15%  { transform: translateY(-10px) scale(1.1); opacity: 1; }
    100% { transform: translateY(-90px) scale(1); opacity: 0; }
}

/* Status pips on the battle HUD */
.status-pips {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    min-height: 18px;
}
.status-pip {
    font-size: 0.95rem;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
}

/* Equipment summary line */
.equip-summary {
    font-family: var(--font-header);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--accent-neon);
    margin-bottom: 1rem;
    min-height: 1rem;
    opacity: 0.85;
}

.item-icon.is-accessory {
    border-color: rgba(255, 210, 63, 0.35);
    background: rgba(255, 210, 63, 0.06);
}

/* Recipe book smudged (undiscovered) entries */
.smudged {
    filter: blur(0.4px);
    opacity: 0.55;
}

/* Victory modal */
.victory-overlay { z-index: 480; }
.victory-panel {
    text-align: center;
    max-width: 440px;
}
.victory-title {
    font-family: var(--font-header);
    font-size: 2.4rem;
    letter-spacing: 4px;
    color: #ffd23f;
    text-shadow: 0 0 20px rgba(255, 210, 63, 0.5);
    margin-bottom: 0.6rem;
}
.victory-rewards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1.2rem 0 1.8rem;
    font-size: 1rem;
}
.victory-levelup {
    color: var(--accent-neon);
    font-family: var(--font-header);
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* Homestead overlay */
.homestead-overlay { z-index: 360; }
.homestead-overlay .shop-item .item-type { color: var(--text-secondary); font-size: 0.75rem; }

/* Shop item info column */
.shop-item-info { display: flex; flex-direction: column; gap: 2px; }
.shop-item-actions { display: flex; align-items: center; gap: 0.6rem; }
