@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&display=swap');

:root {
    --bg-dark: #120024; --gold: #d4af37; --gold-dim: rgba(212, 175, 55, 0.3);
    --red-life: #cc0000; --blue-life: #4a90e2;
    --gold-dark: #b8860b; --gold-light: #ffd700; 
    --blue-life-dark: #1a4b8c; --blue-life-light: #4a90e2; --cyan-magic: #00ffff;
    --purple-magic: #8a2be2;
}

body { font-family: 'Cinzel', serif; background-color: var(--bg-dark); background-image: radial-gradient(circle, #1a0033 0%, #000 100%); color: #ffffff; margin: 0; padding: 20px; min-height: 100vh; text-align: center; }
h1, h2, h3 { color: var(--gold); text-shadow: 0 0 10px rgba(212, 175, 55, 0.5); }

button { background: #1a0033; border: 1px solid var(--gold); color: var(--gold); padding: 10px 20px; cursor: pointer; border-radius: 4px; font-weight: bold; transition: all 0.2s; }
button:hover:not(:disabled) { background: var(--gold); color: var(--bg-dark); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.catalogo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; }
.char-card { background: #150029; border: 1px solid var(--gold-dim); border-radius: 8px; padding: 15px; cursor: pointer; transition: transform 0.2s; overflow: hidden; }
.char-card:hover { transform: scale(1.05); border-color: var(--gold); }
.char-card img { width: 100px; height: 100px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; background: transparent; }
.char-card h3 { margin: 10px 0 5px 0; font-size: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-card p { margin: 0; font-size: 0.9em; color: #aaa; }

.detalle-container { max-width: 900px; margin: 0 auto; background: #150029; border: 1px solid var(--gold); padding: 20px; border-radius: 8px; text-align: left; position: relative; }

/* ESTILOS GEOMÉTRICOS HEX/VEX (SVG) CON CENTRADO ABSOLUTO */
.circle-wrap { display: flex; justify-content: space-around; margin: 30px 0; text-align: center; align-items: center; }
.stat-geom { width: 150px; height: 150px; position: relative; margin: 0 auto; }
.stat-geom svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.stat-geom .bg-path { fill: none; stroke: #222; stroke-width: 8; }
.stat-geom .bar-path { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
/* ESTE ES EL ARREGLO DEL CENTRADO */
.stat-geom .inner-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; width: 100%; text-align: center; pointer-events: none; }
.stat-geom strong { font-size: 1.8em; color: var(--gold); line-height: 1; pointer-events: auto; }
.stat-geom span { font-size: 0.8em; color: #aaa; text-transform: uppercase; letter-spacing: 1px; pointer-events: auto; }

.hex-geom .bar-path { stroke: var(--gold-light); filter: drop-shadow(0 0 5px var(--gold-dark)); }
.vex-geom .bar-path { stroke: var(--blue-life-light); filter: drop-shadow(0 0 5px var(--blue-life-dark)); }

.health-box { border: 1px solid var(--gold-dim); padding: 10px; margin-bottom: 10px; border-radius: 4px; }
.health-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; align-items: center;}
.heart-red { width: 16px; height: 16px; background: var(--red-life); border-radius: 50%; display:inline-block; }
.heart-red.empty { background: transparent; border: 1px solid var(--red-life); }
.heart-blue { width: 16px; height: 16px; background: var(--blue-life); clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); display:inline-block; }
.guard-gold { width: 16px; height: 16px; background: var(--gold); transform: rotate(45deg); margin: 4px; display:inline-block; }
.guard-gold.empty { background: transparent; border: 1px solid var(--gold); }

.affinities-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.affinity-box { background: #0a0014; border: 1px dashed var(--gold-dim); padding: 10px; text-align: center; border-radius: 4px; }
.affinity-box span { display: block; font-size: 1.3em; font-weight: bold; color: white; }
.affinity-box label { font-size: 0.75em; color: var(--gold); text-transform: uppercase; }

.spell-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 15px; }
.spell-button { background: #0a0014; border: 1px solid #1a4b8c; padding: 10px; text-align: center; font-size: 0.85em; font-weight: bold; color: var(--gold-light); border-radius: 4px; transition: 0.2s; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: 'Cinzel', serif; position: relative; }
.spell-button:hover { background: #1a4b8c; color: white; border-color: var(--cyan-magic); box-shadow: 0 0 10px rgba(0, 255, 255, 0.3); }

/* SISTEMA DE COPIADO MUDO CON TOOLTIP */
.floating-tooltip { position: absolute; background: #fff; color: #000; padding: 6px 12px; border-radius: 4px; font-weight: bold; font-family: sans-serif; font-size: 0.9rem; pointer-events: none; z-index: 99999; animation: floatUp 0.6s ease-out forwards; box-shadow: 0 4px 10px rgba(0,0,0,0.8); border: 2px solid var(--gold); transform: translateX(-50%); }
@keyframes floatUp { 0% { opacity: 1; margin-top: 0; } 100% { opacity: 0; margin-top: -35px; } }
.copy-wrap { cursor: pointer; transition: 0.2s; position:relative; display: inline-block; padding: 5px; border-radius:4px; border:1px solid transparent; }
.copy-wrap:hover { filter: brightness(1.3); background: rgba(255,255,255,0.05); border-color: var(--gold-dim); }

/* RESUMEN VISUAL AVANZADO */
.resumen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1400px; margin: 0 auto; }
.resumen-row { display: flex; align-items: stretch; background: #150029; border: 1px solid var(--gold); padding: 15px; border-radius: 8px; gap: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); cursor: pointer; transition: 0.2s; overflow: hidden; }
.resumen-row:hover { border-color: var(--gold-light); transform: scale(1.02); }
.resumen-left { flex: 0 0 130px; text-align: center; border-right: 1px dashed var(--gold-dim); padding-right: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.resumen-left img { width: 90px; height: 90px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; margin-bottom: 10px; background: transparent; }
.resumen-right { flex: 1; text-align: left; display: flex; flex-direction: column; gap: 8px; justify-content: center; }

.mini-item-card { background: #000; padding: 2px; border-radius: 4px; display: inline-block; box-shadow: 0 2px 4px rgba(0,0,0,0.8); transition: 0.2s; }
.mini-item-card:hover { transform: scale(1.1); filter: brightness(1.2); }
.mini-item-card img { width: 35px; height: 35px; object-fit: cover; border-radius: 2px; display: block; background: transparent; }
.rarity-comun { border: 1px solid #777; }
.rarity-raro { border: 2px solid var(--purple-magic); box-shadow: 0 0 10px rgba(138, 43, 226, 0.5); }
.rarity-legendario { border: 2px solid var(--gold-light); box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
.mini-spell-tag { background: #0a0014; border: 1px solid var(--cyan-magic); padding: 3px 6px; border-radius: 4px; font-size: 0.65em; color: var(--cyan-magic); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; display: inline-block; vertical-align: top; font-family: 'Cinzel', serif; font-weight: bold; }

.hex-label { font-size: 1.6em; color: var(--gold-light); font-weight: bold; text-shadow: 0 0 15px rgba(255, 215, 0, 0.6); margin-top: 5px; display: block; line-height:1; }
.vex-label { font-size: 1.1em; color: var(--blue-life); font-weight: bold; text-shadow: 0 0 10px rgba(74, 144, 226, 0.6); display: block; margin-top: 5px; }

/* MODAL POP-UP OP (ARRASTRABLE) */
.hex-modal { position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.hex-modal-content { background: rgba(10, 0, 20, 0.98); border: 2px solid #b8860b; border-radius: 8px; box-shadow: 0 0 40px rgba(0, 0, 0, 0.9), 0 0 20px rgba(184, 134, 11, 0.4); max-width: 900px; width: 95%; max-height: 85vh; display: flex; flex-direction: column; pointer-events: auto; position: relative; }
.modal-header { padding: 12px 20px; background: #000; border-bottom: 1px dashed var(--gold); cursor: move; display: flex; justify-content: space-between; align-items: center; border-radius: 8px 8px 0 0; user-select: none; }
.modal-body-scroll { padding: 20px; overflow-y: auto; flex: 1; }
.close-btn { color: var(--gold); font-size: 30px; font-weight: bold; cursor: pointer; line-height: 1; transition: 0.2s; margin-top:-5px;}
.close-btn:hover { color: #ff4444; text-shadow: 0 0 10px #ff4444; }

.oculto { display: none !important; }
.nav-bar { display: flex; justify-content: space-between; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--gold-dim); }
.filter-group { display: flex; gap: 5px; background: #0a0014; border: 1px solid var(--gold); padding: 5px; border-radius: 4px; }
.filter-group button { background: transparent; border: none; color: gray; padding: 5px 15px; font-size: 0.9em; }
.filter-group button.btn-active { background: var(--gold); color: black; border-radius: 2px; }

/* PANELES DE EDICIÓN OP */
.edit-grid-6 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 15px; }
.edit-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 15px; }
.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; margin-top: 15px; }
.edit-card { background: #150029; border: 1px solid var(--gold); padding: 10px; border-radius: 4px; text-align: center; }
.edit-card h4 { margin: 0 0 10px 0; color: #fff; font-size: 0.85em; text-transform: uppercase; }
.edit-card span { display: block; margin-bottom: 10px; color: var(--gold); font-weight: bold; font-size: 1.5em; }
.edit-card input[type="number"] { width: 80%; text-align: center; background: #000; color: white; border: 1px dashed var(--gold); margin-bottom: 10px; font-size: 1.5em; padding: 5px; box-sizing: border-box; font-family: monospace; }

.btn-row { display: flex; gap: 5px; margin-bottom: 5px; }
.btn-row button { flex: 1; padding: 6px; font-size: 1em; margin: 0; border-radius: 2px; font-family: monospace; font-weight: bold; }

.btn-plus { background: #330066; color: white; border-color: #5500aa; }
.btn-minus { background: #660000; color: white; border-color: #aa0000; }
.btn-plus5 { background: #004a4a; color: white; border-color: #008888; }
.btn-minus5 { background: #4a0000; color: white; border-color: #880000; }

.btn-plus:hover { background: #5500aa; }
.btn-minus:hover { background: #aa0000; }
.btn-plus5:hover { background: #008888; }
.btn-minus5:hover { background: #880000; }

.btn-sync-float { position: fixed; bottom: 30px; right: 30px; background: linear-gradient(145deg, #aa0000, #ff4444); color: white; padding: 15px 25px; border-radius: 50px; font-weight: bold; font-size: 1.1em; border: 2px solid #fff; box-shadow: 0 5px 20px rgba(255,0,0,0.6); z-index: 99999; cursor: pointer; animation: pulse 2s infinite; font-family: 'Cinzel', serif; }

.status-badge { padding: 4px 10px; border-radius: 4px; font-size: 0.75em; font-weight: bold; text-transform: uppercase; border: 1px solid #fff; box-shadow: 2px 2px 0px #000; position: relative; cursor: help; overflow: visible !important; }
.status-badge .tooltiptext { visibility: hidden; width: 250px; background-color: #000; color: #fff; text-align: center; border-radius: 6px; padding: 10px; border: 1px solid var(--gold); position: absolute; z-index: 100; bottom: 135%; left: 50%; transform: translateX(-50%); opacity: 0; transition: opacity 0.3s; font-size: 0.9em; text-transform: none; font-weight: normal; box-shadow: 0 5px 15px rgba(0,0,0,0.8); pointer-events: none; white-space: normal; line-height: 1.4; font-family: sans-serif; }

.status-toggle { background: #111; color: gray; border: 1px solid #333; padding: 10px; cursor: pointer; border-radius: 4px; transition: 0.2s; font-size: 0.8em; font-weight: bold; text-transform: uppercase; font-family: 'Cinzel', serif; }
.status-toggle.active { background: var(--gold); color: black; border-color: white; }

@media (max-width: 768px) {
    body { padding-bottom: 90px !important; padding-left: 10px !important; padding-right: 10px !important; }
    .nav-bar { position: fixed !important; bottom: 0 !important; left: 0 !important; width: 100% !important; background: rgba(18, 0, 36, 0.98) !important; border-top: 2px solid var(--gold) !important; border-bottom: none !important; padding: 10px 5px !important; margin: 0 !important; justify-content: space-around !important; z-index: 9999 !important; display: flex !important; }
    .nav-bar h2 { display: none !important; }
    .nav-bar > div { display: flex !important; width: 75% !important; justify-content: space-around !important; gap: 5px !important; }
    .nav-bar button, .nav-bar span { font-size: 0.65em !important; padding: 10px 2px !important; flex: 1; text-align: center; border-radius: 4px; }
    .catalogo-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .resumen-grid { grid-template-columns: 1fr !important; } 
    .filter-group { display: grid !important; grid-template-columns: 1fr 1fr 1fr !important; gap: 5px !important; width: 100%; }
    .spell-grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
    .edit-grid-3, .edit-grid-6 { grid-template-columns: 1fr !important; } 
    .resumen-row { flex-direction: column !important; text-align: center !important; }
    .resumen-left { border-right: none; border-bottom: 1px dashed var(--gold-dim); padding-right: 0; padding-bottom: 15px; flex: 0 0 auto;}
}
