/* ============================================================
 * PANDEMONIUM BOX - Matching Radar Styles
 * Tema oscuro purpura · radar circular animado · mobile-first
 * ============================================================ */

:root {
  --pdm-bg-deep: #08000f;
  --pdm-bg-mid: #120029;
  --pdm-bg-soft: #1c0040;
  --pdm-purple: #8b5cf6;
  --pdm-purple-bright: #a855f7;
  --pdm-purple-glow: rgba(168, 85, 247, 0.45);
  --pdm-accent: #d946ef;
  --pdm-danger: #ef4444;
  --pdm-warn: #f59e0b;
  --pdm-success: #10b981;
  --pdm-text: #e9d5ff;
  --pdm-text-dim: #9d9bbb;
  --pdm-border: rgba(139, 92, 246, 0.25);
  --pdm-radar-size: min(92vmin, 560px);
  --pdm-font: "Inter", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 30%, var(--pdm-bg-mid) 0%, var(--pdm-bg-deep) 70%);
  color: var(--pdm-text);
  font-family: var(--pdm-font);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

.pdm-hidden { display: none !important; }

/* ============================================================
 * HEADER
 * ============================================================ */

.pdm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(28, 0, 64, 0.85), rgba(28, 0, 64, 0));
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.pdm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pdm-logo-glyph {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--pdm-purple), var(--pdm-accent));
  display: grid;
  place-items: center;
  font-weight: 900;
  color: white;
  box-shadow: 0 0 18px var(--pdm-purple-glow);
}

.pdm-logo-text {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--pdm-text);
}

.pdm-status-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--pdm-border);
  color: var(--pdm-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 200ms;
}

.pdm-status-btn:hover { background: rgba(139, 92, 246, 0.24); }

.pdm-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pdm-success);
  box-shadow: 0 0 8px var(--pdm-success);
  animation: pdm-pulse 2s infinite;
}

.pdm-status-btn[data-status="stealth"] .pdm-status-dot {
  background: var(--pdm-text-dim);
  box-shadow: none;
  animation: none;
}

/* ============================================================
 * MODE BAR
 * ============================================================ */

.pdm-mode-bar {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pdm-mode-group {
  display: flex;
  background: rgba(28, 0, 64, 0.6);
  border: 1px solid var(--pdm-border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.pdm-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: transparent;
  border: none;
  color: var(--pdm-text-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 200ms;
}

.pdm-mode-btn:hover { color: var(--pdm-text); }

.pdm-mode-active {
  background: linear-gradient(135deg, var(--pdm-purple), var(--pdm-accent));
  color: white;
  box-shadow: 0 0 18px var(--pdm-purple-glow);
}

.pdm-mode-ico {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 900;
}

.pdm-mode-hint {
  font-size: 11px;
  color: var(--pdm-text-dim);
  text-align: center;
  max-width: 320px;
  letter-spacing: 0.04em;
}

/* ============================================================
 * RADAR STAGE
 * ============================================================ */

.pdm-radar-main {
  padding: 20px 18px 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.pdm-radar-stage {
  position: relative;
  width: var(--pdm-radar-size);
  height: var(--pdm-radar-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.18) 0%, rgba(28, 0, 64, 0.4) 60%, var(--pdm-bg-deep) 100%);
  border: 2px solid var(--pdm-border);
  box-shadow:
    0 0 40px rgba(139, 92, 246, 0.3),
    inset 0 0 60px rgba(139, 92, 246, 0.12);
  overflow: hidden;
}

.pdm-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(139, 92, 246, 0.28);
}

.pdm-ring-1 { width: 25%; height: 25%; }
.pdm-ring-2 { width: 50%; height: 50%; }
.pdm-ring-3 { width: 75%; height: 75%; }
.pdm-ring-4 {
  width: 96%;
  height: 96%;
  border-style: solid;
  border-color: rgba(139, 92, 246, 0.4);
}

.pdm-cross-h, .pdm-cross-v {
  position: absolute;
  background: rgba(139, 92, 246, 0.18);
}

.pdm-cross-h {
  top: 50%;
  left: 2%;
  right: 2%;
  height: 1px;
}

.pdm-cross-v {
  left: 50%;
  top: 2%;
  bottom: 2%;
  width: 1px;
}

/* Barrido animado */
.pdm-sweep {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50%;
  height: 50%;
  transform-origin: 0 0;
  animation: pdm-sweep-rotate 4s linear infinite;
  pointer-events: none;
}

.pdm-sweep-beam {
  width: 100%;
  height: 100%;
  background: conic-gradient(
    from 0deg,
    rgba(168, 85, 247, 0.55) 0deg,
    rgba(168, 85, 247, 0.25) 10deg,
    rgba(168, 85, 247, 0.05) 40deg,
    transparent 80deg,
    transparent 360deg
  );
  border-top-left-radius: 100%;
}

@keyframes pdm-sweep-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Punto central (jugador) */
.pdm-self-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--pdm-purple-bright);
  box-shadow: 0 0 16px var(--pdm-purple-glow);
  z-index: 5;
}

