/* Zocker — global stylesheet
 *
 * Holds the shared design tokens, base resets, and global interaction fixes.
 * Component-level styling currently still lives inline in the .jsx files;
 * this file is the home for anything global and the starting point for
 * migrating shared styles out of inline objects over time. */

:root {
  --bg-deep: oklch(0.16 0.022 285);
  --surface: oklch(0.215 0.028 285);
  --surface-2: oklch(0.27 0.03 285);
  --border: oklch(0.32 0.025 285);
  --text: oklch(0.96 0.012 285);
  --muted: oklch(0.68 0.022 285);
  --accent: #aaff66;
  --violet: #b388ff;
  --pink: #ff5e8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: oklch(0.12 0.025 285);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Lock the viewport to the device so the document itself never scrolls — only
 * the in-app scroll areas do. `position: fixed` pins the body to the visual
 * viewport (the reliable iOS scroll-lock), and `overscroll-behavior: none`
 * kills the rubber-band/scroll-chaining that otherwise drags the whole app
 * (and the tab bar) "above" the screen on mobile. */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  position: fixed;
  inset: 0;
}
#root {
  position: relative;
  height: 100%;
  width: 100%;
}

/* Remove the grey/blue flash iOS & Android paint over a control the instant
 * it's tapped (before our own active styles kick in). `touch-action` also
 * drops the 300ms tap delay and the double-tap-zoom highlight. */
html {
  -webkit-tap-highlight-color: transparent;
}
button, a, [role="button"], input, select, textarea, label {
  -webkit-tap-highlight-color: transparent;
}
button, a, [role="button"] {
  touch-action: manipulation;
}

button {
  font-family: inherit;
}

/* Don't show a focus ring for pointer/touch taps, but keep one for keyboard
 * users so the app stays accessible. */
:focus:not(:focus-visible) {
  outline: none;
}
:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

/* Hide scrollbars (overlay-scroll feel) but keep scrolling. */
::-webkit-scrollbar { width: 0; height: 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Session voting feedback. vote-glow rings the card you just voted for (uses
 * box-shadow only, so it never fights the FLIP transform when a row also moves);
 * vote-count-pop punches the number; vote-row-in fades a row in at its new spot. */
@keyframes vote-glow {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent); }
  100% { box-shadow: 0 0 0 16px transparent; }
}
@keyframes vote-count-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.65); color: var(--accent); }
  100% { transform: scale(1); }
}
@keyframes vote-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ──────────────────────────────────────────────────────────────────────────
 * Shared primitives — migrated out of inline style objects in ui.jsx.
 * Dynamic, per-instance values (hues, palette-driven chip tints) are passed in
 * via CSS custom properties or left as inline overrides; everything static
 * lives here. Inline `style` props on the components still win over these
 * classes, so call-site overrides keep working.
 * ────────────────────────────────────────────────────────────────────────── */

/* Card surface */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  cursor: default;
}
.card--flush { padding: 0; }
.card--clickable { cursor: pointer; }

/* Button */
.btn {
  appearance: none;
  cursor: pointer;
  width: auto;
  padding: 14px 20px;
  border-radius: 14px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.1px;
}
.btn--full { width: 100%; }
.btn--primary {
  background: var(--accent);
  color: var(--bg-deep);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px oklch(0.85 0.18 145 / 0.25);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--danger {
  background: transparent;
  color: var(--pink);
  border: 1px solid color-mix(in oklab, var(--pink) 30%, transparent);
}

/* Chip — small filled pill. The colour modifiers set --chip-* tokens that the
 * active state reads, so a chip only lights up when `--active`. */
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 140ms ease;
}
.chip--static { cursor: default; }
.chip--neutral { --chip-bg: var(--surface-2); --chip-fg: var(--text); --chip-br: var(--border); }
.chip--mint    { --chip-bg: color-mix(in oklab, var(--accent) 16%, transparent); --chip-fg: var(--accent); --chip-br: color-mix(in oklab, var(--accent) 30%, transparent); }
.chip--violet  { --chip-bg: color-mix(in oklab, var(--violet) 16%, transparent); --chip-fg: var(--violet); --chip-br: color-mix(in oklab, var(--violet) 30%, transparent); }
.chip--pink    { --chip-bg: color-mix(in oklab, var(--pink) 16%, transparent);   --chip-fg: var(--pink);   --chip-br: color-mix(in oklab, var(--pink) 30%, transparent); }
.chip--active {
  border-color: var(--chip-br);
  background: var(--chip-bg);
  color: var(--chip-fg);
}

/* Section header — uppercase label with an optional trailing action link */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 10px;
  gap: 10px;
}
.section-head__title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-head__action {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Avatar — tinted disc + initial. Per-instance size/hue come in as the
 * --av-size / --av-hue custom properties so everything else can be static. */
.avatar {
  position: relative;
  width: var(--av-size);
  height: var(--av-size);
  flex-shrink: 0;
}
.avatar--stack { margin-left: calc(var(--av-size) * -0.32); }
.avatar__disc {
  width: var(--av-size);
  height: var(--av-size);
  box-sizing: border-box;
  border-radius: 50%;
  background: oklch(0.35 0.10 var(--av-hue));
  border: 2px solid var(--bg-deep);
  color: oklch(0.95 0.08 var(--av-hue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 700;
  font-size: calc(var(--av-size) * 0.42);
  letter-spacing: -0.5px;
}
.avatar--ring .avatar__disc { border-color: oklch(0.85 0.18 var(--av-hue)); }
.avatar__img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar__status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: max(8px, calc(var(--av-size) * 0.28));
  height: max(8px, calc(var(--av-size) * 0.28));
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 6px oklch(0.85 0.2 145 / 0.7);
}

/* Overlapping avatar stack + the "+N" overflow bubble */
.avatar-stack { display: flex; align-items: center; }
.avatar-stack__more {
  margin-left: calc(var(--av-size) * -0.32);
  width: var(--av-size);
  height: var(--av-size);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  border: 2px solid var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: calc(var(--av-size) * 0.34);
  font-weight: 600;
}

/* Toggle switch — dimensions come in via --tg-w / --tg-h / --tg-knob so the
 * knob slide is a pure CSS transition driven by the --on modifier. */
.toggle {
  appearance: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  width: var(--tg-w);
  height: var(--tg-h);
  border-radius: 999px;
  background: var(--surface-2);
  transition: background 200ms ease;
}
.toggle--on { background: var(--accent); }
.toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: var(--tg-knob);
  height: var(--tg-knob);
  border-radius: 50%;
  background: var(--muted);
  transition: left 200ms ease;
}
.toggle--on .toggle__knob {
  left: calc(var(--tg-w) - var(--tg-knob) - 3px);
  background: var(--bg-deep);
}

/* Bottom tab bar (mobile shell) */
.tabbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding-top: 8px;
  padding-bottom: 24px;
  background: linear-gradient(180deg, transparent 0%, color-mix(in oklab, var(--bg-deep) 90%, transparent) 30%, var(--bg-deep) 100%);
  backdrop-filter: blur(20px);
}
/* Edge-to-edge devices: clear the home indicator. */
.tabbar--safe { padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 10px)); }
.tabbar__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.tabbar__btn {
  appearance: none;
  cursor: pointer;
  padding: 10px 4px;
  border-radius: 16px;
  background: transparent;
  border: 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 200ms ease;
}
.tabbar__btn--active {
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
}
.tabbar__label {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
