/* XDefiant server panel - shared design system (lobby browser + operator console).
   Dressed in the game's own kit, built into htdocs/assets by tools/build/build_web_assets.py:
   Borda (the XDefiant wordmark face) for display, Eurostile Next (the game UI face)
   for text, the Season 3 X-light backdrop, and the ranked key art's red and steel. */

@font-face { font-family: "Borda"; src: url("/assets/fonts/borda-extrabold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Borda"; src: url("/assets/fonts/borda-demibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Eurostile Next"; src: url("/assets/fonts/eurostile-regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Eurostile Next"; src: url("/assets/fonts/eurostile-semibold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Eurostile Next"; src: url("/assets/fonts/eurostile-bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --ink: #0b0c0f;
  --ink-2: #111317;
  --panel: #15181d;
  --panel-2: #1b1f25;
  --panel-3: #262b33;
  --line: rgba(203, 213, 222, .10);
  --line-2: rgba(203, 213, 222, .22);
  --text: #f3f5f7;
  --muted: #a7afb9;
  --faint: #6e7681;
  --steel: #cbd5de;
  --red: #be242c;
  --red-hot: #e2363f;
  --ok: #5fd39a;
  --warn: #f0b34a;
  --danger: #ff5a64;
  --alpha: #4ba3ff;
  --bravo: #ff8a3d;
  --signal: var(--steel);

  --display: "Borda", "Bahnschrift SemiBold Condensed", "Arial Narrow", sans-serif;
  --body: "Eurostile Next", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;

  --r-lg: 4px;
  --r-md: 4px;
  --r-sm: 3px;
  --gutter: clamp(16px, 3vw, 40px);
  --focus: 0 0 0 2px var(--ink), 0 0 0 4px var(--steel);
  /* The game cuts corners instead of rounding them. */
  --cut: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  --cut-sm: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.5 var(--body);
  background: var(--ink);
}

/* The Season 3 home backdrop: the X of the logo drawn in light. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(11, 12, 15, .35) 0%, rgba(11, 12, 15, .82) 55%, var(--ink) 100%),
    url("/assets/brand/x-light.jpg") center top / cover no-repeat;
  opacity: .55;
}

a { color: var(--steel); text-decoration: none; }
a:hover { color: #fff; }
:focus-visible { outline: none; box-shadow: var(--focus); }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
  text-transform: uppercase;
}

.num { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- brand ------------------------------------------------------------ */

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img.wordmark { height: 20px; width: auto; display: block; }
.brand img.mark { height: 26px; width: auto; display: block; }
.brand .tag {
  padding: 3px 7px 2px;
  color: #fff;
  background: var(--red);
  font: 800 .62rem/1 var(--display);
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  clip-path: var(--cut-sm);
}

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

.btn {
  --bg: rgba(203, 213, 222, .06);
  --fg: var(--text);
  --bd: rgba(203, 213, 222, .24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--bd);
  border-radius: var(--r-sm);
  font: 600 .82rem/1 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { --bg: rgba(203, 213, 222, .14); --bd: var(--steel); --fg: #fff; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { --fg: #fff; --bd: transparent; --bg: var(--red); clip-path: var(--cut-sm); border-radius: 0; }
.btn.primary:hover { --bg: var(--red-hot); }
.btn.light { --fg: #0b0c0f; --bd: transparent; --bg: var(--steel); clip-path: var(--cut-sm); border-radius: 0; }
.btn.light:hover { --bg: #fff; }
.btn.danger { --fg: #ffd6d9; --bd: rgba(255, 90, 100, .45); --bg: rgba(255, 90, 100, .08); }
.btn.danger:hover { --bg: rgba(255, 90, 100, .2); --bd: var(--danger); --fg: #fff; }
.btn.quiet { --bd: transparent; --bg: transparent; }
.btn.quiet:hover { --bg: rgba(203, 213, 222, .1); --bd: transparent; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: .74rem; }
.btn.icon { padding: 0; width: 34px; min-height: 34px; }

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

.field { display: grid; gap: 6px; }
.field > span { color: var(--muted); font-size: .85rem; }
.field small { color: var(--faint); font-size: .8rem; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--text);
  background: rgba(0, 0, 0, .45);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font: inherit;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(203, 213, 222, .14);
}
input[type="checkbox"] { width: 18px; min-height: 18px; accent-color: var(--red); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 40px; min-height: 22px; height: 22px; padding: 0; border-radius: 999px; position: relative; background: var(--panel-3); }
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .15s ease, background .15s ease;
}
.switch input:checked { background: rgba(190, 36, 44, .55); border-color: var(--red-hot); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }

/* ---- chips / status --------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 3px;
  color: var(--muted);
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  font: 600 .72rem/1.2 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip.live { color: #c9f5de; border-color: rgba(95, 211, 154, .45); }
.chip.warn { color: #ffe2ad; border-color: rgba(240, 179, 74, .5); }
.chip.bad { color: #ffd0d4; border-color: rgba(255, 90, 100, .5); }
.chip.info { color: #fff; background: var(--red); border-color: transparent; }

.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red-hot);
  box-shadow: 0 0 0 0 rgba(226, 54, 63, .5);
  animation: pulse 2.4s ease-out infinite;
}
.pulse.off { background: var(--faint); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(226, 54, 63, .45); }
  70% { box-shadow: 0 0 0 9px rgba(226, 54, 63, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 54, 63, 0); }
}

/* ---- seats: one chevron per seat, team coloured ---------------------- */

.seats { display: flex; flex-wrap: wrap; gap: 3px; }
.seat {
  width: 12px; height: 14px;
  clip-path: polygon(0 0, 55% 0, 100% 50%, 55% 100%, 0 100%, 45% 50%);
  background: rgba(203, 213, 222, .16);
}
.seat.alpha { background: var(--alpha); }
.seat.bravo { background: var(--bravo); }
.seat.away { opacity: .35; }

/* ---- surfaces --------------------------------------------------------- */

.panel {
  background: linear-gradient(170deg, rgba(27, 31, 37, .94), rgba(17, 19, 23, .96));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: rgba(13, 15, 18, .8); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(0, 0, 0, .35);
  border-bottom: 1px solid var(--line-2);
  font: 600 .72rem/1.2 var(--display);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(203, 213, 222, .04); }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}
.empty svg { width: 34px; height: 34px; color: var(--faint); }
.empty img { width: 56px; height: auto; opacity: .5; }
.empty strong { color: var(--text); font: 800 1.3rem/1.1 var(--display); text-transform: uppercase; }

/* ---- dialogs and toasts ---------------------------------------------- */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--red);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(3px); }
dialog[open] { animation: rise .18s ease-out; }
.dialog-body { display: grid; gap: 16px; padding: 22px; }
.dialog-body h2 { font-size: 1.45rem; }
.dialog-body p { margin: 0; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--steel);
  border-radius: var(--r-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: rise .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--danger); }
.toast p { margin: 0; flex: 1; }
.toast button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }

.skeleton {
  background: linear-gradient(90deg, rgba(203, 213, 222, .05), rgba(203, 213, 222, .11), rgba(203, 213, 222, .05));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-lg);
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
