/* ============================================================
   TÁCTICA USDt — Design System
   brand.css — tokens + components (shared across all pages)
   "editorial fantasy war-room"
   ============================================================ */

/* Fuentes (Cinzel + Rajdhani): se cargan con <link> desde el HTML, no desde acá; importarlas desde la hoja encadena la descarga detrás del CSS. */

/* ============================================================
   1. TOKENS
   ============================================================ */
:root {
  /* Core palette */
  --obsidian:   #1B1E24;
  --obsidian-2: #23272F;
  --obsidian-3: #2C313A;

  /* Gold scale */
  --gold:    #C89B3C;
  --gold-hi: #E6C879;
  --gold-lo: #8A6A22;

  /* Text */
  --ivory:   #D7D2C7;
  --text:    #D7D2C7;
  --muted:   #9AA0A8;
  --dim:     #6B727B;

  /* Faction */
  --forest:  #56704D;
  --crimson: #8F2F2F;
  --royal:   #2E5F9B;

  /* UI chrome */
  --border:  #3A4048;
  --border-2:#4A525C;
  --iron:    #59616B;
  --ok:      #6FAE5F;
  --bad:     #C0584F;

  /* Surfaces */
  --panel:   rgba(35,39,47,.92);
  --r:       6px;

  /* Typography scale */
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-ui:      'Rajdhani', 'Arial Narrow', sans-serif;

  --text-xs:  0.75rem;   /* 12px */
  --text-sm:  0.875rem;  /* 14px */
  --text-base:1.0625rem; /* 17px */
  --text-lg:  1.125rem;  /* 18px */
  --text-xl:  1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
  --text-6xl: 5rem;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-24: 96px;

  /* Container */
  --container: 1240px;
  --container-pad: clamp(16px, 5vw, 48px);
}

