:root {
  --bg: #0a0d13;
  --panel: rgba(22, 28, 40, .72);
  --line: rgba(148, 166, 201, .16);
  --text: #e8edf6;
  --muted: #8fa1bd;
  --green: #3ddc84;
  --cyan: #46c8f5;
  --accent-grad: linear-gradient(120deg, #b6f7cf 0%, #3ddc84 45%, #46c8f5 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 10.5px/1.9 "Press Start 2P", monospace;
  overflow-x: hidden;
}

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.glow-a { width: 640px; height: 640px; top: -240px; left: -160px; background: #123524; animation: drift 16s ease-in-out infinite alternate; }
.glow-b { width: 560px; height: 560px; bottom: -260px; right: -140px; background: #0e2d3f; animation: drift 20s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(70px, 50px) scale(1.15); } }
.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}
.float-block {
  position: absolute; border: 1px solid rgba(61,220,132,.22);
  background: linear-gradient(135deg, rgba(61,220,132,.10), rgba(70,200,245,.06));
  border-radius: 10px; transform: rotate(12deg); animation: float 9s ease-in-out infinite;
}
.b1 { width: 90px; height: 90px; top: 18%; left: 6%; }
.b2 { width: 46px; height: 46px; top: 62%; right: 10%; animation-delay: -3s; border-radius: 8px; }
.b3 { width: 26px; height: 26px; top: 34%; right: 28%; animation-delay: -6s; }
@keyframes float { 0%,100% { transform: rotate(12deg) translateY(0); } 50% { transform: rotate(12deg) translateY(-22px); } }

/* ---------- layout ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; min-height: 100vh; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 0 20px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.cube {
  width: 22px; height: 22px; border-radius: 6px; position: relative;
  background: linear-gradient(135deg, #57c07a, #27875a);
  box-shadow: 0 0 18px rgba(61,220,132,.5);
}
.cube::after {
  content: ""; position: absolute; inset: 4px; border-radius: 3px;
  background: linear-gradient(135deg, #8ce8ae, #3ddc84);
}
.brand-name { font-size: 13px; letter-spacing: .18em; }
.dot { color: var(--green); }
nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  padding: 10px 16px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 10px;
  text-decoration: none; transition: color .18s, border-color .18s, background .18s, transform .12s;
}
.tab:hover { color: var(--text); border-color: rgba(148,166,201,.35); transform: translateY(-1px); }
.tab.active {
  color: var(--green); border-color: rgba(61,220,132,.55); background: rgba(61,220,132,.10);
  box-shadow: 0 0 22px rgba(61,220,132,.12);
}

/* ---------- hero ---------- */
.panel { display: none; padding: 44px 0 40px; flex: 1; }
.panel.active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hero { max-width: 760px; }
.hero-badge { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; border-radius: 999px; font-size: 9.5px;
  background: rgba(61,220,132,.12); color: var(--green); border: 1px solid rgba(61,220,132,.45);
}
.pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 10px currentColor; animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.75); } }
.pill.off { color: #ff8b8b; border-color: rgba(255,139,139,.4); background: rgba(255,139,139,.1); }
.pill.sub { padding: 7px 11px; font-size: 9px; font-weight: 400; color: var(--cyan); border-color: rgba(70,200,245,.35); background: rgba(70,200,245,.08); }
.pill.sub.warn { color: #ff8b8b; border-color: rgba(255,139,139,.35); background: rgba(255,139,139,.08); }
#players { color: var(--muted); font-size: 10px; }
.hero-title {
  font-size: clamp(19px, 3.4vw, 32px);
  line-height: 1.6;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 20px; letter-spacing: .06em;
}
.hero-sub { color: var(--muted); font-size: 10.5px; line-height: 2.1; margin-bottom: 34px; }

.connect-card {
  display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  margin-bottom: 28px;
}
.label {
  font-size: 9px; letter-spacing: .18em; color: var(--muted); margin-bottom: 12px;
}
.addr {
  font-family: "Press Start 2P", monospace;
  font-weight: 400;
  font-size: clamp(15px, 2.4vw, 21px);
  letter-spacing: .05em; color: #fff;
}
.conn-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn-info .pill.sub { margin: 0; }
.btn-copy {
  display: inline-flex; align-items: center; gap: 9px;
  border: 0; border-radius: 12px; padding: 13px 20px; cursor: pointer; font: inherit; font-size: 10.5px;
  color: #06110b; background: linear-gradient(120deg, #7ce7a9, #3ddc84 55%, #35cbd0);
  box-shadow: 0 8px 26px rgba(61,220,132,.35);
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.btn-copy:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(61,220,132,.45); }
.btn-copy:active { transform: translateY(0); }
.btn-copy.copied { filter: saturate(.4) brightness(1.05); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 30px; }
.fact {
  display: flex; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--cyan);
}
.fact div { display: flex; flex-direction: column; line-height: 1.7; }
.fact b { color: var(--text); font-size: 11px; margin-bottom: 4px; }
.fact span { color: var(--muted); font-size: 9px; }

.online-line { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; color: var(--muted); font-size: 10px; }
.name-chip {
  border: 1px solid rgba(61,220,132,.3); background: rgba(61,220,132,.08); color: var(--green);
  padding: 6px 11px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 9px;
}
.name-chip:hover { background: rgba(61,220,132,.16); }

/* ---------- chat ---------- */
.chat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column; height: 62vh;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
#chat-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; background: rgba(8,11,16,.55); }
.msg { max-width: 78%; font-size: 10px; line-height: 1.9; }
.msg .t { color: var(--muted); font-size: 8px; margin-right: 8px; font-style: normal; }
.msg b { color: var(--green); font-weight: 400; margin-right: 6px; }
.msg span { color: #c9d6e6; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine b { color: var(--cyan); }
#chat-bar { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
#chat-nick { width: 150px; }
#chat-input { flex: 1; min-width: 0; }
#chat-bar input {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #0c1015;
  color: var(--text); font: inherit; font-size: 10px; outline: none;
}
#chat-bar input:focus { border-color: rgba(61,220,132,.55); }
#chat-send {
  border: 1px solid rgba(61,220,132,.55); border-radius: 9px; background: rgba(61,220,132,.12);
  color: var(--green); padding: 11px 16px; cursor: pointer; font: inherit; font-size: 10px;
}
#chat-send:hover { background: rgba(61,220,132,.2); }

