/* Shared design tokens and components for the user site and the admin dashboard. */

:root {
  color-scheme: dark;

  --bg: #070b14;
  --surface: #0e1422;
  --surface-2: #151d2e;
  --surface-3: #1c2639;
  --line: #243049;
  --line-soft: #1a2336;

  --text: #e7ecf5;
  --text-dim: #a3aec2;
  --text-faint: #7a869c;

  --accent: #2f6bf0;
  --accent-hover: #2a5fd6;
  --accent-soft: rgba(47, 107, 240, 0.16);
  --accent-text: #86a9ff;
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --danger-bg: #2c1519;
  --danger-line: #4a2228;
  --danger-solid: #c9353a;
  --danger-solid-hover: #b02e33;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px rgba(47, 107, 240, 0.45);

  --font:
    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/*
 * The `hidden` attribute is only a UA rule of `display: none`, so any explicit
 * `display` in a stylesheet silently beats it — an element set to `display: grid`
 * stays visible no matter how many times you set `el.hidden = true`. Several
 * components here are grid or flex, so make the attribute authoritative once.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font: 11.5px/1.6 var(--mono);
  color: var(--text-dim);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ icons */

.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i.sm {
  width: 16px;
  height: 16px;
}
.i.lg {
  width: 28px;
  height: 28px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  min-height: 56px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}

.brand {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--text);
  text-decoration: none;
}

.brand span {
  color: var(--accent-text);
}

.spacer {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}

.pill[data-state="waiting"] .dot {
  background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}
.pill[data-state="connected"] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
}
.pill[data-state="error"] .dot {
  background: var(--danger);
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

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

button {
  font: inherit;
  font-weight: 550;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    opacity 0.14s ease,
    transform 0.06s ease;
}

button:hover:not(:disabled) {
  background: var(--surface-3);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.danger {
  color: var(--danger);
  border-color: var(--danger-line);
}
button.danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

button.ghost {
  background: transparent;
  border-color: transparent;
}
button.ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

button.icon {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
}

button.icon[aria-pressed="true"] {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}

select,
input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"] {
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  transition:
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

select:hover:not(:disabled),
input:hover:not(:disabled) {
  border-color: #2f3d5a;
}

select:disabled,
input:disabled {
  opacity: 0.55;
}

select:focus-visible,
input:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
select:focus-visible,
input:focus-visible {
  border-color: var(--accent);
}

label.field {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card > header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted {
  color: var(--text-dim);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: var(--mono);
}

.empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ----------------------------------------------------------------- notices */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
}
.notice.error {
  color: #fecaca;
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
.notice.warn {
  color: #fde68a;
  border-color: #4a3a17;
  background: var(--warn-bg);
}

/* ------------------------------------------------------------------ tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 9px 16px;
  color: var(--text-faint);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line-soft);
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: none;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.tag.nudity,
.tag.minor,
.tag.violence {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
.tag.harassment {
  color: var(--warn);
  border-color: #40361c;
}

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