/* =========================================================================
   Mancusquad — base.css
   Tokens, reset, shell (topbar/nav/sesión), tipografía y componentes
   compartidos. Se carga ANTES de asesor.css (que define los layouts de vista).

   Reglas de diseño (heredadas del proyecto):
   - Controles nativos (segmentados, pills, tarjetas), no HUD diegético.
   - El color elemental sigue siendo el canal de información.
   - El ámbar queda para acción y selección, no para decoración.
   ========================================================================= */

:root {
  /* superficies */
  --bg: #07080b;
  --surface: #101319;
  --surface-2: #161b23;
  --surface-3: #1d242e;
  /* alias heredados (armor-view.js y estilos antiguos) */
  --panel: var(--surface);
  --panel-2: var(--surface-2);
  --panel-3: var(--surface-3);

  /* líneas y texto */
  --line: #232b37;
  --line-2: #33404f;
  --text: #ece9e2;
  --muted: #a6aebc;
  --dim: #8b95a5; /* ≥4.5:1 sobre superficie (antes 3.0–3.9:1) */

  /* acento: acción y selección */
  --accent: #e3b341;
  --accent-2: #f2c94c;
  --accent-dim: #a07c12;
  --accent-ink: #191105;
  --accent-soft: rgba(227, 179, 65, 0.13);
  --accent-line: rgba(227, 179, 65, 0.48);

  /* semánticos */
  --ok: #58d6a4;
  --warn: #ef7a5f;
  --danger: #f26d5b;

  /* elementales */
  --arc: #7fd8ff;
  --solar: #f5913e;
  --void: #b58cf7;
  --stasis: #6f96f2;
  --strand: #55dda0;

  /* stats de armadura */
  --s-weapons: #c9d14f;
  --s-health: #e0685f;
  --s-class: #5ec2c9;
  --s-grenade: #e88b3f;
  --s-melee: #cf6bd6;
  --s-super: #f2d05a;

  /* tipografía y forma */
  --f-ui: "IBM Plex Sans", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
  --r-sm: 8px;
  --r: 12px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-line);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  background-image:
    radial-gradient(ellipse 1000px 520px at 10% -12%, rgba(92, 134, 232, 0.07), transparent 55%),
    radial-gradient(ellipse 760px 420px at 100% 0%, rgba(227, 179, 65, 0.045), transparent 52%);
  background-attachment: fixed;
}
::selection { background: rgba(242, 201, 76, 0.26); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0b0d12; }
::-webkit-scrollbar-thumb { background: #2a3140; border: 2px solid #0b0d12; border-radius: 8px; }

button, input, select, textarea { font-family: inherit; }

/* Foco visible único y consistente en todos los controles. */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

.hidden { display: none !important; }

/* ============================ topbar ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 56px;
  padding: 0 24px;
  background: rgba(9, 11, 15, 0.86);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand b {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff;
  white-space: nowrap;
}
.brand .brand-sep {
  width: 1px;
  height: 18px;
  background: var(--line-2);
}
.brand .brand-sub {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--dim);
  white-space: nowrap;
  text-transform: none;
}

.nav {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  height: 30px;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.nav button:hover:not(.on) { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav button.on {
  background: var(--accent-soft);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* interruptor de idioma: ES | EN sobre los nombres que vienen de los datos */
.lang-switch {
  margin-left: auto;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex: none;
}
.lang-switch button {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lang-switch button:hover:not(.on) { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.lang-switch button.on {
  background: var(--accent-soft);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* sesión */
.account-box {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  max-width: 30vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill .stop {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
.status-pill.ok .stop { background: var(--ok); box-shadow: 0 0 8px rgba(88, 214, 164, 0.6); }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 230px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.account-menu button,
.account-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account-menu button:hover,
.account-menu a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.account-menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.account-menu input {
  width: 100%;
  height: 34px;
  margin: 2px 0 4px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
}
.account-menu .bn-form { display: grid; gap: 4px; padding: 2px; }

/* ============================ botones ============================ */
.btn,
.go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 13px;
  font-weight: 600;
  height: 34px;
  padding: 0 14px;
  white-space: nowrap;
  text-decoration: none;
}
.btn-sm,
.go-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-primary,
.go {
  background: linear-gradient(180deg, #f6d276, var(--accent) 58%, #c99a2e);
  color: var(--accent-ink);
  border-color: #b8891f;
}
.btn-primary:hover:not(:disabled),
.go:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn:disabled,
.go:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

.textbtn {
  background: none;
  border: 0;
  color: var(--dim);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  min-height: 24px;
}
.textbtn:hover:not(:disabled) { color: var(--accent-2); }
.textbtn:disabled { opacity: 0.45; cursor: not-allowed; color: var(--dim); }

.iconbtn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.iconbtn:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.iconbtn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn-lg { width: 36px; height: 36px; }

/* iconos (sprite en index.html) */
.i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.i-sm { width: 14px; height: 14px; }

/* ============================ tipografía y utilidades ============================ */
h1, h2, h3, h4 { letter-spacing: -0.02em; }
.kicker {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 3px;
}
.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; font-weight: 700; line-height: 1.15; }
.page-head p { margin: 0; max-width: 60ch; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--dim); line-height: 1.55; }
.muted { color: var(--dim); font-size: 12px; }

.msg {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  padding: 12px 14px;
  line-height: 1.6;
  color: var(--muted);
}
.msg b { color: var(--text); }
.msg.err { border-color: rgba(239, 122, 95, 0.45); color: #f0a99c; }
.msg.warn { border-color: rgba(240, 200, 105, 0.4); color: #e8d3a0; }

.app { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0 56px; }
.app.tool { padding-top: 16px; }
.tool { /* compatibilidad con el modificador que alterna asesor.js */ }

footer {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 18px 0 44px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--dim);
}

/* contenedor de vistas */
#view-cx, #view-arm { min-width: 0; }

/* ============================ toast ============================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ============================ diálogo ============================ */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 6, 9, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 18px;
}
.dialog {
  width: min(560px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* ============================ codex (vista de sets) ============================ */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: center; }
.toolbar .switch { flex: 0 1 auto; }
.toolbar input { flex: 1 1 220px; max-width: 320px; height: 36px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }

.card-scene { perspective: 1200px; transition: opacity 0.5s ease, transform 0.5s ease; }
.card-scene.pre { opacity: 0; transform: translateY(16px); }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow);
  transform-style: preserve-3d;
}
.card[data-el=Arc] { --ec: var(--arc); }
.card[data-el=Solar] { --ec: var(--solar); }
.card[data-el=Void] { --ec: var(--void); }
.card[data-el=Stasis] { --ec: var(--stasis); }
.card[data-el=Strand] { --ec: var(--strand); }
.card { --ec: var(--accent); }
.card-scene:hover .card { border-color: color-mix(in srgb, var(--ec) 45%, var(--line)); }
.card .glare {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.14), transparent 55%);
}
.card-scene:hover .glare { opacity: 1; }
.shot {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(160deg, #1a2230, #0b0f15 70%);
  overflow: hidden;
}
.shot .shot-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 30px;
  font-weight: 600;
  color: rgba(236, 233, 226, 0.18);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
  opacity: 0;
  transition: opacity 0.4s ease;
  transform: scale(1.04);
}
.shot img.in { opacity: 0.92; }
.shot::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 40%, var(--surface) 100%);
}
.shot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 3;
  background: linear-gradient(90deg, var(--ec), transparent 80%);
}
.shot .cap { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 2; }
.shot h3 { font-size: 19px; font-weight: 700; margin: 0; color: #fff; line-height: 1.15; }
.shot .cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ec);
  margin-bottom: 4px;
}
.layout .slots { display: flex; gap: 6px; padding: 12px 14px 0; }
.shot + .slots { display: flex; gap: 6px; padding: 12px 14px 0; }
.slots img { width: 30px; height: 30px; border-radius: 7px; background: #1a212d; }
.card .body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }
.card .pl { color: var(--ec); }
.card .pn { font-size: 14.5px; }
.card .pd { font-size: 13px; }

