:root {
  --bg: #090b0e;
  --panel: #12151b;
  --line: #242a33;
  --text: #ece7dc;
  --muted: #8d8a82;
  --gold: #d4a017;
  --gold-2: #f0c75e;
  --red: #c4473a;
  --green: #3fa56a;
  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(212,160,23,.12), transparent 55%),
    radial-gradient(700px 320px at 100% 0%, rgba(196,71,58,.12), transparent 50%),
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
}
.top, .wrap, .foot { position: relative; z-index: 1; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .9rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: rgba(9,11,14,.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: .4rem; text-decoration: none; color: var(--text); }
.brand .mark { font-family: Teko, sans-serif; font-size: 1.7rem; color: var(--gold); letter-spacing: .08em; }
.brand .name { font-family: Teko, sans-serif; font-size: 1.7rem; letter-spacing: .18em; }
.nav { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--gold-2); }
.nav-user { display: inline-flex; align-items: center; gap: .4rem; }
.nav-user img { width: 22px; height: 22px; border-radius: 50%; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); padding: .3rem .55rem; }
.wrap { width: min(1100px, calc(100% - 2rem)); max-width: 100%; min-width: 0; margin: 1.5rem auto 3rem; }
.hero, .page-head, .profile-hero { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.5rem; align-items: flex-start; }
h1, h2 { font-family: Teko, sans-serif; letter-spacing: .04em; margin: 0 0 .4rem; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: .95; }
.kicker { text-transform: uppercase; letter-spacing: .16em; color: var(--gold); font-size: .72rem; margin: 0 0 .4rem; }
.lede { max-width: 38rem; color: #d5d0c5; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.1rem 0 .6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  text-decoration: none; padding: .55rem .9rem; cursor: pointer; font: inherit;
}
.btn.lg { padding: .75rem 1.15rem; font-size: 1.05rem; }
.btn-connect { background: var(--gold); color: #1a1403; border-color: var(--gold); font-weight: 600; }
.btn-connect:hover { background: var(--gold-2); }
.btn.ghost:hover { border-color: var(--gold); color: var(--gold-2); }
.status-card, .panel {
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  min-width: 0;
  max-width: 100%;
}
.status-card { min-width: 260px; }
.status-card .row { display: flex; align-items: center; gap: .5rem; }
.dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--red); }
.status-card.up .dot { background: var(--green); box-shadow: 0 0 12px var(--green); }
.status-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; margin: .8rem 0 0; }
.status-card dt { color: var(--muted); font-size: .78rem; }
.status-card dd { margin: 0; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .7rem; }
.panel-head a, a { color: var(--gold-2); }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: .78rem; font-weight: 500; border-bottom: 1px solid var(--line); padding: .4rem .3rem; }
.table td { border-bottom: 1px solid var(--line); padding: .55rem .3rem; vertical-align: middle; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; gap: .7rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); min-width: 0; }
.rank-list .place { color: var(--gold); width: 2.2rem; flex-shrink: 0; }
.rank-list .score { margin-left: auto; flex-shrink: 0; }
.rank-list a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-label { display: inline-flex; align-items: center; gap: .5rem; vertical-align: middle; white-space: nowrap; }
.rank-badge { height: 32px; width: auto; display: block; flex-shrink: 0; }
.stats em .rank-label { color: inherit; flex-wrap: wrap; white-space: normal; }
.stats .rank-badge { height: 36px; }
.toolbar { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input, select, textarea {
  background: #0d1014; color: var(--text); border: 1px solid var(--line);
  padding: .55rem .7rem; font: inherit; min-width: 220px;
}
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs a { padding: .35rem .65rem; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.tabs a.on { border-color: var(--gold); color: var(--gold); }
.pill { display: inline-block; padding: .1rem .45rem; border: 1px solid var(--line); font-size: .78rem; }
.pill.active { color: var(--red); border-color: var(--red); }
.pill.expired, .pill.removed { color: var(--muted); }
.pill.gold { color: #1a1403; background: var(--gold); border-color: var(--gold); }
.pill.suspect { color: #f0a8a2; border-color: var(--red); }
.suspect-form { max-width: 36rem; margin-top: .8rem; }
.suspect-form textarea { width: 100%; min-height: 5.5rem; resize: vertical; }
.tag { font-size: .72rem; color: var(--muted); margin-left: .3rem; }
.pager { display: flex; gap: .35rem; margin-top: 1rem; flex-wrap: wrap; }
.pager a { padding: .3rem .55rem; border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.pager a.on { border-color: var(--gold); color: var(--gold); }
.form { display: grid; gap: .85rem; }
.form label { display: grid; gap: .35rem; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem;
}
.stats article { background: var(--panel); border: 1px solid var(--line); padding: .9rem; }
.stats span { color: var(--muted); font-size: .78rem; }
.stats strong { display: block; font-size: 1.4rem; font-family: Teko, sans-serif; }
.stats em { font-style: normal; color: var(--gold); font-size: .85rem; }
.profile-hero { align-items: center; }
.avatar { width: 96px; height: 96px; border: 2px solid var(--gold); }
.badge-equipped {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .45rem; color: var(--gold-2); font-size: .9rem;
}
.badge-equipped img { width: 28px; height: 28px; object-fit: contain; }
.badge-ops { display: grid; gap: 1.2rem; }
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .7rem;
}
.badge-card {
  display: grid; justify-items: stretch; gap: .35rem;
  background: #0d1014; color: var(--text); border: 1px solid var(--line);
  padding: .55rem .45rem .45rem;
}
.badge-card > button[name="coin_id"] {
  display: grid; justify-items: center; gap: .35rem; text-align: center;
  background: none; border: 0; color: inherit; padding: .2rem; cursor: pointer; font: inherit;
}
.badge-card img { width: 72px; height: 72px; object-fit: contain; }
.badge-card span { font-size: .82rem; color: var(--muted); }
.badge-card strong { font-family: Teko, sans-serif; font-size: 1.15rem; letter-spacing: .04em; }
.badge-card em { font-style: normal; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.badge-card:hover { border-color: var(--gold); }
button.badge-card { cursor: pointer; font: inherit; text-align: center; justify-items: center; }
.badge-card.owned { border-color: #4a5563; }
.badge-card.on, .badge-card.main { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.badge-remove {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: .75rem; padding: .2rem .4rem; cursor: pointer;
}
.badge-remove:hover { border-color: var(--red); color: var(--red); }
.badge-current { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 1rem; }
.badge-current img { width: 56px; height: 56px; object-fit: contain; }
.badge-collection { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.badge-mini {
  display: inline-flex; width: 40px; height: 40px; border: 1px solid var(--line);
  background: #0d1014; align-items: center; justify-content: center;
}
.badge-mini img { width: 36px; height: 36px; object-fit: contain; }
.badge-mini.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.player-card {
  margin-top: .7rem;
  padding: .7rem .8rem;
  background: #0d1014;
  border: 1px solid var(--line);
  max-width: 28rem;
}
.player-card-primary {
  display: flex; gap: .75rem; align-items: center;
}
.player-card-primary img { width: 72px; height: 72px; object-fit: contain; flex-shrink: 0; }
.player-card-primary em {
  display: block; font-style: normal; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .1em; color: var(--gold);
}
.player-card-primary strong { display: block; font-family: Teko, sans-serif; font-size: 1.35rem; }
.player-card-primary span { color: var(--muted); font-size: .82rem; }
.player-card-others {
  list-style: none; margin: .45rem 0 0; padding: 0;
  display: grid; gap: .35rem;
}
.player-card-others li {
  display: flex; gap: .5rem; align-items: center;
  color: var(--muted); font-size: .9rem;
}
.player-card-others img { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.inline-form { display: inline-block; margin-top: .4rem; }
.badge-slots { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .55rem; }
.badge-slot {
  display: flex; gap: .7rem; align-items: center; flex-wrap: wrap;
  background: #0d1014; border: 1px solid var(--line); padding: .55rem .7rem;
}
.badge-slot.primary { border-color: var(--gold); }
.badge-slot.dragging { opacity: .55; }
.badge-slot-grip { color: var(--muted); cursor: grab; letter-spacing: -.15em; user-select: none; }
.badge-slot img { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.badge-slot-meta { flex: 1; min-width: 10rem; }
.badge-slot-meta strong { display: block; }
.badge-slot-meta span { color: var(--muted); font-size: .85rem; }
.badge-slot-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-left: auto; }
button.badge-card:disabled { opacity: .5; cursor: default; }
.flash { background: #1c2a1d; border: 1px solid var(--green); color: #d7f0de; padding: .7rem 1rem; margin: 0 1rem 1rem; }
.flash.bad { background: #2a1614; border-color: var(--red); color: #f3d2ce; }
.foot { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.4rem; color: var(--muted); border-top: 1px solid var(--line); font-size: .85rem; }
.foot a { color: var(--gold-2); text-decoration: none; }
.foot a:hover { color: var(--gold); }
.discord-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #8ea1ff;
}
.discord-link:hover { color: #c5cdff; }
.discord-ico { width: 16px; height: 16px; flex-shrink: 0; display: block; }
.nav .discord-link { color: #8ea1ff; }
.appeal-actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.admin-inline { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.admin-inline select, .admin-inline input[type="number"] { min-width: 6rem; }
.group-card { margin: 0 0 .4rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.group-delete { margin: 0 0 1rem; }
.flag-grid { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: .6rem 0 .2rem; }
.flag-grid label { display: inline-flex; gap: .35rem; align-items: center; font-size: .85rem; }
.confirm-dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow);
}
.pill.ok { color: var(--green); border-color: var(--green); }
.pill.wait { color: var(--muted); }
.console-screen {
  background: #07080b;
  border: 1px solid var(--line);
  min-height: 22rem;
  max-height: 32rem;
  overflow: auto;
  padding: .8rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85rem;
  line-height: 1.45;
}
.console-line { white-space: pre-wrap; word-break: break-word; }
.console-line.cmd { color: var(--gold-2); }
.console-line.out { color: var(--text); }
.console-line.log { color: var(--muted); }
.console-line.bad { color: #f0a8a2; }
.console-form { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; }
.console-form input[type="hidden"] { display: none; }
.console-prompt { color: var(--gold); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.console-form input#console-command {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.confirm-dialog h2 { margin: .15rem 0 .5rem; font-family: Teko, sans-serif; font-size: 1.6rem; }
.confirm-dialog p { margin: 0 0 .9rem; }
.confirm-dialog .appeal-actions { justify-content: flex-end; }
@media (max-width: 820px) {
  .hero, .page-head, .profile-hero, .grid-2, .stats { grid-template-columns: 1fr; flex-direction: column; }
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; }
  .top.open .nav { display: flex; }
  .top { flex-wrap: wrap; }
  .status-card { min-width: 0; width: 100%; }
  .toolbar input, select, textarea { min-width: 0; width: 100%; }
  .console-form { flex-wrap: wrap; }
  .console-form input#console-command { width: 100%; }
  .foot { flex-wrap: wrap; }
  .panel { padding: .9rem .8rem; }
  .rank-list { min-width: 0; }
  .rank-list a { overflow: hidden; text-overflow: ellipsis; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-slot-actions { margin-left: 0; width: 100%; }
}
