/* Would You Have Won? — Gameweek XI brand (design handoff, GAM-556 reskin).
   Mobile-first, no framework, no build step. Tokens are the signed-off design
   system — the placeholder palette this file used to carry is retired. */

/* ---------- Fonts (self-hosted, Roboto only) ---------- */

@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Roboto";
  src: url("../fonts/Roboto-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

/* ---------- Tokens (design handoff, final) ---------- */

:root {
  --bg-0: #0f0b0a;
  --surface: #303030;
  --surface-deep: #242424;
  --row-a: #262626;
  --row-b: #2c2c2c;
  --accent: #00ffc2;
  --accent-dim: #00d9a5;
  --prize: #f4bf77;
  --warn: #f79257;
  --error: #f7575a;
  --fg: #ffffff;
  --fg-muted: #a8a8a8;
  --divider: rgba(255, 255, 255, 0.08);
  --dashed: rgba(255, 255, 255, 0.28);
  --outline: #545454;
  --r-chip: 4px;
  --r-btn: 8px;
  --r-card: 12px;
  --r-panel: 16px;
  --maxw: 1160px;
  --pad-x: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-0);
  background: linear-gradient(180deg, #0f0b0a 0%, #05372f 145%) fixed;
  color: var(--fg);
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  transition: color 200ms ease-in-out;
}

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

img {
  max-width: 100%;
}

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

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen--gate,
.screen--block {
  justify-content: center;
  text-align: center;
}

.screen__inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 32px var(--pad-x);
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.screen--main {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ---------- Wordmark + header ---------- */

.wordmark {
  height: 42px;
  width: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 8px;
}

.site-header .wordmark {
  height: 24px;
}

/* ---------- Age gate / block ---------- */

.gate__title {
  font-size: 30px;
  line-height: 37px;
  font-weight: 900;
  margin: 0;
}

.gate__question {
  font-size: 14px;
  line-height: 20px;
  color: var(--fg-muted);
  margin: 0;
}

.gate__actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  margin-top: 8px;
}

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

.btn {
  flex: 1;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 48px;
  transition: background-color 200ms ease-in-out, color 200ms ease-in-out,
    border-color 200ms ease-in-out;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-0);
}
.btn--primary:hover,
.btn--primary:active {
  background: var(--accent-dim);
}

.btn--secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--outline);
}
.btn--secondary:hover,
.btn--secondary:active {
  border-color: var(--fg-muted);
}

.btn--ghost-accent {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
  flex: 0 1 auto;
}
.btn--ghost-accent:hover,
.btn--ghost-accent:active {
  color: var(--accent-dim);
  border-color: var(--accent-dim);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.link-btn:hover {
  color: var(--accent-dim);
}

/* ---------- Badges & chips ---------- */

.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--accent);
  margin: 0;
}

.badge--sm {
  font-size: 10px;
  padding: 1px 8px;
}

.badge--muted {
  border-color: var(--fg-muted);
  color: var(--fg-muted);
}

.badge--error {
  border-color: var(--error);
  color: var(--error);
}

.chip {
  display: inline-block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  border-radius: var(--r-chip);
  padding: 3px 8px;
}

.chip--won {
  color: var(--accent);
  background: rgba(0, 255, 194, 0.12);
}

.chip--near {
  color: var(--warn);
  background: rgba(247, 146, 87, 0.14);
}

/* ---------- Hero ---------- */

.hero {
  padding: 24px 0 8px;
  text-align: center;
}

.hero__headline {
  font-size: 30px;
  line-height: 37px;
  font-weight: 900;
  margin: 16px 0 8px;
}

.hero__stat {
  color: var(--accent);
}

.hero__stat--prize {
  color: var(--prize);
}

/* FAIL-CLOSED polarity (adversarial review, reskin): the headline is hidden
   by DEFAULT and shows only in the one explicitly-good state — an unknown or
   missing data-state can never publish the "{X} ... £{P}" placeholder. */
.hero__headline {
  display: none;
}
.hero__headline[data-state="ready"] {
  display: block;
}

/* Hard-coded, data-free lead shown whenever the headline cannot render —
   it can never show a placeholder because it contains no data at all. */
.hero__fallback {
  font-size: 30px;
  line-height: 37px;
  font-weight: 900;
  margin: 16px 0 8px;
}

.hero__fallback .brand {
  color: var(--accent);
}

.hero__headline[data-state="ready"] ~ .hero__fallback {
  display: none;
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 20px auto 0;
  font-size: 13px;
  line-height: 17px;
  color: var(--fg-muted);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 14px;
}

.counter__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 auto;
}

.counter strong,
.counter #counter-n {
  color: var(--accent);
  font-weight: 700;
}

/* Hidden until the counter has a real value — never show a fabricated number.
   display:none (not visibility) so the empty pill leaves no phantom gap. */
.counter[data-state="loading"],
.counter[data-state="unavailable"] {
  display: none;
}

/* ---------- Sections ---------- */

.section__title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
  margin: 0 0 8px;
}

.footnote {
  font-size: 12px;
  line-height: 17px;
  color: var(--fg-muted);
  margin: 8px 0 0;
}

/* ---------- Upload ---------- */

.upload {
  padding: 24px 0;
}

.upload__help {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 20px;
  margin: 0 0 16px;
}

