/* Fedarium · mapa de la galaxia. Estética de paneles oscuros translúcidos inspirada en LiveAtlas
   (Apache-2.0); el CSS es propio. */
:root {
  --fondo: #05060c;
  --panel: rgba(18, 20, 28, 0.86);
  --panel-solido: #16181f;
  --panel-claro: rgba(46, 50, 64, 0.9);
  --hover: rgba(70, 76, 98, 0.9);
  --pulsado: #3a4a6e;
  --borde: rgba(255, 255, 255, 0.08);
  --texto: rgba(255, 255, 255, 0.74);
  --texto-fuerte: rgba(255, 255, 255, 0.92);
  --tenue: rgba(255, 255, 255, 0.45);
  --acento: #5ce1e6;
  --oro: #f3c969;
  --peligro: #e0483c;
  --radio: 0.55rem;
  --sombra: 0 6px 24px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --barra: 3.4rem;
  --lateral: 19rem;
  --fuente: "Raleway", "Segoe UI", "Ubuntu", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--texto); font: 14px/1.45 var(--fuente); }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-fuerte); margin: 0 0 .6rem; }
h3 { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--tenue); margin: .9rem 0 .4rem; }
a { color: var(--acento); }
.tenue { color: var(--tenue); font-size: .85rem; }
[hidden] { display: none !important; }
input, select { font: inherit; color: var(--texto-fuerte); background: var(--panel-claro); border: 1px solid var(--borde); border-radius: .35rem; padding: .35rem .5rem; }
input:focus, select:focus { outline: 2px solid var(--acento); outline-offset: -1px; }
label { display: block; margin: .35rem 0; }
label input[type=number], label input[type=text], label select { width: 100%; margin-top: .15rem; }