/* ============================================================
   2. RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--text);
  background-color: var(--obsidian);
  /* Layered radial ambient light */
  background-image:
    radial-gradient(ellipse 1200px 700px at 72% -12%, #2a2f3a 0%, transparent 70%),
    radial-gradient(ellipse 900px 500px at 10% 110%, #20242b 0%, transparent 70%);
  min-height: 100vh;
  /* Defensive: prevent any overflow from expanding the layout viewport */
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: var(--font-ui); border: none; background: none; }
input, select, textarea { font-family: var(--font-ui); }
svg { display: block; }

/* Reduced motion — MANDATORY for >5 animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   3. LAYOUT PRIMITIVES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--sp-16);
}

.section--lg {
  padding-block: var(--sp-24);
}

/* ============================================================
   4. TYPOGRAPHY
   ============================================================ */
.cinzel { font-family: var(--font-display); }
.rajdhani { font-family: var(--font-ui); }

h1, h2, h3, .display {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.display-hero {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.display-section {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.display-sub {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.ui-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.ui-value {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-2xl);
  letter-spacing: 0.04em;
}

.ui-stat {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.02em;
}

.text-gold   { color: var(--gold); }
.text-gold-hi{ color: var(--gold-hi); }
.text-muted  { color: var(--muted); }
.text-dim    { color: var(--dim); }
.text-ok     { color: var(--ok); }
.text-bad    { color: var(--bad); }
.text-forest { color: var(--forest); }
.text-crimson{ color: var(--crimson); }
.text-royal  { color: var(--royal); }
.text-ivory  { color: var(--ivory); }
.text-center { text-align: center; }

/* Gold gradient text */
.text-gold-gradient {
  background: linear-gradient(135deg, var(--gold-hi) 0%, var(--gold) 50%, var(--gold-lo) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   5. BUTTONS
   ============================================================ */

/* Primary — gold */
.btn-gold {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 14px 32px;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--obsidian);
  background: linear-gradient(160deg, var(--gold-hi) 0%, var(--gold) 45%, var(--gold-lo) 100%);
  border-radius: var(--r);
  border: 1px solid var(--gold-hi);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 4px 16px rgba(200,155,60,.25),
    0 1px 4px rgba(0,0,0,.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn-gold::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    0 8px 28px rgba(200,155,60,.4),
    0 2px 8px rgba(0,0,0,.5);
  filter: brightness(1.08);
}
.btn-gold:active { transform: translateY(0); filter: brightness(0.95); }
.btn-gold:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 3px;
}

/* Secondary — stone */
.btn-stone {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 13px 28px;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ivory);
  background: linear-gradient(160deg, #3b424c 0%, #262b32 100%);
  border-radius: var(--r);
  border: 1px solid var(--border-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 8px rgba(0,0,0,.4);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}
.btn-stone:hover {
  transform: translateY(-1px);
  border-color: var(--iron);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 4px 16px rgba(0,0,0,.5);
}
.btn-stone:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Small variant */
.btn-sm { padding: 8px 18px; font-size: var(--text-sm); }

/* Ghost variant */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.btn-ghost:hover {
  color: var(--ivory);
  border-color: var(--border-2);
  background: rgba(255,255,255,0.04);
}

/* ============================================================
   6. PANELS
   ============================================================ */

.panel {
  background: linear-gradient(160deg, var(--obsidian-2) 0%, var(--obsidian) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
  /* Top inset shine */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    /* Inner vignette */
    inset 0 0 60px rgba(0,0,0,0.2),
    /* Outer drop shadow */
    0 4px 24px rgba(0,0,0,0.5),
    0 1px 4px rgba(0,0,0,0.4);
}

/* Gilt variant — gold hairline top */
.panel.gilt {
  border-top: 1px solid var(--gold-lo);
  box-shadow:
    inset 0 1px 0 rgba(200,155,60,0.3),
    inset 0 0 60px rgba(0,0,0,0.2),
    0 4px 24px rgba(0,0,0,0.5),
    0 1px 4px rgba(0,0,0,0.4);
}

.panel__body {
  padding: var(--sp-6);
}

.panel__header {
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* ============================================================
   7. CREST — heraldic shield
   ============================================================ */

.crest {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Pentagon / heraldic shield shape */
  clip-path: polygon(50% 0%, 100% 22%, 100% 68%, 50% 100%, 0% 68%, 0% 22%);
  background: var(--obsidian-3);
  border: none; /* clip-path clips borders, use outline below */
}
/* Gold ring wrapper for crest */
.crest-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.crest-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  clip-path: polygon(50% 0%, 100% 22%, 100% 68%, 50% 100%, 0% 68%, 0% 22%);
  background: linear-gradient(160deg, var(--gold-hi) 0%, var(--gold-lo) 100%);
  z-index: -1;
}

/* Faction color variants */
.crest--caos    { background: linear-gradient(160deg, #4a1a1a 0%, #2d0f0f 100%); }
.crest--orden   { background: linear-gradient(160deg, #1a2e4a 0%, #0f1d2d 100%); }
.crest--natura  { background: linear-gradient(160deg, #1e3320 0%, #122015 100%); }

/* ============================================================
   8. FACTION CHIPS
   ============================================================ */

.faction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid;
}
.faction-chip--caos {
  color: #e06060;
  background: rgba(143,47,47,.15);
  border-color: rgba(143,47,47,.4);
}
.faction-chip--orden {
  color: #6090d0;
  background: rgba(46,95,155,.15);
  border-color: rgba(46,95,155,.4);
}
.faction-chip--natura {
  color: #7aaa6a;
  background: rgba(86,112,77,.15);
  border-color: rgba(86,112,77,.4);
}

/* Faction dot */
.faction-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.faction-dot--caos   { background: var(--crimson); }
.faction-dot--orden  { background: var(--royal); }
.faction-dot--natura { background: var(--forest); }

/* ============================================================
   9. STAT CHIPS (ELO / USDt / Pot)
   ============================================================ */

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 20px;
  background: var(--obsidian-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  min-width: 100px;
  /* Gold ring visual */
  box-shadow: inset 0 1px 0 rgba(200,155,60,0.1), 0 2px 8px rgba(0,0,0,.3);
}
.stat-chip__value {
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gold-hi);
  letter-spacing: 0.04em;
}
.stat-chip__label {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   10. NAVIGATION (shared top bar)
   ============================================================ */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(27,30,36,.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* Gold accent line */
  box-shadow: inset 0 -1px 0 rgba(200,155,60,0.15), 0 4px 20px rgba(0,0,0,.4);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--container-pad);
  gap: var(--sp-6);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.topbar__logo-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-hi);
  line-height: 1;
}
.topbar__logo-sub {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  margin-top: 2px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar__nav a {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--r);
  transition: color 0.18s, background 0.18s;
}
.topbar__nav a:hover,
.topbar__nav a.active {
  color: var(--ivory);
  background: rgba(255,255,255,0.06);
}
.topbar__nav a.active {
  color: var(--gold-hi);
  background: rgba(200,155,60,0.08);
}

/* Hamburger for mobile — min 44×44px touch target */
.topbar__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 10px 8px;
}
.topbar__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ivory);
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
}

.topbar__account {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: rgba(27,30,36,.98);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-4);
  z-index: 99;
  flex-direction: column;
  gap: var(--sp-1);
  backdrop-filter: blur(12px);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--r);
  transition: color 0.18s, background 0.18s;
}
.mobile-nav a:hover, .mobile-nav a.active {
  color: var(--ivory);
  background: rgba(255,255,255,0.06);
}

/* Page top padding to clear fixed navbar */
.page-body { padding-top: 64px; }

/* ============================================================
   11. SVG ICON SYSTEM (inline — faction + UI sigils)
   ============================================================ */

.icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}
/* Size helpers */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 18px; height: 18px; }
.icon-md { width: 24px; height: 24px; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 48px; height: 48px; }

/* Stroke coloring helpers */
.icon-gold   { color: var(--gold); }
.icon-ivory  { color: var(--ivory); }
.icon-muted  { color: var(--muted); }
.icon-caos   { color: var(--crimson); }
.icon-orden  { color: var(--royal); }
.icon-natura { color: var(--forest); }

/* ============================================================
   12. SECTION DIVIDER (faction triangle ornament)
   ============================================================ */

.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-block: var(--sp-8);
  position: relative;
}
.divider-ornament::before,
.divider-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.divider-ornament__symbol {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ============================================================
   13. STAKES CHIP (entry / prize info)
   ============================================================ */

.stakes-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  background: rgba(200,155,60,.08);
  border: 1px solid rgba(200,155,60,.3);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--gold-hi);
  letter-spacing: 0.04em;
  box-shadow: 0 0 12px rgba(200,155,60,.1);
}

/* ============================================================
   14. RANK BADGE
   ============================================================ */

.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid;
}
.rank-badge--bronze  { color: #cd8555; border-color: #cd855540; background: #cd855515; }
.rank-badge--silver  { color: #a0a8b0; border-color: #a0a8b040; background: #a0a8b015; }
.rank-badge--gold    { color: var(--gold-hi); border-color: rgba(200,155,60,.4); background: rgba(200,155,60,.1); }
.rank-badge--plat    { color: #88d4e0; border-color: #88d4e040; background: #88d4e015; }
.rank-badge--diamond { color: #b088e0; border-color: #b088e040; background: #b088e015; }

/* ============================================================
   15. UNIT CHIP (squad members)
   ============================================================ */

.unit-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-2);
  background: var(--obsidian-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  min-width: 70px;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  cursor: pointer;
}
.unit-chip:hover {
  border-color: var(--gold-lo);
  box-shadow: 0 0 12px rgba(200,155,60,.15);
  transform: translateY(-2px);
}
.unit-chip__portrait {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--obsidian-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-2);
}
.unit-chip__name {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-align: center;
}

/* ============================================================
   16. PROGRESS / PHASE CARDS
   ============================================================ */

.phase-card {
  padding: var(--sp-5) var(--sp-6);
  background: var(--obsidian-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  position: relative;
  overflow: hidden;
}
.phase-card--active {
  border-color: var(--gold-lo);
  box-shadow: inset 0 1px 0 rgba(200,155,60,.2), 0 0 24px rgba(200,155,60,.1);
}
.phase-card--locked {
  opacity: 0.55;
}
.phase-card--complete {
  border-color: rgba(111,174,95,.3);
}
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
}
.phase-badge--active  { background: rgba(200,155,60,.15); color: var(--gold-hi); border: 1px solid rgba(200,155,60,.3); }
.phase-badge--locked  { background: rgba(107,114,123,.15); color: var(--dim); border: 1px solid rgba(107,114,123,.3); }
.phase-badge--complete{ background: rgba(111,174,95,.1);   color: var(--ok); border: 1px solid rgba(111,174,95,.25); }

/* ============================================================
   17. TABLE (leaderboard)
   ============================================================ */

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}
.tbl th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid rgba(58,64,72,.5);
  vertical-align: middle;
  color: var(--text);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }

