/* Shared tokens and components. Dark theme only, system fonts, no external assets. */
:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --surface: #141922;
  --surface-2: #1b2230;
  --surface-3: #263044;
  --border: #2b3548;
  --text: #eef1f7;
  --muted: #a3aec2;
  --accent: #ffb43a;
  --accent-ink: #1a1204;
  --accent-soft: rgba(255, 180, 58, 0.14);
  --ok: #4ade80;
  --bad: #ff8585;
  --warn: #fbbf24;
  --info: #8bbcff;
  --radius: 14px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 26px;
  line-height: 1.15;
}
h2 {
  font-size: 18px;
  line-height: 1.25;
}
h3 {
  font-size: 16px;
  line-height: 1.3;
}
a {
  color: var(--accent);
}
strong {
  font-weight: 650;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.center {
  text-align: center;
}
.mono {
  font-family: var(--mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  flex: none;
  display: block;
}

/* ---------------------------------------------------------------- brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  min-width: 0;
}
.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: url(/icon.svg) center / cover no-repeat;
}
.brand-mark-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) {
  background: var(--surface-3);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover:not(:disabled) {
  background: #ffc363;
}
.btn-danger {
  background: #c93a3a;
  border-color: #c93a3a;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #d94848;
}
.btn-danger-quiet {
  color: var(--bad);
}
.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
}
.btn-lg {
  min-height: 52px;
  font-size: 17px;
}
.btn-block {
  display: flex;
  width: 100%;
}
.btn-icon {
  padding: 0;
  min-width: 44px;
}
.btn-sm.btn-icon {
  min-width: 40px;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------------------------------------------------------------- forms */
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.field label,
.label {
  font-size: 14px;
  font-weight: 600;
}
.hint {
  color: var(--muted);
  font-size: 13px;
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  background: #0e131b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* stops iOS zooming into the field */
}
textarea.input {
  resize: vertical;
  min-height: 84px;
}
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
.field-error {
  color: var(--bad);
  font-size: 14px;
  min-height: 0;
  margin: 0 0 10px;
}
.field-error:empty {
  display: none;
}

.switch {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 46px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}
.switch-ui {
  flex: none;
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch input:checked + .switch-ui {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + .switch-ui::after {
  transform: translateX(18px);
  background: var(--accent-ink);
}
.switch input:focus-visible + .switch-ui {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch-text {
  display: grid;
  gap: 2px;
}

/* ---------------------------------------------------------------- cards and bits */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card > * + * {
  margin-top: 12px;
}
.card > h2 + *,
.card > h3 + * {
  margin-top: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-ok {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.35);
}
.chip-bad {
  color: var(--bad);
  border-color: rgba(255, 133, 133, 0.35);
}
.chip-warn {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.35);
}
.chip-playing,
.chip-offered {
  color: var(--accent);
  border-color: rgba(255, 180, 58, 0.45);
  background: var(--accent-soft);
}
.chip-queued {
  color: var(--info);
  border-color: rgba(139, 188, 255, 0.35);
}
.chip-watching,
.chip-away {
  color: var(--muted);
}
.chip-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 500;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}
.tag-you {
  background: var(--accent-soft);
  color: var(--accent);
}
.count {
  margin-left: 8px;
  padding: 1px 9px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}
.until {
  font-variant-numeric: tabular-nums;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 3s;
  }
  * {
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------- toasts and dialogs */
.toasts {
  position: fixed;
  z-index: 300;
  top: calc(var(--safe-t) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 440px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left-width: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  transition: opacity 0.25s, transform 0.25s;
  animation: toast-in 0.2s ease-out;
}
.toast.out {
  opacity: 0;
  transform: translateY(-6px);
}
.toast-ok {
  border-left-color: var(--ok);
}
.toast-warn {
  border-left-color: var(--warn);
}
.toast-error {
  border-left-color: var(--bad);
}
.toast-info {
  border-left-color: var(--info);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

dialog.dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
}
dialog.dialog::backdrop {
  background: rgba(5, 7, 10, 0.72);
}
dialog.dialog > * + * {
  margin-top: 10px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px !important;
}
.dialog-actions .btn {
  flex: 1;
}

/* a login-style card, used by the code page and the admin sign-in */
.login-card {
  padding: 20px;
}
.login-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}
