/*
 * Theme: iOS-style tokens. Light follows system prefers-color-scheme: light; dark matches ThemeColors dark.
 */
:root {
  --bg-primary: #000000;
  --bg-card: #1c1c1e;
  --text-primary: #ffffff;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --brand: #007aff;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --link: #0a84ff;
  --surface-secondary: #2c2c2e;
  --image-placeholder: rgba(255, 255, 255, 0.12);
  --brand-icon-filter: invert(1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f2f2f7;
    --bg-card: #ffffff;
    --text-primary: #000000;
    --text-secondary: rgba(60, 60, 67, 0.6);
    --brand: #007aff;
    --border-subtle: rgba(0, 0, 0, 0.12);
    --link: #007aff;
    --surface-secondary: #e5e5ea;
    --image-placeholder: rgba(0, 0, 0, 0.06);
    --brand-icon-filter: none;
  }
}

/* Author display rules must not override HTML hidden — Safari/WebKit can show flex buttons otherwise. */
.cta-row[hidden],
.btn[hidden],
a.btn[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Outfit, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  font-weight: 400;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.47;
}

.wrap {
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

h1 {
  /* titleGiveawayOverview ~22pt */
  font-size: 1.3125rem;
  font-weight: 800;
  line-height: 1.22;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.lead {
  /* body 17pt */
  font-size: 1.0625rem;
  font-weight: 400;
  margin: 0 0 1rem;
}

.lead-strong {
  font-size: 1.0625rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}

.muted {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 400;
}

.schedule-preline {
  white-space: pre-line;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.cta {
  font-weight: 500;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
}

.card-pad {
  padding: 1.5rem 1.35rem 1.35rem;
}

.h1-sm {
  /* titleFormScreen: 22pt medium */
  font-size: 1.375rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
}

.badge {
  display: inline-block;
  font-family: Outfit, system-ui, sans-serif;
  /* Status chip: caption scale, Outfit (not UI serif/system caption) */
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 0.35rem;
}

.prize-line {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 0.4rem;
  color: var(--text-primary);
}

.small {
  font-size: 0.82rem;
}

.countdown-row {
  margin: 0.35rem 0 0.25rem;
}

.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stats {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0.35rem 0 0.6rem;
}

.desc.prose {
  white-space: pre-wrap;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.platform-hint {
  margin: 0 0 0.5rem;
}

.gw-qr-hint {
  margin: 0 0 0.4rem;
  text-align: center;
}

.gw-qr-wrap {
  margin: 0 0 1rem;
  text-align: center;
}

.gw-qr-img {
  display: inline-block;
  vertical-align: top;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.footer-links {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 400;
}

/* Giveaway page: subtle brand bar above cards (not a hero). */
.site-header {
  max-width: 36rem;
  margin: 0 auto;
  padding: 0.45rem 1rem 0.2rem;
  box-sizing: border-box;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 1.375rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-decoration: none;
  text-align: center;
  width: 100%;
}

/* Black raster logo on dark bg: invert so the mark reads as light. Light scheme: no filter. */
.site-brand-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: block;
  object-fit: contain;
  filter: var(--brand-icon-filter);
}

.site-brand:hover {
  color: var(--text-primary);
  text-decoration: none;
  opacity: 0.88;
}

.hero-wrap {
  margin: 0 0 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--image-placeholder);
}

/* Feed-style card: hero flush to top rounded rect (matches in-app card silhouette). */
.card-giveaway {
  padding: 0;
  overflow: hidden;
}

.hero-wrap--card {
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
}

.giveaway-card-body {
  padding: 0.85rem 1rem 0.85rem;
}

.card-giveaway:not(:has(.hero-wrap--card:not([hidden]))) .giveaway-card-body {
  padding-top: 1rem;
}

.giveaway-card-body .lead-strong {
  margin: 0 0 0.35rem;
}

.giveaway-card-body .schedule-preline {
  margin: 0 0 0.35rem;
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  /* bodyMediumSemibold token: 15pt medium */
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

/* Must stay white on accent — light theme sets --text-primary to black, which would ruin contrast. */
.btn-primary,
a.btn-primary {
  background: var(--brand);
  color: #ffffff;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.25);
}

a.btn-primary:visited {
  color: #ffffff;
}

.btn-secondary,
a.btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Apple marketing badge (img) — not a filled pill button */
.btn-appstore {
  padding: 0;
  background: transparent;
  border: none;
  line-height: 0;
  display: inline-flex;
  align-items: center;
}

.btn-appstore:hover {
  filter: brightness(1.12);
}

.btn-appstore img {
  display: block;
  height: 40px;
  width: auto;
}

/* Legal (privacy / terms) */
.h2-legal {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
  letter-spacing: -0.01em;
}

.legal-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-primary);
}

.legal-list li {
  margin-bottom: 0.5rem;
}
