/* =========================================================================
   Design tokens. Light by default, dark follows the system setting unless
   the visitor picked one (html[data-color="light" | "dark"]).
   ========================================================================= */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --surface-3: #e8e8ed;
  --border: #e3e3e8;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #d7263d;
  --accent-hover: #b81f33;
  --accent-soft: #fdecee;
  --accent-text: #ffffff;
  --win: #2e6be6;
  --win-soft: #ecf2ff;
  --loss: #d93a45;
  --loss-soft: #fdeeef;
  --ok: #1f8a55;
  --discord: #4752c4;
  --winbar-text: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 14px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", "Noto Sans SC", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  color-scheme: light;

  /* Tier colours */
  --t-placement: #8e8e93;
  --t-recruit: #7d7f86;
  --t-squire: #a8693c;
  --t-manatarms: #6f8aa6;
  --t-knight: #c4911c;
  --t-champion: #13a07f;
  --t-warlord: #8b4be8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-color="light"]) {
    --bg: #0b0b0d;
    --surface: #151517;
    --surface-2: #1d1d20;
    --surface-3: #26262a;
    --border: #2a2a2e;
    --text: #f5f5f7;
    --muted: #9a9aa0;
    --accent: #ff4458;
    --accent-hover: #ff6b7b;
    --accent-soft: #34141a;
    --accent-text: #ffffff;
    --win: #6a9bff;
    --win-soft: #14203a;
    --loss: #ff6b74;
    --loss-soft: #36161a;
    --ok: #4fd18b;
    --winbar-text: #0b0b0d;
    --header-bg: rgba(21, 21, 23, 0.78);
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-color="dark"] {
  --bg: #0b0b0d;
  --surface: #151517;
  --surface-2: #1d1d20;
  --surface-3: #26262a;
  --border: #2a2a2e;
  --text: #f5f5f7;
  --muted: #9a9aa0;
  --accent: #ff4458;
  --accent-hover: #ff6b7b;
  --accent-soft: #34141a;
  --accent-text: #ffffff;
  --win: #6a9bff;
  --win-soft: #14203a;
  --loss: #ff6b74;
  --loss-soft: #36161a;
  --ok: #4fd18b;
  --winbar-text: #0b0b0d;
  --header-bg: rgba(21, 21, 23, 0.78);
  --shadow: none;
  color-scheme: dark;
}

/* =========================================================================
   Base
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
code { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.wrap { max-width: 1280px; margin: 0 auto; padding-inline: 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 700; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; justify-content: center; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; margin: 0; }

/* =========================================================================
   Header
   ========================================================================= */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; min-height: 60px; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-2 { color: var(--accent); }
