/* ==========================================================================
   TagWhy — shared base
   Loaded by the root site and every game. Keep game-specific styles in each
   game's own stylesheet. Override these tokens locally if a game needs to.
   ========================================================================== */

:root {
  /* Colors */
  --bg: #0b0b12;
  --text: #e9e9f1;
  --muted: #a7a7c2;
  --line: #24243b;
  --accent: #8a7cff;
  --accent-soft: rgba(138, 124, 255, 0.15);
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.09);

  /* Typography */
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-soft: 0 0 26px rgba(0, 0, 0, 0.6);
  --shadow-ring: 0 0 0 1px var(--line);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

img, svg, video, canvas, picture { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { line-height: 1.2; font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* --- Interaction / a11y --- */
a, button, [role="button"], input, select, textarea, label {
  touch-action: manipulation;
}

button { font: inherit; color: inherit; cursor: pointer; }

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

/* --- Chip (shared pill link/button) --- */
.chip {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.chip:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  opacity: 1;
}

/* --- Icon sprite --- */
.icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.18em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  overflow: visible;
}
.icon .filled, .icon [class~="filled"] { fill: currentColor; stroke: none; }
.icon-lg { width: 1.5em; height: 1.5em; }

/* Icon buttons: icon alone or icon + text label */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  line-height: 1;
}
.icon-btn svg { flex-shrink: 0; }

/* --- A11y utility: visually hidden but still announced by screen readers --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Home button (top-left on subpages) --- */
.home-btn {
  position: fixed;
  top: 0.82rem;
  left: 0.75rem;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.7rem;
  width: 2.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(6, 11, 26, 0.9);
  color: var(--muted, #9fa3c5);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.08s ease;
}
.home-btn:hover,
.home-btn:focus-visible {
  background: rgba(40, 50, 70, 0.8);
  border-color: var(--accent, #7dd3fc);
  color: var(--accent, #7dd3fc);
  transform: translateY(-1px);
  opacity: 1;
}
.home-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Push top bars right so they don't sit behind the home button */
body:has(> .home-btn) .top {
  padding-left: 52px !important;
}

/* --- Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