/* toolbar/shell internos de vistas */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.sec-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; }
.sec-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sec-head .count { font-family: var(--f-mono); font-size: 10.5px; color: var(--dim); }

/* ============================ switch/seg/chips compartidos ============================ */
.switch {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.switch > button,
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 11.5px;
  font-weight: 600;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
}
.switch > button { border: 0; background: transparent; height: 28px; border-radius: 6px; padding: 0 11px; }
.switch > button:hover { color: var(--text); }
.switch > button.on,
.switch > button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pills > button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--f-ui);
  font-size: 11.5px;
  font-weight: 600;
  height: 27px;
  padding: 0 10px;
  border-radius: var(--r-pill);
}
.pills > button:hover { color: var(--text); border-color: var(--line-2); }
.pills > button.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-2); }

.el { font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.el-solar { color: var(--solar); background: rgba(245, 145, 62, 0.14); }
.el-arc { color: var(--arc); background: rgba(127, 216, 255, 0.14); }
.el-void { color: var(--void); background: rgba(181, 140, 247, 0.14); }
.el-stasis { color: var(--stasis); background: rgba(111, 150, 242, 0.16); }
.el-strand { color: var(--strand); background: rgba(85, 221, 160, 0.14); }
.el-prismatic { color: var(--accent-2); background: var(--accent-soft); }

.badge {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}
.badge[data-el=Arc] { color: var(--arc); background: rgba(127, 216, 255, 0.14); }
.badge[data-el=Solar] { color: var(--solar); background: rgba(245, 145, 62, 0.14); }
.badge[data-el=Void] { color: var(--void); background: rgba(181, 140, 247, 0.14); }
.badge[data-el=Stasis] { color: var(--stasis); background: rgba(111, 150, 242, 0.16); }
.badge[data-el=Strand] { color: var(--strand); background: rgba(85, 221, 160, 0.14); }

.mini {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.mini.champ { color: var(--warn); background: rgba(239, 122, 95, 0.13); }
.mini.sh-arc,
.mini.arc { color: var(--arc); background: rgba(127, 216, 255, 0.12); }
.mini.sh-solar,
.mini.solar { color: var(--solar); background: rgba(245, 145, 62, 0.13); }
.mini.sh-void,
.mini.void { color: var(--void); background: rgba(181, 140, 247, 0.13); }
.mini.week { color: var(--accent-2); background: var(--accent-soft); }

.el-solar { color: var(--solar); }
.el-arc { color: var(--arc); }
.el-void { color: var(--void); }
.el-stasis { color: var(--stasis); }
.el-strand { color: var(--strand); }

/* `b` heredado de textos de datos */
.data b { color: var(--text); font-weight: 600; }

/* ============================ formularios ============================ */
input[type="text"],
input[type="search"],
select {
  height: 36px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 13px;
  outline: none;
}
input[type="text"]:focus,
input[type="search"]:focus,
select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(227, 179, 65, 0.1);
}
input::placeholder { color: var(--dim); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
