*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--background);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--padding);
  padding: 16px 12px;
  background: var(--elevation1);
  border-right: var(--border) solid var(--elevation2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--corner);
  background: var(--blue);
  color: var(--background);
  font-size: 20px;
}
.brand-title { font-weight: 800; font-size: var(--text-medium); line-height: 1.05; }
.brand-sub { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--corner);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 16px;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--elevation2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--blue); color: var(--text); }
.nav-item .icon { font-size: 18px; }

.sidebar-footer { margin-top: auto; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--frame-corner);
  background: var(--elevation2);
}
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .role { color: var(--blue); font-size: 13px; font-weight: 700; }

.main { min-width: 0; padding: 28px 32px 64px; }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: var(--text-larger); font-weight: 800; letter-spacing: -0.01em; }
.page-subtitle { margin: 2px 0 0; color: var(--text-muted); }

.topbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--elevation1);
    border-bottom: var(--border) solid var(--elevation2);
    position: sticky;
    top: 0;
    z-index: 20;
    overflow-x: auto;
  }
  .topbar .brand { padding: 0; }
  .topbar .nav { flex-direction: row; }
  .main { padding: 18px 16px 48px; }
}

/* ---------- Primitives ---------- */

.frame {
  background: var(--elevation1);
  border: var(--border) solid var(--elevation2);
  border-radius: var(--frame-corner);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--corner);
  background: var(--elevation3);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, transform 0.06s;
}
.btn:hover { background: var(--elevation4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: rgb(100, 175, 245); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--elevation2); color: var(--text); }
.btn-icon { width: 36px; padding: 0; }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--text-small); }
.btn-sm.btn-icon { width: 28px; }

.input {
  height: 36px;
  width: 100%;
  padding: 0 12px;
  border: var(--border) solid var(--elevation3);
  border-radius: var(--corner);
  background: var(--elevation2);
  transition: border-color 0.12s;
}
.input:hover { border-color: var(--elevation4); }
.input:focus { outline: none; border-color: var(--blue); }
.input::placeholder { color: var(--text-faint); }
input[type="date"].input { min-width: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  height: 36px;
  border-radius: var(--corner);
  background: var(--elevation2);
}
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.page > .segmented { align-self: flex-start; }
.segmented button {
  flex: none;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
}
.segmented button:hover:not(:disabled) { color: var(--text); }
.segmented button.active { background: var(--blue); color: var(--text); }
.segmented button:disabled { opacity: 0.4; cursor: not-allowed; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-gold { background: var(--gold-soft); color: var(--gold); }
.pill-muted { background: var(--elevation3); color: var(--text-muted); }

.avatar {
  --hue: 210;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: hsl(var(--hue) 22% 26%);
  object-fit: cover;
}
.avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.avatar > img.loaded { opacity: 1; }
.avatar-initial { color: hsl(var(--hue) 45% 78%); font-size: 13px; font-weight: 800; line-height: 1; }
.avatar-lg .avatar-initial { font-size: 24px; }
.avatar-lg { width: 56px; height: 56px; border-radius: var(--frame-corner); }

.mono { font-family: var(--mono); font-size: 0.86em; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 16px;
  color: var(--text-muted);
  text-align: center;
}
.empty .icon { font-size: 32px; color: var(--elevation5); }
.empty strong { color: var(--text); font-size: var(--text-medium); }

.skeleton {
  border-radius: var(--frame-corner);
  background: linear-gradient(90deg, var(--elevation1) 0%, var(--elevation2) 50%, var(--elevation1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  padding: 10px 16px;
  border-radius: var(--corner);
  background: var(--elevation3);
  border: var(--border) solid var(--elevation4);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.18s ease-out;
}
.toast-error { border-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Player search ---------- */

.player-search { position: relative; }
.player-search .input { padding-left: 36px; }
.player-search > .icon { position: absolute; left: 12px; top: 10px; color: var(--text-faint); font-size: 16px; pointer-events: none; }
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 4px;
  background: var(--elevation2);
  border: var(--border) solid var(--elevation3);
  border-radius: var(--frame-corner);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--corner);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover, .dropdown-item.highlighted { background: var(--elevation3); }
.dropdown-empty { padding: 10px; color: var(--text-muted); }

/* ---------- Filters ---------- */

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px; }
.filters .grow { flex: 1 1 260px; }
.filters .full { flex: 1 1 100%; }
.filters .date { width: 150px; }

/* ---------- Player header + stats ---------- */

.player-header { display: flex; align-items: center; gap: 14px; padding: 14px; }
.player-header .names { min-width: 0; flex: 1; }
.player-header .display { font-size: var(--text-large); font-weight: 800; line-height: 1.1; }
.player-header .actions { display: flex; gap: 6px; }
@media (max-width: 560px) {
  .player-header { flex-wrap: wrap; }
  .player-header .actions { width: 100%; }
  .player-row { grid-template-columns: minmax(0, 1fr) repeat(3, 24px) 88px; padding-left: 10px; padding-right: 10px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 12px 14px; }
.stat-label { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.stat-value { font-size: var(--text-larger); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.wlbar { display: flex; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; background: var(--elevation3); }
.wlbar > span:nth-child(1) { background: var(--green); }
.wlbar > span:nth-child(2) { background: var(--elevation5); }
.wlbar > span:nth-child(3) { background: var(--red); }

/* ---------- Match cards ---------- */

.match-list { display: flex; flex-direction: column; gap: 12px; }

.match { overflow: hidden; }
.match-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--elevation2);
}
.match-score { font-size: var(--text-large); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.match-score .win { color: var(--green); }
.match-meta { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--text-muted); font-size: var(--text-small); }
.match-meta time { color: var(--text); font-weight: 600; }

.match.result-victory { border-color: rgba(80, 240, 80, 0.35); }
.match.result-defeat { border-color: rgba(240, 80, 80, 0.35); }

.teams { display: grid; grid-template-columns: 1fr 1fr; }
.team + .team { border-left: var(--border) solid var(--elevation2); }
@media (max-width: 760px) {
  .teams { grid-template-columns: 1fr; }
  .team + .team { border-left: 0; border-top: var(--border) solid var(--elevation2); }
}

.team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 4px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.team-head .winner { color: var(--green); }
.team.won { box-shadow: inset 0 3px 0 rgba(80, 240, 80, 0.45); }
.player-row.cols .winner { display: inline-flex; align-items: center; gap: 4px; color: var(--green); }

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, 30px) 104px;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-variant-numeric: tabular-nums;
}
.player-row.cols { padding-top: 8px; padding-bottom: 2px; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.player-row .num { text-align: right; }
.player-row .wl { text-align: right; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.player-row.target { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }

.player-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.player-cell .avatar { width: 28px; height: 28px; }
.player-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.player-name button {
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-name button:hover { color: var(--blue); }
.player-name .username { color: var(--text-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { display: inline-flex; gap: 4px; flex: none; }
.badge-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 12px; }
.badge-mvp { background: var(--gold-soft); color: var(--gold); }
.badge-left { background: var(--red-soft); color: var(--red); }
.streak { color: var(--orange); font-weight: 700; }

.load-more { display: flex; justify-content: center; padding: 8px; }

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}
.login-card { width: min(420px, 100%); padding: 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-card .brand-mark { width: 56px; height: 56px; font-size: 30px; border-radius: 14px; }
.login-card h1 { margin: 4px 0 0; font-size: var(--text-larger); font-weight: 800; }
.login-card p { margin: 0; color: var(--text-muted); }
.login-card code { padding: 2px 8px; border-radius: 6px; background: var(--elevation3); color: var(--blue); font-weight: 700; }

/* ---------- Sections ---------- */

.page-actions { display: flex; gap: 8px; }
.section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; font-size: var(--text-medium); font-weight: 800; }
.section-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.profile-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }

.quiet {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--frame-corner);
  border: var(--border) dashed var(--elevation3);
  color: var(--text-muted);
}
.hidden-note { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: var(--text-small); font-weight: 600; }

.skeleton.inline { display: inline-block; width: 70px; height: 26px; vertical-align: middle; border-radius: 6px; }

/* ---------- Players ---------- */

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
}
.player-chip:hover { text-decoration: none; }
.player-chip:hover strong { color: var(--blue); }
.player-chip .avatar { width: 28px; height: 28px; }
.player-chip.small .avatar { width: 22px; height: 22px; }
.player-chip strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.selected-player { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 8px; border-radius: 999px; background: var(--elevation3); }
.with-filter { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-muted); font-size: var(--text-small); }

