/* ChatGoldX dashboard — StrmrX --sx-* design tokens. */
:root {
  --sx-bg: #0d1017;
  --sx-surface: #151a23;
  --sx-surface-2: #1c2330;
  --sx-border: #262f3f;
  --sx-text: #e8ecf3;
  --sx-muted: #8b96a8;
  --sx-accent: #ffc53d;
  --sx-accent-strong: #ffb020;
  --sx-accent-ink: #1a1200;
  --sx-danger: #ff5d5d;
  --sx-ok: #3ddc84;
  --sx-radius: 12px;
  --sx-radius-sm: 8px;
  --sx-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --sx-mono: 'Cascadia Code', Consolas, monospace;

  --accent: var(--sx-accent);
  --surface: var(--sx-surface);
  --border: var(--sx-border);
  --muted: var(--sx-muted);
}

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

body {
  background: var(--sx-bg);
  color: var(--sx-text);
  font-family: var(--sx-font);
  min-height: 100vh;
}

/* ─── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  font-size: 30px;
  color: var(--accent);
  line-height: 1;
}
.brand h1 { font-size: 19px; font-weight: 800; letter-spacing: 0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  background: var(--sx-surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 99px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-pill.ok .dot { background: var(--sx-ok); box-shadow: 0 0 8px var(--sx-ok); }
.status-pill.bad .dot { background: var(--sx-danger); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }

/* ─── Grid & cards ──────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 20px 24px 40px;
  max-width: 1500px;
  margin: 0 auto;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--sx-radius);
  padding: 18px;
}
.card.hero { grid-column: span 2; grid-row: span 2; }
.card.tall { display: flex; flex-direction: column; max-height: 600px; overflow: hidden; }
.card.wide { grid-column: span 3; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h2 { font-size: 15px; font-weight: 700; flex: 1; }
.card h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 16px 0 8px;
}
.head-note, .hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.hint code {
  font-family: var(--sx-mono);
  background: var(--sx-surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent);
}
.head-actions { display: flex; gap: 8px; }
.count-badge {
  font-family: var(--sx-mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  color: var(--sx-accent-ink);
  border-radius: 99px;
  padding: 2px 9px;
}

/* ─── Buttons & inputs ──────────────────────────────────────────────────── */

.btn {
  background: var(--sx-surface-2);
  border: 1px solid var(--border);
  color: var(--sx-text);
  font-family: var(--sx-font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--sx-radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--sx-accent-ink);
}
.btn.primary:hover { background: var(--sx-accent-strong); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; color: var(--sx-danger); }
.btn.danger-ghost:hover { border-color: var(--sx-danger); }

.input {
  background: var(--sx-bg);
  border: 1px solid var(--border);
  color: var(--sx-text);
  font-family: var(--sx-font);
  font-size: 13px;
  padding: 8px 11px;
  border-radius: var(--sx-radius-sm);
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--accent); }
.input.mono { font-family: var(--sx-mono); font-size: 12px; }
select.input { cursor: pointer; }

/* ─── Live Game View ────────────────────────────────────────────────────── */

.preview-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--sx-radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(rgba(13, 16, 23, 0.85), rgba(13, 16, 23, 0.85)),
    repeating-conic-gradient(#161b26 0% 25%, #10141d 0% 50%) 0 0 / 32px 32px;
}
.preview-frame:fullscreen { aspect-ratio: auto; }
#preview-iframe {
  position: absolute;
  top: 0; left: 0;
  width: 1920px;
  height: 1080px;
  border: 0;
  transform-origin: top left;
  pointer-events: none;
  background: transparent;
}
.preview-live {
  position: absolute;
  top: 10px; left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sx-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: rgba(220, 40, 60, 0.9);
  padding: 3px 10px;
  border-radius: 99px;
}
.preview-live .pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.control-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.control-bar .grow { flex: 1 1 240px; }
.control-bar .spacer { flex: 0 0 6px; border-left: 1px solid var(--border); align-self: stretch; }
#compose-name { flex: 0 1 180px; }

/* ─── OBS / URL card ────────────────────────────────────────────────────── */

.url-row { display: flex; gap: 8px; margin: 10px 0; }
.url-row .input { flex: 1; }

/* ─── Chat feed ─────────────────────────────────────────────────────────── */

.chat-feed {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.chat-row {
  position: relative;
  padding: 7px 34px 7px 10px;
  border-radius: var(--sx-radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.chat-row:hover { background: var(--sx-surface-2); border-color: var(--accent); }
.chat-row.captured { opacity: 0.45; }
.chat-head { display: flex; align-items: center; gap: 7px; }
.chat-row .name { font-size: 13px; font-weight: 700; color: var(--accent); }
.chat-text { font-size: 13px; line-height: 1.4; color: var(--sx-text); word-wrap: break-word; }
.chat-star {
  position: absolute;
  right: 9px; top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.12s;
}
.chat-row:hover .chat-star { opacity: 1; }

.chip {
  font-family: var(--sx-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 1px 6px;
  border-radius: 99px;
}
.chip.mod { background: #1e4d2f; color: #a4f0bf; }
.chip.vip { background: #4d1e44; color: #f0a4de; }
.chip.flag { background: #4d3a1e; color: #f0d6a4; }

/* ─── Lists (queue, history) ────────────────────────────────────────────── */

.list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list.horizontal {
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
}
.list-item {
  background: var(--sx-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--sx-radius-sm);
  padding: 10px 12px;
}
.list.horizontal .list-item { flex: 0 0 260px; }
.item-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; flex-wrap: wrap; }
.item-head .name { font-size: 13px; font-weight: 700; color: var(--accent); }
.item-head .src { font-size: 11px; color: var(--muted); margin-left: auto; }
.item-text { font-size: 13px; line-height: 1.4; margin-bottom: 8px; word-wrap: break-word; }
.item-actions { display: flex; gap: 8px; }
.history-item .btn { margin-top: 2px; }

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 28px 10px;
  line-height: 1.7;
}

/* ─── Settings ──────────────────────────────────────────────────────────── */

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.field-row > label:first-child { font-size: 13px; color: var(--sx-text); }
.field-row .input { width: 170px; }
.field-row.col { flex-direction: column; align-items: stretch; }
.field-row.col .input { width: 100%; }
.field-row.col label { margin-bottom: 2px; }
#settings-card { overflow-y: auto; }

.cmd-input {
  display: flex;
  align-items: center;
  width: 170px;
}
.cmd-input span {
  font-family: var(--sx-mono);
  color: var(--accent);
  background: var(--sx-bg);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--sx-radius-sm) 0 0 var(--sx-radius-sm);
  padding: 8px 4px 8px 9px;
  font-size: 13px;
}
.cmd-input .input { border-radius: 0 var(--sx-radius-sm) var(--sx-radius-sm) 0; flex: 1; }

.saved-flash {
  font-size: 12px;
  color: var(--sx-ok);
  opacity: 0;
  transition: opacity 0.25s;
}
.saved-flash.show { opacity: 1; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--sx-surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s;
}
.slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; top: 2px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .slider { background: rgba(255, 197, 61, 0.25); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); background: var(--accent); }

/* ─── Toast ─────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--sx-surface-2);
  border: 1px solid var(--accent);
  color: var(--sx-text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 99px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

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

@media (max-width: 1150px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card.hero { grid-column: span 2; grid-row: auto; }
  .card.wide { grid-column: span 2; }
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; padding: 14px; }
  .card.hero, .card.wide { grid-column: span 1; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}
