/* n3rd dark palette (cutie-main/ui/theme.cpp) */
:root {
  --bg: #090a0e;
  --panel: #0e1016;
  --panel-2: #12141c;
  --hover: #1e2028;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f6fa;
  --text-2: #b0b8c4;
  --muted: #757d8a;
  --faint: #50586a;
  --accent: #ff7020;
  --accent-tint: rgba(255, 112, 32, 0.2);
  --danger: #ff4d68;
  --ct: #5ea8ff;
  --t: #f0b44c;
  --ok: #3ddc84;
  --radius: 10px;
  --side-w: 300px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

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

.brand { display: flex; align-items: baseline; gap: 6px; user-select: none; }
.brand .logo { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand .sub { color: var(--accent); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; }
.brand.big .logo { font-size: 30px; }
.brand.big .sub { font-size: 15px; }

/* ---------------------------------------------------------------- landing */

.landing { height: 100%; display: grid; place-items: center; padding: 16px; }
.landing-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}
.landing-card p { color: var(--text-2); margin: 14px 0 20px; }
.go { display: flex; gap: 8px; }
.go input {
  flex: 1; min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
}
.go input:focus { border-color: var(--accent); }
.go input.bad { border-color: var(--danger); }
.go button {
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: #12080a; font-weight: 600;
  padding: 0 16px; cursor: pointer;
}

/* ---------------------------------------------------------------- app shell */

.app { height: 100%; display: flex; flex-direction: column; }

.bar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
}
.mapname { font-weight: 600; color: var(--text-2); }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
}
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status[data-s="live"] i { background: var(--ok); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.18); }
.status[data-s="menu"] i { background: var(--accent); }
.status[data-s="lost"] i { background: var(--danger); }

.tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tool, .seg button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
}
.tool:hover, .seg button:hover { background: var(--hover); color: var(--text); }
.tool[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: var(--accent-tint); }
.tool.accent { background: var(--accent); border-color: var(--accent); color: #12080a; font-weight: 600; }
.tool.accent:hover { background: #ff8340; color: #12080a; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-tint); color: var(--text); }

.main { flex: 1; min-height: 0; display: flex; }

.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; cursor: grab; }
.stage.drag { cursor: grabbing; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.tool.sel {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
  max-width: 190px;
  text-overflow: ellipsis;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b0b8c4' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center;
}
.tool.sel option, .tool.sel optgroup { background: var(--panel); color: var(--text); }

.watching {
  position: absolute; left: 14px; top: 14px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px;
  background: rgba(14, 16, 22, 0.92);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12px; color: var(--text-2);
}
.watching[data-team="3"] { border-left-color: var(--ct); }
.watching[data-team="2"] { border-left-color: var(--t); }
.watching b { color: var(--text); font-weight: 600; }
.watching button {
  width: 22px; height: 22px; border: 0; border-radius: 6px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-2); cursor: pointer;
}
.watching button:hover { background: var(--hover); color: var(--text); }
.row.watched { border-color: var(--accent); }

.note {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text-2);
  white-space: nowrap;
  pointer-events: none;
}

/* ---------------------------------------------------------------- bomb */

.bombcard {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  width: min(300px, calc(100% - 32px));
  background: rgba(14, 16, 22, 0.92);
  border: 1px solid rgba(255, 77, 104, 0.45);
  border-radius: var(--radius);
  padding: 9px 12px 10px;
  pointer-events: none;
}
.bombcard.defuse { border-color: rgba(94, 168, 255, 0.55); }
.bomb-top { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bomb-top b { margin-left: auto; font-size: 15px; }
.bomb-site {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  background: var(--danger); color: #12080a; font-weight: 700; font-size: 12px;
}
.bombcard.defuse .bomb-site { background: var(--ct); }
.bomb-bar { height: 4px; margin-top: 8px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bomb-bar i { display: block; height: 100%; width: 100%; background: var(--danger); transform-origin: left; }
.bombcard.defuse .bomb-bar i { background: var(--ct); }

/* ---------------------------------------------------------------- teams */

.side {
  width: var(--side-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  padding: 12px 12px 16px;
}
.team + .team { margin-top: 16px; }
.team h2 {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 8px; padding: 0 4px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
}
.team[data-team="3"] .tname { color: var(--ct); }
.team[data-team="2"] .tname { color: var(--t); }
.team .alive { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.team ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

.row {
  position: relative;
  padding: 7px 10px 8px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid transparent;
  cursor: pointer;
  overflow: hidden;
}
.row:hover { border-color: var(--border); }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--team); }
.team[data-team="3"] .row { --team: var(--ct); }
.team[data-team="2"] .row { --team: var(--t); }
.row.me { border-color: var(--border-strong); }
.row.dead { opacity: 0.42; }
.row .l1, .row .l2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .l2 { margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row .you { font-size: 10px; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.row .money { margin-left: auto; color: var(--ok); font-size: 12px; flex-shrink: 0; }
.row .wp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex-shrink: 0; max-width: 45%; }
.row .pl {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  color: var(--text-2);
}
.row .pl::before { content: "·"; margin-right: 6px; color: var(--faint); }
.row .chips { margin-left: auto; display: flex; gap: 4px; flex-shrink: 0; }
.chip {
  font-size: 10px; font-weight: 600; line-height: 1;
  padding: 3px 5px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-2);
}
.chip.c4 { background: rgba(255, 77, 104, 0.2); color: #ff8fa1; }
.chip.kit { background: rgba(94, 168, 255, 0.18); color: #9ccaff; }
.hp { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.hp .track { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.hp .track i { display: block; height: 100%; background: var(--hpc, var(--ok)); }
.hp b { width: 22px; text-align: right; font-size: 11px; font-weight: 600; color: var(--text-2); }
.empty { color: var(--faint); padding: 6px 4px; font-size: 12px; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  font-weight: 600;
  padding: 8px 14px; border-radius: 999px;
  pointer-events: none;
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 820px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .bar { gap: 10px; padding: 10px 16px; }
  .tools { margin-left: 0; width: 100%; }
  .tool, .seg button { height: 32px; }
  .main { flex-direction: column; }
  .stage { flex: none; height: min(100vw, 72vh); }
  .watching { top: auto; bottom: 12px; left: 12px; }
  .side { width: auto; border-left: 0; border-top: 1px solid var(--border); overflow: visible; padding: 12px 16px 24px; }
}
