/* ============================================================
   Os Primim Dashboard – Stylesheet
   Adapted from mails-bot's CoC dashboard
   ============================================================ */

:root {
  --c-bg:       #0b0b18;
  --c-surface:  #12122a;
  --c-card:     #191930;
  --c-card2:    #1e1e38;
  --c-border:   rgba(255,255,255,0.07);
  --c-border2:  rgba(255,255,255,0.04);
  --c-text:     #dde0f0;
  --c-muted:    #7a7a9a;
  --c-dim:      #4a4a6a;

  --c-gold:     #f0a020;
  --c-gold-d:   #c07810;
  --c-green:    #3dc870;
  --c-red:      #e84545;
  --c-orange:   #f08020;
  --c-blue:     #4e8ef7;
  --c-purple:   #a855f7;

  --nav-h: 56px;
  --r:     8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.55);
}

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

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--c-text); text-decoration: none; }
a:hover { color: var(--c-gold); }
code {
  background: var(--c-card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Consolas', monospace;
}

/* ── Navigation ─────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--c-text);
  font-weight: 700;
  font-size: 15px;
  margin-right: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}
.navbar-brand img {
  width: 34px; height: 34px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--c-card2);
}
.navbar-brand .brand-name { color: var(--c-gold); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--c-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--c-text); background: var(--c-card); }
.nav-link.active { color: var(--c-gold); background: rgba(240,160,32,0.1); }
.nav-icon { font-size: 15px; }

.navbar-search {
  margin-left: auto;
  margin-right: 12px;
  flex-shrink: 0;
}
.navbar-search-input {
  background: var(--c-card2);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: inherit;
  width: 180px;
  transition: border-color .15s, width .2s;
}
.navbar-search-input:focus {
  outline: none;
  border-color: var(--c-gold);
  width: 240px;
}
.navbar-search-input::placeholder { color: var(--c-dim); }

.navbar-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--c-muted);
}
.navbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-card2);
}
.navbar-user .username { color: var(--c-text); font-weight: 500; }

/* ── Layout ──────────────────────────────────────────────── */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px;
}
.page-meta {
  font-size: 12px;
  color: var(--c-dim);
  margin-bottom: 18px;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(520px,100%), 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px,100%), 1fr)); gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mb-16  { margin-bottom: 16px; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--c-card);
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 16px 18px; }
.card-body-flush { padding: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s, filter 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn-gold     { background: var(--c-gold); color: #000; }
.btn-primary  { background: var(--c-gold); color: #000; }
.btn-ghost    { background: transparent; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-ghost:hover { background: var(--c-card2); filter: none; }
.btn-sm       { padding: 6px 12px; font-size: 12px; }

/* ── Clan hero ───────────────────────────────────────────── */
.clan-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 18px 20px;
  background: var(--c-card);
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow);
}
.clan-hero img.clan-badge {
  width: 72px; height: 72px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--c-surface);
  flex-shrink: 0;
}
.clan-hero-body { flex: 1; min-width: 0; }
.clan-hero-name {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clan-hero-tag { font-size: 12px; color: var(--c-muted); margin-bottom: 8px; }
.clan-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--c-muted);
}
.clan-hero-pill {
  background: var(--c-surface);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 4px;
}
.clan-hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.hs { text-align: center; }
.hs-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-gold);
  line-height: 1;
}
.hs-lbl {
  font-size: 10px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

/* ── Stat boxes ──────────────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--c-surface);
  border-radius: 6px;
  padding: 10px 14px;
  flex: 1;
  min-width: 110px;
  border: 1px solid var(--c-border);
}
.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin-bottom: 4px;
}
.stat-val { font-size: 20px; font-weight: 700; color: #fff; }
.stat-sub { font-size: 10px; color: var(--c-muted); margin-top: 1px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  vertical-align: middle;
  letter-spacing: 0.03em;
}
.b-win, .badge-win   { background: rgba(61,200,112,.2);  color: var(--c-green); border: 1px solid rgba(61,200,112,.35); }
.b-lose, .badge-loss { background: rgba(232,69,69,.2);   color: var(--c-red);   border: 1px solid rgba(232,69,69,.35); }
.b-tie, .badge-tie   { background: rgba(240,160,32,.2);  color: var(--c-gold);  border: 1px solid rgba(240,160,32,.35); }
.badge-cwl           { background: rgba(168,85,247,.2);  color: var(--c-purple); border: 1px solid rgba(168,85,247,.35); }

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.r-leader,   .role-leader   { background: rgba(240,160,32,.2);   color: var(--c-gold); }
.r-coLeader, .role-co       { background: rgba(232,69,69,.2);    color: var(--c-red); }
.r-elder,    .role-admin    { background: rgba(78,142,247,.2);   color: var(--c-blue); }
.r-member,   .role-member   { background: rgba(120,120,154,.15); color: var(--c-muted); }

.th-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(240,160,32,.15);
  color: var(--c-gold);
  border: 1px solid rgba(240,160,32,.3);
  padding: 0 4px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.dt th {
  text-align: left;
  padding: 8px 10px;
  color: var(--c-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
  user-select: none;
}
table.dt td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
table.dt tr:last-child td { border-bottom: none; }
table.dt tbody tr:hover td { background: var(--c-card2); }
.c-pos  { color: var(--c-dim); font-size: 12px; width: 40px; }
.c-name { font-weight: 600; color: #fff; }
.c-r    { text-align: right; }
.c-c    { text-align: center; }

/* ── Member link ─────────────────────────────────────────── */
.member-link {
  color: var(--c-text);
  text-decoration: none;
  transition: color 0.15s;
}
.member-link:hover { color: var(--c-gold); text-decoration: underline; }

.check-mark {
  background: var(--c-green);
  color: #0f1d12;
  width: 14px; height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── League icon ─────────────────────────────────────────── */
.league-icon-sm { width: 20px; height: 20px; vertical-align: middle; object-fit: contain; }
.league-icon-md { width: 32px; height: 32px; flex-shrink: 0; object-fit: contain; }
.league-icon-xl { width: 92px; height: 92px; object-fit: contain; }

/* ── Section label ───────────────────────────────────────── */
.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  margin: 14px 0 8px;
}

/* ── Player hero (profile) ───────────────────────────────── */
.player-hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--c-card);
  border-radius: var(--r);
  border: 1px solid var(--c-border);
}
.player-th {
  width: 72px; height: 72px;
  border-radius: 10px;
  background: var(--c-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: var(--c-gold);
  border: 2px solid rgba(240,160,32,.3);
  flex-shrink: 0;
}
.player-body { flex: 1; min-width: 0; }
.player-name { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.player-tag  { font-size: 12px; color: var(--c-muted); margin-bottom: 8px; }
.player-pills { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--c-muted); }
.player-pill {
  background: var(--c-surface);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 4px;
}
.player-pill img {
  width: 16px; height: 16px;
  object-fit: contain;
  border-radius: 3px;
}
.player-league {
  text-align: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.player-league-name { font-size: 12px; font-weight: 600; color: var(--c-text); }
.player-league-sub { font-size: 11px; color: var(--c-muted); }

/* ── Heroes ──────────────────────────────────────────────── */
.heroes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.hero-card {
  background: var(--c-surface);
  border-radius: 6px;
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--c-border);
}
.hero-card.hero-maxed { border-color: rgba(61,200,112,.5); }
.hero-name {
  font-size: 10px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-lvl  { font-size: 26px; font-weight: 700; color: var(--c-gold); line-height: 1; }
.hero-max  { font-size: 10px; color: var(--c-dim); margin-top: 1px; }

/* ── Unit grid (troops, spells, equipment) ───────────────── */
.units-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 12px;
}
.unit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80px;
  padding: 7px 5px 6px;
  background: var(--c-card2);
  border: 1px solid var(--c-border);
  border-radius: 7px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.unit-card:hover { border-color: rgba(240,160,32,.3); }
.unit-card.unit-maxed {
  border-color: rgba(61,200,112,.4);
  background: rgba(61,200,112,.06);
}
.unit-name {
  color: var(--c-muted);
  font-size: 9px;
  line-height: 1.2;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}
.unit-lvl {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 1px;
}
.unit-max  { font-size: 9px; color: var(--c-muted); font-weight: 400; }

/* ── Progress bars ───────────────────────────────────────── */
.prog-wrap { margin: 6px 0; }
.prog-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.prog-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.prog-gold   { background: linear-gradient(90deg, var(--c-gold-d), var(--c-gold)); }
.prog-green  { background: linear-gradient(90deg, #27a055, var(--c-green)); }
.prog-red    { background: linear-gradient(90deg, #b02020, var(--c-red)); }
.prog-blue   { background: linear-gradient(90deg, #2255cc, var(--c-blue)); }
.prog-purple { background: linear-gradient(90deg, #7020cc, var(--c-purple)); }

/* ── Forms (Admin) ───────────────────────────────────────── */
.form-grid    { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-grid-2  { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.form-row     { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 500; font-size: 13px; color: var(--c-text); }
.form-row-divider { border-top: 1px solid var(--c-border); padding-top: 16px; margin-top: 4px; }

.select, .input-group input, input[type="text"], input[type="number"] {
  background: var(--c-card2);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.select:focus, .input-group input:focus, input:focus {
  outline: none;
  border-color: var(--c-gold);
}
.select option { background: var(--c-card); }
.select optgroup { color: var(--c-muted); font-weight: 600; }

.input-group {
  display: flex; align-items: stretch;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
}
.input-group input { border: none; border-radius: 0; }
.input-suffix {
  padding: 10px 14px;
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 13px;
  border-left: 1px solid var(--c-border);
}
.form-actions {
  display: flex; gap: 12px; margin-top: 20px;
  position: sticky; bottom: 0;
  padding: 16px 0;
  background: linear-gradient(to top, var(--c-bg) 60%, transparent);
}
.readonly {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 24px;
}
.readonly > div { display: flex; flex-direction: column; }
.readonly dt { color: var(--c-muted); font-size: 11px; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.05em; }
.readonly dd { font-size: 14px; color: var(--c-text); }
.big-num { font-size: 22px; font-weight: 700; color: var(--c-gold); }

/* ── Flash banner ────────────────────────────────────────── */
.flash {
  padding: 14px 18px;
  border-radius: var(--r);
  margin-bottom: 20px;
  border: 1px solid;
}
.flash-success {
  background: rgba(61,200,112,.08);
  color: var(--c-green);
  border-color: rgba(61,200,112,.3);
}
.flash-error {
  background: rgba(232,69,69,.08);
  color: var(--c-red);
  border-color: rgba(232,69,69,.3);
}

/* ── Misc info boxes ─────────────────────────────────────── */
.error-box {
  background: rgba(232,69,69,.1);
  border: 1px solid rgba(232,69,69,.3);
  border-radius: var(--r);
  padding: 14px 18px;
  color: var(--c-red);
  margin-bottom: 16px;
}
.info-box {
  background: rgba(78,142,247,.08);
  border: 1px solid rgba(78,142,247,.2);
  border-radius: var(--r);
  padding: 14px 18px;
  color: var(--c-blue);
  margin-bottom: 16px;
}
.empty-box {
  text-align: center;
  padding: 60px 24px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  color: var(--c-muted);
}
.empty-box h2 { color: var(--c-text); margin-bottom: 8px; }

.player-link { color: var(--c-text); text-decoration: none; }
.player-link:hover { color: var(--c-gold); }

.text-muted  { color: var(--c-muted); }
.text-dim    { color: var(--c-dim); }
.text-gold   { color: var(--c-gold); }
.text-green  { color: var(--c-green); }
.text-red    { color: var(--c-red); }
.text-orange { color: var(--c-orange); }
.text-purple { color: var(--c-purple); }
.text-blue   { color: var(--c-blue); }
.fw7 { font-weight: 700; }

/* ── Landing hero ────────────────────────────────────────── */
.lp-hero {
  background: linear-gradient(135deg, #0e0e22 0%, #13132c 55%, #181030 100%);
  border: 1px solid rgba(240,160,32,.22);
  border-radius: var(--r);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lp-hero-inner {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 28px 28px 16px;
  position: relative;
}
.lp-hero-glow {
  position: absolute;
  top: -80px; left: -80px;
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(240,160,32,.14) 0%, transparent 70%);
  pointer-events: none;
}
.lp-badge {
  width: 100px; height: 100px;
  border-radius: 14px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 20px rgba(240,160,32,.35));
}
.lp-info { flex: 1; min-width: 0; }
.lp-name {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin-bottom: 6px;
}
.lp-tag {
  font-size: 12px;
  color: var(--c-dim);
  font-family: Consolas, monospace;
  margin-bottom: 10px;
}
.lp-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lp-pill {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  font-size: 12px;
  color: var(--c-muted);
}
.lp-desc {
  font-size: 12px;
  color: var(--c-muted);
  line-height: 1.5;
  max-width: 520px;
}
.lp-war-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
  background: rgba(0,0,0,.2);
  border-left: 1px solid var(--c-border);
  padding: 20px 24px;
  border-radius: 0 var(--r) 0 0;
}
.lp-winbar {
  padding: 14px 28px;
  border-top: 1px solid var(--c-border);
  background: rgba(0,0,0,.15);
}
.lp-winbar-track {
  height: 5px;
  background: rgba(255,255,255,.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.lp-winbar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}
.lp-winbar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--c-muted);
}

/* card with left accent border */
.card-accent {
  border-left: 3px solid var(--accent, var(--c-border));
}

/* ── Home banner (legacy) ─────────────────────────────────── */
.home-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
  border: 1px solid rgba(240,160,32,.25);
  margin-bottom: 16px;
  box-shadow: 0 6px 32px rgba(0,0,0,.6);
  background: linear-gradient(135deg, #16162e 0%, #1a1a38 60%, #1e1832 100%);
}
.home-banner-glow {
  position: absolute;
  top: -60px; left: -60px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(240,160,32,.18) 0%, transparent 70%);
  pointer-events: none;
}
.home-banner-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px 24px 16px;
}
.home-body  { flex: 1; min-width: 0; }
.home-name  { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 8px; letter-spacing: -0.5px; }
.home-meta  { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.home-pill  {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  font-size: 12px;
  color: var(--c-muted);
}
.home-desc  { font-size: 12px; color: var(--c-muted); margin-top: 4px; line-height: 1.5; }
.home-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.home-hint    { font-size: 12px; color: var(--c-muted); margin-top: 10px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.quick-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--c-card);
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  text-decoration: none;
  color: var(--c-text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.quick-card:hover {
  background: var(--c-card2);
  border-color: rgba(240,160,32,.3);
  transform: translateY(-1px);
  color: var(--c-text);
}
.quick-icon  { font-size: 22px; margin-bottom: 4px; }
.quick-title { font-size: 14px; font-weight: 700; color: #fff; }
.quick-desc  { font-size: 11px; color: var(--c-muted); }

/* ── War Map ─────────────────────────────────────────────── */
.wm-container { background:var(--c-card); border:1px solid var(--c-border); border-radius:var(--r); overflow:hidden; margin-bottom:4px; }
.wm-header { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:12px; padding:14px 16px; background:linear-gradient(135deg,rgba(20,20,50,.6),rgba(30,24,50,.6)); border-bottom:1px solid var(--c-border); }
.wm-header-side { display:flex; align-items:center; gap:10px; min-width:0; }
.wm-header-side-r { justify-content:flex-end; flex-direction:row-reverse; }
.wm-badge-img { width:48px; height:48px; object-fit:contain; border-radius:6px; flex-shrink:0; }
.wm-header-name { font-size:15px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wm-header-sub  { font-size:11px; color:var(--c-muted); }
.wm-name-r { text-align:right; }
.wm-header-score { text-align:center; flex-shrink:0; display:flex; flex-direction:column; align-items:center; gap:4px; }
.wm-score-block  { display:flex; align-items:center; gap:8px; }
.wm-score-stars  { font-size:20px; font-weight:800; color:var(--c-muted); }
.wm-score-lead   { color:var(--c-gold); }
.wm-score-sep    { font-size:18px; font-weight:700; color:var(--c-dim); }
.wm-score-destr  { font-size:11px; color:var(--c-muted); }
.wm-infobar { display:flex; justify-content:space-between; align-items:center; padding:7px 14px; background:rgba(0,0,0,.2); border-top:1px solid var(--c-border); font-size:12px; color:var(--c-muted); flex-wrap:wrap; gap:6px; }
.wm-ib-atts { font-weight:700; color:var(--c-gold); }
.wm-legend { display:flex; flex-wrap:wrap; gap:8px; padding:7px 16px; border-bottom:1px solid var(--c-border); background:rgba(255,255,255,.02); }
.wm-leg { font-size:11px; padding:2px 8px; border-radius:4px; border-left:3px solid; }
.wm-leg.wm-3star { border-color:var(--c-green); background:rgba(61,200,112,.08); }
.wm-leg.wm-2star { border-color:var(--c-gold);  background:rgba(240,160,32,.08); }
.wm-leg.wm-1star { border-color:#a07820;         background:rgba(160,120,32,.08); }
.wm-leg.wm-0star { border-color:#884444;         background:rgba(136,68,68,.08); }
.wm-leg.wm-none  { border-color:var(--c-dim);    background:rgba(255,255,255,.03); }
.wm-field { padding:8px 10px; display:flex; flex-direction:column; gap:5px; }
.wm-row   { display:grid; grid-template-columns:minmax(0,1fr) 6px minmax(0,1fr); gap:4px; align-items:stretch; }
.wm-vsline { width:6px; background:linear-gradient(180deg,rgba(255,200,0,.08),rgba(255,200,0,.18),rgba(255,200,0,.08)); border-radius:3px; align-self:stretch; }
.wm-card { border-radius:7px; border:1px solid var(--c-border); padding:7px 9px; background:var(--c-card2); transition:background .15s; min-height:58px; min-width:0; overflow:hidden; }
.wm-card:hover { background:rgba(255,255,255,.06); }
.wm-card-top   { display:flex; align-items:center; gap:6px; margin-bottom:5px; }
.wm-card-top-r { flex-direction:row-reverse; }
.wm-pos  { font-size:10px; font-weight:700; color:var(--c-muted); flex-shrink:0; min-width:24px; }
.wm-name { font-size:12px; font-weight:600; color:#ddd; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.wm-sec-label { font-size:9px; color:var(--c-muted); text-transform:uppercase; letter-spacing:.4px; margin-top:4px; margin-bottom:2px; }
.wm-def-lbl   { color:rgba(200,200,200,.35); }
.wm-chips   { display:flex; flex-wrap:wrap; gap:3px; }
.wm-chips-r { justify-content:flex-end; }
.wm-def-chips { display:flex; flex-wrap:wrap; gap:3px; margin-top:2px; opacity:.6; }
.wm-chip { display:inline-flex; align-items:center; gap:3px; font-size:10px; padding:1px 6px; border-radius:10px; font-weight:600; }
.wm-chip-stars  { font-size:9px; letter-spacing:-.5px; }
.wm-chip-target { color:rgba(255,255,255,.7); }
.wm-chip-pct    { color:rgba(255,255,255,.5); font-size:9px; }
.chip-3 { background:rgba(61,200,112,.2);  border:1px solid rgba(61,200,112,.5);  color:var(--c-green); }
.chip-2 { background:rgba(240,160,32,.18); border:1px solid rgba(240,160,32,.4);  color:var(--c-gold); }
.chip-1 { background:rgba(200,140,40,.14); border:1px solid rgba(200,140,40,.3);  color:#c8a028; }
.chip-0 { background:rgba(180,60,60,.14);  border:1px solid rgba(180,60,60,.3);   color:#c06060; }
.wm-noatt { font-size:10px; color:var(--c-muted); font-style:italic; }
.wm-3star { border-left:3px solid var(--c-green); }
.wm-2star { border-left:3px solid var(--c-gold); }
.wm-1star { border-left:3px solid #a07820; }
.wm-0star { border-left:3px solid #884444; }
.wm-none  { border-left:3px solid var(--c-dim); }
.wm-card-them.wm-3star { border-right:3px solid var(--c-green); border-left:none; }
.wm-card-them.wm-2star { border-right:3px solid var(--c-gold);  border-left:none; }
.wm-card-them.wm-1star { border-right:3px solid #a07820;        border-left:none; }
.wm-card-them.wm-0star { border-right:3px solid #884444;        border-left:none; }
.wm-card-them.wm-none  { border-right:3px solid var(--c-dim);   border-left:none; }

/* ── Capital Raid Weekend ────────────────────────────────── */
.b-inwar { background: rgba(232,69,69,.2);   color: var(--c-red);   border: 1px solid rgba(232,69,69,.35); }
.b-ended { background: rgba(61,200,112,.2);  color: var(--c-green); border: 1px solid rgba(61,200,112,.35); }

.raid-details {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
}
.raid-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background .15s;
}
.raid-summary::marker            { display: none; }
.raid-summary::-webkit-details-marker { display: none; }
.raid-summary:hover { background: var(--c-card2); }
.raid-details[open] .raid-summary { border-bottom: 1px solid var(--c-border); }
.raid-sum-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.raid-arrow {
  font-size: 10px;
  color: var(--c-muted);
  transition: transform .2s;
  display: inline-block;
}
.raid-details[open] .raid-arrow { transform: rotate(90deg); }
.raid-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.raid-sum-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.raid-pill {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 20px;
  background: rgba(255,255,255,.07);
  color: var(--c-text);
  white-space: nowrap;
}
.raid-pill-gold  { background: rgba(240,160,32,.18); color: var(--c-gold);  font-weight: 700; }
.raid-pill-green { background: rgba(61,200,112,.18); color: var(--c-green); font-weight: 600; }
.raid-pill-red   { background: rgba(220,60,60,.18);  color: #f06060;        font-weight: 600; }
.raid-body { padding: 14px 16px 16px; }
.raid-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.raid-stat {
  background: var(--c-card2);
  border: 1px solid var(--c-border);
  border-radius: 7px;
  padding: 7px 12px;
  min-width: 90px;
  text-align: center;
}
.raid-stat-lbl { font-size: 11px; color: var(--c-muted); margin-bottom: 2px; }
.raid-stat-val { font-size: 16px; font-weight: 700; color: #fff; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--c-border);
  padding: 24px 20px;
  margin-top: 60px;
  color: var(--c-dim);
  font-size: 12px;
  text-align: center;
}

/* ── Search page ─────────────────────────────────────────── */
.search-hero {
  background: linear-gradient(135deg, var(--c-card) 0%, var(--c-card2) 100%);
  border: 1px solid rgba(240,160,32,.2);
  border-radius: var(--r);
  padding: 28px 24px 20px;
  margin-bottom: 24px;
}
.search-hero-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.search-hero-sub {
  font-size: 13px;
  color: var(--c-muted);
  margin-bottom: 18px;
}
.search-form { display: flex; flex-direction: column; gap: 12px; }
.search-input-row { display: flex; gap: 8px; }
.search-input {
  flex: 1;
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color .15s;
}
.search-input:focus { outline: none; border-color: var(--c-gold); }
.search-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.search-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.search-filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  font-weight: 600;
}
.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--c-card2);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.search-chip input[type="radio"] { display: none; }
.search-chip.active,
.search-chip:has(input:checked) {
  background: rgba(240,160,32,.15);
  border-color: rgba(240,160,32,.45);
  color: var(--c-gold);
}
.search-chip:hover { border-color: rgba(240,160,32,.3); color: var(--c-text); }
.search-num-input {
  width: 56px;
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
}
.search-num-input:focus { outline: none; border-color: var(--c-gold); }

/* hint cards */
.search-hint { margin-top: 16px; }
.search-hint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.search-hint-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 18px;
}
.search-hint-icon  { font-size: 28px; margin-bottom: 8px; }
.search-hint-title { font-size: 14px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.search-hint-body  { font-size: 12px; color: var(--c-muted); line-height: 1.6; }

/* player result card */
.search-player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--c-text);
  transition: border-color .15s, background .15s;
  margin-bottom: 4px;
}
.search-player-card:hover { border-color: rgba(240,160,32,.4); background: var(--c-card2); color: var(--c-text); }
.search-player-name { font-size: 18px; font-weight: 700; color: #fff; }
.search-player-tag  { font-size: 11px; color: var(--c-dim); font-family: Consolas, monospace; }
.search-player-clan { font-size: 12px; color: var(--c-muted); margin-top: 2px; display:flex; align-items:center; gap:4px; }
.search-player-stats { display: flex; align-items: center; gap: 8px; }
.search-arrow { font-size: 18px; color: var(--c-gold); margin-left: 8px; }

/* clan result grid */
.search-clan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.search-clan-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s;
}
.search-clan-card:hover { border-color: rgba(240,160,32,.3); }
.search-clan-top  { display: flex; gap: 12px; align-items: flex-start; }
.search-clan-badge { width: 52px; height: 52px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.search-clan-name { font-size: 15px; font-weight: 700; color: #fff; }
.search-clan-tag  { font-size: 11px; color: var(--c-dim); font-family: Consolas, monospace; margin-bottom: 4px; }
.search-clan-desc { font-size: 11px; color: var(--c-muted); line-height: 1.4; }
.search-clan-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.search-clan-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  color: var(--c-muted);
  white-space: nowrap;
}
.search-clan-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Leaderboard ─────────────────────────────────────────── */
.leaderboard { list-style: none; padding: 0; }
.leaderboard li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border2);
}
.leaderboard li:last-child { border-bottom: none; }
.leaderboard .rank {
  background: var(--c-card2);
  border-radius: 6px;
  width: 28px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  padding: 3px 0;
  color: var(--c-muted);
}
.leaderboard li:nth-child(1) .rank { background: rgba(240,160,32,.25); color: var(--c-gold); }
.leaderboard li:nth-child(2) .rank { background: rgba(180,180,200,.18); color: #d0d0e0; }
.leaderboard li:nth-child(3) .rank { background: rgba(200,140,40,.18); color: #c8a028; }
.leaderboard .name { color: var(--c-text); font-weight: 500; }
.leaderboard .value { font-weight: 700; color: var(--c-gold); }

/* ── Donation bar (member row) ───────────────────────────── */
.don-numbers {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}
.don-out  { color: var(--c-green); font-weight: 600; }
.don-in   { color: var(--c-muted); }
.don-bar {
  margin-top: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--c-surface);
  overflow: hidden;
  min-width: 60px;
}
.don-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-gold-d), var(--c-gold));
  border-radius: 999px;
}

/* ── Responsive ──────────────────────────────────────────── */

/* Tablet (≤ 900px) */
@media (max-width: 900px) {
  .lp-war-stats { border-left: none; border-top: 1px solid var(--c-border); border-radius: 0 0 var(--r) 0; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 14px 20px; gap: 20px; }
  .navbar-search-input { width: 140px; }
  .navbar-search-input:focus { width: 180px; }
}

/* Mobile (≤ 680px) */
@media (max-width: 680px) {
  /* Layout */
  .page { padding: 10px 12px; }

  /* Navbar: compact, hide labels + search */
  .navbar { padding: 0 10px; gap: 0; height: 52px; }
  .navbar-brand .brand-name { display: none; }
  .navbar-search { display: none; }
  .nav-link .nav-label { display: none; }
  .nav-link { padding: 7px 9px; }
  .nav-icon { font-size: 17px; }
  .navbar-user .username { display: none; }
  .navbar-user .avatar { width: 26px; height: 26px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }

  /* Search page: full-width */
  .search-hero { padding: 16px; }
  .search-form { flex-direction: column; gap: 8px; }
  .search-input { font-size: 15px; }
  .search-clan-grid { grid-template-columns: 1fr; }
  .search-filters { flex-wrap: wrap; gap: 6px; }

  /* Tables */
  table.dt th, table.dt td { padding: 7px 8px; font-size: 12px; }

  /* Cards */
  .card-body { padding: 12px 14px; }
  .card-header { padding: 10px 14px; }

  /* Landing page hero */
  .lp-hero-inner { flex-direction: column; gap: 14px; padding: 16px 14px 12px; }
  .lp-badge { width: 68px; height: 68px; }
  .lp-name { font-size: 22px; }
  .lp-war-stats { flex-direction: row; flex-wrap: wrap; justify-content: center; border-left: none; border-top: 1px solid var(--c-border); border-radius: 0; padding: 12px 16px; gap: 16px; }
  .lp-winbar { padding: 10px 16px; }

  /* Clan hero */
  .clan-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .clan-hero img.clan-badge { width: 56px; height: 56px; }
  .clan-hero-name { font-size: 20px; }
  .clan-hero-stats { gap: 14px; }

  /* Player hero */
  .player-hero { flex-direction: column; gap: 12px; }

  /* War map: stack us/them vertically */
  .wm-header { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .wm-header-side-r { flex-direction: row; justify-content: flex-start; }
  .wm-name-r { text-align: left; }
  .wm-header-score { order: -1; flex-direction: row; gap: 12px; align-items: center; justify-content: center; background: rgba(0,0,0,.2); border-radius: var(--r); padding: 8px 12px; }
  .wm-score-destr { order: 2; }
  .wm-row { grid-template-columns: 1fr; gap: 3px; }
  .wm-vsline { display: none; }
  .wm-card-them { border-left: 1px solid var(--c-border); border-right: none; }
  .wm-card-them.wm-3star { border-left: 3px solid var(--c-green); border-right: none; }
  .wm-card-them.wm-2star { border-left: 3px solid var(--c-gold);  border-right: none; }
  .wm-card-them.wm-1star { border-left: 3px solid #a07820;        border-right: none; }
  .wm-card-them.wm-0star { border-left: 3px solid #884444;        border-right: none; }
  .wm-card-them.wm-none  { border-left: 3px solid var(--c-dim);   border-right: none; }
  .wm-card-top-r { flex-direction: row; }
  .wm-chips-r { justify-content: flex-start; }
  .wm-field { padding: 6px 8px; }
  .wm-infobar { padding: 6px 12px; font-size: 11px; }
  .wm-legend { padding: 6px 12px; gap: 5px; }

  /* Capital */
  .raid-summary { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 12px; }
  .raid-sum-pills { flex-wrap: wrap; gap: 4px; }
  .raid-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 12px; }
  .raid-stat { padding: 8px 10px; }
  .raid-body { padding: 10px; }
  .section-label { padding: 6px 10px; }

  /* Grids */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .heroes-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
  .units-grid  { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }

  /* Stat boxes */
  .stat-box { min-width: 80px; padding: 10px 12px; }
  .stat-val  { font-size: 20px; }

  /* Home legacy */
  .home-banner-inner { flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px 14px 10px; }
  .home-name { font-size: 20px; }

  /* Quick nav grid on landing: force 2 columns */
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .quick-card { padding: 12px; }
  .quick-desc { display: none; }
}

/* Small phones (≤ 400px) */
@media (max-width: 400px) {
  .page { padding: 8px 8px; }
  .navbar { padding: 0 8px; }
  table.dt th, table.dt td { padding: 5px 6px; font-size: 11px; }
  .wm-name { font-size: 11px; }
  .wm-chip { font-size: 9px; padding: 1px 4px; }
  .lp-name { font-size: 19px; }
  .raid-stats { grid-template-columns: 1fr 1fr; }
}