/* Top 3 gold rows */
.tbl tr.rank-1 td { background: rgba(200,155,60,.07); }
.tbl tr.rank-2 td { background: rgba(200,155,60,.04); }
.tbl tr.rank-3 td { background: rgba(200,155,60,.025); }

/* Your row */
.tbl tr.my-row td {
  background: rgba(200,155,60,.1);
  border-top: 1px solid rgba(200,155,60,.25);
  border-bottom: 1px solid rgba(200,155,60,.25);
}

.rank-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
}
.rank-num.top { color: var(--gold-hi); }

.delta-up   { color: var(--ok);  font-weight: 700; }
.delta-down { color: var(--bad); font-weight: 700; }
.delta-same { color: var(--dim); }

/* ============================================================
   18. FORM ELEMENTS
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.field__label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__input {
  background: var(--obsidian-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 12px 16px;
  color: var(--ivory);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}
.field__input:focus {
  outline: none;
  border-color: var(--gold-lo);
  box-shadow: 0 0 0 3px rgba(200,155,60,.15);
}
.field__hint {
  font-size: var(--text-xs);
  color: var(--dim);
  margin-top: 2px;
}
.field__hint--ok  { color: var(--ok); }
.field__hint--bad { color: var(--bad); }

/* ============================================================
   19. TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}
.tab-btn {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}
.tab-btn:hover { color: var(--ivory); }
.tab-btn.active {
  color: var(--gold-hi);
  border-bottom-color: var(--gold);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   20. MATCH RESULT CHIPS
   ============================================================ */

