/* ============================================================
   EL HATO DE JUEGOS — tema compartido
   Misma paleta "noche de hato" que Ánimas del Llano (índigo
   profundo + fogón + cuero + lienzo crudo) para que el hub y
   todos los juegos se sientan como un solo lugar. Cada juego
   puede seguir trayendo su propio style.css encima de este.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rye&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --night-950: #070b12;
  --night-900: #0c1220;
  --night-800: #141c2e;
  --night-700: #1e2a40;
  --fire-400: #ffb15c;
  --fire-500: #ff8a3d;
  --fire-700: #c9541a;
  --leather-500: #7a5230;
  --canvas: #e9dcc3;
  --canvas-dim: #c9bb9e;
  --danger-500: #a33b2b;
  --danger-glow: #d9633f;
  --hato-500: #4c7a52;
  --shadow-deep: 0 20px 60px rgba(0,0,0,0.6);

  --font-display: 'Rye', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255,138,61,0.10) 0%, transparent 60%),
    radial-gradient(ellipse at 50% -10%, #16233a 0%, var(--night-950) 55%, #04070c 100%);
  color: var(--canvas);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 400; }

.btn {
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  padding: 12px 20px; border-radius: 12px; border: 1px solid rgba(255,177,92,0.3);
  background: linear-gradient(180deg, var(--fire-500), var(--fire-700));
  color: #1a0f06; cursor: pointer; box-shadow: 0 8px 20px rgba(255,138,61,0.25);
}
.btn.secondary {
  background: rgba(255,255,255,0.05); color: var(--canvas);
  border-color: rgba(233,220,195,0.2); box-shadow: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card {
  background: linear-gradient(180deg, var(--night-800), var(--night-900));
  border: 1px solid rgba(255,177,92,0.14); border-radius: 18px;
  box-shadow: var(--shadow-deep);
}

.profile-bar {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,177,92,0.16);
  border-radius: 16px; padding: 10px 14px;
}
.profile-bar img, .profile-bar .avatar-fallback {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  background: var(--night-700); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); color: var(--fire-400); flex: none;
}
.profile-bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.profile-bar-points { font-family: var(--font-display); color: var(--fire-400); }

.hato-lang-switch { display: flex; gap: 4px; }
.hato-lang-btn {
  border: 1px solid rgba(255,177,92,0.2); background: rgba(255,255,255,0.04);
  border-radius: 8px; padding: 3px 6px; font-size: 0.9rem; line-height: 1; cursor: pointer; opacity: 0.55;
}
.hato-lang-btn.active { opacity: 1; border-color: var(--fire-400); background: rgba(255,177,92,0.16); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; background: rgba(255,177,92,0.12); border: 1px solid rgba(255,177,92,0.25);
  font-size: 0.78rem; color: var(--fire-400);
}

/* ---- Agregar/quitar CPU desde el lobby (pedido explícito de Will —
   poder jugar solo si no hay suficientes jugadores reales) ---- */
.hato-bot-row { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }

/* ---- Salas abiertas (public/shared/openRooms.js) — landing de los 16 juegos ---- */
.hato-open-rooms { margin: 4px 0 16px; text-align: left; }
.hato-open-rooms-title { font-size: 0.78rem; font-weight: 700; color: var(--canvas-dim); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.hato-open-rooms-empty { font-size: 0.85rem; color: var(--canvas-dim); text-align: center; margin: 4px 0 16px; }
.hato-open-rooms-list { display: flex; flex-direction: column; gap: 8px; }
.hato-room-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,177,92,0.16);
}
.hato-room-avatars { display: flex; flex: none; }
.hato-room-avatar { width: 26px; height: 26px; margin-left: -8px; border: 2px solid var(--night-800); border-radius: 50%; flex: none; }
.hato-room-avatar:first-child { margin-left: 0; }
.hato-room-avatar img, .hato-room-avatar-fallback {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: flex;
  align-items: center; justify-content: center; background: var(--night-700);
  font-family: var(--font-display); font-size: 0.7rem; color: var(--fire-400);
}
.hato-room-info { flex: 1; min-width: 0; }
.hato-room-host { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hato-room-count { font-size: 0.72rem; color: var(--canvas-dim); }
.hato-room-join { flex: none; padding: 7px 14px; font-size: 0.8rem; }

/* ---- Aviso de "tu turno" (public/shared/turnNotify.js) — todos los juegos con turno ---- */
.hato-turn-banner {
  position: fixed; top: 14%; left: 50%; z-index: 9999; pointer-events: none;
  transform: translate(-50%, -12px) scale(0.92); opacity: 0;
  font-family: var(--font-display); font-size: 1.5rem; color: var(--canvas, #e9dcc3);
  background: linear-gradient(180deg, rgba(255,177,92,0.96), rgba(255,138,61,0.96));
  padding: 14px 26px; border-radius: 16px; text-align: center; white-space: nowrap;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.hato-turn-banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---- Aviso chico de reconexión (rollout de "reconexión automática de
   socket", ver CLAUDE.md) — no reemplaza la pantalla, solo avisa que es
   la red y no un bug mientras el cliente reintenta unirse solo. Clase
   compartida por los 16 juegos (nació en UNO como `.uno-reconnect-banner`
   con su propio keyframe; acá es genérica para no repetir el CSS en
   cada juego). */
.hato-reconnect-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: rgba(20,10,5,0.92); color: #ffcf7a; border: 1px solid rgba(255,177,92,0.5);
  padding: 8px 18px; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5); animation: hatoReconnectGlow 1.2s ease-in-out infinite;
}
@keyframes hatoReconnectGlow {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 4px 22px rgba(255,177,92,0.55); }
}

/* ---- Chat de voz (public/shared/voiceChat.js) — en los 16 juegos ---- */
.hato-voice-widget { position: fixed; bottom: 16px; right: 16px; z-index: 997; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hato-voice-toggle {
  width: 48px; height: 48px; border-radius: 50%; border: none; flex: none;
  background: linear-gradient(180deg, var(--night-700), var(--night-800)); color: var(--canvas, #e9dcc3);
  font-size: 1.3rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.45); border: 1px solid rgba(255,177,92,0.3);
}
.hato-voice-toggle.live { border-color: var(--fire-400); box-shadow: 0 0 0 3px rgba(255,177,92,0.25), 0 4px 12px rgba(0,0,0,0.45); }
.hato-voice-panel {
  background: var(--night-800); border: 1px solid rgba(255,177,92,0.3); border-radius: 12px;
  padding: 10px; min-width: 190px; max-width: min(260px, calc(100vw - 32px)); box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.hato-voice-peers { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.hato-voice-peer { font-size: 0.78rem; padding: 5px 9px; border-radius: 8px; background: rgba(255,255,255,0.05); color: var(--canvas, #e9dcc3); }
.hato-voice-empty { font-size: 0.72rem; color: var(--canvas-dim); margin: 0 0 8px; }
.hato-voice-mic-btn {
  width: 100%; padding: 9px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--fire-400); color: #1a1410; font-weight: 700; font-family: var(--font-body); font-size: 0.82rem;
}
.hato-voice-note { font-size: 0.65rem; color: var(--canvas-dim); margin: 8px 0 0; line-height: 1.3; }
/* Aviso de navegador embebido (WhatsApp/Instagram/etc.) y error de
   micrófono con causa específica — ver detectInAppBrowser()/
   micErrorMessage() en voiceChat.js. */
.hato-voice-inapp-warning {
  font-size: 0.7rem; line-height: 1.35; color: #ffe8c2; background: rgba(255,177,92,0.14);
  border: 1px solid rgba(255,177,92,0.4); border-radius: 8px; padding: 8px; margin-bottom: 8px;
}
.hato-voice-copy-link {
  display: block; margin-top: 6px; padding: 6px 8px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--fire-400); color: #1a1410; font-weight: 700; font-family: var(--font-body); font-size: 0.7rem;
}
.hato-voice-error {
  font-size: 0.7rem; line-height: 1.35; color: #ffb4b4; background: rgba(220,60,60,0.12);
  border: 1px solid rgba(220,60,60,0.35); border-radius: 8px; padding: 8px; margin: 8px 0 0;
}
