:root {
  --bg: #e7e8ec;
  --shell: #ffffff;
  --tint: #edf0ea;        /* soft sage panel accent */
  --ink: #16181d;         /* near-black: primary text + buttons */
  --ink-soft: #3c3f47;
  --muted: #8b8e97;
  --line: #ececef;        /* borders / dividers */
  --pill: #f3f4f6;        /* light pill backgrounds */
  --pill-ink: #4b4e57;
  --ok: #37b24d;          /* active / in-transit green */
  --warn: #ef7c3c;        /* picked-up orange */
  --fire: #f0803c;
  --radius: 20px;
  --radius-lg: 28px;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page { max-width: 1080px; margin: 0 auto; padding: 28px 22px 48px; }

.shell {
  background: var(--shell);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 18px 44px rgba(20, 24, 45, .06);
  padding: 22px 26px 26px;
}

/* Header */
.top { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.mark { width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px; background: var(--tint); border-radius: 12px; }
.brand h1 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.tagline { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Tabs */
.tabs { display: flex; background: var(--pill); border-radius: 12px; padding: 4px; }
.tab { background: transparent; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 16px; border-radius: 9px; cursor: pointer; transition: .16s; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; }

/* Inputs */
.guild, .picker { background: var(--shell); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 10px 14px; font: inherit; font-size: 14px; }
.guild { width: 150px; }
.picker { max-width: 190px; cursor: pointer; }
.guild::placeholder { color: var(--muted); }
.guild:focus, .picker:focus { outline: none; border-color: var(--ink); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 12px; cursor: pointer; text-decoration: none; transition: transform .12s, background .16s, filter .16s, border-color .16s; }
.btn:active { transform: scale(.97); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { filter: brightness(1.18); }
.btn-ghost { background: var(--shell); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--pill); }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* Auth chip */
.auth { display: flex; align-items: center; gap: 10px; }
.auth .login { background: var(--ink); color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 12px; white-space: nowrap; transition: filter .16s; }
.auth .login:hover { filter: brightness(1.18); }
.auth .whoami { color: var(--ink); font-weight: 600; font-size: 14px; }
.auth .logout { color: var(--muted); text-decoration: none; font-size: 13px; }
.auth .logout:hover { color: var(--ink); }

.body { padding-top: 22px; }

.card { background: var(--shell); border: 1px solid var(--line); border-radius: var(--radius); }

/* Admin settings panel */
.admin { padding: 24px; margin-bottom: 22px; }
.admin-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.admin-head h2 { font-size: 17px; font-weight: 700; }
.admin-sub { color: var(--muted); font-size: 13px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld.wide { grid-column: 1 / -1; }
.fld > span { font-weight: 600; font-size: 13.5px; }
.fld small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.fld input[type="number"], .fld input[type="text"] { background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; }
.fld input::placeholder { color: var(--muted); }
.fld input:focus { outline: none; border-color: var(--ink); background: var(--shell); }
.fld.toggle { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
.fld.toggle > span { flex: 1; }
.fld.toggle input[type="checkbox"] { width: 42px; height: 24px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: background .18s; }
.fld.toggle input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.fld.toggle input[type="checkbox"]:checked { background: var(--ink); }
.fld.toggle input[type="checkbox"]:checked::after { transform: translateX(18px); }
.fld.toggle small { flex-basis: 100%; }
.admin-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.save-msg { font-size: 14px; font-weight: 600; }
.save-msg.ok { color: var(--ok); }
.save-msg.err { color: #e0483f; }

/* Podium */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; margin-bottom: 22px; }
.pod { background: var(--shell); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 14px; text-align: center; }
.pod .medal { font-size: 26px; }
.pod .name { font-weight: 700; font-size: 15px; margin: 8px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .num { font-family: "JetBrains Mono", monospace; font-size: 26px; font-weight: 700; }
.pod .lbl { color: var(--muted); font-size: 12px; }
.pod.p1 { transform: translateY(-12px); background: var(--tint); border-color: #dfe4d9; }

/* Board */
.board { padding: 8px 22px 14px; }
.board-head { padding: 14px 0 6px; }
.board-head h2 { font-size: 17px; font-weight: 700; }

/* Empty state = centered search (Google-style); loaded = slim top bar */
.board-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; gap: 16px; padding: 20px 0 30px; }
.board-body.loaded { align-items: stretch; justify-content: flex-start; min-height: 0; gap: 0; padding: 4px 0 6px; }

.search { display: flex; gap: 10px; width: 100%; max-width: 440px; }
.search .guild { flex: 1; width: auto; }
.board-body:not(.loaded) .search .guild { padding: 13px 16px; font-size: 15px; border-radius: 14px; }
.board-body:not(.loaded) .search .btn { padding: 13px 22px; border-radius: 14px; }
.board-body.loaded .search { max-width: 360px; margin-bottom: 10px; }
.board-body:not(.loaded) .empty { padding: 0; }
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px; padding: 15px 6px; border-top: 1px solid var(--line); transition: background .14s; animation: rise .32s ease both; }
.row:first-child { border-top: 0; }
.row:hover { background: #f7f8fa; }
.row .rank { font-family: "JetBrains Mono", monospace; color: var(--muted); font-size: 15px; text-align: center; }
.row .who { font-weight: 600; font-size: 14.5px; }
.row .who small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }
.row .streak { font-family: "JetBrains Mono", monospace; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.row .streak span { color: var(--muted); font-size: 13px; font-family: "Inter"; font-weight: 400; }
.row.inactive { opacity: .5; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; color: var(--muted); padding: 44px 0; font-size: 14px; }
.empty code { background: var(--pill); padding: 2px 8px; border-radius: 6px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 26px; }

/* --- Landing page --- */
.landing { max-width: 940px; margin: 0 auto; padding: 26px 22px 60px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 0; }
.nav-links { display: flex; align-items: center; gap: 18px; }
.nav-links a:not(.btn) { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.nav-links a:not(.btn):hover { color: var(--ink); }

.hero { text-align: center; padding: 74px 0 20px; }
.eyebrow { display: inline-block; background: var(--tint); color: var(--ink-soft); font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 999px; margin-bottom: 22px; }
.hero h2 { font-size: 54px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.02; }
.hero-sub { max-width: 560px; margin: 20px auto 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }

.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 64px; text-align: left; }
.feature { background: var(--shell); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature-ico { font-size: 24px; display: block; }
.feature h3 { font-size: 15.5px; font-weight: 700; margin: 12px 0 6px; }
.feature p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.feature code { background: var(--pill); padding: 1px 6px; border-radius: 5px; font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-soft); }

/* --- Admin gate (signed out) --- */
.gate { text-align: center; padding: 56px 28px; }
.gate-ico { font-size: 34px; }
.gate h2 { font-size: 22px; font-weight: 800; margin: 14px 0 8px; }
.gate p { max-width: 440px; margin: 0 auto 24px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

/* --- Server picker --- */
.chooser { padding: 24px; }
.chooser-head { margin-bottom: 18px; }
.chooser-head h2 { font-size: 17px; font-weight: 700; }
.server-list { display: flex; flex-direction: column; gap: 10px; }
.server-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--shell); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; font: inherit; transition: background .14s, border-color .14s, transform .1s; }
.server-item:hover { background: #f7f8fa; border-color: #dcdde1; }
.server-item:active { transform: scale(.995); }
.server-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; background: var(--ink); color: #fff; border-radius: 11px; font-weight: 700; font-size: 17px; }
.server-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.server-name { font-weight: 600; font-size: 15px; color: var(--ink); }
.server-id { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); }
.server-go { color: var(--muted); font-size: 18px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.tag-warn { background: #fdf0e6; color: var(--warn); }

@media (max-width: 760px) {
  .hero h2 { font-size: 40px; }
  .feature-row { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { padding: 18px 16px 20px; }
  .admin-grid { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; gap: 10px; }
  .pod.p1 { transform: none; }
  .controls { width: 100%; }
  .guild { flex: 1; width: auto; }
}
