:root {
  --ink: #12121c;
  --cream: #f5f3ff;
  --panel: #1b1b2b;
  --panel-2: #222236;
  --line: #34344a;
  --blue: #7ecbf5;
  --blue-dim: #4fa8d8;
  --yellow: #ffcc55;
  --yellow-dim: #f0b32e;
  --pink: #f0a0e0;
  --pink-dim: #dd7fd0;
  --red: #ff6b6b;
  --mono: 'Space Mono', monospace;
  --sans: 'Archivo Variable', system-ui, sans-serif;
  --display: 'Fredoka', 'Archivo Variable', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--cream); font-family: var(--sans); }
body { min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.ticker { background: var(--yellow); color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; padding: 6px 0; overflow: hidden; white-space: nowrap; }
.ticker span { padding-right: 48px; }

header.top { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(18,18,28,0.9); backdrop-filter: blur(8px); z-index: 20; }
header.top .bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; }
header.top .brand { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; color: var(--cream); }
header.top .brand b { color: var(--yellow); }
header.top nav { display: flex; gap: 22px; font-family: var(--mono); font-size: 13px; }
header.top nav a { color: var(--cream); opacity: 0.75; }
header.top nav a:hover { opacity: 1; color: var(--blue); }

.hero {
  padding: 76px 0 52px; text-align: center; position: relative;
  background-image: radial-gradient(rgba(126,203,245,0.18) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
}
.hero .tag { display: inline-block; font-family: var(--mono); font-size: 12px; color: var(--yellow); border: 1.5px solid var(--yellow-dim); padding: 5px 14px; border-radius: 999px; margin-bottom: 22px; background: rgba(255,204,85,0.08); }
.hero h1 { font-family: var(--display); font-size: clamp(36px, 6.5vw, 68px); line-height: 1.05; margin: 0 0 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--blue); text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.hero h1 em { color: var(--yellow); font-style: normal; }
.hero p.lede { max-width: 620px; margin: 0 auto 32px; font-size: 17px; opacity: 0.82; line-height: 1.55; }
.cta-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  font-family: var(--display); font-weight: 600; font-size: 15px; padding: 14px 26px; border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.25); cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25); transition: transform 0.08s, box-shadow 0.08s; color: var(--ink);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
.btn.primary { background: var(--yellow); }
.btn.primary:hover { background: #ffd877; }
.btn.ghost { background: var(--blue); }
.btn.ghost:hover { background: #95d6ff; }
.btn.pink { background: var(--pink); }
.btn.pink:hover { background: #f6b6ea; }
.btn.small { padding: 10px 16px; font-size: 13px; box-shadow: 0 3px 0 rgba(0,0,0,0.25); }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 44px auto 0; max-width: 680px; }
.stats-row .cell { background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; padding: 20px 10px; text-align: center; }
.stats-row .num { font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--yellow); }
.stats-row .label { font-size: 11px; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

section { padding: 64px 0; border-top: 1px solid var(--line); }
section h2 { font-family: var(--display); font-size: 30px; margin: 0 0 8px; font-weight: 700; color: var(--cream); }
section .sub { opacity: 0.65; margin: 0 0 28px; max-width: 560px; }

.map-frame { border: 1.5px solid var(--line); border-radius: 20px; overflow: hidden; margin-bottom: 18px; box-shadow: 0 0 0 4px rgba(126,203,245,0.08); }
#map-canvas { display: block; width: 100%; height: 320px; cursor: grab; }
#map-canvas:active { cursor: grabbing; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row input[type=text] { flex: 1; min-width: 180px; background: var(--panel); border: 1.5px solid var(--line); color: var(--cream); font-family: var(--sans); font-size: 13px; padding: 9px 14px; border-radius: 999px; }
.filter-row input[type=text]:focus { outline: none; border-color: var(--blue-dim); }
.filter-row select { background: var(--panel); border: 1.5px solid var(--line); color: var(--cream); font-family: var(--sans); font-size: 13px; padding: 9px 14px; border-radius: 999px; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: 0.8; white-space: nowrap; }
.check-label input { accent-color: var(--yellow); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.map-grid-empty { font-family: var(--mono); font-size: 13px; opacity: 0.5; padding: 20px 0; }
.node-card { background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.node-card:hover { border-color: var(--blue-dim); transform: translateY(-2px); }
.node-card .dot-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex-shrink: 0; }
.dot.online { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.node-card .name { font-weight: 700; font-size: 14px; }
.node-card .meta { font-family: var(--mono); font-size: 11px; opacity: 0.6; margin-top: 4px; }
.map-empty { font-family: var(--mono); font-size: 13px; opacity: 0.55; padding: 30px 0; }

.board { display: flex; flex-direction: column; gap: 6px; }
.board .row { display: grid; grid-template-columns: 36px 1fr 100px 90px; gap: 10px; align-items: center; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 16px; font-size: 13px; }
.board .row .rank { font-family: var(--display); color: var(--yellow); font-weight: 700; }
.board .row .uptime { font-family: var(--mono); font-size: 12px; opacity: 0.75; text-align: right; }
.board .head { background: transparent; border: none; font-family: var(--mono); font-size: 11px; opacity: 0.5; text-transform: uppercase; padding: 0 16px; }

.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.guide-card { background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; padding: 22px; }
.guide-card .step { font-family: var(--display); color: var(--pink); font-size: 12px; margin-bottom: 8px; font-weight: 600; }
.guide-card h3 { font-family: var(--display); font-size: 17px; margin: 0 0 8px; font-weight: 600; }
.guide-card p { font-size: 13px; opacity: 0.75; line-height: 1.5; margin: 0; }
.guide-card code { background: var(--panel-2); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.server-card { background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; padding: 18px; cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.server-card:hover { border-color: var(--pink-dim); transform: translateY(-2px); }
.server-card .s-name { font-family: var(--display); font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.server-card .s-topic { font-size: 12px; opacity: 0.65; margin-bottom: 10px; min-height: 16px; }
.server-card .s-members { font-family: var(--mono); font-size: 11px; color: var(--yellow); display: flex; align-items: center; gap: 6px; }
.server-card .s-members .dot { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.field-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; margin-bottom: 5px; }
.modal-backdrop input[type=text] { width: 100%; background: var(--panel-2); border: 1.5px solid var(--line); color: var(--cream); font-family: var(--sans); font-size: 13px; padding: 10px 12px; border-radius: 12px; }
.modal-backdrop input[type=text]:focus { outline: none; border-color: var(--blue-dim); }
.chat-modal .head { justify-content: space-between; }
.chat-modal .sub-t { font-family: var(--mono); font-size: 11px; opacity: 0.55; margin-top: 2px; }
.switch-row { display: flex; gap: 8px; padding: 10px 20px; overflow-x: auto; border-bottom: 1.5px solid var(--line); }
.switch-row:empty { display: none; }
.switch-chip { flex-shrink: 0; font-family: var(--mono); font-size: 11px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); border: 1.5px solid var(--line); cursor: pointer; white-space: nowrap; color: var(--cream); opacity: 0.8; }
.switch-chip:hover { border-color: var(--blue-dim); opacity: 1; }
.switch-chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 6px var(--yellow); margin-right: 6px; }

.safety { background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; padding: 20px 24px; font-size: 13px; opacity: 0.85; line-height: 1.6; }
.safety b { color: var(--yellow); }

footer { border-top: 1px solid var(--line); padding: 30px 0; text-align: center; font-family: var(--mono); font-size: 12px; opacity: 0.5; }

/* Chat modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8,8,16,0.65); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-backdrop.open { display: flex; }
.chat-modal { background: var(--panel); border: 1.5px solid var(--line); border-radius: 22px; width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.chat-modal .head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1.5px solid var(--line); }
.chat-modal .head .t { font-family: var(--display); font-weight: 600; font-size: 15px; }
.chat-modal .head .close { cursor: pointer; opacity: 0.6; font-family: var(--mono); background: none; border: none; color: var(--cream); font-size: 18px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.msg { max-width: 85%; padding: 9px 14px; border-radius: 16px; font-size: 13px; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--blue); color: var(--ink); }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1.5px solid var(--line); }
.msg.sys { align-self: center; font-family: var(--mono); font-size: 11px; opacity: 0.5; }
.chat-input-row { display: flex; gap: 8px; padding: 14px; border-top: 1.5px solid var(--line); }
.chat-input-row input { flex: 1; background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 16px; color: var(--cream); font-family: var(--sans); font-size: 13px; }
.chat-input-row input:focus { outline: none; border-color: var(--blue-dim); }

@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
  .board .row { grid-template-columns: 28px 1fr 70px; }
  .board .row .messages { display: none; }
}
