/* Noobserver Status — escena "Dentro del servidor".
   Escena 2.5D con parallax + mouse-look sobre la foto del portal del nether
   y tarjetas de datos flotando en 3D. Sin librerías. */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --glass: rgba(10, 14, 22, 0.62);
  --glass-line: rgba(200, 180, 255, 0.22);
  --text: #eef2f8;
  --text-dim: #a6b2c4;
  --accent: #c8a6ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font); color: var(--text); background: #05070c; overflow: hidden; }

/* ---------- Visor / foto de fondo ------------------------------- */
.viewer {
  position: fixed; inset: 0;
  overflow: hidden;
  perspective: 1600px;
  perspective-origin: 50% 42%;
  background: #05070c;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.viewer img { -webkit-user-drag: none; user-drag: none; }

.hero {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #0a0f18 center / cover no-repeat;
  transform: scale(1.06);
  transform-origin: 50% 50%;
  will-change: transform;
  pointer-events: none;
}

/* Marcador invisible sobre el recuadro del portal. Hijo de .hero, así que
   hereda su transform (zoom/pan). scene.js lo coloca cada frame con
   matemática de "background cover"; sirve de zona de clic y origen de la onda. */
#portal { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }

.haze {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 80% at 50% 45%, transparent 42%, rgba(3, 5, 10, 0.33) 78%, rgba(2, 3, 8, 0.7) 100%),
    linear-gradient(180deg, rgba(4, 6, 12, 0.42) 0%, transparent 22%, transparent 62%, rgba(3, 5, 10, 0.72) 100%);
}