.boton {
  appearance: none; border: 0; border-radius: var(--radio); background: var(--panel-claro); color: var(--texto);
  padding: .45rem .7rem; cursor: pointer; font: 500 .85rem var(--fuente); transition: background .15s, color .15s;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; user-select: none;
}
.boton:hover { background: var(--hover); color: var(--texto-fuerte); }
.boton[aria-pressed=true] { background: var(--pulsado); color: #fff; box-shadow: 0 0 0 1px rgba(92, 225, 230, .45) inset; }
.boton.peligro { background: rgba(224, 72, 60, .25); color: #ffb0a8; }
.boton.peligro:hover { background: rgba(224, 72, 60, .5); color: #fff; }
.boton.icono { width: 2.4rem; height: 2.4rem; font-size: 1.2rem; padding: 0; }
.grupo-botones { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.grupo-botones input[type=text] { flex: 1; min-width: 6rem; }

.panel { background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: var(--radio); box-shadow: var(--sombra); padding: .9rem 1rem; border: 1px solid var(--borde); }

/* ------------------------------------------------------------------ barra superior */
#barra { position: fixed; z-index: 1000; top: 0; left: 0; right: 0; height: var(--barra); display: flex; align-items: center; gap: .6rem; padding: 0 .7rem;
  background: linear-gradient(180deg, rgba(8, 9, 16, .95), rgba(8, 9, 16, .7)); border-bottom: 1px solid var(--borde); }
#marca { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--texto-fuerte); font-weight: 700; letter-spacing: .28em; font-size: .95rem; }
#marca img { width: 1.9rem; height: 1.9rem; }
#migas { display: flex; gap: .3rem; align-items: center; color: var(--tenue); font-size: .9rem; white-space: nowrap; overflow: hidden; }
#migas a { color: var(--texto); text-decoration: none; }
#migas a:hover { color: var(--acento); }
#migas .sep { opacity: .5; }
#buscador { position: relative; margin-left: auto; width: min(24rem, 40vw); }
#buscar { width: 100%; padding: .45rem .7rem; border-radius: 1rem; background: rgba(40, 44, 58, .85); }
#sugerencias { position: absolute; top: 2.4rem; left: 0; right: 0; margin: 0; padding: .3rem; list-style: none; background: var(--panel-solido); border-radius: var(--radio); box-shadow: var(--sombra); max-height: 60vh; overflow: auto; border: 1px solid var(--borde); }
#sugerencias li { padding: .4rem .55rem; border-radius: .35rem; cursor: pointer; display: flex; gap: .5rem; align-items: center; }
#sugerencias li:hover, #sugerencias li.activa { background: var(--hover); color: #fff; }
#sugerencias .tipo { margin-left: auto; font-size: .72rem; color: var(--tenue); text-transform: uppercase; letter-spacing: .06em; }
#sesion { font-size: .78rem; padding: .25rem .55rem; border-radius: 1rem; background: rgba(243, 201, 105, .18); color: var(--oro); }

/* ------------------------------------------------------------------ lateral */
#lateral { position: fixed; z-index: 900; top: calc(var(--barra) + .6rem); left: .6rem; bottom: .6rem; width: var(--lateral); display: flex; flex-direction: column; gap: .6rem; overflow-y: auto; scrollbar-width: thin; transition: transform .25s; }
body.sin-lateral #lateral { transform: translateX(calc(-1 * var(--lateral) - 1rem)); }
#lista-capas .capa { display: flex; align-items: center; gap: .55rem; padding: .3rem .4rem; border-radius: .35rem; cursor: pointer; }
#lista-capas .capa:hover { background: rgba(255, 255, 255, .05); }
#lista-capas .capa input { accent-color: var(--acento); width: 1rem; height: 1rem; }
#lista-capas .capa .muestra { width: .9rem; height: .9rem; border-radius: .2rem; margin-left: auto; }
.deslizador { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .2rem .5rem; font-size: .85rem; }
.deslizador input { grid-column: 1 / -1; grid-row: 2; width: 100%; accent-color: var(--acento); padding: 0; background: none; border: 0; }
.deslizador output { color: var(--texto-fuerte); font-variant-numeric: tabular-nums; }
.casillas label { display: inline-flex; gap: .3rem; align-items: center; margin-right: .6rem; font-size: .85rem; }
.leyenda-diplo { display: grid; grid-template-columns: auto 1fr; gap: .2rem .5rem; font-size: .8rem; margin-top: .4rem; }
.leyenda-diplo i { width: .9rem; height: .9rem; border-radius: .2rem; display: inline-block; }

.faccion-fila { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--borde); }
.faccion-fila:last-child { border: 0; }
.faccion-fila .escudo { width: 1.9rem; height: 1.9rem; flex: none; }
.faccion-fila b { color: var(--texto-fuerte); display: block; }
.faccion-fila small { color: var(--tenue); }
.faccion-fila .barra-pct { height: .25rem; border-radius: .2rem; margin-top: .2rem; }

.guerra { padding: .5rem .55rem; margin-bottom: .45rem; border-radius: .4rem; background: rgba(224, 72, 60, .1); border-left: 3px solid var(--peligro); cursor: pointer; }
.guerra.solicitada { background: rgba(243, 201, 105, .08); border-color: var(--oro); }
.guerra b { color: var(--texto-fuerte); }
.guerra .bandos { font-size: .8rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.guerra .vs { color: var(--tenue); font-weight: 700; }
.guerra .stats { font-size: .75rem; color: var(--tenue); margin-top: .2rem; }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .4rem; border-radius: .8rem; background: rgba(255, 255, 255, .06); font-size: .78rem; }
.chip i { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; }

/* ------------------------------------------------------------------ escena */
#escena { position: fixed; inset: 0; }
#galaxia { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#galaxia.arrastrando { cursor: grabbing; }
#etiquetas-galaxia { position: absolute; inset: 0; pointer-events: none; }
.etq-planeta { position: absolute; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer; text-align: center; white-space: nowrap; font-size: .82rem; font-weight: 600; letter-spacing: .08em; color: #e8f6ff; text-shadow: 0 0 6px #000, 0 0 2px #000; text-transform: uppercase; }
.etq-planeta small { display: block; font-size: .65rem; letter-spacing: .05em; font-weight: 500; opacity: .75; text-transform: none; }
body:not(.vista-galaxia) #galaxia, body:not(.vista-galaxia) #etiquetas-galaxia { display: none; }

#vista-esfera { position: absolute; inset: 0; background: radial-gradient(ellipse at 40% 50%, #121530 0%, #05060c 70%); }
#esfera { position: absolute; inset: 0; width: 100%; height: 100%; }
#info-planeta { position: absolute; right: 1.2rem; top: calc(var(--barra) + 1.2rem); width: min(23rem, 90vw); max-height: calc(100% - var(--barra) - 2.4rem); overflow: auto; }
#info-planeta h1 { margin: 0; font-size: 1.9rem; letter-spacing: .14em; text-transform: uppercase; color: #fff; font-weight: 700; }
#info-planeta .sub { color: var(--tenue); margin-bottom: .8rem; }
.dato { display: flex; justify-content: space-between; gap: 1rem; padding: .28rem 0; border-bottom: 1px solid var(--borde); font-size: .9rem; }
.dato span:first-child { color: var(--tenue); }
.dato span:last-child { color: var(--texto-fuerte); text-align: right; }
.radios { margin: .8rem 0; }
.radios .pista { position: relative; height: .6rem; border-radius: .3rem; background: rgba(255, 255, 255, .08); overflow: hidden; }
.radios .lleno { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #2e7d5b, #5ce1e6); border-radius: .3rem; transition: width 1.6s cubic-bezier(.2, .8, .2, 1); width: 0; }
.entrar { width: 100%; margin-top: 1rem; padding: .8rem; font-size: 1.05rem; letter-spacing: .3em; font-weight: 700; background: linear-gradient(90deg, #1c5c74, #2a3f88); color: #fff; }
.entrar:hover { background: linear-gradient(90deg, #26809f, #3a55b8); }

#mapa { position: absolute; inset: 0; background: #05060c; }
.leaflet-container { background: #05060c; font-family: var(--fuente); }
.leaflet-control-zoom a, .leaflet-bar a { background: var(--panel) !important; color: var(--texto) !important; border-color: var(--borde) !important; }
.leaflet-bar { border: 0 !important; box-shadow: var(--sombra) !important; border-radius: var(--radio) !important; overflow: hidden; }
.leaflet-bar a:hover { background: var(--hover) !important; color: #fff !important; }
.leaflet-top { top: calc(var(--barra) + .4rem); }
body:not(.sin-lateral) .leaflet-left { left: calc(var(--lateral) + .8rem); }
.leaflet-tooltip.etq-ciudad { background: rgba(10, 12, 20, .78); border: 0; color: #fff; box-shadow: none; font-weight: 600; font-size: .78rem; padding: .1rem .4rem; border-radius: .3rem; }
.leaflet-tooltip.etq-ciudad::before { display: none; }
.icono-mapa { filter: drop-shadow(0 1px 2px #000); }
.icono-recurso { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(10, 12, 20, .8); border: 1px solid rgba(255, 255, 255, .35); }
.icono-recurso svg { width: 12px; height: 12px; }
#coordenadas { position: absolute; z-index: 800; bottom: .6rem; left: 50%; transform: translateX(-50%); font: 600 .85rem ui-monospace, monospace; padding: .3rem .7rem; pointer-events: none; }

/* ------------------------------------------------------------------ flotantes */
.flotante { position: fixed; z-index: 1100; top: calc(var(--barra) + .6rem); right: .6rem; width: min(22rem, 92vw); max-height: calc(100% - var(--barra) - 1.2rem); overflow-y: auto; scrollbar-width: thin; }
#info { right: .6rem; }
#planes, #admin { right: .6rem; }
#hemiciclo { right: auto; left: 50%; transform: translateX(-50%); width: min(30rem, 94vw); }
.cerrar { position: absolute; top: .4rem; right: .5rem; background: none; border: 0; color: var(--tenue); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.cerrar:hover { color: #fff; }
#info .titulo { font-size: 1.2rem; color: #fff; font-weight: 700; margin: 0 1.5rem .2rem 0; }
#info .tipo { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--acento); }
#info .recursos { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
#hemi-svg { width: 100%; height: auto; }
#hemi-leyenda { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; font-size: .8rem; }

.paleta { display: grid; grid-template-columns: repeat(8, 1fr); gap: .3rem; }
.paleta button { aspect-ratio: 1; border-radius: .3rem; border: 2px solid transparent; cursor: pointer; }
.paleta button[aria-pressed=true] { border-color: #fff; box-shadow: 0 0 0 2px #000 inset; }
.unidades { display: grid; grid-template-columns: repeat(6, 1fr); gap: .3rem; }
.unidades button { aspect-ratio: 1; padding: .25rem; background: var(--panel-claro); border: 1px solid var(--borde); border-radius: .35rem; cursor: pointer; color: var(--texto-fuerte); }
.unidades button:hover { background: var(--hover); }
.unidades button[aria-pressed=true] { background: var(--pulsado); border-color: var(--acento); }
.unidades svg { width: 100%; height: 100%; }
.plan-fila { display: flex; gap: .4rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--borde); font-size: .85rem; }
.plan-fila span { flex: 1; }

/* ------------------------------------------------------------------ discord, avisos, carga */
#discord { position: fixed; z-index: 1200; right: 1rem; bottom: 1rem; display: flex; align-items: center; gap: .5rem; padding: .55rem .95rem .55rem .7rem; border-radius: 2rem; background: #5865f2; color: #fff; text-decoration: none; font-weight: 700; box-shadow: 0 6px 20px rgba(88, 101, 242, .45); transition: transform .15s, box-shadow .15s; }
#discord:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(88, 101, 242, .6); }
#discord svg { width: 1.4rem; height: 1.4rem; }
#aviso { position: fixed; z-index: 1300; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--panel-solido); padding: .6rem 1rem; border-radius: var(--radio); box-shadow: var(--sombra); border: 1px solid var(--borde); color: var(--texto-fuerte); }
#aviso.error { border-color: var(--peligro); color: #ffb0a8; }
#cargando { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--fondo); transition: opacity .4s; }
#cargando.fuera { opacity: 0; pointer-events: none; }
.anillo { width: 3rem; height: 3rem; border-radius: 50%; border: 3px solid rgba(92, 225, 230, .2); border-top-color: var(--acento); animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  :root { --lateral: 85vw; }
  #marca span, #migas { display: none; }
  #buscador { width: auto; flex: 1; }
  #discord span { display: none; }
  #discord { padding: .6rem; }
  body:not(.sin-lateral) .leaflet-left { left: 0; }
}

/* logo de Fedarium en la cabecera */
#marca img.logo { height: 26px; width: auto; display: block; filter: drop-shadow(0 0 6px rgba(232,163,23,.35)); }

/* aviso al pasar sobre una región o un planeta de la galaxia (no hay textos fijos) */
.aviso-galaxia { position: absolute; pointer-events: none; background: rgba(8,10,22,.92); border: 1px solid rgba(92,225,230,.45);
  border-radius: 6px; padding: 6px 10px; color: #fff; font-size: 13px; max-width: 280px; z-index: 5; box-shadow: 0 0 14px rgba(92,225,230,.25); }
.aviso-galaxia b { display: block; letter-spacing: .04em; }
.aviso-galaxia small { display: block; color: rgba(255,255,255,.65); }

/* planeta en cubo: las mismas texturas que el cubo del espacio (resource pack) */
#cubo-escena { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; perspective: 1400px; pointer-events: auto; cursor: grab; }
#cubo-escena[hidden] { display: none; }
#cubo { --l: min(38vmin, 360px); margin-right: min(22vw, 300px); width: var(--l); height: var(--l); position: relative; transform-style: preserve-3d; }
#cubo .cara { position: absolute; inset: 0; image-rendering: pixelated; background-size: 100% 100%; backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
#cubo .up { transform: rotateX(90deg) translateZ(calc(var(--l) / 2)); }
#cubo .down { transform: rotateX(-90deg) translateZ(calc(var(--l) / 2)); filter: brightness(.55); }
#cubo .south { transform: translateZ(calc(var(--l) / 2)); filter: brightness(.85); }
#cubo .north { transform: rotateY(180deg) translateZ(calc(var(--l) / 2)); filter: brightness(.7); }
#cubo .east { transform: rotateY(90deg) translateZ(calc(var(--l) / 2)); filter: brightness(.75); }
#cubo .west { transform: rotateY(-90deg) translateZ(calc(var(--l) / 2)); filter: brightness(.8); }
#cubo-escena::before { content: ""; position: absolute; width: 60vmin; height: 60vmin; border-radius: 50%;
  background: radial-gradient(circle, var(--halo, rgba(92,225,230,.25)) 0%, transparent 65%); pointer-events: none; }