.result-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
}
.result-chip--v { background: rgba(111,174,95,.2);  color: var(--ok);  border: 1px solid rgba(111,174,95,.3); }
.result-chip--d { background: rgba(192,88,79,.2);   color: var(--bad); border: 1px solid rgba(192,88,79,.3); }
.result-chip--e { background: rgba(154,160,168,.12);color: var(--muted);border: 1px solid rgba(154,160,168,.25); }

/* ============================================================
   21. VS PANEL (online lobby)
   ============================================================ */

.vs-panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--sp-6);
  align-items: center;
}
.vs-sigil {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold-hi);
  text-shadow: 0 0 32px rgba(200,155,60,.5);
  text-align: center;
  position: relative;
}
.vs-sigil::before {
  content: '';
  position: absolute;
  inset: -12px -16px;
  background: radial-gradient(ellipse 80px 60px at center, rgba(200,155,60,.12) 0%, transparent 70%);
  pointer-events: none;
}

/* ============================================================
   22. MATCHMAKING STATE INDICATOR
   ============================================================ */

.mm-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-8);
  border-radius: var(--r);
  border: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
}
.mm-state--searching {
  background: rgba(46,95,155,.07);
  border-color: rgba(46,95,155,.4);
  box-shadow: 0 0 32px rgba(46,95,155,.12);
}
.mm-state--found {
  background: rgba(200,155,60,.07);
  border-color: rgba(200,155,60,.5);
  box-shadow: 0 0 40px rgba(200,155,60,.2);
}
.mm-state--locked {
  background: rgba(111,174,95,.07);
  border-color: rgba(111,174,95,.4);
  box-shadow: 0 0 24px rgba(111,174,95,.12);
}