.upload__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 32px 16px;
  border: 1px dashed var(--dashed);
  border-radius: var(--r-card);
  background: var(--surface);
  cursor: pointer;
  min-height: 160px;
  transition: opacity 150ms ease-in-out;
}
.upload__dropzone:active {
  opacity: 0.9;
}

.upload__icon {
  width: 24px;
  height: 24px;
}

.upload__cta {
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
}

.upload__hint {
  font-size: 12px;
  line-height: 17px;
  color: var(--fg-muted);
}

.upload__status {
  font-size: 13px;
  line-height: 18px;
  color: var(--fg-muted);
  min-height: 1.5em;
}

/* Checking card (dropzone swaps to this while the Worker reads the image) */

.checking-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 32px 16px;
  border-radius: var(--r-card);
  background: var(--surface);
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid rgba(0, 255, 194, 0.2);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.checking-card__title {
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  margin: 0;
}

.checking-card__sub,
.checking-card__file {
  font-size: 12px;
  line-height: 17px;
  color: var(--fg-muted);
  margin: 0;
}

/* Done row (after a successful check) */

.done-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  padding: 12px 0;
}

.done-row__icon {
  width: 24px;
  height: 24px;
  /* single-color icon tinted to accent green */
  filter: brightness(0) saturate(100%) invert(87%) sepia(21%) saturate(3286%)
    hue-rotate(103deg) brightness(103%) contrast(104%);
}

.done-row__file {
  color: var(--fg);
}

/* ---------- Results ---------- */

.results {
  padding: 8px 0 24px;
}

.result-card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 20px;
}

.result-card--error {
  border: 1px solid rgba(247, 87, 90, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.error-circle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(247, 87, 90, 0.15);
  color: var(--error);
  font-weight: 900;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result__chip-row {
  margin: 0 0 12px;
}

.result__headline {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  margin: 0;
}

.result__amount {
  color: var(--prize);
  font-weight: 900;
}

.result__count {
  color: var(--accent);
}

.result__best-week {
  margin: 16px 0 0;
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 20px;
}

.result__segue {
  margin: 12px 0 0;
  font-weight: 700;
}

.result__file {
  font-size: 12px;
  line-height: 17px;
  color: var(--fg-muted);
  margin: 0;
}

/* GW breakdown rows (rendered only when real per-GW data exists) */

.breakdown {
  margin: 16px 0 0;
  border-radius: var(--r-btn);
  overflow: hidden;
}

.breakdown__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 18px;
}

.breakdown__row:nth-child(odd) {
  background: var(--row-a);
}
.breakdown__row:nth-child(even) {
  background: var(--row-b);
}

.breakdown__pts {
  color: var(--accent);
  background: rgba(0, 255, 194, 0.12);
  border-radius: var(--r-chip);
  padding: 2px 6px;
  font-weight: 600;
  font-size: 12px;
}

.breakdown__right {
  white-space: nowrap;
  color: var(--fg-muted);
}

.breakdown__right .result__amount {
  font-weight: 700;
}

.ph {
  color: var(--fg-muted);
}

/* ---------- CTA ---------- */

.cta {
  padding: 24px 0;
  text-align: center;
}

.cta__appicon {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  margin: 4px 0 12px;
}

.cta__buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.store-btn {
  display: inline-block;
  line-height: 0;
  border-radius: var(--r-btn);
  transition: opacity 150ms ease-in-out;
}
.store-btn:hover,
.store-btn:active {
  opacity: 0.9;
}

.store-btn img {
  height: 48px;
  width: auto;
}

/* ---------- Footer (present on every visible state) ---------- */

.site-footer {
  border-top: 1px solid var(--divider);
  padding: 20px var(--pad-x) 32px;
  text-align: center;
  font-size: 12px;
  line-height: 17px;
  color: var(--fg-muted);
}

.site-footer__line {
  margin: 6px 0;
}

.site-footer a {
  color: var(--fg-muted);
}
.site-footer a:hover {
  color: var(--fg);
}

.site-footer .badge {
  border-color: var(--fg-muted);
  color: var(--fg-muted);
}

/* ---------- Desktop ---------- */

@media (min-width: 1024px) {
  :root {
    --pad-x: 48px;
  }

  .wordmark {
    height: 50px;
  }

  .site-header .wordmark {
    height: 28px;
  }

  .gate__title {
    font-size: 44px;
    line-height: 52px;
  }

  .hero__headline,
  .hero__fallback {
    font-size: 44px;
    line-height: 52px;
    text-align: left;
    margin-top: 0;
  }

  .hero {
    text-align: left;
  }

  /* Landing grid: headline left, upload panel right. */
  .main-grid {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 72px;
    align-items: start;
    padding: 40px 0 24px;
  }

  .main-grid .upload {
    background: var(--surface-deep);
    border: 1px solid var(--divider);
    border-radius: var(--r-panel);
    padding: 28px;
    margin: 0;
  }

  .section__title {
    font-size: 20px;
    line-height: 26px;
  }

  .result-card {
    border-radius: var(--r-panel);
    padding: 28px;
    max-width: 640px;
    margin: 0 auto;
  }

  .result__headline {
    font-size: 26px;
    line-height: 33px;
  }

  .cta__appicon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .cta__buttons {
    flex-direction: row;
    justify-content: center;
  }

  .store-btn img {
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
