/* Tap - shared design tokens.
   Everything is sized in vmin on the presenter screen so a slide looks the
   same on a 15" laptop and a 4m projector wall. */

:root {
  --font-sans: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui,
    -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.16), 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-2: 0 8px 40px rgba(0, 0, 0, 0.3);
}

/* `hidden` has to beat layout. Every panel here sets `display` on its own
   class, and a class selector outranks the UA sheet's `[hidden]` rule - so
   hidden panels kept painting, and .modal-host (fixed, full-bleed, z-index
   200) sat invisibly over the page swallowing every click. */
[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------- themes ---- */

/*
 * --panel is an OPAQUE surface. Anything that floats over other content -
 * the presenter's control bar, the join badge, toasts, the scanner HUD -
 * uses it rather than a translucent fill plus backdrop-filter.
 *
 * backdrop-filter was the obvious choice and it was wrong: Chrome promotes a
 * backdrop-filtered element and its subtree onto their own layer, and on some
 * GPUs that layer renders the element's OWN text soft. A slightly frosted
 * panel is not worth a blurry control bar four metres wide.
 */

[data-theme="midnight"] {
  --panel: #171a2b;
  --bg: #0a0b14;
  --bg-2: #12142099;
  --bg-glow: radial-gradient(120% 90% at 50% -10%, #2a1f5e 0%, transparent 60%),
    radial-gradient(90% 70% at 90% 110%, #0d3b52 0%, transparent 55%);
  --fg: #f3f4fb;
  --fg-dim: #9aa0c0;
  --line: #ffffff1f;
  --accent: #7c6cff;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --series: #7c6cff, #22d3ee, #f472b6, #34d399, #fbbf24, #fb7185, #a78bfa, #38bdf8,
    #4ade80, #fb923c, #e879f9, #2dd4bf;
}

[data-theme="aurora"] {
  --panel: #0b2130;
  --bg: #04121a;
  --bg-2: #0a1f2b99;
  --bg-glow: radial-gradient(110% 80% at 20% -10%, #0f766e 0%, transparent 58%),
    radial-gradient(100% 80% at 85% 105%, #4c1d95 0%, transparent 55%);
  --fg: #eafaf7;
  --fg-dim: #8fb5b2;
  --line: #ffffff1f;
  --accent: #2dd4bf;
  --accent-2: #a78bfa;
  --ok: #4ade80;
  --bad: #fb7185;
  --warn: #fcd34d;
  --series: #2dd4bf, #a78bfa, #fcd34d, #4ade80, #38bdf8, #f472b6, #fb923c, #22d3ee,
    #c084fc, #34d399, #facc15, #f87171;
}

[data-theme="sunset"] {
  --panel: #26111b;
  --bg: #17070c;
  --bg-2: #2a0f1899;
  --bg-glow: radial-gradient(120% 90% at 15% -10%, #7c2d12 0%, transparent 58%),
    radial-gradient(100% 80% at 90% 110%, #831843 0%, transparent 55%);
  --fg: #fff3ec;
  --fg-dim: #d0a08f;
  --line: #ffffff24;
  --accent: #fb923c;
  --accent-2: #f472b6;
  --ok: #4ade80;
  --bad: #f87171;
  --warn: #fcd34d;
  --series: #fb923c, #f472b6, #fcd34d, #f87171, #c084fc, #34d399, #38bdf8, #fb7185,
    #fdba74, #e879f9, #a3e635, #22d3ee;
}

[data-theme="mono"] {
  --panel: #1b1b1b;
  --bg: #0c0c0c;
  --bg-2: #1a1a1a99;
  --bg-glow: radial-gradient(120% 90% at 50% -20%, #2a2a2a 0%, transparent 60%);
  --fg: #fafafa;
  --fg-dim: #9a9a9a;
  --line: #ffffff1f;
  --accent: #fafafa;
  --accent-2: #a3a3a3;
  --ok: #d4d4d4;
  --bad: #737373;
  --warn: #e5e5e5;
  --series: #fafafa, #d4d4d4, #a3a3a3, #e5e5e5, #b8b8b8, #8a8a8a, #f0f0f0, #c4c4c4,
    #9a9a9a, #dcdcdc, #ababab, #eeeeee;
}

[data-theme="paper"] {
  --panel: #ffffff;
  --bg: #fbfaf7;
  --bg-2: #ffffffcc;
  --bg-glow: radial-gradient(120% 90% at 50% -20%, #e8e4f8 0%, transparent 60%),
    radial-gradient(90% 70% at 95% 110%, #d9f0f5 0%, transparent 55%);
  --fg: #17171c;
  --fg-dim: #6b6b78;
  --line: #0000001f;
  --accent: #5b4bd6;
  --accent-2: #0891b2;
  --ok: #059669;
  --bad: #e11d48;
  --warn: #b45309;
  --series: #5b4bd6, #0891b2, #db2777, #059669, #b45309, #e11d48, #7c3aed, #0284c7,
    #16a34a, #ea580c, #c026d3, #0d9488;
  --shadow-1: 0 1px 2px rgba(20, 20, 40, 0.08), 0 4px 16px rgba(20, 20, 40, 0.06);
  --shadow-2: 0 10px 40px rgba(20, 20, 40, 0.12);
}

/* ---------------------------------------------------------------- base --- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.7em 1.15em;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg);
  font-weight: 600;
  transition: transform 0.12s var(--ease), background 0.15s, border-color 0.15s,
    opacity 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
[data-theme="mono"] .btn.primary,
[data-theme="paper"] .btn.primary {
  color: var(--bg);
}
[data-theme="paper"] .btn.primary {
  color: #fff;
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
}

.field {
  width: 100%;
  padding: 0.75em 0.9em;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: border-color 0.15s;
}
.field:focus {
  border-color: var(--accent);
  outline: none;
}
.field::placeholder {
  color: var(--fg-dim);
}

.muted {
  color: var(--fg-dim);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------- toasts -- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
  align-items: center;
  max-width: min(92vw, 480px);
}

.toast {
  padding: 0.7em 1.1em;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  font-weight: 600;
  animation: rise-in 0.24s var(--ease);
  text-align: center;
}
.toast.error {
  border-color: color-mix(in srgb, var(--bad) 55%, transparent);
  color: var(--bad);
}
.toast.ok {
  border-color: color-mix(in srgb, var(--ok) 55%, transparent);
  color: var(--ok);
}
.toast.out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}
