:root {
  --bg-primary: #0b0f17;
  --bg-secondary: #131a26;
  --bg-card: #1a2333;
  --bg-elevated: #222e42;
  --border: #2c3b55;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-green: #10b981;
  --accent-green-bright: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-gold: #eab308;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.45;
  min-height: 100vh;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
}

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

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Badges y Etiquetas */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-live { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.45); }
.badge-green { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.45); }
.badge-amber { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45); }
.badge-blue { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.45); }
.badge-muted { background: rgba(100, 116, 139, 0.22); color: #cbd5e1; border: 1px solid rgba(100, 116, 139, 0.4); }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 1.3s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

@keyframes flashHighlight {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.75); }
  70% { box-shadow: 0 0 0 18px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.flash-online {
  animation: flashHighlight 0.9s ease-out;
}

/* Barra superior compartida Desktop */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-pill {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.nav-pill:hover, .nav-pill.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: var(--accent-cyan);
}

/* Contenedores y Tarjetas */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
  color: #fff;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent-blue); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }

.btn-green { background: var(--accent-green); color: #052e16; }
.btn-green:hover:not(:disabled) { filter: brightness(1.1); }

.btn-amber { background: var(--accent-amber); color: #1f1300; }
.btn-amber:hover:not(:disabled) { filter: brightness(1.08); }

.btn-red { background: var(--accent-red); }
.btn-red:hover:not(:disabled) { filter: brightness(1.12); }

.btn-ghost {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent-cyan); }

/* Inputs y Formularios */
.input, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}
.label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 600;
}

/* Tablas */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.5);
}

/* Video Container */
.video-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #04070c;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.video-box video, .video-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-hud-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  gap: 8px;
}
.video-hud-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

/* =========================================================================
   ESTILOS ESPECÍFICOS APP CELULAR (/bidder) — MOBILE FIRST
   ========================================================================= */
body.mobile-body {
  background: #070b12;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

.mobile-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-left: 1px solid rgba(44, 59, 85, 0.35);
  border-right: 1px solid rgba(44, 59, 85, 0.35);
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 15, 23, 0.94);
  backdrop-filter: blur(10px);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-content {
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.bid-hero-card {
  background: linear-gradient(160deg, #162032 0%, #101725 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.bid-hero-card.is-leading {
  border-color: var(--accent-green);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.18) 0%, #101725 100%);
}

.bid-hero-card.phase-warning {
  border-color: var(--accent-amber);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.25);
}

.bid-hero-card.phase-danger {
  border-color: var(--accent-red);
  box-shadow: 0 0 26px rgba(239, 68, 68, 0.35);
}

.btn-bid-giant {
  width: 100%;
  padding: 18px 16px;
  border-radius: 14px;
  border: none;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #032212;
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.32);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn-bid-giant:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-bid-giant:disabled {
  background: #273244;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  background: rgba(15, 22, 34, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 40;
}

.mobile-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.mobile-tab-btn.active {
  color: var(--accent-green-bright);
}

.mobile-tab-btn span.icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* Modal Móvil / Enlace de Paleta */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(6px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 440px);
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid var(--accent-cyan);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.toast.error { border-color: var(--accent-red); background: #3b1219; }
.toast.success { border-color: var(--accent-green); background: #0c2e21; }

/* Monitor del Martillero (Spotter) */
.spotter-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  transition: background-color 0.2s ease;
}
.spotter-screen.online-flash {
  background-color: #064e3b !important;
}

/* Overlay transparente OBS / vMix */
body.obs-overlay {
  background: transparent !important;
}
