:root {
  color-scheme: dark;
  --bg: #090c12;
  --bg-soft: #0e131c;
  --panel: #121926;
  --panel-2: #172132;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eef7;
  --muted: #93a0b5;
  --faint: #67738a;
  --gold: #e0b45f;
  --gold-soft: rgba(224, 180, 95, 0.14);
  --blue: #74a9ff;
  --green: #5fd3a1;
  --red: #ff7b83;
  --purple: #b58cff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(224, 180, 95, 0.12), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(116, 169, 255, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Skip-link: visible only on keyboard focus (accessibility) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-elevated, #12161d);
  border: 1px solid rgba(224, 180, 95, 0.4);
  color: var(--text);
}
.skip-link:focus { left: 8px; }
#app:focus { outline: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
small { color: var(--muted); }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(9, 12, 18, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-picture { display: contents; }
.brand-mark {
  display: block;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  background: #090c12;
  border: 1px solid rgba(224, 180, 95, 0.38);
  box-shadow: 0 6px 18px rgba(224, 180, 95, 0.3);
}
.brand small { color: var(--faint); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }

.nav { display: flex; column-gap: 4px; row-gap: 12px; flex-wrap: wrap; }
.nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 550;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--gold-soft); color: var(--gold); }
.nav a.nav-locked { opacity: 0.55; }
.nav-lock { font-size: 0.62rem; margin-left: 4px; vertical-align: middle; }
.nav a.has-nav-badge { position: relative; padding-top: 8px; }
.nav-badge {
  position: absolute;
  top: 1px;
  right: 0;
  margin: 0;
  padding: 0 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--gold);
  font-size: 0.43rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.chart-point-link { cursor: pointer; }
.chart-point-link:hover .chart-point-ring { stroke-width: 2.6; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

@media (max-width: 1360px) {
  .topbar { gap: 16px; }
  .brand small { display: none; }
  .nav { column-gap: 2px; }
  .nav a { padding: 7px 9px; font-size: 0.85rem; }
  .topbar-actions { gap: 8px; }
}

/* ------------------------------------------------------------------ layout */

main {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 32px) clamp(16px, 4vw, 48px) 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .eyebrow {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 650;
  margin-bottom: 6px;
}
.page-head p { color: var(--muted); margin: 4px 0 0; max-width: 70ch; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.mt { margin-top: 16px; }

@media (max-width: 1100px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-top: 10px; padding-bottom: 2px; }
  .topbar-actions { margin-left: auto; }
  .cols-4, .cols-5, .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .dashboard-stat-cluster { grid-template-columns: 1fr; }
  .profile-spotlight { padding: 16px; }
  .span-2 { grid-column: auto; }
  h1 { font-size: 1.4rem; }
}
@media (max-width: 480px) {
  .profile-metrics { grid-template-columns: 1fr; }
}

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

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 40%), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .hint { color: var(--faint); font-size: 0.8rem; }

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 180, 95, 0.25);
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(224, 180, 95, 0.2), transparent 70%),
    linear-gradient(135deg, #18202e, #10151f);
  margin-bottom: 14px;
}
.hero h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.hero .dashboard-week-title { color: var(--gold); }
.hero p { color: var(--muted); margin: 6px 0 0; }
.hero-side { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.reset-timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 8px 14px;
  border: 1px solid rgba(224, 180, 95, 0.28);
  border-radius: 12px;
  background: rgba(224, 180, 95, 0.08);
}
.reset-timer-label { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 650; }
.reset-timer-value { color: var(--gold); font-size: 1.42rem; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.reset-timer-sub { color: var(--faint); font-size: 0.7rem; }

.stat { position: relative; padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--faint); font-size: 0.8rem; margin-top: 2px; }
.stat-help { position: absolute; top: 10px; right: 10px; }
.stat-help .help-dot { transform: none; }

.dashboard-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: stretch;
}
/* This rule must come after the base grid: the earlier 1100px media block is
   overridden by the two-column default above. */
@media (max-width: 1100px) {
  .dashboard-summary { grid-template-columns: 1fr; }
}
.dashboard-stat-cluster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
a.profile-spotlight {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 180, 95, 0.28);
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(224, 180, 95, 0.2), transparent 65%),
    linear-gradient(145deg, rgba(224, 180, 95, 0.08), transparent 55%),
    var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
a.profile-spotlight:hover {
  border-color: rgba(224, 180, 95, 0.55);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}
