/* ------------------------------------------------------------------
   Serverless Smasher - base styles
   Brand palette: exactly four colours (CirOps brand guide).
   --ok / --bad are the approved gameplay-feedback exception: used only
   for short flashes after a tap, never for tile states before a tap.
   ------------------------------------------------------------------ */

@font-face { font-family: 'Montserrat'; font-weight: 400; font-display: swap; src: url('../assets/fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-display: swap; src: url('../assets/fonts/montserrat-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 800; font-display: swap; src: url('../assets/fonts/montserrat-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-weight: 400; font-display: swap; src: url('../assets/fonts/lato-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-weight: 700; font-display: swap; src: url('../assets/fonts/lato-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url('../assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 700; font-display: swap; src: url('../assets/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }

:root {
  --blue: #1981C1;
  --gold: #FDCA0C;
  --white: #FFFFFF;
  --navy: #0F172A;

  --ok: #22C55E;
  --bad: #EF4444;

  /* Tints of the brand colours (no grey/slate) */
  --text-dim: rgba(255, 255, 255, 0.72);
  --text-faint: rgba(255, 255, 255, 0.5);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --blue-soft: rgba(25, 129, 193, 0.18);
  --gold-soft: rgba(253, 202, 12, 0.14);

  --font-head: 'Montserrat', system-ui, sans-serif;
  --font-body: 'Lato', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --radius: 14px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-body);
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(25, 129, 193, 0.35), transparent 60%),
    var(--navy);
  background-attachment: fixed;
}

#app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 1.5rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 12px; }
b, strong { font-weight: 700; }
a { color: var(--gold); }

/* ---------- Screens ---------- */

.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(var(--gutter) + var(--safe-top)) var(--gutter) calc(var(--gutter) + var(--safe-bottom));
}
.screen.active { display: flex; animation: screen-in 220ms ease-out; }
.screen--scroll { overflow-y: auto; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

#screen-loading, #screen-countdown, #screen-message { align-items: center; justify-content: center; text-align: center; gap: 24px; }

.logo { height: 40px; width: auto; display: block; }
.logo--sm { height: 30px; }

.brandbar { display: flex; justify-content: center; padding: 8px 0 4px; }

.eyebrow {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.sub { color: var(--text-dim); }
.fine { color: var(--text-faint); font-size: 0.8rem; text-align: center; margin-top: 10px; }

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  min-height: 52px;
  padding: 14px 20px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 80ms ease, filter 120ms ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-xl { min-height: 60px; font-size: 1.15rem; }
.btn-primary { background: var(--blue); color: var(--white); box-shadow: 0 8px 24px rgba(25, 129, 193, 0.4); }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--white); border: 1px solid var(--line); }

.link {
  background: none;
  border: 0;
  color: var(--gold);
  font: inherit;
  text-decoration: underline;
  padding: 4px;
  cursor: pointer;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  color: var(--white);
  cursor: pointer;
}

/* ---------- Forms ---------- */

form { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.85rem; font-weight: 700; color: var(--text-dim); }
.field em { font-style: normal; color: var(--text-faint); font-weight: 400; }

.field input, .field select {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--white);
  font: 1rem var(--font-body); /* >= 16px stops iOS zoom on focus */
}
.field select option { color: var(--navy); }
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--bad); }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--text-dim);
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
}
.consent input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--blue); }

.form-error { color: var(--bad); min-height: 1.2em; margin: 0; font-weight: 700; font-size: 0.9rem; }

/* ---------- Misc ---------- */

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
