@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0a10;
  --surface: #13121a;
  --border: #252430;
  --text: #e8e8ec;
  --muted: #666672;
  --accent: #7c6af7;
  --accent-hover: #9585ff;
  --danger: #ff5f5f;
  --success: #6bcb77;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: page-in 0.35s ease both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* GRAIN */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* HEADER */
header {
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(124,106,247,0.08);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e8e8ec 0%, #b0a8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 16px; }

.live-count {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-count span { color: var(--success); font-weight: 600; }

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s ease;
  animation: pulse-dot 2.2s ease-in-out infinite;
}
.live-dot.fetching { background: #555; animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(107,203,119,0.5); }
  50%       { opacity: 0.6; box-shadow: 0 0 0 4px rgba(107,203,119,0); }
}

/* WALL */
#wall {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 110px);
  background:
    radial-gradient(circle, rgba(255,255,255,0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px, 100% 100%;
  box-shadow: inset 0 0 120px rgba(0,0,0,0.5);
}

/* AMBIENT GLOW BLOBS */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.glow-1 {
  width: 45%; height: 45%;
  left: 5%; top: 5%;
  background: rgba(124,106,247,0.13);
  animation: drift-1 20s ease-in-out infinite alternate;
}

.glow-2 {
  width: 38%; height: 38%;
  right: 5%; bottom: 8%;
  background: rgba(255,107,107,0.09);
  animation: drift-2 26s ease-in-out infinite alternate;
}

.glow-3 {
  width: 32%; height: 32%;
  right: 18%; top: 8%;
  background: rgba(77,150,255,0.08);
  animation: drift-3 22s ease-in-out infinite alternate;
}

@keyframes drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(8%, 12%) scale(1.1); }
}
@keyframes drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10%, -8%) scale(0.92); }
}
@keyframes drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-6%, 10%) scale(1.08); }
}

#canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.empty-inner {
  text-align: center;
  animation: empty-pulse 3s ease-in-out infinite;
}

.empty-inner p {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 8px;
}

.empty-arrow {
  color: var(--accent);
  font-size: 1.5rem;
  display: block;
  animation: arrow-bounce 1.5s ease-in-out infinite;
}

@keyframes arrow-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%       { transform: translateY(-8px); opacity: 1; }
}

@keyframes empty-pulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}

/* NAME TAGS */
.name-tag {
  position: absolute;
  white-space: nowrap;
  cursor: default;
  animation: fadein 0.5s ease both;
  transition: opacity 0.5s ease, transform 0.15s ease, filter 0.15s ease;
  user-select: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transform: rotate(var(--rot, 0deg));
  transform-origin: center center;
}

.name-tag:hover {
  transform: rotate(var(--rot, 0deg)) scale(1.2);
  filter: brightness(1.4);
  z-index: 10 !important;
}

.name-label { pointer-events: none; }

