/* ═══════════════════════════════════════════════════ */
/* GLOBAL RESET                                       */
/* ═══════════════════════════════════════════════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #000;
    color: #e5e7eb;
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    margin: 0;
    transition: background 0.3s, color 0.3s;
}

/* ═══════════════════════════════════════════════════ */
/* ACCESSIBILITY & FOCUS MODE                          */
/* ═══════════════════════════════════════════════════ */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/opendyslexic@1.0.3/OpenDyslexic-Bold.otf');
}

.focus-mode {
    --bg-primary: #000000;
    --text-primary: #ffffff;
    --accent-primary: #ffff00;
    --accent-secondary: #00ffff;
    font-family: 'OpenDyslexic', sans-serif !important;
}

.focus-mode .app-container, .focus-mode body {
    background: #000 !important;
    color: #fff !important;
}

.focus-mode .hud-box, .focus-mode .action-btn, .focus-mode .party-item, .focus-mode .dialogue-box {
    border: 3px solid #fff !important;
    background: #000 !important;
    box-shadow: none !important;
    color: #fff !important;
}

.focus-mode .health-bar-container {
    border: 2px solid #fff !important;
    height: 20px !important;
}

.focus-mode .action-btn:hover {
    background: #fff !important;
    color: #000 !important;
}

.focus-mode * {
    text-shadow: none !important;
}

/* Visual Cues */
.visual-cue {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    border: 2px solid #facc15;
    padding: 10px 20px;
    border-radius: 20px;
    color: #fff;
    font-weight: 800;
    z-index: 5000;
    pointer-events: none;
    animation: cuePop 1.5s ease-out forwards;
}

@keyframes cuePop {
    0% { opacity: 0; transform: translate(-50%, -40%); }
    20% { opacity: 1; transform: translate(-50%, -50%); }
    80% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -60%); }
}