.profile-head { display: flex; align-items: flex-start; gap: 14px; }
.profile-avatar {
  display: flex;
  flex: 0 0 48px;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(224, 180, 95, 0.4);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
}
.profile-identity { flex: 1; min-width: 0; }
.profile-eyebrow {
  color: var(--gold);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.profile-name {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.profile-open { color: var(--gold); font-size: 0.72rem; font-weight: 650; white-space: nowrap; }
.profile-chart {
  padding: 8px 10px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.profile-chart-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.profile-chart-empty {
  padding: 18px 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.profile-duel {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
a.profile-spotlight.is-alert-missed,
.profile-duel.is-alert-missed,
.duel-detail-block.is-alert-missed {
  border-color: var(--red);
  box-shadow:
    0 0 0 1px rgba(255, 123, 131, 0.4),
    0 0 26px rgba(255, 123, 131, 0.22);
}
a.profile-spotlight.is-alert-missed {
  background:
    radial-gradient(120% 150% at 0% 0%, rgba(255, 123, 131, 0.16), transparent 55%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
}
.profile-duel.is-alert-missed,
.duel-detail-block.is-alert-missed {
  background:
    linear-gradient(135deg, rgba(255, 123, 131, 0.12), rgba(255, 255, 255, 0.02));
}
a.profile-spotlight.is-alert-low,
.profile-duel.is-alert-low,
.duel-detail-block.is-alert-low {
  border-color: var(--gold);
  box-shadow:
    0 0 0 1px rgba(224, 180, 95, 0.35),
    0 0 24px rgba(224, 180, 95, 0.18);
}
.profile-duel.is-alert-low,
.duel-detail-block.is-alert-low {
  background:
    linear-gradient(135deg, rgba(224, 180, 95, 0.1), rgba(255, 255, 255, 0.02));
}
.duel-alert-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--red);
  color: #1a0507;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
  box-shadow: 0 0 12px rgba(255, 123, 131, 0.6);
}
.is-alert-low .duel-alert-mark {
  background: var(--gold);
  color: #1a1408;
  box-shadow: 0 0 12px rgba(224, 180, 95, 0.6);
}
.duel-alert-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.35;
}
.duel-alert-line .duel-alert-mark {
  width: 16px;
  height: 16px;
  margin-right: 0;
  font-size: 0.65rem;
}
.duel-alert-line.missed { color: var(--red); }
.duel-alert-line.low { color: var(--gold); }
.profile-duel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.profile-duel-head span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
}
.profile-duel-head strong {
  color: var(--gold);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini-bars { display: flex; flex-direction: column; gap: 4px; }
.mini-bar-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 7px;
}
.mini-bar-label {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.2;
  white-space: nowrap;
}
.mini-bar-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.mini-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width 0.3s ease;
}
.mini-bar-fill.all { background: var(--gold); }
.mini-bar-pct {
  color: var(--text);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.profile-duel-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--faint);
  font-size: 0.64rem;
  line-height: 1.3;
}
.duel-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
}
.duel-detail-block {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.duel-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.duel-detail-head h3 { margin: 0; font-size: 0.9rem; }
.duel-detail-value {
  color: var(--gold);
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.duel-detail-value small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}
.duel-detail-block .mini-bar-row { grid-template-columns: 96px minmax(0, 1fr) 42px; }
.duel-detail-block .mini-bar-track { height: 7px; }
.duel-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.7rem;
}
.duel-detail-stats b { color: var(--text); font-weight: 600; }
.duel-detail-note {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.4;
}
@media (max-width: 800px) {
  .duel-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .duel-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-bar-row { grid-template-columns: 80px minmax(0, 1fr) 36px; }
}
.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.profile-metric {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.profile-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.profile-metric strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.profile-metric.accent strong { color: var(--gold); }
.profile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill.gold { border-color: rgba(224, 180, 95, 0.35); background: var(--gold-soft); color: var(--gold); }
.pill.green { border-color: rgba(95, 211, 161, 0.3); background: rgba(95, 211, 161, 0.1); color: var(--green); }
.pill.blue { border-color: rgba(116, 169, 255, 0.3); background: rgba(116, 169, 255, 0.1); color: var(--blue); }

/* ------------------------------------------------------------------ buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.button:hover { background: #1d2940; text-decoration: none; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button.primary { background: linear-gradient(140deg, var(--gold), #b9893a); border-color: transparent; color: #1b1405; }
.button.primary:hover { filter: brightness(1.05); background: linear-gradient(140deg, var(--gold), #b9893a); }
.button.ghost { background: transparent; }
.button.danger { border-color: rgba(255, 123, 131, 0.4); color: var(--red); }
.button.small { padding: 5px 9px; font-size: 0.78rem; border-radius: 8px; }

.transfer-ops-subtitle { margin: -2px 0 10px; font-size: 0.8rem; }
.transfer-op-summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.transfer-ops-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
}
.transfer-balance-grid { gap: 18px; padding-bottom: 4px; }
.transfer-balance-block h3 { margin: 0 0 8px; font-size: 0.9rem; }
.transfer-balance-block .table-wrap { border: 1px solid var(--border); }
.transfer-leaving { color: var(--red); }
.transfer-arriving { color: var(--green); }
.transfer-op {
  position: relative;
  padding: 11px 34px 11px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}
.transfer-op-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  line-height: 0;
  cursor: pointer;
}
.transfer-op-remove svg { display: block; }
.transfer-op-remove:hover {
  color: var(--red);
  border-color: rgba(255, 123, 131, 0.45);
  background: rgba(255, 123, 131, 0.1);
}
.transfer-op-remove:disabled { opacity: 0.5; cursor: not-allowed; }
.game-id-editor { display: inline-flex; align-items: center; gap: 5px; }
.game-id-editor .game-id-input { width: 132px; padding: 4px 6px; font-size: 0.78rem; }
.game-id-editor .game-id-save { padding: 4px 7px; min-height: 0; }
.game-id-editor .game-id-save:disabled { opacity: 0.35; }
.players-game-id-input { width: 132px; padding: 4px 6px; font-size: 0.78rem; }
.transfer-op-done { border-left-color: var(--green); }
.transfer-op-pending { border-left-color: var(--gold); }
.transfer-op-cancelled { border-left-color: var(--red); }
/* Kind styling is intentionally stronger than the status colour: departures
   and arrivals must be recognisable at a glance among ordinary transfers. */
.transfer-op.transfer-op-kind-remove {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(255, 123, 131, 0.09), rgba(255, 255, 255, 0.02));
}
.transfer-op.transfer-op-kind-new,
.transfer-op.transfer-op-kind-return {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(61, 220, 132, 0.09), rgba(255, 255, 255, 0.02));
}
.transfer-op.transfer-op-kind-transfer {
  border-left-color: var(--gold);
  background: rgba(224, 180, 95, 0.035);
}
.quick-plan-toolbar { flex-wrap: wrap; }
.quick-plan-toolbar .field { min-width: 180px; }
@media (max-width: 720px) {
  .quick-plan-toolbar .field,
  .quick-plan-toolbar .button {
    flex: 1 1 100%;
  }
}
.transfer-op-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.transfer-op-player { display: flex; align-items: center; gap: 8px; min-width: 0; }
.transfer-op-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-op-route { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.transfer-op-arrow { color: var(--gold); font-weight: 700; }
.transfer-op-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.transfer-op-note { margin-top: 8px; color: var(--muted); font-size: 0.8rem; }
.transfer-op-editor { margin-top: 10px; border-top: 1px dashed var(--border); }
.transfer-op-editor summary { padding-top: 9px; cursor: pointer; color: var(--gold); font-size: 0.8rem; }
.transfer-op-edit {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 10px;
}
.transfer-op-edit .select { max-width: 155px; }
.transfer-op-edit .input { flex: 1; min-width: 160px; }
.transfer-op-field { display: flex; flex-direction: column; gap: 4px; color: var(--faint); font-size: 0.7rem; }
.transfer-op-field .select, .transfer-op-field .input { min-width: 130px; }
.transfer-op-note-field { flex: 1; min-width: 180px; }
.pill.kick { border-color: rgba(255, 123, 131, 0.35); background: rgba(255, 123, 131, 0.1); color: var(--red); }
.locked-wrap { position: relative; overflow: hidden; }
.locked-wrap.is-locked .locked-content {
  filter: blur(5px);
  opacity: 0.58;
  pointer-events: none;
  user-select: none;
}
.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(9, 12, 18, 0.16), rgba(9, 12, 18, 0.5));
}
.lock-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  max-width: 370px;
  padding: 18px 20px;
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(21, 29, 42, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.lock-mark { font-size: 1.5rem; line-height: 1; }
.lock-badge strong { font-size: 0.92rem; }
.lock-badge span:not(.lock-mark):not(.pill) { color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.lock-badge-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.skeleton-line {
  display: inline-block;
  height: 9px;
  max-width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}
.locked-preview-value { display: block; margin-top: 12px; color: var(--muted); font-size: 1.7rem; }

.apply-panel {
  position: sticky;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border: 1px solid rgba(224, 180, 95, 0.28);
  border-radius: var(--radius);
  background:
    radial-gradient(500px 130px at 0% 0%, rgba(224, 180, 95, 0.14), transparent 70%),
    linear-gradient(135deg, #141c29, #0e141d);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}
.apply-copy { display: flex; flex-direction: column; gap: 3px; }
.apply-copy strong { font-size: 0.95rem; }
.apply-copy .faint { font-size: 0.8rem; }
.apply-button {
  width: 100%;
  max-width: 340px;
  min-height: 54px;
  padding: 14px 26px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 28px rgba(224, 180, 95, 0.22);
}
.apply-button:disabled { box-shadow: none; }
tbody tr.dirty td { background: rgba(224, 180, 95, 0.055); }
tbody tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
tbody tr.archive-historical { opacity: 0.62; }
tbody tr.archive-historical:hover { opacity: 0.9; }
.inline-history {
  width: 92px;
  padding: 5px 7px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}
.inline-history:disabled { opacity: 0.55; }

/* ------------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* Logs can render up to 10k rows; skip offscreen row painting. */
#logs-table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 36px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 11px 12px;
  background: #0f1520;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.055); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 600; white-space: nowrap; }
.week-title-link { color: var(--text); text-decoration: none; }
.week-title-link:hover { color: var(--gold); text-decoration: none; }
td.dim { color: var(--muted); }
.rank-pos { color: var(--faint); font-variant-numeric: tabular-nums; width: 44px; }
.th-label { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.threshold-input { width: 86px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.inline-contribution { width: 92px; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.inline-contribution:disabled { opacity: 0.55; }
.week-alert-legend {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}
#week-sections tbody tr.week-row-alert-missed { background: rgba(255, 123, 131, 0.11); }
#week-sections tbody tr.week-row-alert-low { background: rgba(224, 180, 95, 0.09); }
#week-sections tbody tr.week-row-alert-missed td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}
#week-sections tbody tr.week-row-alert-low td:first-child {
  box-shadow: inset 3px 0 0 var(--gold);
}
.week-alert-mark {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--red);
  color: #1a0507;
  font-size: 0.65rem;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}
.week-alert-mark.low {
  background: var(--gold);
  color: #1a1408;
  box-shadow: 0 0 12px rgba(224, 180, 95, 0.6);
}
.week-alert-mark[hidden] { display: none; }
.help-dot {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(245, 196, 81, 0.4);
  background: rgba(245, 196, 81, 0.1);
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  user-select: none;
  vertical-align: top;
}
.help-dot:hover, .help-dot:focus-visible {
  background: rgba(245, 196, 81, 0.2);
  color: #fff;
  border-color: var(--gold);
  outline: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 650;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.alpha { background: rgba(224, 180, 95, 0.13); color: var(--gold); border-color: rgba(224, 180, 95, 0.3); }
.badge.beta { background: rgba(116, 169, 255, 0.12); color: var(--blue); border-color: rgba(116, 169, 255, 0.3); }
.badge.gamma { background: rgba(95, 211, 161, 0.12); color: var(--green); border-color: rgba(95, 211, 161, 0.3); }
.badge.delta { background: rgba(181, 140, 255, 0.12); color: var(--purple); border-color: rgba(181, 140, 255, 0.3); }
.badge.reserve { background: rgba(255, 255, 255, 0.05); color: var(--muted); border-color: var(--border); }
.badge.rank { background: rgba(181, 140, 255, 0.12); color: var(--purple); border-color: rgba(181, 140, 255, 0.28); }
.badge.rank-elite, .inline-rank.rank-elite { background: rgba(153, 0, 255, 0.14); color: #9900FF; border-color: rgba(153, 0, 255, 0.4); }
.badge.rank-epic, .inline-rank.rank-epic { background: rgba(255, 153, 0, 0.13); color: #FF9900; border-color: rgba(255, 153, 0, 0.38); }
.badge.rank-legendary, .inline-rank.rank-legendary { background: rgba(255, 0, 0, 0.12); color: #FF0000; border-color: rgba(255, 0, 0, 0.38); }
.badge.rank-mythic, .inline-rank.rank-mythic { background: rgba(98, 110, 122, 0.18); color: #626E7A; border-color: rgba(98, 110, 122, 0.5); }
.badge.rank-supreme, .inline-rank.rank-supreme { background: rgba(184, 197, 232, 0.13); color: #B8C5E8; border-color: rgba(184, 197, 232, 0.4); }
.inline-rank { width: 128px; padding: 5px 7px; font-size: 0.78rem; font-weight: 650; }
.inline-rank.kick { background: rgba(255, 123, 131, 0.16); color: var(--red); border-color: rgba(255, 123, 131, 0.3); }
.inline-rank:disabled { opacity: 0.55; }
.badge.up { background: rgba(95, 211, 161, 0.12); color: var(--green); }
.badge.down { background: rgba(255, 123, 131, 0.12); color: var(--red); }
.badge.flat { background: rgba(255, 255, 255, 0.05); color: var(--muted); }
.badge.kick { background: rgba(255, 123, 131, 0.16); color: var(--red); border-color: rgba(255, 123, 131, 0.3); }

.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.mono { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ rosters */

.week-upload {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 18px 20px;
  overflow: hidden;
  border: 1px solid rgba(224, 180, 95, 0.28);
  border-radius: 22px;
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(224, 180, 95, 0.16), transparent 55%),
    radial-gradient(90% 120% at 100% 100%, rgba(95, 211, 161, 0.08), transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 22px 50px -32px rgba(224, 180, 95, 0.55);
}
.week-upload::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--green));
}
.week-upload::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 180, 95, 0.18), transparent 65%);
  pointer-events: none;
}
.week-upload.open {
  border-color: rgba(240, 166, 74, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 30px rgba(240, 166, 74, 0.18),
    0 22px 50px -32px rgba(224, 180, 95, 0.55);
}
.week-upload.open::before { background: linear-gradient(180deg, #f0a64a, var(--gold)); }
.week-upload-icon {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(224, 180, 95, 0.45);
  background: radial-gradient(circle at 35% 30%, rgba(224, 180, 95, 0.28), rgba(224, 180, 95, 0.06));
  box-shadow: 0 0 24px rgba(224, 180, 95, 0.18);
}
.week-upload-icon::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--gold);
  filter: drop-shadow(0 0 6px rgba(224, 180, 95, 0.6));
}
.week-upload-main { position: relative; z-index: 1; flex: 1 1 300px; min-width: 0; }
.week-upload-kicker {
  display: block;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.week-upload-title { margin: 2px 0 6px; font-size: 1rem; letter-spacing: 0.01em; }
.week-upload-status { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.week-upload-state {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.week-upload-value {
  color: var(--gold);
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-shadow: 0 0 18px rgba(224, 180, 95, 0.35);
}
.week-upload.open .week-upload-value { color: #ffe6b0; text-shadow: 0 0 18px rgba(240, 166, 74, 0.55); }
.week-upload-window { display: block; margin-top: 2px; color: var(--muted); font-size: 0.76rem; }
.week-upload-hint { display: block; margin-top: 4px; color: var(--faint); font-size: 0.74rem; line-height: 1.4; }
.week-upload-hint:empty { display: none; }
.week-upload-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-left: auto;
}
.week-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(224, 180, 95, 0.35);
  background: rgba(224, 180, 95, 0.12);
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}
.week-upload-button.ready {
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
  border-color: transparent;
  background: linear-gradient(135deg, var(--gold), #ffe6a3);
  color: #1a1408;
  box-shadow: 0 0 20px rgba(224, 180, 95, 0.3);
}
.week-upload.open .week-upload-button.ready {
  background: linear-gradient(135deg, #f0a64a, #ffd27a);
  box-shadow: 0 0 22px rgba(240, 166, 74, 0.35);
}
.week-upload-button.ready:hover { filter: brightness(1.05); }
.week-upload-progress {
  width: 100%;
  min-width: 150px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}
.week-upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f0a64a, #ffe6a3);
  transition: width 0.2s ease;
}
@media (max-width: 720px) {
  .week-upload { padding: 16px; }
  .week-upload-value { font-size: 1.7rem; }
  .week-upload-actions { width: 100%; align-items: stretch; }
  .week-upload-button { width: 100%; }
}

.roster-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .roster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .roster-grid { grid-template-columns: 1fr; } }

.roster-card { position: relative; overflow: visible; }
.roster-card:focus-within, .roster-card:has(.threshold-details[open]) { z-index: 30; }
.roster-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent, var(--gold));
}
.roster-card.alpha { --accent: var(--gold); }
.roster-card.beta { --accent: var(--blue); }
.roster-card.gamma { --accent: var(--green); }
.roster-card.delta { --accent: var(--purple); }
.roster-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.roster-card .avg { font-size: 1.6rem; font-weight: 700; margin: 8px 0 0; }
.threshold-details { position: relative; margin-top: 8px; }
.thresholds-button { cursor: pointer; list-style: none; }
.thresholds-button::-webkit-details-marker { display: none; }
.thresholds-button:hover { border-color: rgba(224, 180, 95, 0.45); color: var(--gold); }
.threshold-chevron { color: var(--faint); font-size: 0.65rem; transition: transform 0.15s; }
.threshold-details[open] .threshold-chevron { transform: rotate(180deg); }
.threshold-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 250px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #0f1520;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.threshold-line { font-size: 0.8rem; font-weight: 650; white-space: nowrap; }
.threshold-line.promote { color: var(--green); }
.threshold-line.keep { color: var(--gold); }
.threshold-line.drop { color: var(--red); }
.threshold-line.fatal { color: #ff4b57; font-weight: 750; }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent, var(--gold)); opacity: 0.8; }

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { background: rgba(255, 255, 255, 0.04); }
.tab.active { background: var(--gold-soft); border-color: rgba(224, 180, 95, 0.35); color: var(--gold); }

/* ------------------------------------------------------------------ forms */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.sort-header {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.sort-header:hover { color: var(--gold); }
.sort-arrow { color: var(--muted); font-size: 0.72rem; line-height: 1; }
th[aria-sort="ascending"] .sort-arrow,
th[aria-sort="descending"] .sort-arrow { color: var(--gold); }

.vlm-player-select { min-width: 310px; }
.vlm-duplicate-cell { min-width: 220px; vertical-align: top; }
.vlm-duplicate-warning {
  color: var(--red);
  font-size: 0.74rem;
  line-height: 1.4;
  padding: 2px 0;
}
.vlm-duplicate-warning strong { color: var(--red); }
.vlm-duplicate-summary {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 123, 131, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 123, 131, 0.05);
}
.vlm-duplicate-summary > strong { display: block; margin-bottom: 8px; color: var(--red); }

.input, .select, .textarea {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #0d131e;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid rgba(224, 180, 95, 0.35); outline-offset: 1px; border-color: rgba(224, 180, 95, 0.5); }
.input::placeholder { color: var(--faint); }
.textarea { width: 100%; min-height: 90px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.file-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.file-field #chest-file-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }
.vlm-drop {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.vlm-drop.is-over {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold);
}
.scan-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0b0f17;
}
.vlm-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.vlm-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.vlm-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.vlm-tab.active {
  color: #1b1405;
  background: linear-gradient(140deg, var(--gold), #b9893a);
  border-color: transparent;
}
.vlm-panel[hidden] { display: none; }
@media (max-width: 720px) {
  .vlm-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vlm-tab { width: 100%; }
}
.scan-frame-wrap[hidden] { display: none; }
.scan-frame-wrap iframe {
  display: block;
  width: 100%;
  height: min(80vh, 980px);
  min-height: 560px;
  border: 0;
  background: #0b0f17;
}
@media (max-width: 720px) {
  .scan-frame-wrap iframe {
    height: 74vh;
    min-height: 460px;
  }
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ misc */

.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); gap: 14px; }
.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, #131a27 25%, #1a2333 37%, #131a27 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.error-box {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 123, 131, 0.35);
  background: rgba(255, 123, 131, 0.08);
  color: #ffc2c6;
}
.error-box code { color: #ffd9dc; }

.list { display: flex; flex-direction: column; gap: 2px; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.list-row:hover { background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { color: var(--faint); font-size: 0.78rem; }
.list-row .tail { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.kv { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 8px 16px; font-size: 0.88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .input, .kv .textarea { max-width: 420px; }
.kv .textarea { min-height: 64px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #1a2333;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  max-width: min(560px, 90vw);
}
.toast.error { border-color: rgba(255, 123, 131, 0.45); color: #ffc2c6; }

dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(460px, 92vw);
  box-shadow: var(--shadow);
  overflow: visible;
}
dialog::backdrop { background: rgba(3, 6, 10, 0.7); backdrop-filter: blur(3px); }
.dialog-body { padding: 22px; }
.dialog-body h2 { margin-bottom: 6px; }
.dialog-body p { color: var(--muted); font-size: 0.87rem; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.form-error {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(255, 123, 131, 0.45);
  border-radius: 9px;
  background: rgba(255, 123, 131, 0.08);
  color: #ffc2c6;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Member login: form on the left, permanent UID hint on the right. */
#member-dialog {
  width: min(980px, 94vw);
  max-height: calc(100vh - 28px);
  overflow: auto;
}
.member-dialog-body { padding: 24px; }
.member-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(248px, 380px);
  gap: 24px;
  align-items: start;
}
.member-fields { min-width: 0; }
.member-uid-hint {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}
.member-uid-hint-link { display: block; }
.member-uid-hint img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.member-uid-hint p {
  margin: 10px 4px 2px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}
#member-dialog .member-easter {
  margin: 12px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(224, 180, 95, 0.55);
  border-radius: 10px;
  background: rgba(224, 180, 95, 0.14);
  color: var(--gold);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
#member-dialog .member-easter-uid {
  margin-top: 8px;
  border-color: rgba(255, 123, 131, 0.6);
  background: rgba(255, 123, 131, 0.16);
  color: #ffb3b8;
}
.fa1l-confirm { border-color: rgba(255, 123, 131, 0.55); }
.fa1l-confirm h2 { color: #ffb3b8; }
.fa1l-confirm p { min-height: 1.4em; }
@media (max-width: 820px) {
  #member-dialog { width: min(560px, 94vw); }
  .member-dialog-body { padding: 20px; }
  .member-layout { grid-template-columns: 1fr; gap: 16px; }
  .member-uid-hint { order: 2; }
  .member-uid-hint img { width: auto; max-height: 44vh; margin: 0 auto; }
}

.field-label-row { display: flex; align-items: center; gap: 7px; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.88rem; cursor: pointer; }
.no-promotion-card {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 196, 81, 0.28);
  border-radius: 10px;
  background: rgba(245, 196, 81, 0.06);
}
.no-promotion-toggle { font-weight: 600; }
.no-promotion-desc {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.help-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(245, 196, 81, 0.4);
  background: rgba(245, 196, 81, 0.1);
  color: var(--gold);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  outline: none;
}
.help-tip:hover, .help-tip:focus-visible { color: var(--gold); border-color: var(--gold); }
.tooltip-portal {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: min(380px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(224, 180, 95, 0.42);
  background: linear-gradient(145deg, rgba(21, 29, 42, 0.98), rgba(9, 12, 18, 0.98));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.tooltip-portal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.tooltip-portal.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.access-gate { max-width: 680px; margin: 34px auto; }
.access-gate h1 { margin: 10px 0 8px; }
.access-gate p { max-width: 62ch; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ social / footer */

.social-links { display: inline-flex; align-items: center; gap: 6px; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 7px;
  cursor: pointer;
}
.lang-switch button:hover { background: rgba(255, 255, 255, 0.05); }
.lang-switch button.active { background: var(--gold-soft); color: var(--gold); }
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.social-link svg { width: 18px; height: 18px; display: block; }
.social-link:hover {
  color: var(--gold);
  border-color: rgba(224, 180, 95, 0.4);
  background: var(--gold-soft);
  text-decoration: none;
}
.social-link.telegram:hover { color: var(--blue); border-color: rgba(116, 169, 255, 0.4); background: rgba(116, 169, 255, 0.1); }

.footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 16px clamp(16px, 4vw, 48px) 28px;
}
.footer-inner {
  width: min(1400px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-copy { color: var(--muted); font-size: 0.8rem; }

@media (max-width: 720px) {
  .topbar-actions { gap: 6px; }
  .social-link { width: 28px; height: 28px; }
  .social-link svg { width: 16px; height: 16px; }
  .footer-inner { justify-content: center; text-align: center; }
}

a[href^="#/players/"] { color: var(--gold); }
a[href^="#/players/"]:hover { color: var(--gold); }

/* Screen-reader-only live region (route announcements). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ mobile */
/*
 * Narrow screens get a compact topbar and stacked table cards instead of
 * 850–1000 px wide tables inside a 305 px scroller. The card labels are
 * injected by assets/mobile.js from the table headers.
 */
@media (max-width: 720px) {
  main {
    padding: 16px 14px 84px;
  }

  /* topbar */
  .topbar {
    gap: 8px;
    padding: 10px 14px;
    align-items: center;
  }
  .brand {
    gap: 8px;
    font-size: 0.95rem;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .brand small { display: none; }
  .topbar .social-links { display: none; }
  .topbar-actions {
    gap: 6px;
  }
  .topbar-actions .pill {
    display: none;
  }
  .topbar-actions .button.small,
  #token-button {
    padding: 5px 8px;
    font-size: 0.72rem;
  }
  .lang-switch button {
    padding: 4px 7px;
    font-size: 0.72rem;
  }
  .nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 2px;
    padding: 2px 0 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  /* Edge fade: only the side that still has tabs is dimmed. */
  .nav.can-scroll-left {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18px);
    mask-image: linear-gradient(90deg, transparent 0, #000 18px);
  }
  .nav.can-scroll-right {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent 100%);
  }
  .nav.can-scroll-left.can-scroll-right {
    -webkit-mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 18px,
      #000 calc(100% - 24px),
      transparent 100%
    );
    mask-image: linear-gradient(
      90deg,
      transparent 0,
      #000 18px,
      #000 calc(100% - 24px),
      transparent 100%
    );
  }
  .nav a {
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .nav a.has-nav-badge { padding-top: 6px; }
  .nav-badge { display: none; }
  .nav-lock { font-size: 0.55rem; margin-left: 3px; }

  /* headings, cards, stats */
  .page-head {
    margin-bottom: 14px;
    gap: 10px;
  }
  h1 { font-size: 1.28rem; line-height: 1.2; }
  .hero-side { width: 100%; justify-content: center; }
  .page-head .eyebrow {
    font-size: 0.66rem;
    letter-spacing: 0.12em;
  }
  .page-head p { font-size: 0.86rem; }
  .card { padding: 14px; border-radius: 14px; }
  .card-head { margin-bottom: 10px; flex-wrap: wrap; align-items: flex-start; }
  .card-head > a.hint { margin-left: auto; white-space: nowrap; }
  .card-head > span.hint {
    flex-basis: 100%;
    margin-top: -2px;
    line-height: 1.4;
  }
  .grid { gap: 10px; }
  .grid.cols-3:has(> .stat) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.cols-4:has(> .stat) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.cols-5:has(> .stat) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid.cols-5:has(> .stat) > .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 1.45rem; }
  .stat .label { font-size: 0.68rem; }
  .stat .sub { font-size: 0.72rem; }
  .dashboard-stat-cluster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .roster-card { padding: 12px; }
  .roster-card .avg {
    font-size: 1.35rem;
    margin-top: 6px;
  }
  .roster-card .top .faint { font-size: 0.7rem; }
  .thresholds-button {
    justify-content: center;
    width: 100%;
    padding: 6px 8px;
    font-size: 0.72rem;
  }
  .threshold-popover {
    position: fixed;
    top: auto;
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: 60vh;
    overflow: auto;
    z-index: 80;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  }
  .bar { margin-top: 8px; }
  .profile-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .profile-metric { padding: 6px 8px; }
  .profile-metric span { font-size: 0.6rem; }
  .profile-metric strong { font-size: 0.98rem; }

  /* Dashboard list rows: let long week titles/nicks wrap instead of being
     ellipsized next to the value. */
  .list-row {
    gap: 8px;
    padding: 9px 8px;
    align-items: flex-start;
  }
  .list-row .rank-pos {
    flex: 0 0 24px;
    width: 24px;
  }
  .list-row .title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.28;
  }
  .list-row .tail {
    margin-left: auto;
    padding-left: 6px;
  }

  /* toolbar and week upload */
  .toolbar { gap: 8px; margin-bottom: 10px; }
  .toolbar .input,
  .toolbar .select { max-width: 100%; }
  .toolbar label[for="players-sort"],
  .toolbar label[for="week-sort"] {
    flex: 0 0 100%;
    margin: 2px 0 -4px;
    margin-left: 0 !important;
  }
  .toolbar #players-sort,
  .toolbar #week-sort {
    flex: 1 1 100%;
    max-width: none !important;
  }
  .toolbar #week-search,
  #players-filter input[name="search"] {
    flex: 1 1 100%;
    min-width: 0 !important;
    max-width: none !important;
  }
  #players-filter button[type="submit"] {
    flex: 1 1 100%;
  }
  .week-upload {
    padding: 12px;
    overflow: hidden;
  }
  .week-upload-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .week-upload-title { font-size: 0.92rem; }
  .week-upload-kicker { font-size: 0.64rem; }
  .week-upload-value { font-size: 1.2rem; }
  .week-upload-window { font-size: 0.7rem; }
  .week-upload-actions {
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }
  .week-upload-button {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.8rem;
  }
  .apply-panel {
    bottom: 8px;
    padding: 12px;
    gap: 10px;
  }
  .apply-panel:not(.has-changes) { display: none; }
  .apply-panel .apply-button { width: 100%; }

  /* forms */
  .kv {
    grid-template-columns: 1fr;
    gap: 6px;
    font-size: 0.86rem;
  }
  .kv .input,
  .kv .textarea {
    max-width: none;
    width: 100%;
  }
  .form-grid { grid-template-columns: 1fr; }
  .transfer-op-edit { flex-wrap: wrap; }
  .transfer-op-edit .input {
    min-width: 0;
    flex: 1 1 100%;
  }
  .transfer-op-edit .select { max-width: none; width: 100%; }
  .transfer-op-field .select,
  .transfer-op-field .input {
    min-width: 0;
    width: 100%;
  }
  .locked-content,
  #transfer-add-form { min-width: 0; }
  .locked-content { overflow-x: hidden; }

  /* dialogs */
  .dialog-body { padding: 16px; }
  .member-dialog-body { padding: 16px; }
  .member-uid-hint img { max-height: 34vh; }

  /* tables: stacked cards */
  .mobile-sort { display: none; }
  .table-wrap.mobile-cards {
    overflow: visible;
    padding: 10px 12px 2px;
    border-radius: 0;
  }
  .table-wrap.mobile-cards .mobile-sort {
    display: block;
    width: 100%;
    margin: 0 0 10px;
  }
  .table-wrap.mobile-cards table,
  .table-wrap.mobile-cards thead,
  .table-wrap.mobile-cards tbody,
  .table-wrap.mobile-cards tr,
  .table-wrap.mobile-cards th,
  .table-wrap.mobile-cards td {
    display: block;
    width: 100%;
  }
  .table-wrap.mobile-cards table {
    min-width: 0;
    font-size: 0.86rem;
  }
  .table-wrap.mobile-cards thead { display: none; }
  .table-wrap.mobile-cards tbody tr {
    position: relative;
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 45%),
      var(--panel);
  }
  .table-wrap.mobile-cards tbody tr:last-child { margin-bottom: 0; }
  .table-wrap.mobile-cards td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .table-wrap.mobile-cards td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 45%;
    min-width: 0;
    text-align: left;
    color: var(--faint);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .table-wrap.mobile-cards td:not([data-label])::before { display: none; }
  .table-wrap.mobile-cards td[data-primary] {
    display: block;
    padding: 0 44px 8px 0;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.98rem;
    font-weight: 650;
    white-space: normal;
  }
  .table-wrap.mobile-cards td[data-primary]::before { display: none; }
  .table-wrap.mobile-cards td[data-primary] a { color: var(--text); }
  .table-wrap.mobile-cards td[data-rank] {
    position: absolute;
    top: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
  }
  .table-wrap.mobile-cards td[data-rank]::before { display: none; }
  .table-wrap.mobile-cards td.num,
  .table-wrap.mobile-cards td.center { text-align: right; }
  .table-wrap.mobile-cards td.name { white-space: normal; }
  /* Guild Duel efficiency cell: keep one clear value on a phone instead of
     the wide three-column desktop bar (own %, all %, absolute value). */
  .table-wrap.mobile-cards td.eff-pcts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-width: 0;
  }
  .table-wrap.mobile-cards td.eff-pcts::before {
    flex: 0 0 100%;
    max-width: none;
  }
  .table-wrap.mobile-cards td.eff-pcts .eff-half.eff-all { display: none; }
  .table-wrap.mobile-cards td.eff-pcts .eff-track { display: none; }
  .table-wrap.mobile-cards td.eff-pcts .eff-half {
    flex: 0 0 auto;
    gap: 6px;
  }
  .table-wrap.mobile-cards td.eff-pcts .eff-half::after { display: none; }
  .table-wrap.mobile-cards td.eff-pcts .eff-half::before {
    content: attr(data-mobile-label);
    color: var(--faint);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .table-wrap.mobile-cards td.eff-pcts .eff-mid {
    margin-left: auto;
    font-size: 0.76rem;
  }
  .table-wrap.mobile-cards td[colspan] {
    display: block;
    text-align: left;
  }
  .table-wrap.mobile-cards td[colspan]::before { display: none; }
  .table-wrap.mobile-cards select,
  .table-wrap.mobile-cards input:not([type="checkbox"]) {
    max-width: 58%;
    min-width: 0;
  }
  .table-wrap.mobile-cards .inline-contribution {
    width: 92px;
    max-width: 48%;
  }
  .table-wrap.mobile-cards input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
  }

  /* keep non-card tables usable */
  .table-wrap:not(.mobile-cards) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

