/* Public server page — same blocky design language as the panel
   (public/css/style.css): pixel font, 3D block buttons, deepslate texture,
   grass edge, XP bars and the Minecraft material palette. */
:root {
  --bg: #17181b;
  --card: #26282d;
  --accent: #5fb83a;
  --dim: #a1a4ab;
  --text: #eeeeef;

  --grass: #5fb83a;
  --dirt: #7a5230;
  --gold: #f4c542;
  --iron: #d8dadf;
  --copper: #d27d46;
  --diamond: #4fd8cf;
  --redstone: #e04a3f;
  --lapis: #4a7cf0;
  --amethyst: #a879e8;

  --border: color-mix(in srgb, var(--card) 86%, #ffffff 10%);
  --border-strong: color-mix(in srgb, var(--card) 76%, #ffffff 18%);
  --surface-2: color-mix(in srgb, var(--card) 92%, #ffffff 6%);
  --elevated: color-mix(in srgb, var(--bg) 80%, #000000 20%);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-faint: color-mix(in srgb, var(--accent) 8%, transparent);

  --radius: 6px;
  --radius-sm: 4px;
  --block-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --pixel: 'Pixelify Sans', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

/* Faint deepslate texture: 4px "pixels" in slightly varying shades */
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' shape-rendering='crispEdges'%3E%3Cg fill='%23fff'%3E%3Crect x='0' y='0' width='4' height='4' opacity='.018'/%3E%3Crect x='12' y='4' width='4' height='4' opacity='.026'/%3E%3Crect x='24' y='0' width='4' height='4' opacity='.014'/%3E%3Crect x='4' y='12' width='4' height='4' opacity='.022'/%3E%3Crect x='20' y='16' width='4' height='4' opacity='.03'/%3E%3Crect x='8' y='24' width='4' height='4' opacity='.016'/%3E%3Crect x='28' y='24' width='4' height='4' opacity='.024'/%3E%3Crect x='16' y='28' width='4' height='4' opacity='.012'/%3E%3C/g%3E%3Cg fill='%23000'%3E%3Crect x='8' y='4' width='4' height='4' opacity='.12'/%3E%3Crect x='28' y='8' width='4' height='4' opacity='.1'/%3E%3Crect x='16' y='12' width='4' height='4' opacity='.14'/%3E%3Crect x='0' y='20' width='4' height='4' opacity='.1'/%3E%3Crect x='24' y='28' width='4' height='4' opacity='.12'/%3E%3C/g%3E%3C/svg%3E");
  image-rendering: pixelated;
  color: var(--text);
  font: 15px/1.55 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { image-rendering: pixelated; }

.font-pixel { font-family: var(--pixel); letter-spacing: 0.01em; }
.text-gold { color: var(--gold); }
.text-diamond { color: var(--diamond); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ── Top bar with grass edge ─────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.topbar-inner {
  max-width: 920px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar-logo { width: 28px; height: 28px; }
#brand { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grass-edge {
  height: 6px;
  background:
    linear-gradient(90deg, var(--grass) 0 8px, #4e9e2e 8px 16px, var(--grass) 16px 20px, #6cc446 20px 28px, var(--grass) 28px 36px, #4e9e2e 36px 40px) 0 0 / 40px 3px repeat-x,
    linear-gradient(90deg, var(--dirt) 0 6px, #684425 6px 14px, var(--dirt) 14px 22px, #8b6038 22px 26px, var(--dirt) 26px 40px) 0 3px / 40px 3px repeat-x;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 8px 16px 40px; }

/* ── Hero ────────────────────────────────────────────── */
.hero { text-align: center; padding: 28px 0 12px; }
.hero-logo {
  width: 96px; height: 96px;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35));
  animation: bob 3s steps(6) infinite alternate;
}
@keyframes bob { to { transform: translateY(-6px); } }
.motd {
  margin: 14px 0 14px;
  font-size: clamp(28px, 7vw, 46px);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
.meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  border-radius: 3px; border: 2px solid rgba(0, 0, 0, 0.45);
  background: var(--surface-2);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  font-family: var(--pixel); font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 2px; background: var(--dim); }
.dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.dot.starting { background: var(--gold); animation: blink 1s steps(2, start) infinite; }
.dot.offline { background: var(--redstone); }
@keyframes blink { to { opacity: 0.35; } }

/* ── Cards: flat block with a darker "bottom face" ──── */
.card {
  display: block;
  margin-top: 18px; padding: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--block-shadow), inset 0 2px 0 rgba(255, 255, 255, 0.035);
}
.card-hover { transition: transform 0.12s ease, border-color 0.12s ease; }
.card-hover:hover { transform: translateY(-2px); border-color: var(--border-strong); }
h2 { margin: 0 0 14px; font-size: 20px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 18px; }
.grid2 > .card { margin-top: 0; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.inset-box {
  background: var(--elevated);
  border: 2px solid color-mix(in srgb, var(--bg) 70%, #000 30%);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* ── Buttons: Minecraft-style 3D blocks ──────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.22);
  font-family: var(--pixel); font-size: 17px; font-weight: 600; letter-spacing: 0.02em; line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  text-decoration: none; cursor: pointer; user-select: none;
  transition: filter 0.1s ease, transform 0.06s ease, box-shadow 0.06s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.15); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: rgba(0, 0, 0, 0.45); }
.btn-primary.done { background: var(--diamond); color: #06302d; text-shadow: none; }

/* ── Join ────────────────────────────────────────────── */
.address { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.address code {
  flex: 1 1 220px;
  display: flex; align-items: center;
  padding: 12px 16px;
  font: 700 clamp(18px, 4.8vw, 22px)/1.2 var(--mono);
  color: var(--accent);
  user-select: all; overflow-wrap: anywhere;
}
.address .btn { flex: 0 0 auto; }
@media (max-width: 480px) { .address .btn { flex: 1 1 100%; } }
.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; }
.num {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 3px; border: 2px solid rgba(0, 0, 0, 0.5);
  background: var(--dirt); color: #fff;
  box-shadow: inset 0 3px 0 var(--grass), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  font-size: 14px; font-weight: 700; padding-top: 2px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.hint { margin: 12px 0 0; color: var(--dim); font-size: 14px; }

/* ── Online players ──────────────────────────────────── */
.online { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.online li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--elevated);
  border: 2px solid color-mix(in srgb, var(--bg) 70%, #000 30%);
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
}
.online li.empty { padding: 0; background: none; border: 0; font-weight: 400; color: var(--dim); }
.mc-head { image-rendering: pixelated; border-radius: 3px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); background: #3a3d44; }

/* ── Map card ────────────────────────────────────────── */
.map-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  color: var(--text); text-decoration: none;
  background: linear-gradient(160deg, color-mix(in srgb, var(--lapis) 18%, transparent), transparent 65%), var(--card);
}
.map-card p { margin: 0 0 12px; color: var(--dim); }
.map-card .btn { align-self: flex-start; margin-top: auto; }

/* ── Leaderboard ─────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 8px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--elevated);
  border: 2px solid color-mix(in srgb, var(--bg) 70%, #000 30%);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35);
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border: 2px solid transparent; border-radius: var(--radius-sm);
  background: none; color: var(--dim);
  font-family: var(--pixel); font-size: 15px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; cursor: pointer;
}
.tab-btn:hover { color: var(--text); background: var(--accent-faint); }
.tab-btn.active {
  color: var(--text); background: var(--surface-2);
  border-color: rgba(0, 0, 0, 0.45); box-shadow: inset 0 -3px 0 var(--cat, var(--accent));
}

.board { list-style: none; margin: 0; padding: 0; }
.board li {
  display: grid; grid-template-columns: 30px 40px minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 10px 2px;
  border-top: 2px solid color-mix(in srgb, var(--card) 80%, #000 20%);
}
.board li:first-child { border-top: 0; }
.board li.empty { display: block; color: var(--dim); }
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  font-family: var(--pixel); font-size: 16px; font-weight: 700; color: var(--dim);
}
.r1 .rank, .r2 .rank, .r3 .rank {
  border-radius: 3px; border: 2px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}
.r1 .rank { background: var(--gold); color: #3a2a00; }
.r2 .rank { background: var(--iron); color: #2b2d31; }
.r3 .rank { background: var(--copper); color: #3a1c08; }
.board .mc-head { width: 40px; height: 40px; }
.who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.val { font-family: var(--pixel); font-size: 17px; font-weight: 600; white-space: nowrap; }

/* XP-bar progress with notches */
.xp {
  position: relative; height: 10px; margin-top: 6px;
  background: #0d0e10; border: 2px solid #000; border-radius: 2px; overflow: hidden;
}
.xp::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, 0.55) calc(10% - 2px) 10%);
}
.xp span {
  display: block; height: 100%;
  background: var(--cat, var(--accent));
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 0.6s steps(12);
}

.foot { margin-top: 26px; text-align: center; color: var(--dim); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
