:root {
  --bg-1: #0b1220;
  --bg-2: #101a2e;
  --card: rgba(23, 32, 50, 0.78);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e9eefb;
  --muted: #93a2c0;
  --accent: #66c0f4;
  --online: #57cb5f;
  --offline: #7a8699;
  --error: #e05252;
  --ring: var(--offline);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

html[data-state="online"],
html[data-state="ingame"] {
  --ring: var(--online);
}
html[data-state="error"] {
  --ring: var(--error);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  font-family:
    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(102, 192, 244, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(87, 203, 95, 0.1), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

.card {
  width: 100%;
  max-width: 440px;
  padding: 22px 22px 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: opacity 0.3s ease;
}

.card[data-loading="true"] {
  opacity: 0.75;
}

/* --- Cabecera --- */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ring);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 22%, transparent);
  transition: background 0.3s ease;
}

html[data-state="online"] .brand-dot,
html[data-state="ingame"] .brand-dot {
  animation: pulse 1.8s ease-in-out infinite;
}

/* --- Hero --- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 0 20px;
}

.avatar-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  margin-bottom: 18px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ring);
  background: #1b2838;
  transition: border-color 0.3s ease;
}

.avatar-wrap::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ring) 45%, transparent);
}

html[data-state="online"] .avatar-wrap::after,
html[data-state="ingame"] .avatar-wrap::after {
  animation: halo 1.8s ease-out infinite;
}

.question {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

.name {
  color: var(--text);
  font-weight: 700;
}

.answer {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ring);
  transition: color 0.3s ease;
}

/* --- Tarjeta del juego --- */
.game {
  margin: 6px 0 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.game-banner {
  display: block;
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  background: #1b2838;
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
}

.game-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--online);
}

.game-name {
  font-size: 1.02rem;
  font-weight: 600;
}

/* --- Pie --- */
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.meta-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.profile-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.profile-link:hover {
  text-decoration: underline;
}

/* --- Animaciones --- */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes halo {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ring) 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 16px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-dot,
  .avatar-wrap::after {
    animation: none !important;
  }
}

@media (max-width: 420px) {
  .answer {
    font-size: 1.35rem;
  }
  .meta {
    flex-direction: column;
    align-items: flex-start;
  }
}