/* Pulse ring animation (searching state) */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: .6; }
  50%  { transform: scale(1.12); opacity: .2; }
  100% { transform: scale(1);   opacity: .6; }
}
.pulse-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--royal);
  animation: pulse-ring 2s ease-in-out infinite;
}

/* Gold flare animation (found state) */
@keyframes gold-flare {
  0%, 100% { box-shadow: 0 0 20px rgba(200,155,60,.3); }
  50%       { box-shadow: 0 0 60px rgba(200,155,60,.7); }
}
.gold-flare { animation: gold-flare 1.2s ease-in-out infinite; }

/* ============================================================
   23. EMBER PARTICLES (hero section)
   ============================================================ */

@keyframes ember-rise {
  0%   { transform: translateY(0) translateX(0) scale(1); opacity: .8; }
  50%  { transform: translateY(-60px) translateX(10px) scale(.7); opacity: .5; }
  100% { transform: translateY(-120px) translateX(-6px) scale(.3); opacity: 0; }
}

.ember {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold-hi);
  box-shadow: 0 0 6px var(--gold);
  animation: ember-rise var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  pointer-events: none;
}

/* ============================================================
   24. GRID DIAGRAM (determinism section)
   ============================================================ */

/* Legacy 8x8 (kept for reference, unused) */
.grid-diagram {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-width: 260px;
}
.grid-cell {
  aspect-ratio: 1;
  background: var(--obsidian-3);
  border: 1px solid var(--border);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  position: relative;
}
.grid-cell--unit   { background: rgba(46,95,155,.3);  border-color: rgba(46,95,155,.6); }
.grid-cell--move   { background: rgba(200,155,60,.15); border-color: rgba(200,155,60,.4); }
.grid-cell--enemy  { background: rgba(143,47,47,.3);   border-color: rgba(143,47,47,.6); }
.grid-cell--result { background: rgba(111,174,95,.15); border-color: rgba(111,174,95,.4); }
.grid-cell--path   { background: rgba(200,155,60,.06); border-color: rgba(200,155,60,.2); }

/* Premium 6x6 board (Into the Breach telegraphing style) */
.grid-diagram-6 {
  display: inline-block;
  position: relative;
}

.board-6x6 {
  display: grid;
  grid-template-columns: repeat(6, 52px);
  grid-template-rows: repeat(6, 52px);
  gap: 3px;
  background: rgba(27,30,36,.6);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 3px;
  box-shadow:
    0 0 0 1px rgba(200,155,60,.08),
    inset 0 0 32px rgba(0,0,0,.4),
    0 8px 32px rgba(0,0,0,.5);
}

/* Base cell */
.bc {
  width: 52px;
  height: 52px;
  background: var(--obsidian-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: box-shadow 0.15s;
}

/* Unit cell — royal blue, glowing */
.bu {
  background: rgba(46,95,155,.25);
  border-color: rgba(74,130,204,.7);
  box-shadow:
    inset 0 0 12px rgba(46,95,155,.3),
    0 0 8px rgba(74,130,204,.25);
}

/* Move cell — gold, subtle */
.bm {
  background: rgba(200,155,60,.12);
  border-color: rgba(200,155,60,.5);
  box-shadow: inset 0 0 8px rgba(200,155,60,.1);
}
.bm::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(200,155,60,.35);
  border-radius: 2px;
}

/* Result cell — forest green, glowing */
.br {
  background: rgba(111,174,95,.18);
  border-color: rgba(111,174,95,.65);
  box-shadow:
    inset 0 0 12px rgba(111,174,95,.2),
    0 0 10px rgba(111,174,95,.2);
}