.player-header .actions { flex-wrap: wrap; justify-content: flex-end; }
.discord-ids { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-muted); font-size: var(--text-small); }
.chip-button {
  padding: 1px 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(88, 101, 242, 0.18);
  color: rgb(160, 170, 255);
  cursor: pointer;
}
.chip-button:hover { background: rgba(88, 101, 242, 0.3); }

/* ---------- Moderation ---------- */

.mod-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mod-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--elevation1);
  border: var(--border) solid var(--elevation2);
  border-radius: var(--frame-corner);
}
.mod-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: var(--text-small); }
.pill.cap { text-transform: capitalize; }
.mod-meta { margin-left: auto; color: var(--text-muted); }
.mod-meta .staff { color: var(--text); font-weight: 700; }
.log-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}
.log-content.expanded { display: block; }

/* ---------- Tables (joins) ---------- */

.table { overflow: hidden; }
.table-row {
  display: grid;
  grid-template-columns: 110px 90px minmax(0, 1fr) 90px;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  font-variant-numeric: tabular-nums;
}
.table-row.with-player { grid-template-columns: minmax(0, 1.2fr) 110px 90px minmax(0, 1fr) 90px; }
.table-row + .table-row, .table-body > .table-row:first-child { border-top: 1px solid var(--elevation2); }
.table-head { background: var(--elevation2); color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.table-row .num { text-align: right; }
.table-row .device { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.table-row time { font-weight: 600; margin-right: 8px; }
.table-row .abs { font-size: 13px; }
.table.compact .abs { display: none; }
@media (max-width: 760px) {
  .table-row, .table-row.with-player { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .table-head { display: none; }
  .table-row .abs { display: none; }
}

/* ---------- Trades ---------- */

.trade-head { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--elevation2); }
.trade-body { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.trade-side { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; min-width: 0; }
.trade-gave { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.trade-arrow { display: grid; place-items: center; padding: 0 4px; color: var(--blue); font-size: 20px; }
@media (max-width: 640px) {
  .trade-body { grid-template-columns: minmax(0, 1fr); }
  .trade-arrow { padding: 0; transform: rotate(90deg); }
}

.sword-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sword-item { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sword-name { color: var(--text); font-weight: 700; text-transform: capitalize; }
.sword-name:hover { color: var(--blue); }
.sword-name .serial, .display .serial { color: var(--blue); font-variant-numeric: tabular-nums; }

.sword-lookup { display: flex; gap: 8px; }
.sword-lookup .input { flex: 1; min-width: 0; }

.sword-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px; }
.sword-header .display { font-size: var(--text-large); font-weight: 800; text-transform: capitalize; }
.sword-header .actions { display: flex; align-items: center; gap: 8px; }

.choices { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; }
.choice { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 6px 0; border-top: 1px solid var(--elevation2); }

.chain { list-style: none; margin: 0; padding: 16px 14px 4px; }
.chain-step { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.chain-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--elevation3);
}
.chain-dot { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--elevation5); box-shadow: 0 0 0 3px var(--elevation1); }
.chain-dot.blue { background: var(--blue); }
.chain-dot.green { background: var(--green); }
.chain-dot.red { background: var(--red); }
.chain-content { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chain-title { display: flex; align-items: baseline; gap: 10px; font-weight: 800; }
.chain-title time { color: var(--text-muted); font-weight: 600; font-size: var(--text-small); }
.chain-transfer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text-faint); }

/* ---------- Nav groups ---------- */

.nav-group { margin: 14px 12px 4px; color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar .nav-group { display: none; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.select { appearance: none; padding-right: 32px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.history-filter { max-width: 280px; }

/* ---------- Swords ---------- */

.sword-label { font-weight: 700; }
.sword-img { width: 72px; height: 72px; object-fit: contain; }
.sword-img.missing { visibility: hidden; }
.sword-title { display: flex; align-items: center; gap: 12px; }
.sword-title .sword-img { width: 56px; height: 56px; }

.sword-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sword-tile {
  --rarity: var(--elevation4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 10px 10px;
  text-align: center;
  color: var(--text);
  border-color: color-mix(in srgb, var(--rarity) 45%, var(--elevation2));
  background: linear-gradient(180deg, color-mix(in srgb, var(--rarity) 14%, var(--elevation1)) 0%, var(--elevation1) 70%);
  transition: transform 0.1s, border-color 0.1s;
}
.sword-tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--rarity); }
.sword-tile.removed { opacity: 0.55; }
.sword-tile-name { margin-top: 4px; line-height: 1.15; }
.sword-tile .serial { color: var(--blue); font-weight: 700; font-variant-numeric: tabular-nums; }
.sword-tile-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; color: var(--text-faint); font-size: 12px; }
.sword-tile-meta time { color: var(--text-faint); }
.sword-tile .pill { margin-top: 4px; }

.rarity-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rarity-chip {
  --rarity: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: var(--border) solid var(--elevation3);
  border-radius: 999px;
  background: var(--elevation2);
  color: var(--rarity);
  font-weight: 700;
  cursor: pointer;
}
.rarity-chip:hover { border-color: var(--rarity); }
.rarity-chip.active { background: color-mix(in srgb, var(--rarity) 22%, var(--elevation2)); border-color: var(--rarity); }
.rarity-chip .count { color: var(--text-muted); font-weight: 600; font-size: 13px; }

/* ---------- Purchases ---------- */

.purchase-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 140px 100px; }
.purchase-row .product { display: flex; align-items: center; gap: 8px; min-width: 0; }
.purchase-row .product strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.purchase-row .gift { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: var(--text-small); }
.robux { font-weight: 700; color: var(--green); }

/* ---------- Staff activity & leave ---------- */

.staff-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.staff-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.staff-tags .pill, .staff-cell > .pill { font-size: 12px; padding: 1px 7px; align-self: flex-start; }

.activity-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 70px minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 0.7fr) 90px; }
.activity-row.on-leave { opacity: 0.6; }

.req { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-variant-numeric: tabular-nums; }
.req-text { font-weight: 700; white-space: nowrap; }
.req-bar { height: 6px; border-radius: 3px; background: var(--elevation3); overflow: hidden; }
.req-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--blue); }
.req.met .req-bar > span { background: var(--green); }
.req.not-required { color: var(--text-muted); font-size: 13px; }
.req.not-required .req-text { font-weight: 600; }
.allowance.low .req-bar > span { background: var(--gold); }
.allowance.out .req-bar > span { background: var(--red); }

.leave-row { grid-template-columns: minmax(0, 1.4fr) 110px minmax(0, 1fr) 80px 120px 80px; }

