/* ============================================================
   base.css · sistema visual común · torneo.emprendimiento.vip
   No editar desde las páginas. Tokens + componentes compartidos.
   ============================================================ */

@font-face {
  font-family: "Bebas Neue";
  src: url("fonts/bebas-neue.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #080b0a;
  --bg-elev: #0c1110;
  --surface: #131917;
  --surface-2: #18211d;
  --surface-3: #1e2924;
  --line: rgba(243, 245, 239, 0.11);
  --line-strong: rgba(243, 245, 239, 0.22);
  --text: #f3f5ef;
  --muted: #98a29b;
  --faint: #6b756e;
  --lime: #cbff3f;
  --lime-soft: rgba(203, 255, 63, 0.14);
  --lime-ink: #0a0f04;
  --orange: #ff6a3d;
  --danger: #ff5c5c;
  --danger-soft: rgba(255, 92, 92, 0.12);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --font-display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 50% -220px, rgba(203, 255, 63, 0.075), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

::selection { background: var(--lime); color: var(--lime-ink); }

h1, h2, h3, h4, p, figure { margin: 0; }

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 6px;
}

[hidden] { display: none !important; }

/* ---------- Tipografía ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.015em;
  line-height: 0.86;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nums { font-variant-numeric: tabular-nums; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout ---------- */

.container {
  width: min(1180px, 100% - 40px);
  margin-inline: auto;
}
@media (max-width: 640px) {
  .container { width: min(1180px, 100% - 28px); }
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.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;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Botones ---------- */

.btn {
  --btn-h: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 160ms var(--ease), border-color 160ms var(--ease),
    color 160ms var(--ease), transform 160ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: rgba(243, 245, 239, 0.06); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

.btn--primary {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}
.btn--primary:hover { background: #d7ff6d; border-color: #d7ff6d; }

.btn--ghost { border-color: transparent; color: var(--muted); }
.btn--ghost:hover { color: var(--text); background: rgba(243, 245, 239, 0.06); }

.btn--danger { border-color: rgba(255, 92, 92, 0.4); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }

.btn--sm { --btn-h: 38px; padding: 0 14px; font-size: 13px; }
.btn--lg { --btn-h: 54px; padding: 0 28px; font-size: 15px; }
.btn--block { width: 100%; }

.btn--icon {
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
}
.btn--icon svg { width: 19px; height: 19px; }

/* ---------- Pills / badges ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(243, 245, 239, 0.04);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pill--live { color: var(--lime); border-color: rgba(203, 255, 63, 0.35); background: var(--lime-soft); }
.pill--done { color: var(--text); }
.pill--draft { color: var(--muted); }
.pill--danger { color: var(--danger); border-color: rgba(255, 92, 92, 0.35); background: var(--danger-soft); }

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0 rgba(203, 255, 63, 0.5);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(203, 255, 63, 0.45); }
  60% { box-shadow: 0 0 0 7px rgba(203, 255, 63, 0); }
  100% { box-shadow: 0 0 0 0 rgba(203, 255, 63, 0); }
}

/* ---------- Tarjetas / superficies ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
@media (max-width: 640px) {
  .panel { padding: 18px; border-radius: var(--radius); }
}

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Formularios ---------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { font-size: 12px; color: var(--faint); }
.error-text { font-size: 13px; color: var(--danger); }

.input,
.textarea,
.select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 15px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(203, 255, 63, 0.14);
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.45; }
.input--lg { min-height: 58px; font-size: 20px; font-weight: 600; }
.input--pin {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
}
.segmented button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.segmented button[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
}
.segmented--block { display: flex; width: 100%; }
.segmented--block button { flex: 1 1 0; }

/* ---------- Avatar ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.avatar--lime {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}

/* ---------- Tabs ---------- */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.tabs [role="tab"] {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}
.tabs [role="tab"][aria-selected="true"] {
  background: var(--surface-3);
  color: var(--text);
}

/* ---------- Tabla ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.table th {
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background 120ms var(--ease); }
.table tbody tr:hover { background: rgba(243, 245, 239, 0.025); }
.table .is-me { color: var(--lime); }

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 4, 0.72);
  backdrop-filter: blur(4px);
  animation: fade 160ms var(--ease);
}
.modal__panel {
  position: relative;
  width: min(520px, 100%);
  max-height: min(90vh, 760px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 200ms var(--ease);
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal__title { font-family: var(--font-display); font-size: 30px; line-height: 0.95; text-transform: uppercase; }
.modal__close {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.modal__close:hover { color: var(--text); background: rgba(243, 245, 239, 0.06); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 640px) {
  .modal { padding: 0; align-items: end; }
  .modal__panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: sheet 220ms var(--ease);
  }
  @keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
}

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  animation: toast-in 200ms var(--ease);
}
.toast svg { width: 16px; height: 16px; }
.toast--error { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Estados ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 54px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}
.empty__icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--lime);
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(243, 245, 239, 0.25);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scrollbars ---------- */

.hscroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.hscroll::-webkit-scrollbar { height: 8px; }
.hscroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }
.hscroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Utilidades ---------- */

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.full { width: 100%; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Movimiento reducido ---------- */

@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;
  }
}