/* Enemy cell — crimson, aggressive */
.be {
  background: rgba(143,47,47,.28);
  border-color: rgba(224,96,96,.65);
  box-shadow:
    inset 0 0 12px rgba(143,47,47,.3),
    0 0 8px rgba(143,47,47,.2);
}

/* Telegraph arrow SVG overlay */
.telegraph-arrow {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(6 * 52px + 5 * 3px);
  height: calc(6 * 52px + 5 * 3px);
  pointer-events: none;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  .telegraph-arrow path { animation: none !important; }
}

/* Legend dots — larger to match bigger pieces */
.proof__legend-dot--unit   { width: 14px; height: 14px; border-radius: 3px; background: rgba(46,95,155,.4); border: 2px solid rgba(74,130,204,.7); flex-shrink: 0; }
.proof__legend-dot--move   { width: 14px; height: 14px; border-radius: 3px; background: rgba(200,155,60,.18); border: 2px solid rgba(200,155,60,.55); flex-shrink: 0; }
.proof__legend-dot--result { width: 14px; height: 14px; border-radius: 3px; background: rgba(111,174,95,.22); border: 2px solid rgba(111,174,95,.65); flex-shrink: 0; }
.proof__legend-dot--enemy  { width: 14px; height: 14px; border-radius: 3px; background: rgba(143,47,47,.35); border: 2px solid rgba(224,96,96,.65); flex-shrink: 0; }

/* ============================================================
   25. FACTION PICKER CARDS (profile)
   ============================================================ */

.faction-card {
  padding: var(--sp-5) var(--sp-4);
  background: var(--obsidian-2);
  border: 2px solid var(--border);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: border-color 0.22s, box-shadow 0.22s, background 0.22s, transform 0.22s;
  text-align: center;
}
.faction-card:hover { transform: translateY(-2px); }
.faction-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.faction-card[data-faction="caos"].selected,
.faction-card[data-faction="caos"]:focus-visible {
  border-color: var(--crimson);
  background: rgba(143,47,47,.1);
  box-shadow: 0 0 24px rgba(143,47,47,.25), inset 0 1px 0 rgba(143,47,47,.2);
}
.faction-card[data-faction="orden"].selected,
.faction-card[data-faction="orden"]:focus-visible {
  border-color: var(--royal);
  background: rgba(46,95,155,.1);
  box-shadow: 0 0 24px rgba(46,95,155,.25), inset 0 1px 0 rgba(46,95,155,.2);
}
.faction-card[data-faction="natura"].selected,
.faction-card[data-faction="natura"]:focus-visible {
  border-color: var(--forest);
  background: rgba(86,112,77,.1);
  box-shadow: 0 0 24px rgba(86,112,77,.25), inset 0 1px 0 rgba(86,112,77,.2);
}

.faction-card__name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.faction-card__desc {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: 1.45;
}
.faction-card__triangle {
  font-size: var(--text-xs);
  color: var(--dim);
  font-weight: 600;
}
.faction-selected-badge {
  display: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}
.faction-card.selected .faction-selected-badge { display: inline-block; }
.faction-card[data-faction="caos"].selected  .faction-selected-badge { background: rgba(143,47,47,.2); color: #e06060; }
.faction-card[data-faction="orden"].selected .faction-selected-badge { background: rgba(46,95,155,.2); color: #6090d0; }
.faction-card[data-faction="natura"].selected .faction-selected-badge { background: rgba(86,112,77,.2); color: #7aaa6a; }

/* ============================================================
   26. UTILITY
   ============================================================ */

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.py-4 { padding-block: var(--sp-4); }
.py-6 { padding-block: var(--sp-6); }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.p-6 { padding: var(--sp-6); }
.w-full { width: 100%; }
.hidden { display: none; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

/* Responsive helpers */
@media (max-width: 768px) {
  .topbar__nav   { display: none; }
  .topbar__hamburger { display: flex; }
  .hide-mobile   { display: none !important; }
  .vs-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}