.pdm-self-pulse {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--pdm-purple-bright);
  animation: pdm-ping 1.8s ease-out infinite;
}

@keyframes pdm-ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

@keyframes pdm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Capa de dots */
.pdm-dots-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdm-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  --pdm-rank-color: var(--pdm-purple);
  animation: pdm-dot-appear 380ms ease-out;
}

@keyframes pdm-dot-appear {
  from { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.pdm-dot-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pdm-rank-color);
  box-shadow: 0 0 12px var(--pdm-rank-color);
}

.pdm-dot-ring {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid var(--pdm-rank-color);
  opacity: 0.5;
  animation: pdm-ping 2.4s ease-out infinite;
}

.pdm-dot-meta {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  display: flex;
  gap: 4px;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
}

.pdm-dot-rank, .pdm-dot-level {
  background: rgba(8, 0, 15, 0.85);
  border: 1px solid var(--pdm-border);
  padding: 2px 5px;
  border-radius: 4px;
  font-style: normal;
  color: var(--pdm-text);
}

.pdm-dot-rank {
  color: var(--pdm-rank-color);
}

.pdm-dot-stealth {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.pdm-dot:hover .pdm-dot-core,
.pdm-dot:focus .pdm-dot-core {
  transform: translate(-50%, -50%) scale(1.4);
  transition: transform 180ms;
}

.pdm-ring-label {
  position: absolute;
  font-size: 10px;
  color: var(--pdm-text-dim);
  letter-spacing: 0.1em;
  pointer-events: none;
}

.pdm-label-1 { top: 50%; left: calc(50% + 12%); transform: translateY(-50%); }
.pdm-label-2 { top: 50%; left: calc(50% + 25%); transform: translateY(-50%); }
.pdm-label-3 { top: 50%; left: calc(50% + 37%); transform: translateY(-50%); }
.pdm-label-4 { top: 50%; left: calc(50% + 47%); transform: translate(-100%, -50%); }

/* Stats inferiores */
.pdm-radar-stats {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.pdm-stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  background: rgba(28, 0, 64, 0.6);
  border: 1px solid var(--pdm-border);
  border-radius: 10px;
  min-width: 80px;
}

.pdm-stat-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--pdm-purple-bright);
  text-shadow: 0 0 10px var(--pdm-purple-glow);
}

.pdm-stat-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--pdm-text-dim);
  font-weight: 700;
}

/* ============================================================
 * MODAL
 * ============================================================ */

.pdm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdm-modal-hidden {
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms;
}

.pdm-modal:not(.pdm-modal-hidden) {
  opacity: 1;
}

.pdm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 0, 15, 0.85);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.pdm-modal-panel {
  position: relative;
  width: min(92vw, 420px);
  background: linear-gradient(180deg, var(--pdm-bg-soft), var(--pdm-bg-mid));
  border: 1px solid var(--pdm-border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--pdm-purple-glow);
  animation: pdm-modal-in 280ms ease-out;
}

@keyframes pdm-modal-in {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.pdm-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--pdm-text);
  font-weight: 900;
  cursor: pointer;
}