.name-tag.free  { color: #6e6e84; z-index: 1; }
.name-tag.paid  { font-weight: 600; z-index: 3; }
.name-tag.expiring { opacity: 0.25; }

/* Paid name glow pulse */
.name-tag.paid .name-label {
  animation: paid-glow-pulse 2.8s ease-in-out infinite;
}

@keyframes paid-glow-pulse {
  0%, 100% { text-shadow: 0 0 16px var(--nc, #ff6b6b)99, 0 0 32px var(--nc, #ff6b6b)44; }
  50%       { text-shadow: 0 0 28px var(--nc, #ff6b6b)cc, 0 0 56px var(--nc, #ff6b6b)66; }
}

/* Fresh name ring */
.name-tag.fresh::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  animation: ring-expand 1.8s ease-out forwards;
  pointer-events: none;
}

@keyframes ring-expand {
  0%   { transform: scale(0.7); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Permalink highlight */
.name-tag.highlighted .name-label {
  animation: pulse-glow 1.2s ease 4;
}
@keyframes pulse-glow {
  0%, 100% { text-shadow: none; }
  50%       { text-shadow: 0 0 16px #fff, 0 0 32px var(--accent); }
}

@keyframes fadein {
  from { opacity: 0; transform: rotate(var(--rot,0deg)) scale(0.6); }
  to   { opacity: 1; transform: rotate(var(--rot,0deg)) scale(1); }
}

/* REPORT BUTTON */
.report-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.name-tag:hover .report-btn { opacity: 1; }
.report-btn:hover { color: var(--danger); }

/* TOOLTIP */
.tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
}
.tooltip.hidden { display: none; }

/* JOIN TOAST */
.join-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 999;
  animation: toast-in 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  max-width: 240px;
}
.join-toast.fade-out {
  animation: toast-out 0.4s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); transform: scale(1.03); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-upgrade {
  background: linear-gradient(135deg, #f6a623, #f06595);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-upgrade:hover { opacity: 0.9; transform: scale(1.02); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: #555; }

.btn-share-x {
  flex: 1;
  background: #000;
  color: #fff;
  border: 1px solid #333;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-share-x:hover { background: #111; }

.btn-copy {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-copy:hover { border-color: #555; }

.share-row { display: flex; gap: 8px; margin-bottom: 16px; }
.full { width: 100%; }

/* MODAL */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(6px);
  padding: 16px;
}
#modal-overlay.hidden { display: none; }

#modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: modal-in 0.22s ease;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
}

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

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

#modal h2 { font-size: 1.3rem; margin-bottom: 6px; }
.modal-sub { color: var(--muted); font-size: 0.88rem; margin-bottom: 20px; }

#name-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,106,247,0.15);
}
#name-input::placeholder { color: var(--muted); }

.error { color: var(--danger); font-size: 0.82rem; margin-bottom: 10px; }
.error.hidden { display: none; }

.success-icon { font-size: 2.5rem; margin-bottom: 12px; }

.upgrade-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin: 0 0 12px;
  text-align: left;
}
.upgrade-box p { font-size: 0.95rem; margin-bottom: 4px; }
.upgrade-price { font-size: 1.4rem !important; font-weight: 700; color: #f6a623; margin: 8px 0 12px !important; }
.upgrade-perks { list-style: none; margin-bottom: 16px; }
.upgrade-perks li { font-size: 0.85rem; color: var(--muted); margin-bottom: 5px; }

/* SUCCESS BANNER */
.success-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #000;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
  animation: fadein 0.4s ease;
  white-space: nowrap;
}

/* LEGAL PAGES */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
  line-height: 1.7;
}
.legal-page h1 { font-size: 1.6rem; margin-bottom: 6px; }
.legal-page .legal-date { color: var(--muted); font-size: 0.85rem; margin-bottom: 40px; }
.legal-page h2 { font-size: 1.05rem; font-weight: 600; margin: 32px 0 10px; color: var(--text); }
.legal-page p, .legal-page li { font-size: 0.92rem; color: #b0b0bc; margin-bottom: 10px; }
.legal-page ul { padding-left: 20px; margin-bottom: 10px; }
.legal-page a { color: var(--accent); text-decoration: none; }
.legal-page a:hover { text-decoration: underline; }
.legal-back { display: inline-block; color: var(--muted); font-size: 0.85rem; margin-bottom: 32px; text-decoration: none; }
.legal-back:hover { color: var(--text); }

/* ADMIN PAGE */
.admin-page { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.admin-page h1 { font-size: 1.4rem; margin-bottom: 24px; }
.admin-auth { max-width: 360px; }
.admin-auth p { color: var(--muted); font-size: 0.88rem; margin-bottom: 16px; }
.admin-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.admin-search {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  flex: 1;
  min-width: 200px;
}
.admin-search:focus { border-color: var(--accent); }
.admin-search::placeholder { color: var(--muted); }
.names-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.names-table th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.names-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.names-table tr:hover td { background: var(--surface); }
.badge-paid { background: linear-gradient(135deg,#f6a623,#f06595); color: #000; font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.badge-free { background: #2a2a35; color: var(--muted); font-size: 0.72rem; padding: 2px 7px; border-radius: 4px; }
.reports-badge { color: var(--danger); font-weight: 600; }
.btn-delete { background: none; border: 1px solid #3a2020; color: var(--danger); padding: 4px 12px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; transition: background 0.15s; }
.btn-delete:hover { background: #2a1010; }

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }

/* RESPONSIVE */
@media (max-width: 600px) {
  .tagline { display: none; }
  .live-count { display: none; }
  header { padding: 12px 16px; }
  #modal { padding: 24px; border-radius: 12px; }
  .success-banner { font-size: 0.82rem; padding: 8px 14px; white-space: normal; text-align: center; width: 90%; }
  .names-table th:nth-child(3), .names-table td:nth-child(3) { display: none; }
  .join-toast { right: 12px; bottom: 12px; }
}
