/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0e0e13;
  --surface:   #18181f;
  --surface2:  #22222c;
  --border:    #2e2e3a;
  --accent:    #9b8cff;
  --accent2:   #c3b8ff;
  --text:      #e8e6f0;
  --text-muted:#8e8aa8;
  --success:   #5cb97e;
  --warning:   #e8a045;
  --danger:    #e05c6e;
  --twitch:    #9146ff;
  --radius:    10px;
  --radius-sm: 6px;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  background: var(--surface2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent2);
}

/* ── Utilities ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { filter: brightness(0.9); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-twitch   { background: var(--twitch);  color: #fff; font-size: 1rem; padding: 12px 28px; }
.btn-ghost    {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-connecting { background: #333; color: var(--text-muted); }
.badge-connected  { background: #1b3a2a; color: var(--success); }
.badge-error      { background: #3a1b1e; color: var(--danger); }
.badge-open       { background: #1b3a2a; color: var(--success); }
.badge-closed     { background: #3a2a1b; color: var(--warning); }

/* ── Login Screen ───────────────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.login-logo { font-size: 3rem; margin-bottom: 16px; }
.login-card h1 { font-size: 1.6rem; margin-bottom: 10px; }
.login-card p  { color: var(--text-muted); margin-bottom: 32px; line-height: 1.6; }

/* ── Header ─────────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo { font-size: 1.4rem; }
.site-title { font-weight: 700; font-size: 1.05rem; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

#user-name { font-size: 0.9rem; color: var(--text-muted); }

/* ── Main Layout ────────────────────────────────────────────────────────────── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Controls ───────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.queue-count {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Section titles ─────────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header .section-title { margin-bottom: 0; }

/* ── Current Card ───────────────────────────────────────────────────────────── */
.current-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 24px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s;
}

.current-card:not(.empty) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent)22, 0 4px 24px #9b8cff18;
}

.current-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 16px 0;
}

.current-trigger {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.3;
}

.current-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.current-meta strong {
  color: var(--text);
  margin-left: 4px;
}

.current-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Queue List ─────────────────────────────────────────────────────────────── */
.queue-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.queue-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 28px 0;
}

.queue-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: border-color 0.15s;
  animation: slideIn 0.2s ease;
}

.queue-item:hover { border-color: var(--accent); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.queue-pos {
  min-width: 26px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.queue-trigger {
  flex: 1;
  font-weight: 600;
  color: var(--text);
}

.queue-user {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.queue-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.queue-remove:hover { color: var(--danger); background: #3a1b1e44; }

/* ── Commands Table ─────────────────────────────────────────────────────────── */
.commands-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.commands-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.commands-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}
.commands-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border)88;
  vertical-align: middle;
}
.commands-table tr:last-child td { border-bottom: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 12px 16px; }
  main { padding: 16px 12px 48px; }
  .controls { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 32px 20px; }
  .current-trigger { font-size: 1.2rem; }
}
