/* base.css - global primitives, layer 1 of the game-app CSS stack.
   Loaded first on every game-app page (game/base.html and the broker pages
   that opt into this stack). Holds design tokens (color, type scale, spacing,
   radius, focus, depth), the reset, and base button behaviour. No component or
   page-specific rules live here. See docs/11-css-architecture.md. */
:root {
  color-scheme: light;
  --bg: #f7f8f7;
  --ink: #171a17;
  --muted: #65706a;
  --line: rgba(23, 26, 23, 0.12);
  --panel: #ffffff;
  --panel-soft: rgba(255, 255, 255, 0.96);
  --accent: #0f6b61;
  --accent-dark: #0b4f48;
  --target: #9f2f25;
  --road: rgba(104, 116, 110, 0.28);
  --shadow: 0 1px 2px rgba(20, 28, 24, 0.06), 0 10px 24px rgba(20, 28, 24, 0.08);
  --shadow-strong: 0 2px 4px rgba(20, 28, 24, 0.07), 0 18px 42px rgba(20, 28, 24, 0.12);
  --button-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.58);
  --button-press: inset 0 1px 3px rgba(9, 16, 13, 0.18);
  --button-shadow: 0 1px 1px rgba(8, 59, 54, 0.45), 0 8px 18px rgba(13, 44, 39, 0.18);
  --button-shadow-soft: 0 1px 1px rgba(145, 151, 145, 0.38), 0 8px 18px rgba(20, 28, 24, 0.11);
  --focus: 0 0 0 3px rgba(15, 107, 97, 0.24);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --step--1: 0.78rem;
  --step-0: 0.92rem;
  --step-1: 1rem;
  --step-2: 1.18rem;
  --step-3: 1.45rem;
  --step-4: 2rem;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  /* Stop iOS from auto-inflating text after orientation changes. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  background:
    linear-gradient(180deg, #fbfbfa 0%, var(--bg) 420px),
    var(--bg);
  color: var(--ink);
  line-height: 1.45;
  /* App-like touch: kill the double-tap-to-zoom + 300ms tap delay everywhere
     (pinch-zoom and scrolling still work), and drop the grey tap flash. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* No pull-to-refresh / rubber-band reload mid-round. */
  overscroll-behavior-y: none;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button,
a,
input,
select,
textarea {
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}

img {
  display: block;
  max-width: 100%;
  /* No long-press save/share callout or text selection on listing photos. */
  -webkit-touch-callout: none;
  user-select: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.3vw, 2.25rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 720;
  text-transform: uppercase;
}

.primary-action,
.secondary-action,
.icon-button,
.guess-chip {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 780;
  letter-spacing: 0;
  user-select: none;
}

.primary-action {
  min-height: 44px;
  border-color: rgba(8, 79, 72, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 46%),
    linear-gradient(180deg, #128074, var(--accent));
  color: white;
  box-shadow: var(--button-highlight), var(--button-shadow);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.primary-action:hover:not(:disabled) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 44%),
    linear-gradient(180deg, #159185, var(--accent-dark));
  transform: translateY(-1px);
  box-shadow: var(--button-highlight), 0 1px 1px rgba(7, 54, 49, 0.5), 0 12px 24px rgba(13, 44, 39, 0.22);
}

.primary-action:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--button-press), 0 3px 10px rgba(13, 44, 39, 0.16);
}

.secondary-action {
  min-height: 44px;
  border-color: rgba(23, 26, 23, 0.22);
  background:
    linear-gradient(180deg, white, rgba(241, 243, 240, 0.96));
  color: var(--ink);
  box-shadow: var(--button-highlight), var(--button-shadow-soft);
}

.secondary-action:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.guess-chip:hover:not(:disabled) {
  border-color: rgba(15, 107, 97, 0.3);
  background:
    linear-gradient(180deg, white, rgba(232, 238, 234, 0.98));
  transform: translateY(-1px);
  box-shadow: var(--button-highlight), 0 1px 1px rgba(123, 130, 124, 0.45), 0 10px 22px rgba(20, 28, 24, 0.13);
}

.secondary-action:active:not(:disabled),
.icon-button:active:not(:disabled),
.guess-chip:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: var(--button-press), 0 3px 10px rgba(20, 28, 24, 0.1);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-color: rgba(23, 26, 23, 0.2);
  background:
    linear-gradient(180deg, white, rgba(239, 241, 238, 0.96));
  color: var(--ink);
  box-shadow: var(--button-highlight), var(--button-shadow-soft);
}
