/* Colors and base styles. Change colors here — everything else uses these variables. */
:root {
  --bg: #0E0E10;            /* page background */
  --panel: #18181B;         /* header, side column, panels */
  --card: #1F1F23;          /* cards, inputs, secondary buttons */
  --card-hover: #26262C;
  --border: #2F2F35;
  --accent: #9146FF;        /* main buttons, active things, progress bar, links */
  --accent-hover: #772CE8;
  --text: #EFEFF1;
  --text-2: #ADADB8;
  --error: #EB0400;
  --success: #00F593;       /* online dot */

  --radius: 4px;
  --radius-lg: 6px;
  --header-h: 50px;
  --side-w: 340px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fast: 120ms;
  --font: 'Inter', 'Roobert', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 0; border-radius: var(--radius);
  font-weight: 600; font-size: 13px; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--card); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--card-hover); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--card-hover); }
.btn-danger { background: transparent; color: var(--error); }
.btn-danger:hover { background: rgba(235, 4, 0, .12); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--card-hover); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- inputs ---------- */
.input {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.input::placeholder { color: var(--text-2); }
.input:hover { border-color: var(--border); }
.input:focus { border-color: var(--accent); background: var(--bg); }
.input.invalid { border-color: var(--error); }

.label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.hint { color: var(--text-2); font-size: 12px; }
.error-text { color: var(--error); font-size: 12px; min-height: 18px; }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---------- dialogs (Twitch-like modal) ---------- */
dialog.modal {
  width: min(400px, calc(100vw - 32px));
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .6);
}
dialog.modal[open] { animation: pop 160ms var(--ease); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .7); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0 20px; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 16px 20px 20px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 40px; height: 40px;
  border: 4px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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