:root {
  --bg: #0e0e0e;
  --panel: #151515;
  --panel2: #1a1a1a;
  --row: #161616;
  --border: #2a2a2a;
  --text: #e9e8e4;
  --muted: #888780;
  --blue: #185FA5;
  --blue2: #378ADD;
  --green: #9FE1CB;
  --danger: #A32D2D;
  --danger2: #E24B4A;
  --alert: #F09595;
  --warn: #C47A2D;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--blue2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.grow { flex: 1; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; letter-spacing: 1px; color: var(--text); }
.brand span { color: var(--danger2); }
.nav { display: flex; align-items: center; gap: 14px; }
.nav a { color: #cfcec9; font-weight: 600; }
.nav a.admin { color: var(--green); }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 12px; }

/* ---- cards / layout ---- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; margin-bottom: 16px;
}
.auth-card { max-width: 420px; margin: 48px auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { text-align: center; }
.stat-card .big { font-size: 34px; font-weight: 800; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---- forms ---- */
.form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.input, .select, textarea.input {
  width: 100%; margin-top: 5px; padding: 9px 11px; background: #101010;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px;
}
.input.sm, .select.sm { width: auto; }
.input:focus, .select:focus { outline: none; border-color: var(--blue2); }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
label.inline .input, label.inline .select { margin-top: 0; }
textarea.mono { font-family: ui-monospace, monospace; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #2a2a2a; color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600;
}
.btn:hover { background: #343434; text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: #1a6fbf; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #7f1f1f; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; margin-top: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.bookmarklet { background: #26215C; border-color: #3a3382; color: #cfc8ff; }

/* ---- alerts ---- */
.alert { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 13px; border: 1px solid transparent; }
.alert.error { background: #2a1515; border-color: #5a2a2a; color: var(--alert); }
.alert.warn  { background: #261c10; border-color: #5a431f; color: #f0c27a; }
.alert.info  { background: #15202a; border-color: #244055; color: #9ecbe8; }
.alert.ok    { background: #14240b; border-color: #2f5a1a; color: var(--green); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; background: #2a2a2a; font-size: 11px; font-weight: 700; color: #cfcec9; }
.pill.ok { background: #1f3a14; color: var(--green); }
.pill.danger { background: #3a1414; color: var(--alert); }
.pill.admin { background: #26215C; color: #cfc8ff; }

.divider { display: flex; align-items: center; text-align: center; color: var(--muted); margin: 18px 0; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); margin: 0 10px; }
.divider span { color: var(--muted); }
.steps { padding-left: 18px; line-height: 2; }
.steps code { background: #101010; padding: 1px 6px; border-radius: 5px; }

/* ---- controls ---- */
.controls .control-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.control-row.wrap { flex-wrap: wrap; }
.search { display: flex; gap: 8px; margin-top: 12px; }
.search .input { margin-top: 0; }
.budget { color: var(--muted); font-size: 12px; }
.spinner { color: var(--blue2); font-size: 12px; }
.htmx-indicator { opacity: 0; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#autoToggle.on { background: var(--blue); border-color: var(--blue); }

/* ---- results ---- */
.results { margin-top: 6px; }
.placeholder { text-align: center; color: #666; padding: 60px 16px; }
.result-meta { color: var(--muted); font-size: 12px; margin: 6px 2px 12px; }
.team-section { background: var(--panel2); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.team-header { font-weight: 800; font-size: 13px; letter-spacing: .5px; padding: 4px 4px 10px; }

.player-row {
  display: grid;
  grid-template-columns: 52px 36px minmax(140px, 1fr) auto auto;
  align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; border: 2px solid transparent;
  background: #121212; margin-bottom: 6px;
}
.player-row.hl-critical { background: #2a1515; }
.player-row.hl-high { background: #261c10; }
.player-row.hl-medium { background: #1a1814; }
.p-icon img, .p-icon-fallback { width: 44px; height: 44px; border-radius: 8px; }
.p-icon-fallback { background: #2a2a2a; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.p-rank img { width: 30px; height: 30px; }
.p-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.p-name.revealed .p-name-text { color: #AFA9EC; }
.p-name.hidden .p-name-text { color: #888780; }
.p-name .seen { color: #FAC775; font-weight: 800; }
.p-sub { color: var(--muted); font-size: 12px; }
.p-server { color: #7EC8E3; font-size: 10px; margin-top: 3px; }
.p-copy, .p-link {
  background: transparent; border: none; color: #777; cursor: pointer;
  font-size: 13px; padding: 0 2px;
}
.p-copy:hover, .p-link:hover { color: var(--blue2); }

.p-stats { display: flex; gap: 12px; }
.p-stats .stat { text-align: center; min-width: 38px; }
.p-stats .stat span { display: block; color: var(--muted); font-size: 10px; }
.p-stats .stat b { font-size: 15px; }
.p-stats .stat b.alert { color: var(--alert); }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; justify-content: flex-end; }
.tag { padding: 2px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; }

@media (max-width: 760px) {
  .player-row { grid-template-columns: 48px 1fr; }
  .p-rank, .p-stats, .p-tags { grid-column: 2; justify-content: flex-start; }
  .p-tags { max-width: none; }
}

/* ---- tables / admin ---- */
.admin-nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.online-list { list-style: none; padding: 0; margin: 0; }
.online-list li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3fd07a; margin-right: 7px; }
.copyable { cursor: pointer; background: #101010; padding: 2px 7px; border-radius: 6px; }
.copyable:hover { color: var(--blue2); }

.legend { color: var(--muted); font-size: 12px; margin-top: 8px; }
.legend summary { cursor: pointer; }
.legend-body { padding: 8px 4px; }