/* ---------- stats ---------- */
.chart-title { margin-top: 40px; }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; height: 260px; }
.chart-card canvas { max-height: 224px; }
.stat-status { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.stat-status .pill.sub { margin: 0; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0,0,0,.35); overflow-x: auto;
}
.leaderboard { width: 100%; border-collapse: collapse; min-width: 520px; }
.leaderboard th {
  text-align: left; font-size: 8.5px; letter-spacing: .16em;
  color: var(--muted); padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.leaderboard td { padding: 14px 18px; border-bottom: 1px solid rgba(148,166,201,.07); font-size: 10px; }
.leaderboard tbody tr:last-child td { border-bottom: 0; }
.leaderboard tr.clickable { cursor: pointer; }
.leaderboard tr.clickable:hover td { background: rgba(61,220,132,.06) !important; }
.rank { color: var(--green); width: 44px; }
.name { color: var(--text); }
.empty { color: var(--muted); text-align: center; padding: 30px 18px !important; }

.modal { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(5,7,10,.7); align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-card {
  position: relative; width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px 26px 24px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 70px rgba(0,0,0,.5);
}
.modal-card h3 { font-size: 13px; margin-bottom: 18px; }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.modal-stats { display: flex; flex-direction: column; gap: 11px; margin-bottom: 20px; }
.modal-stats div { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: var(--muted); }
.modal-stats b { color: var(--text); font-weight: 400; }
.modal-card .btn-copy { justify-content: center; width: 100%; }

/* ---------- map ---------- */
.map-title { margin-bottom: 20px; }
.map-title h2 { font-size: 14px; margin-bottom: 12px; letter-spacing: .05em; }
.map-title p { color: var(--muted); font-size: 10px; }
.map-player-info {
  background: rgba(61,220,132,.1); border: 1px solid rgba(61,220,132,.4); color: var(--green);
  border-radius: 12px; padding: 12px 16px; font-size: 10px; line-height: 1.9; margin-bottom: 14px;
}
.map-player-info .hint { color: var(--muted); display: block; }
.map-frame {
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  background: var(--panel); box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
#mapframe { width: 100%; height: 66vh; border: 0; display: block; background: #0d1117; }

footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 18px 0 26px; color: var(--muted); font-size: 9px; border-top: 1px solid var(--line);
}

@media (max-width: 640px) {
  .top { flex-direction: column; gap: 16px; }
  .connect-card { flex-direction: column; align-items: stretch; }
  .btn-copy { justify-content: center; }
  .hero-title { font-size: 17px; }
  #chat-nick { width: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  .glow, .float-block, .pill::before { animation: none !important; }
}