.leave-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.leave-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-color: rgba(239, 184, 56, 0.35); }
.leave-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.leave-reason { font-size: 16px; }
.leave-meta { color: var(--text-muted); font-size: var(--text-small); }
.leave-meta time, .leave-meta strong { color: var(--text); font-weight: 700; }
.extension-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--gold); font-size: var(--text-small); font-weight: 600; }

@media (max-width: 860px) {
  .activity-row, .leave-row, .purchase-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 8px; }
  .activity-row .num, .leave-row .num, .purchase-row .num { text-align: left; }
}
.table-row > .pill, .table-row > .num > .pill { justify-self: start; }

/* ---------- Player status, account, game data ---------- */

.status-box:empty { display: none; }
.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--frame-corner);
  border: var(--border) solid;
}
.status-banner > .icon { font-size: 22px; margin-top: 1px; }
.status-banner.danger { background: var(--red-soft); border-color: rgba(240, 80, 80, 0.5); }
.status-banner.danger > .icon, .status-banner.danger strong:first-child { color: var(--red); }
.status-banner.warn { background: var(--gold-soft); border-color: rgba(239, 184, 56, 0.45); }
.status-banner.warn > .icon, .status-banner.warn strong:first-child { color: var(--gold); }
.status-banner .btn { margin-left: auto; }
.status-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.status-text > strong { font-size: 16px; }
.status-meta { color: var(--text-muted); font-size: var(--text-small); }
.status-meta strong { color: var(--text); }
.status-clear { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 700; font-size: var(--text-small); }

.discord-account { display: inline-flex; align-items: center; gap: 6px; }
.avatar.tiny { width: 18px; height: 18px; }
.person-plain { font-weight: 700; }

.stats.compact { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.stats.compact .stat-value { font-size: var(--text-large); }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; padding: 12px 14px; background: var(--elevation1); border: var(--border) solid var(--elevation2); border-radius: var(--frame-corner); }
.kv dt { color: var(--text-faint); font-size: 13px; font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.raw { border: var(--border) solid var(--elevation2); border-radius: var(--frame-corner); padding: 10px 12px; }
.raw summary { cursor: pointer; font-weight: 700; color: var(--text-muted); }
.raw[open] summary { margin-bottom: 8px; }
.raw pre { max-height: 360px; overflow: auto; margin: 8px 0 0; padding: 10px; border-radius: var(--corner); background: var(--background); font-family: var(--mono); font-size: 12px; }

/* ---------- Badge chart ---------- */

.chart-frame { padding: 10px 6px 4px; }
.badge-chart { display: block; width: 100%; height: auto; }
.badge-chart .bar { fill: var(--blue); opacity: 0.85; }
.badge-chart .bar:hover { opacity: 1; }
.badge-chart .cumulative { fill: none; stroke: var(--gold); stroke-width: 2; }
.badge-chart .baseline { stroke: var(--elevation4); }
.badge-chart .axis { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.badge-chart .line-label { fill: var(--gold); }
.badge-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; color: var(--text-muted); }
.badge-summary strong { color: var(--text); }
.badge-summary .legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch.bar { background: var(--blue); }
.swatch.line { height: 3px; background: var(--gold); margin-left: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--elevation4); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.quiet .btn { margin-left: auto; }

/* ---------- Appeals ---------- */

.appeal.status-pending { border-color: rgba(239, 184, 56, 0.35); }
.appeal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 14px; background: var(--elevation2); }
.appeal-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.ban-reason { display: flex; align-items: center; gap: 6px; color: var(--red); font-weight: 700; }
.appeal-message { color: var(--text); line-height: 1.45; }
.appeal-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.votes { display: flex; flex-direction: column; gap: 4px; min-width: 220px; flex: 1; max-width: 360px; }
.vote-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--elevation3); }
.vote-bar .vote-accept { background: var(--green); }
.vote-bar .vote-decline { background: var(--red); }
.vote-bar .vote-blacklist { background: rgb(150, 30, 30); }
.vote-bar .vote-delete { background: var(--elevation5); }
.vote-counts { display: flex; gap: 10px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.vote-counts .accept { color: var(--green); }
.vote-counts .decline { color: var(--red); }
.my-vote { color: var(--text-muted); font-size: var(--text-small); }
.my-vote strong { color: var(--blue); }
.voters { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--elevation2); }
.voter { display: flex; align-items: center; gap: 10px; }
.voter .pill { min-width: 74px; justify-content: center; }
.vote-pill-accept { background: var(--green-soft); color: var(--green); }
.vote-pill-decline, .vote-pill-blacklist { background: var(--red-soft); color: var(--red); }
.vote-pill-delete, .vote-pill-cancel { background: var(--elevation3); color: var(--text-muted); }

/* ---------- Moderation & command logs ---------- */

.blacklist-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 0.8fr) 110px; }
.mod-head .staff { color: var(--text); font-weight: 700; }
.mod-head a.staff:hover { color: var(--blue); }

@media (max-width: 860px) {
  .blacklist-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 6px; }
}

/* ---------- Command logs ---------- */