/* ---------- Onda al hacer clic en el portal -------------------- */
.ripples { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.ripple {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid rgba(210, 170, 255, 0.7);
  border-radius: 50%;
  animation: rippleOut 900ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes rippleOut {
  0%   { transform: scale(0.3); opacity: 0.85; }
  100% { transform: scale(11);  opacity: 0; }
}

/* ---------- Brasas del portal (dos planos de profundidad) ----- */
.dust { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; will-change: transform; z-index: 3; }
.dust-layer { position: absolute; inset: 0; will-change: transform; }
.dust-behind { z-index: 0; }
.dust-far    { z-index: 1; }
.mote {
  position: absolute; display: block; border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #ffffff 0%, #e7ccff 30%, #c07bff 60%, #8a2bff 100%);
  box-shadow:
    0 0 10px 2px rgba(200, 140, 255, 0.9),
    0 0 26px 6px rgba(150, 70, 255, 0.5),
    0 0 46px 12px rgba(120, 50, 240, 0.25);
  animation: ember linear infinite;
  mix-blend-mode: screen;
}
.dust-behind .mote {
  box-shadow:
    0 0 6px 1px rgba(190, 140, 255, 0.6),
    0 0 16px 4px rgba(140, 70, 255, 0.28);
}
@keyframes ember {
  0%   { transform: translate3d(0, 0, 0) scale(0.5);                              opacity: 0; }
  10%  { opacity: 1; }
  45%  { transform: translate3d(var(--sway, 16px), calc(var(--rise, -220px) * 0.5), 0) scale(1); opacity: 1; }
  75%  { opacity: 0.6; }
  100% { transform: translate3d(0, var(--rise, -220px), 0) scale(0.45);           opacity: 0; }
}

/* ---------- Estela de partículas del ratón -------------------- */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.spark {
  position: absolute; border-radius: 50%;
  margin-left: -3px; margin-top: -3px;
  background: radial-gradient(circle at 45% 40%, #fff 0%, #d9b3ff 40%, rgba(162, 76, 255, 0) 72%);
  box-shadow: 0 0 10px 2px rgba(200, 140, 255, 0.7);
  animation: sparkfade 0.7s ease-out forwards;
}
@keyframes sparkfade {
  0%   { opacity: 0.95; transform: translate3d(0, 0, 0) scale(1); }
  100% { opacity: 0;    transform: translate3d(var(--dx, 0), var(--dy, 18px), 0) scale(0.25); }
}

/* ---------- Tarjetas ----------------------------------------- */
.scene3d {
  position: absolute; inset: 0; z-index: 5;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}
.scene3d .players-list { pointer-events: auto; }

.plate {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow:
    0 30px 70px -28px rgba(0, 0, 0, 0.8),
    0 0 40px -12px rgba(200, 166, 255, 0.25);
}

.title-plate {
  position: absolute; left: 50%; top: 5%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
}
.icon-wrap {
  width: 52px; height: 52px; border-radius: 12px; flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--glass-line);
  display: grid; place-items: center; overflow: hidden;
}
#server-icon { width: 46px; height: 46px; image-rendering: pixelated; display: block; }
#server-icon:not([src]) { display: none; }
.title-text h1 { font-size: 22px; color: #fff; letter-spacing: 0.5px; }
.title-text p { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); }
.title-status { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; margin-left: 6px; }
.status {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  padding: 5px 12px; border-radius: 999px; border: 1px solid currentColor;
  will-change: transform;
  animation: statusBeat 5s ease-in-out infinite;
}
.status.online { color: #6df0a5; box-shadow: 0 0 20px -4px #6df0a5; }
.status.offline { color: #ff6a86; box-shadow: 0 0 20px -6px #ff6a86; }
@keyframes statusBeat {
  0%, 100% { transform: scale(1);      box-shadow: 0 0 15px -7px currentColor; }
  40%      { transform: scale(1.012);  box-shadow: 0 0 18px -5px currentColor; }
}
.version { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.col {
  position: absolute; top: 11%;
  display: flex; flex-direction: column; gap: 16px;
  max-height: 80vh;
}
.col-left  { left: 3.5%;  width: min(24vw, 300px); transform: rotateY(6deg);  transform-origin: left center; }
.col-right { right: 3.5%; width: min(27vw, 340px); transform: rotateY(-6deg); transform-origin: right center; }

.card { padding: 16px 18px; }
.label { font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 9px; }
.value { font-size: 26px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(200, 166, 255, 0.4); }

.bar { margin-top: 11px; height: 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
#players-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6df0a5, var(--accent));
  box-shadow: 0 0 14px 0 rgba(109, 240, 165, 0.55);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.ping-status-container { position: relative; margin-top: 12px; height: 24px; }
.ping-bar {
  position: absolute; left: 0; right: 0; top: 6px; height: 11px;
  display: flex; border-radius: 999px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.ping-bar-segment { flex: 1; }
.ping-bar-segment.excellent  { background: #39FF14; }  /* verde neón  · ping <= 30 ms */
.ping-bar-segment.good       { background: #00C853; }  /* verde       · 31-60 ms */
.ping-bar-segment.acceptable { background: #F2CC60; }  /* amarillo    · 61-150 ms */
.ping-bar-segment.bad        { background: #DA3633; }  /* rojo        · 151-250 ms */
.ping-bar-segment.terrible   { background: #000000; }  /* negro       · > 250 ms */
.ping-arrow {
  position: absolute; top: -4px; left: 2%;
  transform: translateX(-50%);
  color: #fff; font-size: 14px; text-shadow: 0 0 10px #fff, 0 0 20px var(--accent);
  transition: left 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ping-status-text { margin-top: 8px; font-size: 11px; color: var(--text-dim); }

#motd { font-size: 13px; line-height: 1.55; color: #e4e9f2; white-space: pre-wrap; word-break: break-word; }

.players-card { display: flex; flex-direction: column; min-height: 0; max-height: 78vh; }
.players-card .bar { flex: 0 0 auto; }
.players-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 12px;
  max-height: 58vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.players-list::-webkit-scrollbar { width: 6px; }
.players-list::-webkit-scrollbar-thumb { background: rgba(200, 166, 255, 0.35); border-radius: 6px; }
.players-list .empty { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; padding: 4px 0; }
.player {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 9px; background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
}
.player img { width: 26px; height: 26px; border-radius: 6px; image-rendering: pixelated; background: #10141c; flex: 0 0 auto; }
.player span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.foot {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 7; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(5, 7, 12, 0.5); padding: 6px 14px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#last-update { color: var(--accent); text-transform: none; }
.hint {
  position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%);
  z-index: 7; font-size: 11px; letter-spacing: 0.5px; color: rgba(255, 255, 255, 0.6);
  transition: opacity 0.6s ease; text-align: center;
}
.hint.fade { opacity: 0; }

/* ---------- Móvil / panel estrecho -------------------------- */
@media (max-width: 900px) {
  html, body, .viewer { overflow-y: auto; }
  .viewer { position: relative; min-height: 100vh; perspective: none; }
  .scene3d { position: relative; transform: none !important; display: flex; flex-direction: column; gap: 14px; padding: 90px 14px 90px; }
  .title-plate { position: static; transform: none; margin: 0 auto; }
  .col { position: static; width: 100%; transform: none; }
}