.app-container { width: 100vw; height: 100vh; display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════ */
/* CONSOLE FRAME                                       */
/* ═══════════════════════════════════════════════════ */
.console-frame {
    background: #000;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.screen-container {
    position: relative;
    overflow: hidden;
    background: #000;
    flex: 1;
    width: 100%;
}

canvas {
    display: block;
    image-rendering: pixelated;
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════════════ */
/* GLOBAL HUD (High-Resolution Text)                    */
/* ═══════════════════════════════════════════════════ */
.global-hud {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; justify-content: space-between; align-items: flex-start;
    pointer-events: none; z-index: 100;
}

.hud-left, .hud-right { display: flex; flex-direction: column; gap: 4px; }
.hud-item {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff; padding: 6px 12px; border-radius: 8px;
    font-size: 0.9rem; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.hud-icon { opacity: 0.8; font-size: 1.1rem; }

.hud-debug {
    background: rgba(0,0,0,0.6);
    color: #4ade80; font-family: 'monospace'; font-size: 0.75rem;
    padding: 6px 12px; border-radius: 8px;
    display: flex; flex-direction: column; align-items: flex-end;
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════ */
/* BATTLE OVERLAY                                      */
/* ═══════════════════════════════════════════════════ */
.battle-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    z-index: 10;
    display: flex; flex-direction: column; justify-content: space-between;
    transition: opacity 0.3s ease-in-out;
}

.hidden { display: none !important; opacity: 0 !important; }

/* Global HUD System Occlusion (State-Driven) */
body[data-state="battle"]   #globalHud,
body[data-state="intro"]    #globalHud,
body[data-state="dialogue"] #globalHud,
body[data-state="fishing"]  #globalHud,
body[data-state="spotted"]  #globalHud,
body[data-state="transition"] #globalHud {
    display: none !important;
}

/* HUD */
.hud-box {
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
    position: absolute; min-width: 220px;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}
.enemy-hud { top: 30px; left: 30px; }
.player-hud { bottom: 140px; right: 30px; }

.entity-info { display: flex; justify-content: space-between; font-weight: 600; font-size: 1.1rem; color: #f8fafc; }
.entity-name { text-transform: uppercase; letter-spacing: 1px; }

.health-bar-container {
    width: 100%; height: 12px; background: rgba(0,0,0,0.5);
    border-radius: 6px; overflow: hidden; position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.health-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); }
.enemy-fill { background: linear-gradient(90deg, #ef4444, #f87171); }
.player-fill { background: linear-gradient(90deg, #10b981, #34d399); }
.hp-text { font-size: 0.85rem; color: #94a3b8; text-align: right; font-variant-numeric: tabular-nums; }

/* Sprites */
.battle-field { position: absolute; width: 100%; height: 100%; pointer-events: none; }
.sprite {
    position: absolute; width: 192px; height: 192px;
    border-radius: 12px;
    /* High Resolution Rendering */
    image-rendering: auto; 
    transition: transform 0.2s, opacity 0.5s;
}
.enemy-sprite { top: 40px; right: 100px; }
.player-sprite { bottom: 100px; left: 80px; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.bob-animation { animation: bob 3s ease-in-out infinite; }

/* Battle Bottom */
.battle-bottom {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 110px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    display: flex; padding: 16px; gap: 16px;
}
.dialogue-box {
    flex: 2; background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; padding: 16px;
    font-size: 1.1rem; line-height: 1.5; color: #f1f5f9;
}
.action-menu { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.action-btn {
    flex: 1 1 45%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none; border-radius: 6px; color: white;
    font-weight: 600; font-size: 1rem; cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.1s, box-shadow 0.1s, filter 0.2s;
    padding: 6px 8px;
}
.action-btn:hover { filter: brightness(1.2); transform: translateY(-2px); }
.action-btn:active { transform: translateY(2px); }
.run-btn { background: linear-gradient(135deg, #475569 0%, #334155 100%); }

/* ═══════════════════════════════════════════════════ */
/* TRANSITIONS                                         */
/* ═══════════════════════════════════════════════════ */
.transition-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: white; z-index: 50;
    animation: flash 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes flash {
    0% { opacity: 0; } 25% { opacity: 1; background-color: white; }
    50% { opacity: 0; } 75% { opacity: 1; background-color: black; }
    100% { opacity: 0; background-color: black; }
}

/* Controls hint */
.controls-hint {
    background: rgba(15,23,42,0.95); padding: 8px 16px;
    font-size: 0.8rem; color: #94a3b8; letter-spacing: 0.5px;
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center;
    height: 40px;
}
.controls-hint span {
    display: inline-block; background: rgba(255,255,255,0.1); color: white;
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2); font-weight: bold;
}

/* Shake */
@keyframes shake {
    0% { transform: translateX(0); } 20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); } 60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); } 100% { transform: translateX(0); }
}
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }

/* Type Colors */
.type-normal { background: linear-gradient(135deg, #a8a77a 0%, #8b8a65 100%); }
.type-fire { background: linear-gradient(135deg, #ee8130 0%, #c86c28 100%); }
.type-water { background: linear-gradient(135deg, #6390f0 0%, #5178ca 100%); }
.type-grass { background: linear-gradient(135deg, #7ac74c 0%, #66a740 100%); }
.type-electric { background: linear-gradient(135deg, #f7d02c 0%, #d1ae24 100%); }
.type-psychic { background: linear-gradient(135deg, #f85888 0%, #f73670 100%); }
.type-flying { background: linear-gradient(135deg, #a890f0 0%, #9175ec 100%); }
.type-ghost { background: linear-gradient(135deg, #735797 0%, #5a4379 100%); }
.type-poison { background: linear-gradient(135deg, #a040a0 0%, #803380 100%); }
.type-rock { background: linear-gradient(135deg, #b8a038 0%, #9a8530 100%); }

/* ═══════════════════════════════════════════════════ */
/* OVERWORLD UI                                        */
/* ═══════════════════════════════════════════════════ */
.overworld-ui {
    position: absolute; bottom: 20px; left: 20px;
    width: calc(100% - 40px); z-index: 5;
}

/* ═══════════════════════════════════════════════════ */
/* ENCOUNTER HUD                                       */
/* ═══════════════════════════════════════════════════ */
.encounter-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
}

.hud-pill {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.pill-lure { border-color: #facc15; color: #facc15; }
.pill-spray { border-color: #3b82f6; color: #3b82f6; }

/* ═══════════════════════════════════════════════════ */
/* WORLD MAP OVERLAY                                   */
/* ═══════════════════════════════════════════════════ */
.map-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 40px;
}

.map-container {
    position: relative;
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
}

.map-node {
    position: absolute;
    width: 24px; height: 24px;
    background: #334155;
    border: 3px solid #475569;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: all 0.3s;
}

.map-node:hover {
    transform: translate(-50%, -50%) scale(1.4);
    background: #2563eb;
    border-color: #fff;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
}

.map-node.discovered { background: #2563eb; border-color: #fff; }
.map-node.current { border-color: #facc15; background: #facc15; animation: pulseNode 1.5s infinite; }

@keyframes pulseNode {
    0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(250, 204, 21, 0); }
    100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

.node-label {
    position: absolute;
    top: 100%; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-top: 8px;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════ */
/* PARTY MENU                                          */
/* ═══════════════════════════════════════════════════ */
.party-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.95); z-index: 60;
    padding: 20px; display: flex; flex-direction: column; gap: 10px;
    backdrop-filter: blur(8px);
}
.party-overlay h2 { color: white; text-align: center; margin-bottom: 4px; letter-spacing: 2px; }
.party-hint {
    color: #64748b; text-align: center; font-size: 0.8rem; margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.party-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.party-item {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; padding: 10px 12px;
    display: flex; align-items: center; gap: 10px;
    transition: all 0.2s ease;
    user-select: none;
}
.party-item:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); }
.party-item.fainted { opacity: 0.45; background: rgba(255,0,0,0.08); }
.party-item.party-primary {
    background: rgba(37, 99, 235, 0.12); border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}
.party-item.party-active {
    background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.4);
}
.party-item.dragging {
    opacity: 0.4; transform: scale(0.95);
}
.party-item.drag-over {
    border-color: #facc15; background: rgba(250, 204, 21, 0.1);
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
}
.party-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.party-name { font-weight: bold; font-size: 1rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.party-lvl { font-size: 0.85rem; color: #94a3b8; }
.party-badge {
    display: inline-block; background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff; font-size: 0.65rem; font-weight: 800; padding: 2px 8px;
    border-radius: 10px; letter-spacing: 1px; vertical-align: middle;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.party-sprite-mini {
    width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
    background-size: contain; background-repeat: no-repeat; background-position: center;
    image-rendering: pixelated;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
}
.party-hp-bar {
    width: 100%; height: 5px; background: rgba(0,0,0,0.4);
    border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.party-hp-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.3s ease;
}
.party-hp-text {
    font-size: 0.85rem; color: #94a3b8; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.party-reorder-controls {
    display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.reorder-btn {
    width: 26px; height: 22px; background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15); border-radius: 4px;
    color: #94a3b8; font-size: 0.7rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease; padding: 0;
}
.reorder-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.3); color: #fff; border-color: #3b82f6;
    transform: scale(1.1);
}
.reorder-btn:active:not(:disabled) { transform: scale(0.9); }
.reorder-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.close-party-btn {
    margin-top: auto;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-basis: auto !important;
    max-width: 200px;
    width: auto;
    height: auto !important;
    max-height: 40px;
    padding: 8px 24px;
    align-self: center;
    font-size: 0.85rem;
}

/* Battle Party Overlay */
.battle-party-overlay {
    z-index: 70;
    background: rgba(15, 23, 42, 0.97);
}
.battle-party-overlay .party-item:not(.fainted):not(.party-active) {
    cursor: pointer;
}
.battle-party-overlay .party-item:not(.fainted):not(.party-active):hover {
    background: rgba(16, 185, 129, 0.15); border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

/* ═══════════════════════════════════════════════════ */
/* PC STORAGE                                          */
/* ═══════════════════════════════════════════════════ */
.pc-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.95); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
}
.pc-overlay h2 { color: white; text-align: center; }
.pc-container { display: flex; flex: 1; gap: 20px; margin-top: 10px; }
.pc-column {
    flex: 1; display: flex; flex-direction: column;
    background: rgba(0,0,0,0.5); border-radius: 8px; padding: 10px;
}
.pc-column h3 { color: #facc15; text-align: center; margin-bottom: 10px; }
#pcMessage { color: #fff; text-align: center; margin: 10px 0; }

/* ═══════════════════════════════════════════════════ */
/* STORE / ADOPTION CENTER                             */
/* ═══════════════════════════════════════════════════ */
.store-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(20, 30, 20, 0.95); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
}
.store-overlay h2 { color: #10b981; text-align: center; }
.store-top { display: flex; flex: 1; gap: 20px; margin-top: 10px; }
.store-inventory {
    flex: 1; display: flex; flex-direction: column; gap: 8px;
    background: rgba(0,0,0,0.5); border-radius: 8px; padding: 10px; overflow-y: auto;
}
.store-inventory h3 { color: #fff; border-bottom: 1px solid #444; padding-bottom: 5px; }
.store-bottom {
    background: rgba(0,0,0,0.8); border: 1px solid #444; padding: 10px;
    display: flex; flex-direction: column; gap: 10px; margin-top: 10px;
}
#storeMoney { font-weight: bold; color: #10b981; }
#storeMessage { color: #aaa; }

/* ═══════════════════════════════════════════════════ */
/* MONSTERDEX                                          */
/* ═══════════════════════════════════════════════════ */
.dex-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 15, 30, 0.97); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
}
.dex-overlay h2 { color: #ef4444; text-align: center; letter-spacing: 3px; }
.dex-count { color: #facc15; text-align: center; margin: 8px 0; font-size: 1rem; }
.dex-grid {
    flex: 1; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px; padding: 10px 0;
}
.dex-entry {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 12px 8px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 0.85rem; color: #aaa;
}
.dex-entry.dex-caught { background: rgba(16, 185, 129, 0.1); border-color: #10b981; color: #fff; }
.dex-entry.dex-seen { background: rgba(255,255,255,0.03); }

.dex-entry-btn {
    margin-top: auto;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    font-size: 0.7rem;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
}
.dex-entry-btn:hover { background: #ef4444; color: #fff; }

.dex-path-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px; text-align: center;
}

.evo-tree {
    display: flex; align-items: center; gap: 20px; margin-top: 20px;
}
.evo-node { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.evo-arrow { color: #facc15; font-size: 1.5rem; font-weight: bold; }

.dex-sprite {
    width: 64px; height: 64px; border-radius: 50%;
}
.dex-silhouette { filter: brightness(0); }
.dex-unknown { background: #222; width: 40px; height: 40px; border-radius: 50%; }
.dex-type { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; }

/* ═══════════════════════════════════════════════════ */
/* QUEST LOG                                           */
/* ═══════════════════════════════════════════════════ */
.quest-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 10, 25, 0.97); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
}
.quest-overlay h2 { color: #a78bfa; text-align: center; letter-spacing: 2px; }
.quest-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 15px; }
.quest-item {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 12px 16px; font-size: 1rem; color: #ccc;
}
.quest-item.quest-done {
    background: rgba(16, 185, 129, 0.1); border-color: #10b981; color: #10b981;
}

/* ═══════════════════════════════════════════════════ */
/* TRAINER PERKS                                       */
/* ═══════════════════════════════════════════════════ */
.perk-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 25, 0.97); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
    backdrop-filter: blur(8px);
}
.perk-overlay h2 { color: #facc15; text-align: center; letter-spacing: 3px; font-size: 1.5rem; }
.perk-points-display {
    text-align: center; margin: 8px 0 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.perk-points-display strong {
    color: #facc15; font-size: 1.4rem;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.4);
}
.perk-milestone-hint { color: #64748b; font-size: 0.75rem; }
.perk-categories {
    display: flex; gap: 6px; justify-content: center;
    margin-bottom: 12px; flex-wrap: wrap;
}
.perk-tab {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8; padding: 6px 14px; border-radius: 20px;
    font-size: 0.8rem; cursor: pointer; font-weight: 600;
    transition: all 0.2s;
}
.perk-tab:hover { background: rgba(255,255,255,0.1); color: #fff; }
.perk-tab.active { background: rgba(250, 204, 21, 0.15); border-color: #facc15; color: #facc15; }

.perk-grid {
    flex: 1; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px; padding: 4px 0;
}
.perk-card {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 14px 12px; cursor: pointer;
    transition: all 0.25s ease; position: relative; overflow: hidden;
}
.perk-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.perk-card.perk-unlocked {
    background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}
.perk-card.perk-unlocked .perk-card-icon { filter: none; }
.perk-card.perk-locked {
    opacity: 0.4; cursor: not-allowed;
}
.perk-card.perk-locked::after {
    content: '🔒'; position: absolute; top: 8px; right: 8px; font-size: 0.8rem;
}
.perk-card-icon { font-size: 1.5rem; margin-bottom: 6px; display: block; }
.perk-card-name { font-weight: 700; font-size: 0.9rem; color: #f8fafc; margin-bottom: 4px; }
.perk-card-desc { font-size: 0.75rem; color: #94a3b8; line-height: 1.4; }
.perk-card-cost {
    display: inline-block; margin-top: 8px;
    background: rgba(250, 204, 21, 0.15); color: #facc15;
    font-size: 0.7rem; font-weight: 700; padding: 2px 10px; border-radius: 10px;
}
.perk-card.perk-unlocked .perk-card-cost {
    background: rgba(16, 185, 129, 0.15); color: #10b981;
}
.perk-card-req {
    font-size: 0.65rem; color: #ef4444; margin-top: 4px;
    font-style: italic;
}

.perk-milestones {
    margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}
.perk-milestones h3 { color: #94a3b8; font-size: 0.85rem; margin-bottom: 6px; }
.milestone-list { display: flex; gap: 8px; flex-wrap: wrap; }
.milestone-item {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px; padding: 4px 10px; font-size: 0.7rem; color: #64748b;
}
.milestone-item.milestone-done {
    background: rgba(16, 185, 129, 0.1); border-color: #10b981; color: #10b981;
}

/* ═══════════════════════════════════════════════════ */
/* MOVE TUTOR                                          */
/* ═══════════════════════════════════════════════════ */
.tutor-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 20, 15, 0.97); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
}
.tutor-overlay h2 { color: #a78bfa; text-align: center; letter-spacing: 2px; }
.tutor-subtitle { color: #64748b; text-align: center; font-size: 0.85rem; margin: 4px 0 12px; }
.tutor-content { display: flex; flex: 1; gap: 16px; min-height: 0; }
.tutor-party {
    flex: 1; display: flex; flex-direction: column;
    background: rgba(0,0,0,0.4); border-radius: 8px; padding: 10px;
}
.tutor-party h3 { color: #a78bfa; text-align: center; margin-bottom: 8px; font-size: 0.85rem; }
.tutor-moves {
    flex: 1.5; display: flex; flex-direction: column;
    background: rgba(0,0,0,0.4); border-radius: 8px; padding: 10px;
}
.tutor-moves h3 { color: #a78bfa; text-align: center; margin-bottom: 8px; font-size: 0.85rem; }
.tutor-move-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.tutor-move-item {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 10px 12px;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
}
.tutor-move-item:hover { background: rgba(255,255,255,0.1); border-color: #a78bfa; }
.tutor-move-info { display: flex; flex-direction: column; gap: 2px; }
.tutor-move-name { font-weight: 700; font-size: 0.9rem; color: #f8fafc; }
.tutor-move-meta { font-size: 0.75rem; color: #94a3b8; }
.tutor-move-cost {
    font-weight: 700; color: #facc15; font-size: 0.85rem;
    white-space: nowrap;
}
.tutor-move-known {
    font-size: 0.7rem; color: #10b981; font-weight: 600;
}
.tutor-party .party-item { cursor: pointer; }
.tutor-party .party-item:hover { background: rgba(167, 139, 250, 0.15); border-color: #a78bfa; }
.tutor-party .party-item.tutor-selected {
    background: rgba(167, 139, 250, 0.15); border-color: #a78bfa;
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.2);
}
.tutor-bottom {
    background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.08);
    padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
    border-radius: 8px;
}
#tutorMoney { font-weight: bold; color: #10b981; }
#tutorMessage { color: #94a3b8; font-size: 0.85rem; }

/* ═══════════════════════════════════════════════════ */
/* MOVE REPLACE MODAL                                  */
/* ═══════════════════════════════════════════════════ */
.move-replace-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 200; display: flex; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(6px);
}
.move-replace-box {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 12px; padding: 24px 30px;
    max-width: 400px; width: 90%; text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    animation: modalPop 0.25s ease-out;
}
.move-replace-box h3 { color: #a78bfa; margin-bottom: 8px; }
#moveReplaceInfo { color: #94a3b8; font-size: 0.85rem; margin-bottom: 12px; }
.move-replace-list { display: flex; flex-direction: column; gap: 8px; }
.move-replace-btn {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; padding: 10px 14px; cursor: pointer;
    color: #f8fafc; font-weight: 600; font-size: 0.9rem;
    display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s;
}
.move-replace-btn:hover { background: rgba(239, 68, 68, 0.15); border-color: #ef4444; }
.move-replace-btn span { font-size: 0.75rem; color: #94a3b8; }

/* ═══════════════════════════════════════════════════ */
/* BOND / FRIENDSHIP HEARTS                            */
/* ═══════════════════════════════════════════════════ */
.bond-hearts {
    display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle;
}
.bond-heart {
    font-size: 0.7rem; transition: transform 0.2s;
}
.bond-heart.filled { color: #ef4444; }
.bond-heart.empty { color: #334155; }
.bond-label {
    font-size: 0.7rem; color: #94a3b8; margin-left: 4px;
    font-style: italic;
}

/* ═══════════════════════════════════════════════════ */
/* CRAFTING WORKSHOP                                   */
/* ═══════════════════════════════════════════════════ */
.craft-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 10, 5, 0.97); z-index: 60;
    padding: 20px; display: flex; flex-direction: column;
    backdrop-filter: blur(8px);
}
.craft-overlay h2 { color: #f59e0b; text-align: center; letter-spacing: 2px; font-size: 1.4rem; }
.craft-materials {
    display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
    margin: 8px 0 12px; font-size: 0.85rem; color: #94a3b8;
}
.craft-materials strong { color: #f8fafc; }
.craft-categories {
    display: flex; gap: 6px; justify-content: center;
    margin-bottom: 12px; flex-wrap: wrap;
}
.craft-tab {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8; padding: 6px 14px; border-radius: 20px;
    font-size: 0.8rem; cursor: pointer; font-weight: 600;
    transition: all 0.2s;
}
.craft-tab:hover { background: rgba(255,255,255,0.1); color: #fff; }
.craft-tab.active { background: rgba(245, 158, 11, 0.15); border-color: #f59e0b; color: #f59e0b; }

.craft-grid {
    flex: 1; overflow-y: auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px; padding: 4px 0;
}
.craft-card {
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px; padding: 14px 12px; cursor: pointer;
    transition: all 0.25s ease; position: relative;
}
.craft-card:hover { background: rgba(255,255,255,0.08); transform: translateY(-2px); }
.craft-card.can-craft {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}
.craft-card.cannot-craft { opacity: 0.5; cursor: not-allowed; }
.craft-card-icon { font-size: 1.5rem; margin-bottom: 4px; display: block; }
.craft-card-name { font-weight: 700; font-size: 0.9rem; color: #f8fafc; margin-bottom: 4px; }
.craft-card-desc { font-size: 0.72rem; color: #94a3b8; line-height: 1.3; margin-bottom: 6px; }
.craft-card-cost {
    font-size: 0.7rem; color: #64748b; line-height: 1.5;
}
.craft-card-cost .has { color: #10b981; }
.craft-card-cost .lacks { color: #ef4444; }
.craft-card-btn {
    margin-top: 8px; width: 100%; padding: 5px 0;
    background: rgba(245, 158, 11, 0.2); border: 1px solid #f59e0b;
    color: #f59e0b; border-radius: 6px; font-weight: 700; font-size: 0.75rem;
    cursor: pointer; transition: all 0.2s;
}
.craft-card-btn:hover { background: rgba(245, 158, 11, 0.35); }
.craft-card-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════ */
/* SHINY SPARKLE                                       */
/* ═══════════════════════════════════════════════════ */
@keyframes shinySparkle {
    0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
    25% { opacity: 0.6; transform: scale(0.8) rotate(90deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(180deg); }
    75% { opacity: 0.6; transform: scale(0.8) rotate(270deg); }
}
.shiny-badge {
    display: inline-block; font-size: 0.75rem; margin-left: 4px;
    animation: shinySparkle 2s infinite ease-in-out;
    vertical-align: middle;
}
.shiny-label {
    font-size: 0.65rem; color: #fbbf24; font-weight: 700;
    letter-spacing: 1px; margin-left: 2px;
}
.battle-shiny-sparkle {
    position: absolute; font-size: 1.2rem;
    animation: shinySparkle 1.5s infinite ease-in-out;
    pointer-events: none; z-index: 5;
}

/* ═══════════════════════════════════════════════════ */
/* RESET BUTTON & MODAL                                */
/* ═══════════════════════════════════════════════════ */
.reset-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fecaca;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}
.reset-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}
.reset-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.3);
}

.reset-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
}

.reset-modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 16px;
    padding: 32px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), 0 0 60px rgba(239, 68, 68, 0.1);
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reset-modal-content h3 {
    color: #fbbf24;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.reset-modal-content p {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

.reset-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.reset-confirm-btn {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%) !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4) !important;
}
.reset-confirm-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6) !important;
}


/* ═══════════════════════ NEW PREMIUM JOURNEY SCREENS ═══════════════════════ */
.title-screen, .custom-overlay, .starter-overlay, .intro-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1000; /* High z-index to cover everything */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    color: white;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.title-content { text-align: center; }
.game-logo {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: -4px;
    background: linear-gradient(to bottom, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(255,255,255,0.3));
    margin-bottom: 2rem;
    animation: bounceLogo 2s infinite ease-in-out;
}

/* Battle Speed Badge */
.speed-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    z-index: 100;
}
.speed-badge:hover { background: #3b82f6; }

/* Customization Sub-rows */
.custom-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.toggle-row {
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #334155; transition: .4s; border-radius: 24px;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: #2563eb; }
input:checked + .slider:before { transform: translateX(26px); }

/* Keybinding Menu */
.keybind-list {
    display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
}
.keybind-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(255,255,255,0.05); padding: 8px 12px; border-radius: 6px;
}
.key-cap {
    background: #334155; color: #fff; padding: 2px 8px; border-radius: 4px;
    font-family: monospace; font-weight: bold; min-width: 40px; text-align: center;
    cursor: pointer; border: 1px solid rgba(255,255,255,0.1);
}
.key-cap.waiting { background: #ef4444; animation: pulseNode 1s infinite; }

@keyframes bounceLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.title-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
    margin: 0 auto;
}

.title-options button {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e1;
    padding: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.title-options button:hover {
    background: #2563eb;
    color: white;
    transform: translateX(5px);
}

.pulse-text {
    margin-top: 3rem;
    font-size: 0.8rem;
    letter-spacing: 2px;
    opacity: 0.6;
    animation: pulseText 1.5s infinite;
}

/* Customization Box */
.custom-box {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 30px;
    width: 440px;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.custom-row {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-row label { font-size: 0.7rem; font-weight: 800; color: #64748b; letter-spacing: 1px; text-align: left; }
.custom-row input[type="text"], .custom-row select {
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-family: inherit;
}

.color-pickers { display: flex; gap: 10px; }
.color-pickers input { width: 40px; height: 40px; border: none; cursor: pointer; background: none; padding: 0; }

.character-preview {
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.character-preview canvas {
    width: 64px;
    height: 64px;
}

/* Starter Grid */
.starter-grid {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.starter-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 20px;
    width: 200px;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.starter-card:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-10px);
    border-color: #2563eb;
}

.starter-sprite {
    width: 80px; height: 80px; margin: 0 auto 15px; border-radius: 50%;
}

.ember-glow { box-shadow: 0 0 20px rgba(227, 81, 44, 0.4); }
.aqua-glow { box-shadow: 0 0 20px rgba(138, 180, 211, 0.4); }
.grass-glow { box-shadow: 0 0 20px rgba(74, 156, 128, 0.4); }

.stat-bar { background: #334155; height: 4px; border-radius: 2px; margin-top: 10px; overflow: hidden; }
.stat-bar div { height: 100%; }

/* Settings Modal */
.settings-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.settings-box {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 30px;
    width: 380px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

/* Professor Byte - Color Improvement */
.prof-byte {
    width: 140px; height: 140px;
    background: linear-gradient(135deg, #f0b890 0%, #d97706 100%);
    border-radius: 20px;
    margin-bottom: 30px;
    position: relative;
    box-shadow: 0 0 50px rgba(37, 99, 235, 0.4);
    border: 4px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prof-byte::before {
    content: "\1F5A5\FE0F";
    font-size: 3rem;
}

.prof-byte::after {
    content: 'PROF. BYTE';
    position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%);
    font-size: 0.8rem; font-weight: 900; color: #3b82f6; white-space: nowrap;
    background: rgba(0,0,0,0.5);
    padding: 2px 8px;
    border-radius: 4px;
}

.intro-dialogue-box {
    background: white;
    color: #1e293b;
    padding: 24px;
    border-radius: 8px;
    width: 600px;
    line-height: 1.6;
    font-weight: 500;
    font-size: 1.1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

@keyframes bounceLogo { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }
@keyframes pulseText { 0% { opacity: 0.4; } 50% { opacity: 0.9; } 100% { opacity: 0.4; } }
/* Floating Settings */
.floating-settings {
    position: absolute;
    bottom: 20px; right: 20px;
    z-index: 1200;
}

.settings-btn {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.settings-btn:hover {
    background: #2563eb;
    transform: rotate(45deg) scale(1.1);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.vfx-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Battle Particles */
.battle-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Touch Controls Overlay */
.touch-controls { display: none; }

@media (pointer: coarse) {
    .touch-controls {
        display: block;
        position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        pointer-events: none; z-index: 1000;
    }
    .dpad {
        position: absolute; bottom: 40px; left: 30px;
        display: flex; flex-direction: column; align-items: center; gap: 8px;
        pointer-events: auto;
    }
    .dpad-row { display: flex; gap: 8px; }
    .dpad-center { width: 50px; height: 50px; background: rgba(30, 41, 59, 0.4); border-radius: 8px; }
    .action-buttons {
        position: absolute; bottom: 40px; right: 30px;
        display: flex; flex-direction: column; align-items: flex-end; gap: 16px;
        pointer-events: auto;
    }
    .ab-group { display: flex; gap: 16px; align-items: flex-end;}
    .touch-btn {
        width: 50px; height: 50px;
        background: rgba(15, 23, 42, 0.6); border: 2px solid rgba(255,255,255,0.2);
        color: rgba(255,255,255,0.8); border-radius: 50%; font-size: 1.2rem; font-weight: bold;
        display: flex; align-items: center; justify-content: center;
        user-select: none; -webkit-tap-highlight-color: transparent;
        backdrop-filter: blur(4px); transition: transform 0.1s, background 0.1s;
    }
    .touch-btn.action-a, .touch-btn.action-b { width: 60px; height: 60px; font-size: 1.5rem; }
    .touch-btn.action-a { margin-bottom: 20px; }
    .touch-btn.action-m { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 8px; }
    .touch-btn:active { transform: scale(0.9); background: rgba(59, 130, 246, 0.8); color: #fff; border-color: #fff; }

    /* Hide touch controls in battle */
    body[data-state="battle"] .touch-controls {
        display: none !important;
    }
}

/* ═══════════════════════ MINI-MAP ═══════════════════════ */
.mini-map {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    z-index: 90;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    overflow: hidden;
}

/* ═══════════════════════ SAVE INDICATOR ═══════════════════════ */
.save-indicator {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    z-index: 100;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* ═══════════════════════ BATTLE LOG ═══════════════════════ */
.battle-log {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 200px;
    max-height: 150px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.7rem;
    color: #cbd5e1;
    overflow-y: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
}

.battle-log div {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 2px;
}

/* ═══════════════════════ MONSTER DETAILS ═══════════════════════ */
.details-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.details-box {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    width: 450px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.details-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.details-sprite-box {
    text-align: center;
}

.details-sprite {
    width: 100px;
    height: 100px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    margin-bottom: 8px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 12px;
}

.details-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 4px;
}

.stat-row strong {
    color: white;
}

.details-moves h3 {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.details-move-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.details-move-list div {
    background: rgba(255,255,255,0.05);
    padding: 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ═══════════════════════ PARTY FOOTER ═══════════════════════ */
.party-footer {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.party-footer .action-btn {
    flex: 1;
    margin: 0 !important;
}