.pdm-modal-close:hover { background: rgba(255, 255, 255, 0.16); }

.pdm-profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.pdm-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  background: var(--pdm-purple);
  box-shadow: 0 0 20px var(--pdm-purple-glow);
}

.pdm-profile-handle {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pdm-profile-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pdm-tag {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--pdm-text);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pdm-tag-rank { background: linear-gradient(135deg, var(--pdm-purple), var(--pdm-accent)); color: white; }

.pdm-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  background: rgba(8, 0, 15, 0.5);
  border-radius: 12px;
  margin-bottom: 14px;
}

.pdm-pstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.pdm-pstat span {
  font-size: 22px;
  font-weight: 900;
  color: var(--pdm-purple-bright);
}

.pdm-pstat em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--pdm-text-dim);
  font-weight: 700;
}

.pdm-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  min-height: 1px;
}

.pdm-badge {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(217, 70, 239, 0.2);
  color: var(--pdm-accent);
  border: 1px solid rgba(217, 70, 239, 0.4);
  font-weight: 700;
}

.pdm-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdm-btn {
  padding: 14px 18px;
  border-radius: 12px;
  border: none;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: transform 120ms, box-shadow 120ms;
  position: relative;
  overflow: hidden;
}

.pdm-btn:active { transform: scale(0.97); }

.pdm-btn-primary {
  background: linear-gradient(135deg, var(--pdm-purple), var(--pdm-accent));
  color: white;
  box-shadow: 0 8px 24px var(--pdm-purple-glow);
}

.pdm-btn-primary:hover { box-shadow: 0 12px 32px var(--pdm-purple-glow); }

.pdm-btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--pdm-danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.pdm-btn-danger.pdm-longpress-active {
  background: var(--pdm-danger);
  color: white;
}

.pdm-btn-danger.pdm-longpress-active::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
  animation: pdm-longpress-fill 0.8s linear forwards;
}

@keyframes pdm-longpress-fill {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

.pdm-modal-note {
  margin: 14px 0 0;
  font-size: 10px;
  color: var(--pdm-text-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ============================================================
 * TOASTS
 * ============================================================ */

.pdm-toast-zone {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  max-width: 90vw;
}

.pdm-toast {
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--pdm-bg-soft);
  border: 1px solid var(--pdm-border);
  color: var(--pdm-text);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: all 280ms;
  pointer-events: auto;
}

.pdm-toast-visible { transform: translateY(0); opacity: 1; }
.pdm-toast-success { border-color: var(--pdm-success); color: var(--pdm-success); }
.pdm-toast-warn { border-color: var(--pdm-warn); color: var(--pdm-warn); }
.pdm-toast-error { border-color: var(--pdm-danger); color: var(--pdm-danger); }

/* ============================================================
 * BOTTOM NAV
 * ============================================================ */

.pdm-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 10px 0 16px;
  background: rgba(8, 0, 15, 0.95);
  border-top: 1px solid var(--pdm-border);
  backdrop-filter: blur(12px);
  z-index: 30;
}

.pdm-nav-link {
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--pdm-text-dim);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
}

.pdm-nav-active {
  color: var(--pdm-purple-bright);
  background: rgba(139, 92, 246, 0.15);
}

/* ============================================================
 * FREEMIUM BANNER
 * ============================================================ */

.pdm-freemium-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--pdm-warn), var(--pdm-danger));
  color: white;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  z-index: 40;
}

.pdm-freemium-cta {
  background: rgba(0, 0, 0, 0.4);
  color: white;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.15em;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */

@media (max-width: 480px) {
  .pdm-logo-text { display: none; }
  .pdm-radar-stats { gap: 8px; }
  .pdm-stat-block { padding: 8px 12px; min-width: 60px; }
  .pdm-stat-value { font-size: 16px; }
  .pdm-mode-btn { padding: 8px 14px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .pdm-sweep,
  .pdm-self-pulse,
  .pdm-dot-ring,
  .pdm-status-dot,
  .pdm-dot {
    animation: none !important;
  }
}
