/* ALWTO — shared styles.
   Palette matches the Tebex store so the two feel like one product. */

:root {
  --bg: #0f1116;
  --surface: #1b1f27;
  --surface-2: #161a21;
  --border: #2b313c;
  --text: #e8eaed;
  --muted: #a8b0bd;
  --dim: #c9d1dc;
  --accent: #ff5f4a;
  --blue: #4fc3fe;
  --gold: #ffc42e;
  --discord: #5865f2;
  --radius: 14px;
  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 17, 22, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 26px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.15rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); font-weight: 600; font-size: .94rem; }
.nav a:hover, .nav a.is-active { color: var(--text); text-decoration: none; }
.nav .cta {
  background: var(--discord); color: #fff; padding: 9px 16px; border-radius: 9px;
}
.nav .cta:hover { background: #4752c4; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 16px; margin: 26px auto 30px; max-width: var(--wrap);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--hero-image);
  background-size: cover; background-position: center;
  filter: brightness(.4);
}
.hero-inner { position: relative; padding: 52px 36px 46px; }
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 900;
  margin: 0 0 14px; letter-spacing: .5px; color: #fff;
}
.hero p { margin: 0 0 10px; max-width: 760px; text-shadow: 0 1px 3px rgba(0,0,0,.65); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 10px; padding: 13px 20px;
  font-size: .95rem; font-weight: 700; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn-ip { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ip .ip { color: var(--blue); }
.btn-ip .hint { color: var(--muted); font-weight: 500; min-width: 46px; text-align: left; }
.btn-discord { background: var(--discord); color: #fff; }
.btn-accent { background: var(--accent); color: #14161b; }
.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* ---------- sections ---------- */
section { padding: 34px 0; }
.section-title { text-align: center; font-size: 2rem; font-weight: 800; margin: 0 0 6px; }
.section-sub { text-align: center; color: var(--muted); margin: 0 0 24px; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; text-align: center;
}
.stat b { display: block; font-size: 1.9rem; font-weight: 800; color: #fff; line-height: 1.15; }
.stat span { color: var(--muted); font-size: .88rem; }

/* ---------- leaderboard ---------- */
.lb-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.seg button {
  background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600;
  padding: 8px 18px; border-radius: 7px; cursor: pointer;
}
.seg button.is-active { background: var(--accent); color: #14161b; }
select.mode-select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer;
  min-width: 190px;
}

.lb-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lb-table th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; padding: 14px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
/* Numeric columns are right-aligned in the body, so their headings have to be
   too - ".lb-table th" outranks a bare ".num", which is what pulled every
   heading away from the figures underneath it. */
.lb-table th.num { text-align: right; }
.lb-table td { padding: 12px 16px; border-bottom: 1px solid rgba(43,49,60,.55); }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-table tbody tr:hover { background: rgba(255,255,255,.025); }
.lb-rank { font-weight: 800; color: var(--muted); width: 68px; }
.lb-rank.top1 { color: #ffd54a; }
.lb-rank.top2 { color: #cfd6e0; }
.lb-rank.top3 { color: #e0955a; }
.lb-player { display: flex; align-items: center; gap: 11px; font-weight: 700; color: #fff; }
.lb-player img { width: 28px; height: 28px; border-radius: 6px; background: var(--surface-2); }
.lb-elo { font-weight: 800; color: var(--blue); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.notice { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- rank cards (store) ---------- */
.ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 16px; }
.rank-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; display: flex; flex-direction: column;
}
.rank-card img.tag { height: 84px; width: 100%; object-fit: contain; object-position: left; margin-bottom: 14px; }
.rank-name { font-size: 1.45rem; font-weight: 800; color: #fff; }
.rank-tagline { font-size: .88rem; color: var(--muted); margin: 3px 0 16px; }
.rank-price { margin-bottom: 16px; }
.rank-price b { font-size: 1.9rem; color: #fff; }
.rank-price span { font-size: .8rem; color: var(--muted); }
.rank-card .btn { justify-content: center; width: 100%; color: #14161b; }
.rank-divider { height: 1px; background: var(--border); margin: 20px 0; }
.rank-label { font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.perks { font-size: .88rem; line-height: 1.95; color: var(--dim); }
.perks i { font-style: normal; font-weight: 800; }
.rank-more { margin-top: auto; padding-top: 14px; }
.rank-more summary { cursor: pointer; font-size: .85rem; }
.rank-more p { font-size: .85rem; line-height: 1.85; color: var(--muted); margin: 12px 0 0; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- info cards ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 16px; }
.info-card b { display: block; margin-bottom: 6px; color: #fff; }
.info-card span { font-size: .9rem; color: var(--muted); }

/* ---------- header search ---------- */
.search { position: relative; flex: 1; max-width: 300px; }
.search input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 9px; padding: 9px 13px; font: inherit; font-size: .92rem;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--blue); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 60;
}
.search-hit {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  color: var(--text); font-weight: 600; font-size: .9rem;
}
.search-hit:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.search-hit img { width: 22px; height: 22px; border-radius: 5px; }
.search-hit .muted { margin-left: auto; font-weight: 500; }
.search-empty { padding: 12px; color: var(--muted); font-size: .9rem; }

/* ---------- load more ---------- */
.btn-more {
  display: block; margin: 18px auto 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.seg-wrap { flex-wrap: wrap; }

/* ---------- player profile ---------- */
.profile-head { display: flex; align-items: center; gap: 20px; padding: 30px 0 14px; }
.profile-avatar { width: 84px; height: 84px; border-radius: 12px; background: var(--surface); }
.profile-name { margin: 0; font-size: 2.1rem; font-weight: 900; color: #fff; line-height: 1.25; }
.profile-head p { margin: 8px 0 0; font-size: .92rem; }
.rank-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rank-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 13px; font-size: .82rem; color: var(--muted); font-weight: 600;
}
.rank-chip b { color: var(--blue); font-weight: 800; }
.rank-chip .muted { font-weight: 500; }
.panel-title { font-size: 1.15rem; font-weight: 800; margin: 26px 0 12px; }
.mode-kind {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.stats-tight { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.stats-tight .stat { padding: 15px 12px; }
.stats-tight .stat b { font-size: 1.45rem; }
.stats-tight .stat b.lb-elo { color: var(--blue); }
.table-scroll { overflow-x: auto; }
.lb-player { color: #fff; }
.lb-player:hover { text-decoration: none; }
.lb-player:hover .lb-name { text-decoration: underline; }

/* ---------- sign-in dialog ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 10, 14, .72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modal-fade .14s ease-out;
}
.modal {
  width: 100%; max-width: 400px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: modal-rise .16s ease-out;
}
.modal-avatar {
  width: 64px; height: 64px; border-radius: 12px;
  background: var(--surface-2); margin-bottom: 14px;
}
.modal-title { margin: 0 0 6px; font-size: 1.3rem; font-weight: 800; color: #fff; }
.modal-sub { margin: 0 0 18px; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.modal-input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 12px 14px;
  font: inherit; font-size: 1rem; font-weight: 600; text-align: center;
}
.modal-input::placeholder { color: var(--muted); font-weight: 500; }
.modal-input:focus { outline: none; border-color: var(--blue); }
.modal-error { margin: 10px 0 0; font-size: .84rem; color: var(--accent); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-cancel { background: var(--surface-2); border-color: var(--border); color: var(--text); }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-back, .modal { animation: none; }
}

/* ---------- account pill ---------- */
.account { position: relative; }
.account-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 6px 13px 6px 7px;
  font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
}
.account-pill:hover { border-color: var(--blue); }
.account-pill.is-out { padding: 7px 15px; color: var(--muted); }
.account-pill.is-out:hover { color: var(--text); }
.account-pill img { width: 20px; height: 20px; border-radius: 5px; }
.account-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 70;
}
.account-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 600;
  padding: 10px 14px; cursor: pointer;
}
.account-menu button:hover { background: rgba(255,255,255,.06); }

/* ---------- in-basket state ----------
   No quantity control: ranks are monthly subscriptions that renew on their own,
   so more than one of the same rank is never what someone means. */
.buy-slot { position: relative; }
.buy-slot.is-pending { opacity: .55; pointer-events: none; }
.in-basket {
  display: flex; align-items: stretch; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
}
.in-basket-label {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 13px 10px; font-size: .95rem; font-weight: 700;
}
.in-basket-remove {
  flex: none; background: none; border: 0; border-left: 1px solid var(--border);
  color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600;
  padding: 0 16px; cursor: pointer;
}
.in-basket-remove:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* ---------- checkout bar ---------- */
.checkout-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(0,0,0,.45);
}
body.has-checkout { padding-bottom: 96px; }
.checkout-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 13px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.checkout-items { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-size: .92rem; }
.checkout-for { color: var(--muted); }
.checkout-for b { color: var(--text); }
.checkout-line {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 11px;
}
.checkout-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.checkout-total { color: var(--muted); white-space: nowrap; }
.checkout-total b { color: #fff; font-size: 1.15rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 44px; padding: 30px 0 44px;
  color: var(--muted); font-size: .86rem; text-align: center;
}
.site-footer .wrap { max-width: 720px; }
.site-footer p { margin: 0 0 8px; line-height: 1.6; }
.footer-lead { color: var(--dim); font-weight: 700; font-size: .92rem; }
.footer-links { display: flex; justify-content: center; gap: 8px 20px; flex-wrap: wrap; margin: 16px 0 14px; }
.footer-links a { color: var(--dim); font-weight: 600; }
.footer-copy { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .84rem; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 10px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Board tables drop their least important columns on narrow screens; the wider
   profile tables scroll inside .table-scroll instead, so nothing is lost. */
@media (max-width: 720px) {
  .nav { gap: 14px; }
  .nav a:not(.cta) { font-size: .88rem; }
  /* Brand + nav on one row, search on its own - sharing a row squeezes the
     input down to a stub you cannot type a name into. */
  .site-header .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 12px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .nav { margin-left: auto; }
  .hero-inner { padding: 34px 22px 30px; }
  .lb-table:not(.wide) th:nth-child(4),
  .lb-table:not(.wide) td:nth-child(4) { display: none; }
  .profile-head { gap: 14px; }
  .profile-avatar { width: 60px; height: 60px; }
  .profile-name { font-size: 1.6rem; }
}
@media (max-width: 520px) {
  .brand span { display: none; }
  .lb-table th, .lb-table td { padding: 10px 9px; font-size: .9rem; }
  .lb-player { gap: 8px; }
  .lb-player img { width: 22px; height: 22px; }
  .lb-rank { width: 46px; }
  /* Games goes before Score does - the score is the whole point of the board. */
  .lb-table:not(.wide) th:nth-child(5),
  .lb-table:not(.wide) td:nth-child(5) { display: none; }
}