.main-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav a { color: var(--text); font-weight: 600; font-size: .92rem; padding: 8px 12px; border-radius: 999px; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; }
.main-nav a[aria-current="page"] { background: var(--text); color: var(--bg); }
.header-search {
  flex: 1 1 140px; min-width: 0; max-width: 360px; display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 999px; padding: 0 14px; color: var(--muted);
}
.header-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; height: 38px; outline: none; }
.header-search:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.header-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.lang-form select {
  appearance: none; background: var(--surface-2); color: var(--text); border: 0; border-radius: 999px;
  padding: 0 14px; height: 38px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.user-menu { display: flex; align-items: center; gap: 4px; position: relative; }
/* Account menu: only on hover / keyboard focus, so "log out" is never a stray click away */
.user-drop { position: absolute; top: 100%; inset-inline-end: 0; min-width: 190px; padding: 6px; margin-top: 4px; z-index: 30;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  visibility: hidden; opacity: 0; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility 0s .12s; }
.user-menu::after { content: ''; position: absolute; top: 100%; inset-inline: 0; height: 8px; } /* bridge so the menu stays open */
.user-menu:hover .user-drop, .user-menu:focus-within .user-drop { visibility: visible; opacity: 1; transform: none; transition: opacity .12s, transform .12s; }
.user-drop a, .user-drop button { display: block; width: 100%; text-align: start; padding: 9px 12px; border-radius: 8px; color: var(--text);
  font: inherit; font-size: .92rem; background: none; border: 0; cursor: pointer; }
.user-drop a:hover, .user-drop button:hover, .user-drop a:focus-visible, .user-drop button:focus-visible { background: var(--surface-2); text-decoration: none; }
.user-drop form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.user-drop button { color: var(--muted); }
@media (hover: none) { .user-drop { display: none; } }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; padding: 4px 10px 4px 4px; border-radius: 999px; }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.user-chip img { border-radius: 50%; }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .88rem; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary, .btn-outline { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover, .btn-outline:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--accent); padding-inline: 8px; }
.btn-danger { background: var(--loss-soft); color: var(--loss); }
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { background: #3c45a5; }
.btn-link { background: none; border: none; color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer; padding: 8px; min-height: 40px; }
.btn-link:hover { color: var(--text); }

/* =========================================================================
   Page shell
   ========================================================================= */

.page-row { display: flex; gap: 24px; align-items: flex-start; padding-block: 28px 56px; }
.page-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ad-slot {
  flex: 0 0 160px; height: 600px; position: sticky; top: 84px; border-radius: var(--radius-sm);
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}
@media (max-width: 1180px) { .ad-slot { display: none; } }

.card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card.highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.narrow { max-width: 640px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-head h1, .card-head h2 { margin: 0; }
.see-all { font-size: .88rem; font-weight: 600; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.kicker { margin: 0 0 12px; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .grow { flex: 999 1 560px; min-width: 0; }
.split > .side { flex: 1 1 320px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.flash { background: var(--win-soft); color: var(--text); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0; font-weight: 600; }
.error { background: var(--loss-soft); color: var(--loss); border-radius: var(--radius-sm); padding: 10px 14px; font-weight: 600; margin: 0 0 12px; }

/* =========================================================================
   Home hero (search-first)
   ========================================================================= */

.hero { padding: 48px 0 28px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 6.2vw, 4.4rem); line-height: 1.02; letter-spacing: -0.04em; max-width: 14ch; margin-bottom: 16px; }
.lead { font-size: clamp(1rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 52ch; margin: 0 0 28px; }
.hero-search {
  width: 100%; max-width: 640px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 6px 6px 20px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06); color: var(--muted);
}
.hero-search:focus-within { border-color: var(--accent); }
.hero-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; height: 44px; outline: none; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

/* =========================================================================
   Tables & ranking
   ========================================================================= */

.table-scroll { overflow-x: auto; margin-inline: -8px; }
table.board { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; }
.board th {
  text-align: start; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 8px; border-bottom: 1px solid var(--border);
}
.board td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.board tbody tr:last-child td { border-bottom: 0; }
.board tbody tr:hover td { background: var(--surface-2); }
.board .num { text-align: end; font-variant-numeric: tabular-nums; }
.board.compact td { padding-block: 8px; }
.col-rank { width: 44px; }
.col-wr { width: 180px; }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 8px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.rank.top { background: var(--text); color: var(--bg); }
.prov { margin-inline-start: 3px; color: var(--muted); text-decoration: none; cursor: help; font-weight: 400; }
@media (max-width: 760px) { .col-weapon { display: none; } }

.player-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.player-link:hover { text-decoration: none; }
.player-link:hover .player-name { text-decoration: underline; text-underline-offset: 3px; }
.player-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.player-name { font-weight: 700; }
.player-sub { font-size: .78rem; color: var(--muted); font-weight: 500; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }

/* Tier badge */
.tier { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 700; color: var(--tc); white-space: nowrap; }
.tier-gem { width: 14px; height: 14px; background: var(--tc); transform: rotate(45deg); border-radius: 3px; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.28); flex: none; }
.tier-placement { --tc: var(--t-placement); }
.tier-placement .tier-gem { background: transparent; box-shadow: inset 0 0 0 2px var(--tc); }
.tier-recruit { --tc: var(--t-recruit); }
.tier-squire { --tc: var(--t-squire); }
.tier-manatarms { --tc: var(--t-manatarms); }
.tier-knight { --tc: var(--t-knight); }
.tier-champion { --tc: var(--t-champion); }
.tier-warlord { --tc: var(--t-warlord); }

/* Win/loss split bar */
.winbar { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 140px; }
.winbar-track { flex: 1; display: flex; height: 20px; border-radius: 5px; overflow: hidden; background: var(--loss); font-size: .7rem; font-weight: 700; color: var(--winbar-text); }
.winbar-w { background: var(--win); display: flex; align-items: center; padding-inline: 6px; white-space: nowrap; }
.winbar-l { flex: 1; display: flex; align-items: center; justify-content: flex-end; padding-inline: 6px; }
.winbar-pct { font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; width: 3.2em; text-align: end; }
.p0 { width: 0; padding: 0; overflow: hidden; } .p5 { width: 5%; } .p10 { width: 10%; } .p15 { width: 15%; } .p20 { width: 20%; }
.p25 { width: 25%; } .p30 { width: 30%; } .p35 { width: 35%; } .p40 { width: 40%; } .p45 { width: 45%; } .p50 { width: 50%; }
.p55 { width: 55%; } .p60 { width: 60%; } .p65 { width: 65%; } .p70 { width: 70%; } .p75 { width: 75%; } .p80 { width: 80%; }
.p85 { width: 85%; } .p90 { width: 90%; } .p95 { width: 95%; } .p100 { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips a { padding: 7px 14px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: .85rem; font-weight: 600; }
.chips a:hover { text-decoration: none; background: var(--surface-3); }
.chips a[aria-current] { background: var(--text); color: var(--bg); }
.pager { display: flex; justify-content: space-between; margin-top: 12px; font-size: 1.1rem; font-weight: 700; }

/* =========================================================================
   Lists, matches
   ========================================================================= */

.plain-list, .rank-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { border-top: 1px solid var(--border); padding: 10px 0; }
.plain-list > li:first-child { border-top: 0; }
.rank-list > li + li { margin-top: 2px; }
.clan-row { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 8px; margin-inline: -8px; border-radius: var(--radius-sm); }
.clan-row:hover { background: var(--surface-2); text-decoration: none; }
.clan-row-name { display: block; font-weight: 700; }
.crest-sm { width: 40px; height: 40px; border-radius: 10px; background: var(--text); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 800; letter-spacing: .02em; flex: none; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.match-list { display: flex; flex-direction: column; gap: 6px; }
.match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.match-card {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
}
.match-card:hover { background: var(--surface-3); text-decoration: none; }
.mc-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mc-right { justify-content: flex-end; }
.mc-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.mc-name.winner { color: var(--text); font-weight: 800; }
.mc-score { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mc-colon { color: var(--muted); padding-inline: 3px; }
.mc-meta { grid-column: 1 / -1; text-align: center; font-size: .75rem; color: var(--muted); }

.player-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.player-grid li { padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.search-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.search-row input { flex: 1 1 160px; min-width: 0; }

/* =========================================================================
   Profile (op.gg-style: summary left, history right)
   ========================================================================= */

.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; padding: 8px 0 4px; }
.profile-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.035em; margin-bottom: 6px; }
.profile-head .avatar { box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.profile-meta > * { font-size: .82rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.profile-meta .clan-chip { background: var(--text); color: var(--bg); }
.bio { white-space: pre-line; max-width: 70ch; margin: 10px 0 0; }
.profile-grid { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
.tier-card { display: flex; flex-direction: column; gap: 14px; }
.tier-card h2 { margin: 0; }
.tier-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.tier-hero .tier { font-size: 1rem; }
.tier-hero .tier-gem { width: 18px; height: 18px; }
.tier-rating { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.facts { margin: 0; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: end; }
.copyable { cursor: copy; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.h-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 52px 90px; align-items: center; gap: 12px;
  padding: 10px 14px 10px 0; border-radius: var(--radius-sm); border-inline-start: 5px solid;
}
.h-row.win { background: var(--win-soft); border-color: var(--win); }
.h-row.loss { background: var(--loss-soft); border-color: var(--loss); }
.h-result { text-align: center; font-weight: 800; }
.win .h-result { color: var(--win); }
.loss .h-result { color: var(--loss); }
.h-opp { display: flex; align-items: center; gap: 10px; min-width: 0; }
.h-opp a { color: var(--text); font-weight: 700; }
.h-score { font-weight: 800; font-size: 1.1rem; color: var(--text); font-variant-numeric: tabular-nums; }
.h-delta { font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.h-delta.up { color: var(--win); }
.h-delta.down { color: var(--loss); }
.h-when { text-align: end; }
@media (max-width: 560px) { .h-row { grid-template-columns: 28px minmax(0, 1fr) auto 44px; } .h-when { display: none; } }

/* Stat tiles (still used on some pages) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; }
.stat-value { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .9rem; }

/* =========================================================================
   Clans
   ========================================================================= */

.clan-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.clan-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; height: 100%;
  border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}
.clan-card:hover { background: var(--surface-3); text-decoration: none; }
.clan-name { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.crest { width: 52px; height: 52px; border-radius: 14px; background: var(--text); color: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; flex: none; margin-bottom: 4px; }
.crest-lg { width: 88px; height: 88px; border-radius: 22px; font-size: 1.3rem; }
.clan-head, .profile-head-card { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.pill { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.pill.ok { background: var(--win-soft); color: var(--win); }
.role { font-size: .82rem; font-weight: 600; color: var(--muted); }
.role-leader { color: var(--accent); font-weight: 800; }
.role-officer { color: var(--text); }

/* =========================================================================
   Match page
   ========================================================================= */

.versus { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 28px; margin: 20px 0; }
.versus .player-link { font-size: 1.15rem; }
.score { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.score.big { font-family: var(--font-display); font-size: 3rem; letter-spacing: -0.04em; }
.message { border-inline-start: 3px solid var(--border); margin: 12px auto; padding: 4px 12px; max-width: 60ch; color: var(--muted); white-space: pre-line; }
.admin-box { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }

/* =========================================================================
   Forms
   ========================================================================= */

.form { display: flex; flex-direction: column; gap: 16px; }
.form.narrow { max-width: 520px; margin-inline: auto; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form input:not([type="checkbox"]):not([type="file"]), .form select, .form textarea, .search-row input {
  background: var(--surface-2); color: var(--text); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; font: inherit; font-weight: 400; max-width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus, .search-row input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.form legend { font-weight: 700; padding: 0 6px; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); margin: 0; }
.avatar-edit { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.score-form { margin: 20px auto 0; max-width: 420px; align-items: center; }
.score-inputs { display: flex; align-items: flex-end; gap: 12px; }
.score-inputs input { width: 84px; text-align: center; font-size: 1.4rem !important; font-weight: 800; }

.prose { max-width: 70ch; }

/* =========================================================================
   Footer
   ========================================================================= */

.site-footer { border-top: 1px solid var(--border); padding: 20px 0 32px; color: var(--muted); font-size: .8rem; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer-row > span:first-child { font-weight: 800; color: var(--text); }
.site-footer a { color: var(--muted); }

@media (max-width: 640px) {
  .wrap { padding-inline: 14px; }
  .card { padding: 16px; }
  .hero { padding-top: 24px; }
  .user-name { display: none; }
  .header-search { order: 5; flex-basis: 100%; max-width: none; }
}

/* =========================================================================
   Phase 2: verification, clan wars
   ========================================================================= */

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.vbadge { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--win-soft); color: var(--win); }
a.vbadge:hover { text-decoration: none; filter: brightness(1.05); }
.vtick { color: var(--win); vertical-align: -2px; margin-inline-start: 4px; }
.verify-card { display: flex; flex-direction: column; gap: 14px; }
.verify-card h2 { margin: 0; }
.verify-step { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.verify-step h3 { font-size: .9rem; margin: 0; }
.conn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.conn-list li { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.conn { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: .78rem; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); min-width: 92px; }
.conn.ok { background: var(--win-soft); color: var(--win); }
.code-box { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.big-code { font-size: 1.4rem; font-weight: 800; letter-spacing: .08em; background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius-sm); align-self: flex-start; }
.crest-xs { width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: .6rem; font-weight: 800; flex: none; }
.clan-rating { margin: 6px 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.clan-rating .tier-rating { font-size: 2rem; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row > label { flex: 1 1 140px; }

/* =========================================================================
   Phase 3: duel entries, fair play, creators, live, clips, clan archive
   ========================================================================= */

:root { --live: #e5193c; --live-text: #ffffff; --warn-soft: #fff4e5; --warn: #9a5b00; }
@media (prefers-color-scheme: dark) { :root:not([data-color="light"]) { --live: #ff3355; --warn-soft: #2e2210; --warn: #f3b95f; } }
:root[data-color="dark"] { --live: #ff3355; --warn-soft: #2e2210; --warn: #f3b95f; }

/* Live */
.live-pill { display: inline-flex; align-items: center; padding: 1px 6px; margin-inline-start: 6px; border-radius: 4px; background: var(--live); color: var(--live-text);
  font-size: .62rem; font-weight: 800; letter-spacing: .08em; line-height: 1.5; vertical-align: 2px; }
a.live-pill:hover { text-decoration: none; filter: brightness(1.08); }
.live-pill.on-thumb { position: absolute; top: 8px; inset-inline-start: 8px; margin: 0; }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--live); margin-inline-end: 8px; vertical-align: 1px;
  box-shadow: 0 0 0 0 var(--live); animation: live-pulse 2s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.live-chip { display: inline-flex; align-items: center; gap: 2px; font-size: .8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--live); color: var(--live-text); }
.live-chip .live-dot { background: var(--live-text); animation: none; width: 7px; height: 7px; margin-inline-end: 6px; }
.live-chip:hover { text-decoration: none; filter: brightness(1.08); }

/* Creator links */
.socials { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.social { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.social:hover { text-decoration: none; background: var(--surface-3); }
.social-platform { font-weight: 800; }
.social-handle { color: var(--muted); max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social.verified { color: var(--win); background: var(--win-soft); }
.social.verified .social-handle { color: inherit; }
.label-row { display: flex; align-items: center; gap: 8px; }
.vmini { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 700; color: var(--win); }

/* Fair play */
.fair-card .card-head { margin-bottom: 4px; }
.fair-card h2 { margin: 0; }
.fair-card .facts { border-top: 0; padding-top: 4px; }
.facts dd.bad { color: var(--loss); }
.honour { font-size: .75rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--win-soft); color: var(--win); }

/* Duel page */
.duel-panel { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.duel-panel h2 { font-size: 1.05rem; margin: 0; text-align: center; }
.center-col { align-items: center; text-align: center; }
.center-col p { margin: 0; }
.claim { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.proof-field, .proof-form label { width: 100%; }
.proof-form { max-width: 460px; margin-inline: auto; width: 100%; }
.dispute-banner { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; background: var(--warn-soft); color: var(--warn);
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 0; }
.dispute-banner span { color: var(--text); }
table.claims { min-width: 520px; }
.claims .note { max-width: 32ch; white-space: pre-line; }
.proof-link { font-weight: 600; }

/* Clan archive & invite link */
.chip-count { opacity: .65; font-weight: 600; margin-inline-start: 2px; }
.small-pill { margin-inline-start: 8px; vertical-align: 1px; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.history-list.two-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.former-row { padding: 6px 0; }
.invite-url { display: block; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); overflow-wrap: anywhere; font-size: .85rem; }
.danger-zone { border-color: color-mix(in srgb, var(--loss) 40%, var(--border)); }
.join-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-inline: auto; }
.join-card h1 { margin: 0; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.media-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media-thumb { position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.thumb-ph span { padding: 6px 12px; border-radius: 999px; background: var(--surface); font-size: .8rem; }
.platform-twitch .thumb-ph span { color: #8a5cf5; }
.platform-youtube .thumb-ph span { color: var(--live); }
.thumb-count { position: absolute; bottom: 8px; inset-inline-end: 8px; padding: 2px 8px; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #fff; font-size: .72rem; font-weight: 700; }
.media-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.media-title { color: var(--text); font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-meta { color: var(--muted); font-size: .8rem; }
.media-player { color: var(--text); font-weight: 700; }
.clip-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.vote { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 800; cursor: pointer; }
.vote:hover { background: var(--surface-2); }
.vote.voted { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.clip-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.clip-form label { display: flex; flex: 1 1 240px; }
.clip-form input { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; font: inherit; }
.clip-form input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.live-strip .card-head h2 { display: flex; align-items: center; }

/* Phase 3 layout fixes: more nav items, long button labels, phone layouts */
.main-nav a { padding: 8px 10px; font-size: .9rem; }
.header-search { flex: 1 1 120px; }
.duel-panel .btn { white-space: normal; max-width: 100%; text-align: center; line-height: 1.25; padding-block: 8px; }
.duel-panel .admin-box { flex-direction: column; align-items: stretch; }
.duel-panel .admin-box h2 { text-align: start; }
.duel-panel .admin-box .score-form { margin-inline: 0; align-items: flex-start; }
@media (max-width: 640px) {
  .versus { flex-direction: column; gap: 12px; }
  .table-scroll:has(table.claims) { overflow-x: visible; margin-inline: 0; }
  table.claims { min-width: 0; }
  table.claims thead { display: none; }
  table.claims, table.claims tbody, table.claims tr, table.claims td { display: block; width: 100%; }
  table.claims tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  table.claims tbody tr:last-child { border-bottom: 0; }
  table.claims td { border: 0; padding: 2px 0; text-align: start !important; background: none !important; }
  table.claims td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; font-size: .8rem; }
  .claims .note { max-width: none; }
}
.duel-panel .admin-box .actions { justify-content: flex-start; margin-top: 0; }

/* =========================================================================
   Phase 4: header on phones, tier lists, tournaments, clan news, Steam
   ========================================================================= */

:root { --tl-S: #ff6b6b; --tl-A: #ffa94d; --tl-B: #ffd43b; --tl-C: #69db7c; --tl-D: #74c0fc; --tl-ink: #17171a; }

/* Header: duels button with badge; one compact header on phones */
.duels-btn { position: relative; color: var(--text); }
.duels-btn:hover { text-decoration: none; }
.duels-btn[aria-current] { background: var(--text); color: var(--bg); }
.badge { position: absolute; top: -3px; inset-inline-end: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font-size: .66rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--header-bg); direction: ltr; unicode-bidi: isolate; }
.footer-color { display: none; }
@media (max-width: 760px) {
  .site-header { position: static; }
  .header-row { gap: 8px 10px; padding-block: 10px 8px; }
  .brand { order: 1; }
  .header-tools { order: 2; gap: 6px; }
  .main-nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px 24px; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { white-space: nowrap; flex: none; }
  .header-search { order: 4; }
  .header-tools .color-form, .user-drop { display: none; }
  .lang-form select { max-width: 112px; padding: 0 10px; }
  .footer-color { display: block; }
}

/* Page heads, sub navigation, card grid */
.page-head { display: flex; flex-direction: column; gap: 10px; }
.page-head h1, .page-head p { margin: 0; }
.subnav { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.profile-actions { align-items: flex-end; }
.explain summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary h2 { margin: 0; }
.explain summary::after { content: '+'; color: var(--muted); font-weight: 800; font-size: 1.2rem; }
.explain[open] summary::after { content: '–'; }
.explain-list { margin: 12px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); max-width: 75ch; }
.steps-list { color: var(--text); gap: 12px; }
.steps-list .btn { margin-inline-start: 6px; vertical-align: middle; }
.role-linked { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 0; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; }
.role-linked p { margin: 0; }

/* Players on Steam */
.players-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; margin: 0 0 18px; border-radius: 999px; font-size: .88rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); box-shadow: var(--shadow); }
.players-chip strong { color: var(--text); font-weight: 800; }
.players-chip:hover { text-decoration: none; border-color: var(--surface-3); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.players-card h2 { margin: 0; }
.players-now { display: flex; align-items: center; gap: 12px; margin: 10px 0 0; }
.players-value { font-family: var(--font-display); font-size: 3rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.players-card .facts { margin-top: 12px; }
.spark { position: relative; margin: 14px 0 0; }
.spark-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.spark-svg:focus-visible { outline-offset: 4px; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-base { stroke: var(--border); stroke-width: 1; }
.spark-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark-cross { stroke: var(--muted); stroke-width: 1; }
.spark-hit { fill: transparent; cursor: crosshair; }
.spark-tip { position: absolute; top: -6px; transform: translate(-50%, -100%); padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: .75rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); z-index: 2; }
.spark-tip strong { display: block; font-size: .95rem; }
.spark-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: .72rem; color: var(--muted); }

/* Tier lists */
.tl-S { background: var(--tl-S); color: var(--tl-ink); }
.tl-A { background: var(--tl-A); color: var(--tl-ink); }
.tl-B { background: var(--tl-B); color: var(--tl-ink); }
.tl-C { background: var(--tl-C); color: var(--tl-ink); }
.tl-D { background: var(--tl-D); color: var(--tl-ink); }
.tl-none { background: var(--surface-3); color: var(--muted); }
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.seg a { padding: 7px 14px; border-radius: 999px; color: var(--text); font-size: .85rem; font-weight: 700; }
.seg a:hover { text-decoration: none; background: var(--surface-3); }
.seg a[aria-current] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.chips-sm { margin: 0; }
.chips-sm a { padding: 5px 11px; font-size: .8rem; }
.tl { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.tl-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.tl-label { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.6rem; font-weight: 900; }
/* Pool of items without a tier: caption on top instead of a narrow label column, so long words
   ("eingestuft") never clip; hidden while empty. */
.tl-row.tl-pool { grid-template-columns: minmax(0, 1fr); }
.tl-pool .tl-label { justify-content: flex-start; padding: 10px 12px 0; background: none; font-family: var(--font); font-size: .7rem; font-weight: 800;
  letter-spacing: .06em; line-height: 1.2; text-align: start; text-transform: uppercase; }
.tl-pool:has(> .tl-items:empty) { display: none; }
.tl-items { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 8px; min-height: 92px; }
.tl-tile { position: relative; width: 84px; height: 84px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: center; transition: transform .12s, box-shadow .12s; }
.tl-tile:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }
.tl-tile:focus-visible { outline-offset: 1px; }
.tl-icon { width: 30px; height: 30px; flex: none; }
.tl-icon.sm { width: 22px; height: 22px; color: var(--muted); }
.tl-name { max-width: 100%; font-size: .7rem; font-weight: 700; line-height: 1.15; overflow-wrap: break-word; hyphens: manual;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-mine { position: absolute; top: -6px; inset-inline-end: -6px; width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 900; box-shadow: 0 0 0 2px var(--surface-2); }
.tl-mono { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.tl-map { --mh: 4; --map-s: 55%; --map-l: 93%; --mono-l: 36%; background: hsl(var(--mh) var(--map-s) var(--map-l)); border-color: transparent; }
.tl-map .tl-mono { color: hsl(var(--mh) 55% var(--mono-l)); }
@media (prefers-color-scheme: dark) { :root:not([data-color="light"]) .tl-map { --map-s: 26%; --map-l: 21%; --mono-l: 78%; } }
:root[data-color="dark"] .tl-map { --map-s: 26%; --map-l: 21%; --mono-l: 78%; }
.hue-0 { --mh: 4; } .hue-1 { --mh: 26; } .hue-2 { --mh: 45; } .hue-3 { --mh: 145; } .hue-4 { --mh: 174; } .hue-5 { --mh: 210; } .hue-6 { --mh: 262; } .hue-7 { --mh: 322; }
.tl-hint { margin-top: 12px; }
@media (max-width: 640px) {
  .tl-card { padding: 14px 10px; }
  .tl-row { grid-template-columns: 40px minmax(0, 1fr); }
  .tl-label { font-size: 1.25rem; }
  .tl-pool .tl-label { font-size: .62rem; padding: 8px 8px 0; }
  .tl-items { gap: 4px; padding: 5px; min-height: 80px; }
  .tl-tile { width: 62px; height: 72px; padding: 7px 2px 4px; gap: 4px; }
  .tl-icon { width: 24px; height: 24px; }
  .tl-mono { font-size: 1.15rem; }
  .tl-name { font-size: .6rem; }
  .tl-mine { width: 18px; height: 18px; top: -5px; inset-inline-end: -5px; font-size: .62rem; }
  .live-strip .media-grid { grid-auto-flow: column; grid-auto-columns: 78%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .live-strip .media-card { scroll-snap-align: start; }
}

/* Vote dialog (bottom sheet on phones) */
.vote-dialog { width: min(420px, calc(100vw - 24px)); padding: 20px; border: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35); }
.vote-dialog::backdrop { background: rgba(0, 0, 0, .45); }
@media (max-width: 640px) {
  .vote-dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
.vd-head { display: flex; align-items: center; gap: 12px; }
.vd-head h2 { margin: 0; font-size: 1.2rem; }
.vd-head p { margin: 2px 0 0; }
.vd-art, .tl-art { flex: none; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.vd-art { width: 52px; height: 52px; border-radius: 12px; }
.vd-art svg { width: 30px; height: 30px; }
.vd-community { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; }
.vd-tier, .tl-badge { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; flex: none; }
.dist { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.dist-seg { display: block; height: 100%; width: 0; }
.vd-q { margin: 18px 0 8px; font-weight: 700; }
.vd-tiers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tier-btn { width: 52px; height: 52px; border: 0; border-radius: 12px; font: inherit; font-family: var(--font-display); font-size: 1.35rem; font-weight: 900;
  cursor: pointer; transition: transform .1s; }
.tier-btn:hover { transform: translateY(-2px); }
.tier-btn[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: 2px; }
.tier-btn:disabled { opacity: .6; cursor: progress; }
.vd-clear { margin-top: 4px; padding-inline: 0; }
.vote-dialog .see-all { display: inline-block; margin-top: 12px; }

/* Tier item page */
.tl-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 8px; }
.tl-item-head h1 { margin: 0; }
.tl-item-head p { margin: 4px 0 0; }
.tl-art { width: 72px; height: 72px; border-radius: 16px; }
.tl-art .tl-icon { width: 42px; height: 42px; }
.tl-art .tl-mono { font-size: 1.8rem; }
.tl-item-tier { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tl-item-tier .tl-badge { min-width: 56px; height: 56px; border-radius: 14px; font-size: 1.8rem; }
.tl-dist-title { margin: 20px 0 10px; font-size: .95rem; }
.dist-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-width: 480px; }
.dist-rows li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 48px; align-items: center; gap: 10px; }
.dist-key { height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 900; }
.dist-track { height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.dist-fill { display: block; height: 100%; border-radius: 999px; }
.dist-pct { text-align: end; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-teaser { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

/* Tournaments */
.tour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tour-card { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--text); }
.tour-card:hover { text-decoration: none; background: var(--surface-3); }
.tour-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-name { font-size: 1.02rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.tour-winner { font-weight: 700; }
.crest-xs.official { background: var(--accent); color: var(--accent-text); font-size: .8rem; }
.pill.tour-open { background: var(--win-soft); color: var(--win); }
.pill.tour-running { background: var(--accent-soft); color: var(--accent); }
.pill.tour-finished { background: var(--surface-3); color: var(--muted); }
.pill.tour-cancelled { background: var(--loss-soft); color: var(--loss); }
.tour-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.tour-head h1 { margin-bottom: 8px; }
.tour-context { margin: -4px 0 10px; font-weight: 600; }
.champion { display: flex; align-items: center; gap: 14px; margin: 18px 0 0; padding: 14px 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--t-knight) 22%, var(--surface)), var(--surface-2)); }
.champion-cup { font-size: 2rem; line-height: 1; }
.champion strong { display: block; font-size: 1.3rem; letter-spacing: -0.02em; }
.radio-cards { flex-direction: row !important; flex-wrap: wrap; }
.form .radio-card { flex: 1 1 200px; flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; }
.form .radio-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.radio-card > span { display: flex; flex-direction: column; gap: 2px; }
.entry-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 16px; }
.entry-list li { padding: 4px 0; }

/* Bracket: columns per round, lines join each pair to the next game */
.bracket { display: flex; gap: 28px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; }
.b-round { flex: 0 0 214px; display: flex; flex-direction: column; scroll-snap-align: start; }
.b-title { height: 20px; margin: 0 0 6px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.b-col { flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.b-pair { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: space-around; }
.b-match { position: relative; display: block; margin: 5px 0; padding: 4px 0; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: .85rem; }
a.b-match:hover { text-decoration: none; background: var(--surface-3); }
.b-round:not(.b-final) .b-match::after { content: ''; position: absolute; inset-inline-start: 100%; top: 50%; width: 14px; border-top: 2px solid var(--border); }
.b-round:not(.b-final) .b-pair::after { content: ''; position: absolute; inset-inline-start: calc(100% + 14px); top: 25%; bottom: 25%; border-inline-start: 2px solid var(--border); }
.b-round + .b-round .b-match::before { content: ''; position: absolute; inset-inline-end: 100%; top: 50%; width: 14px; border-top: 2px solid var(--border); }
.b-side { display: grid; grid-template-columns: 22px minmax(0, 1fr) 26px; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-inline-start: 3px solid transparent; }
.b-side.won { border-inline-start-color: var(--win); }
.b-side.won .b-name, .b-side.won .b-score { font-weight: 800; }
.b-side.lost { color: var(--muted); }
.b-seed { text-align: center; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.b-score { text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.b-state { display: block; padding: 0 10px 2px 35px; font-size: .68rem; color: var(--muted); }
.b-state.warn { color: var(--warn); font-weight: 700; }
.b-side.bye .b-name { color: var(--muted); font-weight: 500; font-style: italic; }
@media (max-width: 640px) { .b-round { flex-basis: 176px; } .bracket { gap: 24px; } .b-round:not(.b-final) .b-match::after, .b-round + .b-round .b-match::before { width: 12px; }
  .b-round:not(.b-final) .b-pair::after { inset-inline-start: calc(100% + 12px); } }

/* Clan news */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post + .post { border-top: 1px solid var(--border); padding-top: 16px; }
.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.post-head .crest-xs:hover { text-decoration: none; }
.post-meta { flex: 1; min-width: 0; }
.post-meta a { color: var(--text); font-weight: 600; }
.post-meta a.via-discord, .via-discord { color: var(--discord); font-weight: 700; }
.post-title { margin: 8px 0 0; font-size: 1.05rem; }
.post-body { margin-top: 6px; line-height: 1.55; overflow-wrap: anywhere; }
.post-body code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.post-body small { color: var(--muted); }
.post-h1 { font-size: 1.15rem; } .post-h2 { font-size: 1.05rem; }
.post-quote { display: inline-block; padding-inline-start: 8px; border-inline-start: 3px solid var(--border); color: var(--muted); }
.post-img { display: inline-block; margin-top: 10px; }
.post-img img { display: block; max-width: 100%; max-height: 420px; width: auto; border-radius: var(--radius-sm); }
.post-compose { margin-bottom: 16px; }
.post-compose summary { list-style: none; }
.post-compose summary::-webkit-details-marker { display: none; }
.post-compose[open] summary { margin-bottom: 14px; }
.post-compose .hint { margin-top: 12px; }

/* News page */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 14px 0; border-top: 1px solid var(--border); }
.news-item:first-child { border-top: 0; padding-top: 4px; }
.news-title { color: var(--text); font-size: 1rem; font-weight: 800; line-height: 1.3; }
.news-summary { margin: 0; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pill-patch { background: var(--accent-soft); color: var(--accent); }
.link-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.link-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); }
.link-list a:hover { text-decoration: none; background: var(--surface-3); }

/* =========================================================================
   Phase 5a: admin area, announcement banner, report button, notices
   ========================================================================= */

:root { --gold: #a0700b; --gold-soft: #fbf1d9; --blue-soft: #ebf2ff; }
@media (prefers-color-scheme: dark) { :root:not([data-color="light"]) { --gold: #f0c35a; --gold-soft: #2c2410; --blue-soft: #142038; } }
:root[data-color="dark"] { --gold: #f0c35a; --gold-soft: #2c2410; --blue-soft: #142038; }

/* Announcement and maintenance bars */
.site-banner { border-bottom: 1px solid var(--border); font-size: .9rem; }
.banner-row { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.banner-text { flex: 1; min-width: 0; }
.banner-link { font-weight: 700; white-space: nowrap; }
.banner-icon { flex: none; }
.banner-close { flex: none; width: 32px; height: 32px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.banner-close:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.banner-info { background: var(--blue-soft); color: var(--text); }
.banner-warning { background: var(--warn-soft); color: var(--text); }
.banner-warning .banner-text strong { color: var(--warn); }
.banner-event { background: var(--accent-soft); color: var(--text); }
.banner-event .banner-link { color: var(--accent); }

/* Notice pages (ban, maintenance, paused team rights) */
.notice-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 36px; padding-bottom: 32px; }
.notice-card h1 { margin: 4px 0; }
.notice-card p { margin: 4px 0; max-width: 46ch; }
.notice-icon { font-size: 2.4rem; line-height: 1; }

/* Report button: a small disclosure that opens a form */
.report-box { position: relative; }
.report-box > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 32px; padding: 4px 6px; }
.report-box > summary::-webkit-details-marker { display: none; }
.report-box[open] > summary { color: var(--text); }
.report-form { margin-top: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); text-align: start; width: min(340px, 86vw); gap: 10px; }
.report-title { margin: 0; font-weight: 800; }
.profile-actions .report-box, .clan-head .report-box, .tour-head .report-box { align-self: flex-end; }
.profile-actions .report-form, .clan-head .report-form, .tour-head .report-form { position: absolute; inset-inline-end: 0; z-index: 20; }
.post-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.clip-actions { flex-wrap: wrap; }
.clip-actions .report-box { margin-inline-start: auto; }
.delete-box { margin-top: 12px; }
.delete-box > summary { cursor: pointer; display: inline-block; color: var(--loss); }
.delete-box[open] > summary { margin-bottom: 8px; }

/* Admin shell */
.admin-head { margin-bottom: 4px; }
.admin-head .kicker { margin: 0; }
.admin-nav { margin-top: 2px; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .72rem; font-weight: 800; line-height: 1; }
.chips a[aria-current] .count-badge { background: var(--accent); }
@media (max-width: 640px) {
  .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -14px; padding-inline: 14px; padding-bottom: 2px; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { white-space: nowrap; flex: none; }
}

.warn-card { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: var(--warn-soft); }
.warn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.warn-list li { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.warn-list a { white-space: nowrap; font-weight: 700; }
.warn-icon { flex: none; width: 22px; height: 22px; border-radius: 999px; background: var(--warn); color: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .8rem; }

.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-weight: 600; }
.todo-list a:hover { text-decoration: none; background: var(--surface-3); }
.todo-count { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; background: var(--accent); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.admin-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.admin-stats .stat { padding: 14px 16px; }
.admin-stats .stat-value { font-size: 1.5rem; }
.stat-sub { font-size: .8rem; color: var(--ok); font-weight: 600; margin-top: 2px; }
a.stat-link { color: var(--text); }
a.stat-link:hover { text-decoration: none; border-color: var(--text); }

/* Lists */
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list > li { border-top: 1px solid var(--border); padding: 10px 0; }
.admin-list > li:first-child { border-top: 0; padding-top: 0; }
.admin-list > li:last-child { padding-bottom: 0; }
.admin-row { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 2px 0; }
.admin-row:hover { text-decoration: none; }
.admin-row:hover strong { color: var(--accent); }
.admin-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.chev { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.log-row { display: flex; flex-direction: column; gap: 3px; }
.log-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.log-main a { font-weight: 600; overflow-wrap: anywhere; }
.log-meta { overflow-wrap: anywhere; }

.role-badge { font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.role-badge.role-owner { background: var(--gold-soft); color: var(--gold); }
.role-badge.role-admin { background: var(--accent-soft); color: var(--accent); }
.role-badge.role-moderator { background: var(--blue-soft); color: var(--win); }
.role-badge.role-referee { background: var(--win-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--loss-soft); color: var(--loss); }
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.text-danger { color: var(--loss); font-weight: 600; }

.admin-user-head { display: flex; gap: 18px; align-items: flex-start; }
.admin-user-head .avatar, .admin-user-head .crest { flex: none; }
.admin-user-head .grow { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.admin-facts { border-top: 0; padding-top: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 24px; }
.admin-facts div { min-width: 0; }
.admin-facts dd { overflow-wrap: anywhere; }
@media (max-width: 560px) { .admin-user-head { flex-direction: column; gap: 12px; } }

/* Reports */
.report-card { display: flex; flex-direction: column; gap: 10px; }
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.report-target { font-weight: 700; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; }
.report-count { font-weight: 800; color: var(--accent); white-space: nowrap; }
.report-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.report-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.report-items li { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.report-quote { font-size: .9rem; overflow-wrap: anywhere; }
.report-quote::before, .report-quote::after { content: none; }
.close-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; border-top: 1px solid var(--border); }
.close-form input { width: 100%; min-height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.close-form .grow { flex: 1 1 220px; }

/* Settings */
.settings-jump { margin-bottom: 0; }
.settings-jump a { font-size: .8rem; padding: 6px 12px; }
.switch-row { align-items: flex-start !important; gap: 10px; }
.switch-row input { margin-top: 3px; }
.hint.block { display: block; margin-top: 2px; }
.translations { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.translations > summary { cursor: pointer; font-weight: 600; }
.translations[open] { display: flex; flex-direction: column; gap: 12px; }
.cleanup-row { margin-top: 12px; }
.perm-table { min-width: 520px; }
.perm-table td, .perm-table th { padding: 9px 8px; }
.perm-table .center { text-align: center; }
.perm-table .yes { color: var(--ok); font-weight: 900; }
.check-dot { flex: none; width: 24px; height: 24px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: .8rem;
  background: var(--surface-3); color: var(--muted); }
.check-dot.ok { background: var(--win-soft); color: var(--ok); }
.check-dot.bad { background: var(--loss-soft); color: var(--loss); }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: 0 4px; }

/* =========================================================================
   Phase 5b: free-form clan tags, clan search, claims, players looking for a clan
   ========================================================================= */

/* Crests fit tags of 1–8 characters: long tags get smaller letters or a wider pill */
.crest, .crest-sm, .crest-xs { white-space: nowrap; overflow: hidden; letter-spacing: 0; }
.crest[data-len="1"] { font-size: 1.35rem; }
.crest[data-len="5"] { font-size: .74rem; }
.crest[data-len="6"] { font-size: .64rem; }
.crest[data-len="7"], .crest[data-len="8"] { font-size: .56rem; }
.crest-lg[data-len="1"] { font-size: 2.4rem; }
.crest-lg[data-len="2"] { font-size: 1.6rem; }
.crest-lg[data-len="5"] { font-size: 1.05rem; }
.crest-lg[data-len="6"] { font-size: .92rem; }
.crest-lg[data-len="7"], .crest-lg[data-len="8"] { font-size: .8rem; }
.crest-sm[data-len="1"] { font-size: 1.05rem; }
.crest-sm[data-len="5"], .crest-sm[data-len="6"], .crest-sm[data-len="7"], .crest-sm[data-len="8"] { width: auto; min-width: 40px; padding: 0 7px; }
.crest-xs[data-len="1"] { font-size: .8rem; }
.crest-xs[data-len="4"], .crest-xs[data-len="5"], .crest-xs[data-len="6"], .crest-xs[data-len="7"], .crest-xs[data-len="8"] { width: auto; min-width: 28px; padding: 0 5px; }
.tag-text { font-size: 1.05em; }
.tag-field { flex: 0 1 150px !important; }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.filter-bar select { appearance: none; min-height: 38px; padding: 0 30px 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; max-width: 100%; }
[dir="rtl"] .filter-bar select { padding: 0 12px 0 30px; background-position: left 12px center; }
.filter-check { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; min-height: 38px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); }
.clan-meta { display: block; }

/* Multi-select checkboxes */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-weight: 600; font-size: .9rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 14px; }
.check-grid label.check { font-weight: 500; }

/* Players looking for a clan */
.lfc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.lfc-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.lfc-rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lfc-note { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }

/* Claims */
.claim-card { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.claim-card h2 { margin-top: 0; }
.claim-row { display: flex; flex-direction: column; gap: 8px; }
.claim-wish { margin: 0; }
.mono-input { font-family: var(--mono); font-size: .9rem; }

/* Phones: clan cards as compact rows (crest left, text right) */
@media (max-width: 600px) {
  .clan-grid { grid-template-columns: 1fr; gap: 8px; }
  .clan-card { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 14px; row-gap: 3px; align-items: center; padding: 12px 14px; }
  .clan-card > .crest { grid-row: 1 / span 4; margin: 0; }
  .clan-card > :not(.crest) { grid-column: 2; justify-self: start; }
}

/* =========================================================================
   Phase 6: duel board ("looking for a duel now")
   ========================================================================= */

.lead-sm { color: var(--muted); margin: -2px 0 16px; max-width: 72ch; }
.lfg-form .lfg-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
@media (max-width: 720px) { .lfg-form .lfg-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lfg-form select { width: 100%; }
.lfg-grid { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lfg-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); scroll-margin-top: 90px; }
.lfg-card:target { border-color: var(--ok); }
.lfg-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lfg-top .player-link { min-width: 0; }
.lfg-rating { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.lfg-meta { margin: 0; }
.lfg-note { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
.lfg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 10px; flex-wrap: wrap; margin-top: auto; padding-top: 2px; }
.lfg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; animation: lfg-pulse 2s ease-out infinite; }
@keyframes lfg-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .lfg-dot { animation: none; } }
.lfg-live { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.lfg-mine { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--border)); border-radius: var(--radius-sm); }
.lfg-mine h3 { margin: 8px 0 0; font-size: .95rem; }
.lfg-incoming li { gap: 8px; }
.lfg-mine-actions { align-items: flex-start; }
.lfg-edit { flex: 0 1 auto; }
.lfg-edit[open] { flex-basis: 100%; }
.lfg-edit > summary { list-style: none; cursor: pointer; display: inline-flex; }
.lfg-edit > summary::-webkit-details-marker { display: none; }
.lfg-edit[open] > summary { margin-bottom: 12px; }
.lfg-strip { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--ok) 40%, var(--border)); color: var(--text); font-weight: 600; }
.lfg-strip:hover { text-decoration: none; background: var(--surface-2); }
.lfg-strip-cta { color: var(--accent); white-space: nowrap; }
.lfg-pill { display: inline-flex; align-items: center; padding: 1px 6px; margin-inline-start: 6px; border-radius: 4px; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok);
  font-size: .62rem; font-weight: 800; letter-spacing: .05em; line-height: 1.5; vertical-align: middle; }
.lfg-profile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }


/* =========================================================================
   Phase 6: calendar
   ========================================================================= */

.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal-item { display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cal-item:last-child { border-bottom: 0; }
.cal-when { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.cal-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-title { font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.cal-item.cancelled .cal-title, .cal-item.cancelled .cal-when { text-decoration: line-through; color: var(--muted); }
@media (max-width: 600px) {
  .cal-item { grid-template-columns: minmax(0, 1fr) auto; }
  .cal-when { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
}
.cal-grid { align-items: start; }
.cal-sub { display: flex; flex-direction: column; gap: 10px; }
.cal-link { display: flex; gap: 8px; align-items: center; }
.cal-link input { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: .8rem; }
.cal-add { white-space: nowrap; }

/* =========================================================================
   Phase 6: notifications, app
   ========================================================================= */

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif-link { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 6px; color: var(--text); border-radius: var(--radius-sm); }
.notif-link:hover { background: var(--surface-2); text-decoration: none; }
.notif-icon { font-size: 1.1rem; text-align: center; }
.notif-text { overflow-wrap: anywhere; }
.notif.unread .notif-text { font-weight: 700; }
.notif.unread .notif-icon { position: relative; }
.notif.unread .notif-icon::after { content: ''; position: absolute; top: -2px; inset-inline-end: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (max-width: 600px) {
  .notif-link { grid-template-columns: 28px minmax(0, 1fr); }
  .notif-time { grid-column: 2; }
}
.notif-move { margin-bottom: 0; }
.install-steps li { padding: 4px 0; }
.offline-page { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 40px 16px; }