.link-button { padding: 0; border: 0; background: none; color: var(--blue); font-weight: 700; font-size: 13px; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

.cmd-filters { align-items: flex-end; }
.date-pair { display: flex; align-items: center; gap: 6px; }
.date-pair .input { width: 150px; }

.facets { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; }
.facet { display: flex; flex-direction: column; gap: 6px; }
.facet-head { display: flex; align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: var(--border) solid var(--elevation3);
  border-radius: 999px;
  background: var(--elevation2);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.chip:hover { border-color: var(--elevation5); }
.chip.active { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.chip .count { color: var(--text-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.active .count { color: var(--blue); opacity: 0.8; }
.chip.more { color: var(--text-muted); border-style: dashed; }

.cmd-summary { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.cmd-summary strong { color: var(--text); }

.cmd-table { overflow: hidden; font-size: 14px; }
.cmd-day {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 12px;
  background: var(--elevation2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cmd-row {
  display: grid;
  grid-template-columns: 52px 170px 110px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 3px 12px;
  border-top: 1px solid var(--elevation2);
  cursor: pointer;
}
.cmd-table.no-who .cmd-row { grid-template-columns: 52px 110px minmax(0, 1fr); }
.cmd-row:hover { background: rgba(255, 255, 255, 0.025); }
.cmd-time { color: var(--text-faint); font-variant-numeric: tabular-nums; font-size: 13px; }
.cmd-who { min-width: 0; overflow: hidden; }
.cmd-who .player-chip .avatar { width: 20px; height: 20px; }
.cmd-name { justify-self: start; padding: 0; border: 0; background: none; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--blue); cursor: pointer; }
.cmd-name:hover { text-decoration: underline; }
.args-inline { display: flex; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.cmd-row.expanded .args-inline { flex-wrap: wrap; white-space: normal; mask-image: none; }
.arg { display: inline-flex; flex: none; max-width: 100%; overflow: hidden; border-radius: 5px; background: var(--elevation2); font-family: var(--mono); font-size: 12px; line-height: 20px; }
.arg-name { padding: 0 6px; background: var(--elevation3); color: var(--text-muted); }
.arg > :last-child, .arg { padding-right: 6px; }
.arg .arg-name { margin-right: 6px; }
.cmd-row.expanded .arg { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .cmd-row, .cmd-table.no-who .cmd-row { grid-template-columns: 46px minmax(0, 1fr); row-gap: 2px; }
  .cmd-row .args-inline { grid-column: 1 / -1; }
}

/* ---------- Transitions ----------
   The router keeps the old view up while the new one loads (see route() in app.js).
   Everything is delayed slightly so fast loads don't flicker at all. */

.main { position: relative; }
.progress {
  position: fixed;
  top: 0;
  left: 232px;
  right: 0;
  z-index: 50;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.progress::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  animation: progress 1.1s ease-in-out infinite;
}
.main.busy .progress { opacity: 1; transition-delay: 0.12s; }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (max-width: 860px) { .progress { left: 0; } }

.view { transition: opacity 0.2s ease; }
.main.busy .view { opacity: 0.6; transition-delay: 0.25s; }
.view.entering { animation: view-in 0.18s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

/* Content that arrives after the view is on screen (profile sections, load more). */
.fade-in { animation: fade-in 0.22s ease-out; }
@keyframes fade-in { from { opacity: 0; } }

/* Quieter shimmer. */
.skeleton {
  background: linear-gradient(90deg, var(--elevation1) 0%, rgb(33, 38, 43) 50%, var(--elevation1) 100%);
  background-size: 200% 100%;
  animation-duration: 1.6s;
}

@media (prefers-reduced-motion: reduce) {
  .view.entering, .fade-in, .progress::after { animation: none; }
  .view, .main.busy .view { transition: none; }
}

/* ---------- Quick search (Ctrl/⌘+K) ---------- */

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--elevation4);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--elevation2);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.palette-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  margin-bottom: 4px;
  padding: 0 10px;
  border: var(--border) solid var(--elevation3);
  border-radius: var(--corner);
  background: var(--elevation2);
  color: var(--text-faint);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.palette-trigger:hover { border-color: var(--elevation5); color: var(--text-muted); }
.palette-trigger span { flex: 1; text-align: left; }

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(8, 10, 12, 0.6);
  backdrop-filter: blur(2px);
  animation: fade-in 0.12s ease-out;
}
.palette {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: 70vh;
  overflow: hidden;
  border: var(--border) solid var(--elevation3);
  border-radius: 14px;
  background: var(--elevation1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: palette-in 0.14s ease-out;
}
@keyframes palette-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: var(--border) solid var(--elevation2); color: var(--text-faint); font-size: 18px; }
.palette-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 17px; }
.palette-input::placeholder { color: var(--text-faint); }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-section + .palette-section { margin-top: 6px; }
.palette-heading { padding: 6px 10px 4px; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--corner); cursor: pointer; }
.palette-item.active { background: var(--elevation3); }
.palette-item .player-name { flex: 1; }
.palette-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--elevation3); color: var(--blue); }
.palette-item.active .palette-icon { background: var(--blue); color: var(--text); }
.palette-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.1s; }
.palette-item.active .palette-actions { opacity: 1; }
.palette-actions .chip { height: 24px; padding: 0 8px; font-size: 12px; }
.palette-empty { padding: 18px; text-align: center; color: var(--text-muted); }
.palette-foot { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 14px; border-top: var(--border) solid var(--elevation2); color: var(--text-faint); font-size: 12px; }
@media (max-width: 560px) { .palette-actions { display: none; } .palette-foot { display: none; } }

/* Feedback the moment a filter is clicked, before its data arrives. */
.segmented button.pressed, .chip.pressed, .rarity-chip.pressed { transition: background 0.08s, color 0.08s; }
.palette-page .faint { margin-left: auto; font-size: 12px; }

/* ---------- Login ---------- */

.login-card { width: min(440px, 100%); }
.login-notice { width: 100%; padding: 8px 12px; border-radius: var(--corner); background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.login-panel { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.discord-button { width: 100%; height: 46px; gap: 10px; background: var(--blurple); font-size: 16px; }
.discord-button:hover { background: rgb(108, 120, 245); }
.discord-logo { width: 22px; height: 22px; }
.login-fine { font-size: 13px; }
.login-note { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: var(--text-small); font-weight: 600; text-align: left; }

.login-details { width: 100%; text-align: left; font-size: var(--text-small); color: var(--text-muted); }
.login-details summary { cursor: pointer; text-align: center; color: var(--blue); font-weight: 700; list-style: none; }
.login-details summary::-webkit-details-marker { display: none; }
.login-details ul { margin: 10px 0 0; padding: 12px 14px 12px 28px; border-radius: var(--corner); background: var(--elevation2); display: flex; flex-direction: column; gap: 6px; }
.login-details strong { color: var(--text); }

.login-divider { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--elevation3); }

.preview-banner { display: flex; align-items: center; gap: 10px; width: min(440px, 100%); padding: 10px 14px; border-radius: var(--frame-corner); background: var(--gold-soft); border: var(--border) solid rgba(239, 184, 56, 0.4); color: var(--gold); font-size: var(--text-small); font-weight: 600; }
.preview-banner .btn { margin-left: auto; }

/* ---------- Tournaments ---------- */

.small-note { margin: 0; font-size: var(--text-small); }
.winners { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--gold); }
.winners > .icon { font-size: 16px; }

.slot-list { overflow: hidden; }
.slot {
  display: grid;
  grid-template-columns: 120px 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 6px 14px;
  border-top: 1px solid var(--elevation2);
}
.slot.past { opacity: 0.7; }
.slot.past.claimed { opacity: 1; }
.slot-time { display: flex; flex-direction: column; line-height: 1.15; }
.slot-time strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.slot-time time { color: var(--text-faint); font-size: 12px; }
.slot > .pill { justify-self: start; }
.pill.faded { opacity: 0.6; }
.slot-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.slot-host { display: inline-flex; align-items: center; gap: 6px; }
.slot-result { display: flex; align-items: center; gap: 12px; color: var(--text); }
.slot-result:hover { text-decoration: none; }
.slot-result:hover .icon:last-child { color: var(--blue); }
.now-line { display: flex; align-items: center; gap: 10px; padding: 2px 14px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.now-line::after { content: ''; flex: 1; height: 2px; background: var(--blue); border-radius: 1px; }

.tournament-card { display: grid; grid-template-columns: 210px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 14px; padding: 12px 14px; color: var(--text); transition: border-color 0.12s; }
.tournament-card:hover { text-decoration: none; border-color: var(--elevation4); }
.tournament-when { display: flex; flex-direction: column; }
.tournament-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.tournament-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; }
.tournament-header .display { font-size: var(--text-large); font-weight: 800; }
.tournament-winners { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-color: rgba(239, 184, 56, 0.4); background: linear-gradient(180deg, var(--gold-soft), var(--elevation1)); }
.standings-row { grid-template-columns: minmax(0, 1fr) 70px 60px 60px 60px; }
.numbered { display: flex; flex-direction: column; gap: 4px; }
.match-number { color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

@media (max-width: 860px) {
  .slot { grid-template-columns: 90px minmax(0, 1fr); }
  .slot-body, .slot-result { grid-column: 1 / -1; }
  .tournament-card { grid-template-columns: minmax(0, 1fr); }
  .standings-row { grid-template-columns: minmax(0, 1fr) 50px 44px 44px 44px; }
}

/* ---------- Density pass ----------
   Overrides earlier rules: less padding, flatter shapes, more rows per screen. */

.main { padding: 18px 22px 48px; }
.page { gap: 10px; max-width: 1280px; }
.page-title { font-size: var(--text-larger); }
.page-subtitle { font-size: var(--text-small); }
.section-head h2 { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.section, .section-body, .stack { gap: 8px; }
.profile-grid { gap: 12px; }

.btn { height: 30px; padding: 0 10px; font-size: var(--text-small); }
.btn-icon { width: 30px; }
.btn-sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-sm.btn-icon { width: 24px; }
.input { height: 30px; padding: 0 10px; font-size: var(--text-small); }
.player-search .input { padding-left: 30px; }
.player-search > .icon { left: 10px; top: 8px; font-size: 14px; }
.segmented { height: 30px; padding: 2px; }
.segmented button { padding: 0 9px; font-size: var(--text-small); border-radius: 4px; }
.filters { padding: 8px 10px; gap: 8px 10px; }
.field { gap: 2px; }
.field-label, .stat-label { font-size: 11px; }

.pill { padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.chip, .rarity-chip { height: 24px; padding: 0 8px; border-radius: 4px; font-size: 12px; }

/* Stats: one strip of cells instead of separate tiles. */
.stats {
  gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  background: var(--elevation1);
  border: var(--border) solid var(--elevation2);
  border-radius: var(--frame-corner);
  overflow: hidden;
}
.stats > .stat { border: 0; border-radius: 0; box-shadow: inset -1px 0 var(--elevation2), inset 0 -1px var(--elevation2); padding: 7px 10px; background: none; }
.stat-value { font-size: 18px; line-height: 1.2; }
.stat-sub { font-size: 12px; }
.stats.compact { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.stats.compact .stat-value { font-size: 16px; }
.wlbar { height: 4px; margin-top: 4px; }

/* Empty sections: one quiet line, not a dashed box. */
.quiet { padding: 6px 2px; border: 0; color: var(--text-faint); font-size: var(--text-small); }
.empty { padding: 24px 12px; gap: 4px; }
.empty .icon { font-size: 22px; }
.empty strong { font-size: var(--text-medium); }

/* Player banner. */
.player-header { padding: 8px 10px; gap: 10px; }
.avatar-lg { width: 40px; height: 40px; border-radius: var(--corner); }
.avatar-lg .avatar-initial { font-size: 18px; }
.player-header .display { font-size: var(--text-large); }
.player-header .muted { font-size: var(--text-small); }
.discord-ids { margin-top: 2px; font-size: 12px; gap: 4px 6px; }
.chip-button { padding: 0 5px; border-radius: 3px; font-size: 11px; }
.status-clear { font-size: 12px; }
.status-banner { padding: 8px 10px; gap: 10px; }
.status-banner > .icon { font-size: 18px; }
.status-text > strong { font-size: var(--text-body); }
.hidden-note { font-size: 12px; }

/* Key/value table (game data). */
.kv { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 4px 12px; padding: 8px 10px; font-size: var(--text-small); }
.kv dt { font-size: 12px; align-self: center; }
.kv dd { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .kv { grid-template-columns: max-content minmax(0, 1fr); } }
.raw { padding: 6px 10px; }

/* Lists and cards. */
.mod-entry { padding: 7px 10px; gap: 4px; }
.mod-list { gap: 6px; }
.match-head, .trade-head, .appeal-head { padding: 6px 10px; gap: 8px; }
.match-score { font-size: var(--text-medium); }
.player-row { padding: 3px 10px; }
.player-row.cols { padding-top: 6px; }
.player-cell .avatar { width: 22px; height: 22px; }
.player-chip .avatar { width: 22px; height: 22px; }
.player-chip.small .avatar { width: 18px; height: 18px; }
.trade-side, .appeal-body { padding: 8px 10px; gap: 4px; }
.table-row { padding: 5px 10px; }
.match-list, .stack { gap: 8px; }
.sword-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.sword-tile { padding: 8px 6px 6px; }
.sword-img { width: 56px; height: 56px; }
.leave-card { padding: 10px; gap: 6px; }
.tournament-card { padding: 8px 10px; }
.slot { min-height: 38px; padding: 4px 10px; }
.slot-time strong { font-size: var(--text-body); }

.sidebar { padding: 12px 10px; gap: 6px; }
.nav-item { padding: 6px 10px; font-size: var(--text-body); }
.nav-group { margin: 10px 10px 2px; }
.brand { padding: 2px 4px 8px; }
.brand-mark { width: 30px; height: 30px; font-size: 17px; border-radius: var(--corner); }
.brand-title { font-size: var(--text-body); }
.palette-trigger { height: 30px; font-size: var(--text-small); }

/* Name and @username on one line in rows, so each player takes one line. */
.player-row .player-name, .player-chip .player-name, .dropdown-item .player-name { flex-direction: row; align-items: baseline; gap: 6px; }
.player-row .player-name .username, .player-chip .player-name .username { font-size: 11px; }
.player-row { min-height: 28px; }
.player-chip strong { font-size: var(--text-small); }

.shell { grid-template-columns: 204px minmax(0, 1fr); }
.progress { left: 204px; }
@media (max-width: 860px) { .shell { grid-template-columns: minmax(0, 1fr); } .progress { left: 0; } }

/* Trades as single rows. */
.trade { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 10px; }
.trade .trade-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 0; }
.trade .sword-list { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; }
.trade .trade-arrow { padding: 0; font-size: 15px; }
.trade-meta { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
@media (max-width: 760px) {
  .trade { grid-template-columns: minmax(0, 1fr) auto; }
  .trade .trade-arrow { display: none; }
  .trade .trade-side:nth-of-type(3) { grid-column: 1; }
}
.slot-run { min-height: 30px; }
.slot-run .slot-body { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Grouped swords in trades. */
.trade { align-items: start; }
.trade .trade-arrow, .trade .trade-meta { align-self: center; }
.trade .trade-side { align-items: baseline; }
.side-count { font-size: 12px; }
.sword-group { display: contents; }
.sword-group-head { display: inline-flex; align-items: baseline; gap: 5px; padding: 0; border: 0; background: none; cursor: pointer; }
.sword-group-head:hover .sword-label { text-decoration: underline; }
.sword-group-head .count { color: var(--text); font-weight: 800; }
.serial-range { color: var(--blue); font-size: 12px; font-variant-numeric: tabular-nums; }
.sword-group-items { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 2px 0 4px; padding: 4px 8px; list-style: none; border-left: 2px solid var(--elevation3); background: rgba(255, 255, 255, 0.02); }
.sword-group-items[hidden] { display: none; }

/* ---------- Trades table ---------- */

.trade-table { overflow: hidden; }
.trade-row {
  display: grid;
  grid-template-columns: 52px 150px minmax(0, 1fr) 18px 150px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 10px;
  padding: 6px 12px;
  border-top: 1px solid var(--elevation2);
}
.trade-row > .cmd-time, .trade-row > .trade-arrow, .trade-row > .btn { margin-top: 2px; }
.trade-row:nth-child(even of .trade-row:not(.trade-head-row)) { background: rgba(255, 255, 255, 0.015); }
.trade-row:hover { background: rgba(255, 255, 255, 0.035); }
.trade-head-row { padding: 6px 12px; background: var(--elevation2); border-top: 0; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.trade-row .trade-arrow { color: var(--text-faint); font-size: 14px; }
.trade-player { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.trade-player .player-chip { max-width: 100%; }
.trade-player .player-chip .username { display: none; }
.trade-gave { color: var(--text-faint); font-size: 11px; padding-left: 24px; }

.trade-swords { display: flex; flex-wrap: wrap; gap: 4px; }
.trade-swords.empty { color: var(--text-faint); padding-top: 2px; }
.sword-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--elevation3);
  border-radius: 4px;
  background: var(--elevation2);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.sword-tag:hover { border-color: var(--elevation5); text-decoration: none; }
.sword-tag.removed { opacity: 0.55; }
.sword-tag.more { color: var(--text-muted); border-style: dashed; background: none; }
.rarity-dot { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--elevation5); }
.tag-serial { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.tag-count { font-weight: 800; }
.tag-flag { color: var(--text-muted); font-size: 11px; }
.tag-flag.removed { color: var(--red); }
.sword-details { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding: 4px 6px; border-left: 2px solid var(--elevation4); }
.sword-details[hidden] { display: none; }

@media (max-width: 960px) {
  .trade-row { grid-template-columns: 46px minmax(0, 1fr) 18px minmax(0, 1fr); }
  .trade-row > .btn, .trade-head-row { display: none; }
  .trade-row > :nth-child(3) { grid-column: 2; grid-row: 2; }
  .trade-row > :nth-child(6) { grid-column: 4; grid-row: 2; }
}
.trade-row .trade-gave { text-transform: none; letter-spacing: 0; font-weight: 400; }
.sword-tag { max-width: 100%; min-width: 0; }
.tag-name { overflow: hidden; text-overflow: ellipsis; }
.trade-row > div { min-width: 0; }

/* ---------- Sword serials ---------- */

.serials-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; align-items: start; }
.sword-types { position: sticky; top: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); overflow: hidden; }
.sword-types-search { padding: 6px; border-bottom: 1px solid var(--elevation2); }
.sword-type-list { overflow-y: auto; padding: 2px 4px 6px; }
.sword-type-heading { padding: 8px 6px 2px; color: var(--text-faint); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.sword-type { display: flex; align-items: center; gap: 7px; padding: 3px 6px; border-radius: 4px; color: var(--text); font-size: var(--text-small); }
.sword-type:hover { background: var(--elevation2); text-decoration: none; }
.sword-type.active { background: var(--blue-soft); color: var(--blue); }
.sword-type .tag-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sword-type .count { font-size: 11px; font-variant-numeric: tabular-nums; }

.sword-hero { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 8px 12px; }
.sword-hero .sword-img { width: 52px; height: 52px; }
.sword-hero .display { font-size: var(--text-large); font-weight: 800; }
.sword-hero-text { min-width: 0; }
.top-holders { display: flex; flex-direction: column; gap: 4px; margin-left: auto; }
.holder { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 2px; border-radius: 4px; background: var(--elevation2); }
.jump { display: flex; gap: 6px; }
.jump .input { width: 110px; }

.serial-table { overflow: hidden; }
.serial-row { display: grid; grid-template-columns: 90px minmax(0, 1.4fr) 90px 120px 80px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 30px; padding: 3px 12px; border-top: 1px solid var(--elevation2); font-size: var(--text-small); }
.serial-row:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
.serial-row.removed { color: var(--text-muted); }
.serial-row.removed .player-chip { opacity: 0.6; }
.serial-head { min-height: 0; padding: 6px 12px; background: var(--elevation2); border-top: 0; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.serial-link { font-weight: 800; font-variant-numeric: tabular-nums; }
.serial-status { display: flex; flex-wrap: wrap; gap: 4px; }

/* Sword tags: name and serial are separate links. */
.sword-tag { cursor: default; }
.sword-tag a { color: inherit; }
.sword-tag a.tag-name:hover { text-decoration: underline; }
.sword-tag a.tag-serial:hover { color: var(--blue); text-decoration: underline; }
.tag-expand { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.tag-expand:hover .tag-count { color: var(--blue); }
.sword-name a { color: inherit; }
.sword-name a:hover { text-decoration: underline; }
.sword-name a.serial { color: var(--blue); }

@media (max-width: 960px) {
  .serials-layout { grid-template-columns: minmax(0, 1fr); }
  .sword-types { position: static; max-height: 260px; }
  .serial-row { grid-template-columns: 70px minmax(0, 1fr) 90px; }
  .serial-row > :nth-child(3), .serial-row > :nth-child(5) { display: none; }
  .serial-row > :nth-child(4) { display: none; }
}

/* Compact one-line matches (profile). */
.match-lines { overflow: hidden; }
.match-line {
  display: grid;
  grid-template-columns: 110px 92px 34px 46px 72px 34px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 30px;
  padding: 3px 12px;
  border-top: 1px solid var(--elevation2);
  border-left: 3px solid transparent;
  color: var(--text);
  font-size: var(--text-small);
}
.match-line:first-child { border-top: 0; }
.match-line:hover { background: rgba(255, 255, 255, 0.035); text-decoration: none; }
.match-line.result-victory { border-left-color: rgba(80, 240, 80, 0.55); }
.match-line.result-defeat { border-left-color: rgba(240, 80, 80, 0.55); }
.match-line > .pill { justify-self: start; }
.line-score { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.line-score strong { color: var(--text); }
.line-kda { font-variant-numeric: tabular-nums; }
.line-badges { display: flex; gap: 3px; }
.line-badges .badge-icon { width: 16px; height: 16px; font-size: 10px; }
.line-team { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-list a { color: var(--text-muted); }
.name-list a:hover { color: var(--blue); }
.mvp-star { margin-left: 2px; color: var(--gold); font-size: 11px; }
/* Names with tiny avatars, spaced rather than comma-separated. */
.name-list { display: inline-flex; align-items: center; gap: 4px 10px; min-width: 0; }
.name-list a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.name-list .avatar { width: 16px; height: 16px; }
.name-list .avatar-initial { font-size: 9px; }
.name-list .rank-icon { width: 12px; height: 12px; margin: 0; }
@media (max-width: 960px) {
  .match-line { grid-template-columns: 84px 84px 46px minmax(0, 1fr); }
  .match-line > :nth-child(3), .match-line > :nth-child(6) { display: none; }
  .line-team { grid-column: 1 / -1; }
}

/* ---------- Alt check ---------- */

.alt-table { overflow: hidden; }
.alt-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 70px 70px 60px 70px 56px 66px 56px 92px 52px;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-top: 1px solid var(--elevation2);
  border-left: 3px solid transparent;
  font-size: var(--text-small);
  font-variant-numeric: tabular-nums;
}
.alt-row.level-strong { border-left-color: var(--red); background: rgba(240, 80, 80, 0.04); }
.alt-row.level-possible { border-left-color: var(--gold); }
.alt-head { padding: 6px 12px; background: var(--elevation2); border-top: 0; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.alt-row .num { text-align: right; }
.alt-who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.alt-reasons { color: var(--text-muted); font-size: 12px; }
.alt-mention { display: flex; gap: 4px; align-items: baseline; color: var(--gold); font-size: 12px; }
.alt-named { font-size: var(--text-small); color: var(--text-muted); }
.alt-named a + a::before { content: ', '; color: var(--text-faint); }
.warn-num { color: var(--gold); font-weight: 700; }
@media (max-width: 1100px) {
  .alt-row { grid-template-columns: minmax(0, 1fr) 70px 70px 70px; }
  .alt-row > :nth-child(n+5):not(:last-child) { display: none; }
}

/* Play time chart (alt check). */
.activity-chart { display: block; width: 100%; height: auto; }
.activity-chart .bar-main { fill: var(--blue); }
.activity-chart .bar-compare { fill: var(--gold); opacity: 0.85; }
.activity-chart .spike { fill: var(--red); }
.activity-chart .bar-compare.spike { fill: rgb(255, 120, 90); }
.activity-chart rect:hover { opacity: 0.75; }
.activity-chart .baseline { stroke: var(--elevation5); }
.activity-chart .axis { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.chart-frame.loading { opacity: 0.6; }
.swatch.compare { background: var(--gold); }
.swatch.spike { background: var(--red); margin-left: 8px; }
.activity-chart { max-height: 300px; }

/* Stacked play time rows. */
.activity-chart { max-height: none; }
.activity-chart .row-bg { fill: rgba(255, 255, 255, 0.015); }
.activity-chart .row-name { fill: var(--text); font-size: 13px; font-weight: 700; font-family: var(--font); }
.activity-chart .row.main .row-name { fill: var(--blue); }
.activity-chart .row-sub { fill: var(--text-faint); font-size: 11px; font-family: var(--font); }
.activity-chart .row .bar { fill: var(--gold); }
.activity-chart .row.main .bar { fill: var(--blue); }
.activity-chart .row .bar.spike { fill: var(--red); }
.activity-chart .guide { stroke: var(--elevation2); stroke-dasharray: 2 3; }

/* ---------- Logs ---------- */

.log-table { overflow: hidden; }
.log-item + .log-item { border-top: 1px solid var(--elevation2); }
.log-row {
  display: grid;
  grid-template-columns: 58px 76px 170px minmax(0, 1fr) 70px 120px 96px;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 3px 12px;
  font-size: var(--text-small);
  cursor: pointer;
}
.log-row:hover, .log-row.open { background: rgba(255, 255, 255, 0.03); }
.log-row > .pill { justify-self: start; }
.log-row.deleted { opacity: 0.6; }
.log-snippet { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-flags { display: flex; gap: 8px; color: var(--text-faint); font-size: 12px; }
.log-flags > span { display: inline-flex; align-items: center; gap: 2px; }
.log-flags .locked { color: var(--gold); }
.log-by { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-when { color: var(--text-muted); text-align: right; white-space: nowrap; }

.log-detail { display: flex; flex-direction: column; gap: 10px; padding: 8px 12px 12px 80px; background: rgba(255, 255, 255, 0.02); border-top: 1px dashed var(--elevation3); }
.log-full { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.log-attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment { margin: 0; display: flex; flex-direction: column; gap: 3px; max-width: 320px; }
.attachment img, .attachment video { display: block; max-width: 320px; max-height: 220px; border-radius: var(--corner); border: 1px solid var(--elevation3); background: var(--background); }
.attachment figcaption { color: var(--text-faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-file { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--elevation3); border-radius: var(--corner); }
.log-history { display: flex; flex-direction: column; gap: 6px; }
.log-edit { display: flex; flex-direction: column; gap: 3px; padding-left: 10px; border-left: 2px solid var(--elevation4); font-size: var(--text-small); }
.log-diff { display: flex; flex-direction: column; gap: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-diff del { color: var(--red); text-decoration: line-through; opacity: 0.8; }
.log-diff ins { color: var(--green); text-decoration: none; }
.log-detail-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

@media (max-width: 960px) {
  .log-row { grid-template-columns: 52px 70px minmax(0, 1fr) 80px; }
  .log-row > .log-snippet { grid-column: 1 / -1; grid-row: 2; }
  .log-row > .log-flags, .log-row > .log-by { display: none; }
  .log-detail { padding-left: 12px; }
}
.log-edit .mod-meta { margin-left: 0; }

/* Staff activity: one line per person. */
.activity-table { overflow: hidden; }
.activity-line {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 150px 70px 120px 90px 90px 64px minmax(0, 1.1fr);
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 3px 12px;
  border-top: 1px solid var(--elevation2);
  font-size: var(--text-small);
  font-variant-numeric: tabular-nums;
}
.activity-line:nth-child(odd):not(.activity-head) { background: rgba(255, 255, 255, 0.015); }
.activity-line.on-leave { opacity: 0.55; }
.activity-head { min-height: 0; padding: 6px 12px; background: var(--elevation2); border-top: 0; color: var(--text-faint); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.activity-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.focus-tag { padding: 0 5px; border-radius: 3px; background: var(--elevation3); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.rank-tag { font-size: 11px; white-space: nowrap; }
.top-tag { color: var(--gold); display: inline-flex; }

.req-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.req-cell .req-value { font-weight: 700; }
.req-cell .req-target { color: var(--text-faint); }
.req-cell.met { color: var(--green); }
.req-cell.met .req-target { color: rgba(80, 240, 80, 0.55); }
.req-cell.not-required { color: var(--elevation5); }
.req-mini { display: inline-block; width: 34px; height: 4px; margin-left: 4px; border-radius: 2px; background: var(--elevation3); overflow: hidden; }
.req-mini > span { display: block; height: 100%; background: var(--blue); }
.afk { color: var(--text-faint); }
.status-text-cell { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-text-cell.met { color: var(--green); }
.status-text-cell.behind { color: var(--red); font-weight: 500; }
.status-text-cell.leave { color: var(--gold); }

@media (max-width: 1000px) {
  /* Name on its own line, then game time · chats · status. */
  .activity-line { grid-template-columns: auto auto minmax(0, 1fr); row-gap: 2px; padding: 6px 12px; }
  .activity-line > .activity-who { grid-column: 1 / -1; }
  .activity-line > :nth-child(3), .activity-line > :nth-child(5), .activity-line > :nth-child(6), .activity-line > :nth-child(7) { display: none; }
  .activity-head { display: none; }
}

/* Clickable sort headers. */
.sort-head { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; white-space: nowrap; }
.sort-head:hover { color: var(--text); }
.sort-head.active { color: var(--blue); }
.sort-arrow { font-size: 9px; }

/* Staff names in their rank colour, with the rank icon (like in game). */
.ranked { --rank: var(--text); }
.player-chip.ranked strong, a.staff.ranked, .player-name button.ranked, .name-list a.ranked { color: var(--rank); }
.player-chip.ranked:hover strong, a.staff.ranked:hover { filter: brightness(1.2); }
.rank-icon { display: inline-block; width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; object-fit: contain; }
.player-chip.small .rank-icon { width: 12px; height: 12px; }
.rank-tag[data-rank], .rank-pill[data-rank] { color: var(--rank); }
.rank-pill { background: color-mix(in srgb, var(--rank, var(--blue)) 16%, transparent); }
.rank-tag { font-size: 11px; font-weight: 700; white-space: nowrap; }
.hosted { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; }
.hosted.none { color: var(--elevation5); font-weight: 400; }

/* Neutral compact match lines (no player selected). */
.match-line.neutral { grid-template-columns: 110px 34px 46px minmax(0, 1.2fr) minmax(0, 1fr) 96px; border-left-color: transparent; }
.match-line.neutral .line-score strong.win { color: var(--green); }
.match-line.neutral .winners { display: flex; align-items: center; gap: 5px; }
.match-line.neutral .winners > .icon { flex: none; color: var(--green); font-size: 13px; }
.match-line.neutral .winners .name-list a:not(.ranked) { color: var(--text); }
.match-line.neutral.ended-early .line-score strong { color: var(--text-muted); }
.line-server { font-size: 12px; text-align: right; white-space: nowrap; }
@media (max-width: 960px) {
  .match-line.neutral { grid-template-columns: 84px 46px minmax(0, 1fr); }
  .match-line.neutral > :nth-child(2), .match-line.neutral > .line-server { display: none; }
  .match-line.neutral .line-team { grid-column: 1 / -1; }
}
/* Keep each name whole; a team that doesn't fit is cut at the cell edge with a fade. */
.name-list a { flex: none; }
.line-team { display: flex; align-items: center; gap: 4px; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.line-team > * { flex: none; }

/* Linked Discord accounts on the profile banner. */
.discord-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.discord-label { display: inline-flex; color: #8a94f5; }
.discord-label svg { width: 16px; height: 16px; }
.discord-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 3px;
  border: 1px solid var(--elevation3);
  border-radius: 999px;
  background: var(--elevation2);
  font-size: 12px;
  cursor: pointer;
}
.discord-chip:hover { border-color: #8a94f5; }
.discord-chip img { width: 18px; height: 18px; border-radius: 50%; }
.discord-chip .discord-name { font-weight: 700; }
.discord-chip .discord-note { color: var(--text-faint); }
.discord-chip.left .discord-note { color: var(--gold); }
.discord-chip.deleted { opacity: 0.6; }
.discord-chip.deleted .discord-name { font-weight: 500; font-style: italic; }
.player-header .display.ranked { color: var(--rank); }
.player-header .display .rank-icon { width: 18px; height: 18px; margin-right: 5px; vertical-align: -3px; }

/* Appeal: ban & logs panel. */
.appeal-actions { display: inline-flex; gap: 4px; margin-left: auto; }
.appeal-actions .btn.active { background: var(--elevation3); color: var(--text); }
.appeal-context { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--elevation2); }
.appeal-context[hidden] { display: none; }
.appeal-ban { display: flex; flex-direction: column; gap: 6px; }
.appeal-logs { display: flex; flex-direction: column; gap: 2px; }
.appeal-logs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.appeal-log { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 6px; border-radius: var(--corner); color: var(--text); font-size: var(--text-small); }
.appeal-log:hover { background: var(--elevation2); text-decoration: none; }
.appeal-log.this-ban { background: rgba(239, 184, 56, 0.07); box-shadow: inset 2px 0 0 var(--gold); }
.appeal-log .pill { flex: none; }
.appeal-log-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appeal-log-meta { flex: none; color: var(--text-muted); font-size: 12px; }
.appeal-ban .status-banner .btn { display: none; }

/* View as (testing) and exports. */
.view-as { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.view-as .input { height: 28px; font-size: 12px; }
.view-as-banner { display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto 12px; padding: 8px 12px; border: 1px solid rgba(239, 184, 56, 0.45); border-radius: var(--frame-corner); background: var(--gold-soft); color: var(--gold); font-size: var(--text-small); }
.view-as-banner .btn { margin-left: auto; }
.summary-actions { margin-left: auto; }
.cmd-summary { width: 100%; }
/* Sort headers inside right-aligned number columns. */
.table-head .sort-head, .alt-head .sort-head { justify-self: start; }
.standings-row .sort-head:not(:first-child), .alt-head .sort-head:nth-child(n+3):not(:last-child) { justify-self: end; }
.palette-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.palette-text > * { max-width: 100%; margin: 0; }
.palette-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-text .faint { font-size: var(--text-xs, 12px); }

/* Inventory cards, matching the in-game inventory and the /swords image:
   dark-to-rarity gradient, rarity outline, name on top, serial bottom right. */
.sword-grid, .sword-grid.sword-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; }
.sword-tile, .sword-tile.sword-tile {
  --rarity: #8a8a8a;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  aspect-ratio: 91 / 114;
  padding: 6px;
  gap: 0;
  text-align: center;
  color: #fff;
  border: 1px solid var(--rarity);
  border-radius: var(--frame-corner);
  background: linear-gradient(180deg, color-mix(in lab, var(--rarity) 10%, #000), color-mix(in lab, var(--rarity) 40%, #000));
  transition: transform 0.1s, box-shadow 0.1s;
}
.sword-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 0 0 1px var(--rarity); }
.sword-tile .sword-tile-name { margin: 0; font-size: var(--text-xs, 12px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.sword-tile .sword-img { flex: 1; width: 100%; height: auto; min-height: 0; padding: 4px; object-fit: contain; }
.sword-tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; width: 100%; min-height: 16px; }
.sword-tile .serial { margin-left: auto; color: #fff; opacity: 0.5; font-size: var(--text-xs, 12px); font-weight: 700; font-variant-numeric: tabular-nums; }
.sword-tile .pill { margin: 0; font-size: 10px; padding: 0 4px; }
.sword-tile.removed { opacity: 0.5; filter: saturate(0.4); }
.sword-tile.removed:hover { opacity: 0.8; }
.palette-page .palette-text .faint { margin-left: 0; }

/* Staff leave: your own leave and manager decisions. */
.your-leave { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.your-leave-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.your-leave-main > span { flex: none; }
.your-leave-form { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 260px; }
.your-leave-form .input { flex: 1; min-width: 180px; }
.your-leave-form .ext-days { flex: none; width: 70px; min-width: 0; }
.your-leave .extension-note { display: inline-flex; margin-right: 6px; }
.extension-actions { display: inline-flex; gap: 4px; margin-left: 8px; }
.btn.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.your-leave-form .input { max-width: 420px; }

/* Compact inventory: like the game's expanded view, no names, many per row. */
.sword-grid.compact { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
.sword-grid.compact .sword-tile { aspect-ratio: 51 / 55; padding: 3px; }
.sword-grid.compact .sword-tile-name { display: none; }
.sword-grid.compact .sword-img { padding: 2px; }
.sword-grid.compact .sword-tile-foot { min-height: 0; }
.sword-grid.compact .serial { font-size: 10px; }
.sword-grid.compact .pill { display: none; }
.login-note[hidden] { display: none; }

/* CD logo in place of the old swords mark: dark tile like the game icon. */
.brand-mark, .brand-mark.brand-mark { display: flex; align-items: center; justify-content: center; flex: none; padding: 0; background: #14171b; border: 1px solid var(--elevation3); }
.brand-mark .logo { width: 72%; height: 72%; display: block; }
.cmd-args { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cmd-args .via-web { flex: none; font-size: 11px; padding: 0 5px; }
@media (max-width: 720px) { .cmd-row .cmd-args { grid-column: 1 / -1; } }

/* Appeal vote buttons, coloured like the Discord ones. */
.vote-buttons { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.vote-button { background: var(--elevation3); }
.vote-button-accept.active { background: var(--green); color: #0b1a10; }
.vote-button-decline.active, .vote-button-blacklist.active { background: var(--red); color: #fff; }
.vote-button-delete.active { background: var(--text-muted); color: var(--background); }
.vote-button.active::before { content: '✓ '; }

/* Creating and editing logs. */
.log-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-color: color-mix(in srgb, var(--blue) 40%, var(--elevation3)); }
.log-form-head { display: flex; align-items: center; justify-content: space-between; }
.log-form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.log-form-row .field.grow { flex: 1; min-width: 260px; }
.log-form-who { display: flex; flex-direction: column; gap: 6px; }
.log-form-pick { display: flex; align-items: center; gap: 8px; }
.log-form-pick .player-search { flex: 1; }
.log-form-pick .input.mono { width: 150px; }
.log-textarea { width: 100%; min-height: 96px; resize: vertical; font: inherit; line-height: 1.45; }
.log-form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.drop-zone { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1px dashed var(--elevation4); border-radius: var(--corner); color: var(--text-muted); font-size: var(--text-small); }
.drop-zone.over { border-color: var(--blue); background: var(--blue-soft); color: var(--text); }
.upload-list { display: flex; flex-direction: column; gap: 4px; }
.upload-list:empty { display: none; }
.uploads { display: flex; flex-direction: column; gap: 6px; }
.upload-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--corner); background: var(--elevation2); font-size: var(--text-small); }
.upload-item img, .upload-icon { width: 32px; height: 32px; flex: none; object-fit: cover; border-radius: 4px; display: grid; place-items: center; background: var(--elevation3); }
.upload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--text-faint); }
.upload-item.done .upload-state { color: var(--green); }
.upload-item.error .upload-state { color: var(--red); }
.log-manage { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--elevation3); }
.log-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.log-actions[hidden] { display: none; }
.log-edit-form { display: flex; flex-direction: column; gap: 8px; }
.log-item.deleted { opacity: 0.5; }
.attachment figcaption .btn { margin-left: 4px; padding: 0 4px; height: 20px; }
.attachment figcaption { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; }
.attachment figcaption > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
