/* Improv Arena legal pages (public/*.html): TinyStage's legal stylesheet (tinystage-all
   public/styles.css) with Improv Arena's typeface. Served as-is, outside the Expo app. */
/* The `hidden` attribute must actually hide. The UA stylesheet's
 * [hidden] { display: none } is the weakest rule there is, so ANY author rule
 * that sets `display` on the same element outranks it — .btn is inline-flex and
 * .cta-row is flex, which meant every JS `el.hidden = true` on this site was a
 * no-op: invite.html and get.html show BOTH store buttons on a phone instead of
 * only the one that device can install from. Utility, hence !important. */
[hidden] { display: none !important; }

/* TinyStage marketing/legal pages — styled to match the in-app landing
 * (src/features/landing/Landing.tsx) rather than the retired cream-and-Fraunces
 * marketing site. Everything here mirrors src/theme/tokens.ts:
 *   • StarryBackdrop's deep navy → indigo → plum gradient + nebula glows,
 *     reproduced with CSS gradients and a tiled star field.
 *   • Plus Jakarta Sans for text and the wordmark (Improv Arena's typeface).
 *   • gold #FFC107 for accents/links, curtain red #FF3D63 for the brand mark.
 * Cards are the app's translucent white-on-dark panels, not white paper.
 */
:root {
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-wordmark: "Plus Jakarta Sans", system-ui, sans-serif;

  /* Brand (tokens.ts) */
  --gold: #FFC107;
  --gold-dark: #F7A337;
  --curtain: #FF3D63;
  --ink: #323232;        /* text on light chips */
  --ink-deep: #0B0618;   /* button face / phone frame */

  /* Starry backdrop stops */
  --space-1: #050513;
  --space-2: #0A081C;
  --space-3: #140A26;

  /* Text on dark */
  --text: #FFFFFF;
  --text-70: rgba(255, 255, 255, 0.72);
  --text-55: rgba(255, 255, 255, 0.55);
  --text-35: rgba(255, 255, 255, 0.35);

  --hairline: rgba(255, 255, 255, 0.1);
  --panel: rgba(255, 255, 255, 0.045);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 600; /* body text one step heavier than regular, as the site does */
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  min-height: 100vh;
  background-color: var(--space-1);
}

/* The starry backdrop, in three fixed layers: stars, nebula glows, gradient. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    /* Stars — a 320px tile of assorted dots, echoing the 120-star field. */
    radial-gradient(1.1px 1.1px at 24px 38px, rgba(255,255,255,0.75), transparent),
    radial-gradient(1px 1px at 142px 12px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.6px 1.6px at 268px 74px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 62px 122px, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.2px 1.2px at 198px 158px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 300px 196px, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 96px 226px, rgba(255,255,255,0.95), transparent),
    radial-gradient(1px 1px at 236px 262px, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.3px 1.3px at 16px 292px, rgba(255,255,255,0.65), transparent),
    radial-gradient(1px 1px at 172px 306px, rgba(255,255,255,0.5), transparent),
    /* Nebulae — purple top-right, blue bottom-left. */
    radial-gradient(680px 680px at 78% 14%, rgba(140, 77, 191, 0.18), transparent 70%),
    radial-gradient(640px 640px at 20% 78%, rgba(77, 102, 217, 0.14), transparent 70%),
    linear-gradient(180deg, var(--space-1) 0%, var(--space-2) 52%, var(--space-3) 100%);
  background-size:
    320px 320px, 320px 320px, 320px 320px, 320px 320px, 320px 320px,
    320px 320px, 320px 320px, 320px 320px, 320px 320px, 320px 320px,
    100% 100%, 100% 100%, 100% 100%;
  background-repeat: repeat, repeat, repeat, repeat, repeat, repeat, repeat,
    repeat, repeat, repeat, no-repeat, no-repeat, no-repeat;
}

a { color: var(--gold); }
a:hover { color: var(--gold-dark); }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

/* Header — the landing's logo-left / actions-right bar. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(10, 8, 28, 0.72);
  border-bottom: 1px solid var(--hairline);
}
.site-header .bar {
  max-width: 1060px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.brand .name {
  font-family: var(--font-wordmark);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1;
  padding-top: 2px;
}
.brand img, .brand svg { width: 34px; height: 34px; border-radius: 8px; display: block; }

.nav { display: flex; align-items: center; gap: 10px; }
.lang-select {
  appearance: none; -webkit-appearance: none;
  background: transparent; color: var(--text-55);
  border: 1px solid var(--hairline); border-radius: 999px;
  font-family: inherit; font-weight: 800; font-size: 13px;
  padding: 7px 12px; cursor: pointer;
}
.lang-select:hover { color: var(--text); }
.lang-select option { color: var(--ink); background: #fff; }

/* Buttons — the app's PressableButton: flat face, hard shadow, sinks on press. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-radius: 16px;
  padding: 13px 24px;
  font-size: 0.95rem;
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
  border: none;
  cursor: pointer;
}
.btn-primary {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.45);
}
.btn-primary:hover { background: #FFD04A; color: var(--ink); }
.btn-primary:active { transform: translateY(3px); box-shadow: none; }
.btn-ghost {
  background: transparent;
  color: var(--text-55);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.btn-appstore {
  background: var(--ink-deep);
  color: var(--text);
  text-transform: none;
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.55);
}
.btn-appstore:hover { background: #150C29; color: var(--text); }
.btn-appstore .apple { width: 18px; height: 18px; margin-top: -2px; fill: currentColor; }
/* Play's triangle reads a touch larger than the apple at the same box. */
.btn-appstore .play { width: 17px; height: 17px; fill: currentColor; }

/* Hero (invite page) */
.hero, .invite { text-align: center; padding: 64px 0 56px; }
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--gold);
  margin: 0 0 18px;
}
h1.title {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 0;
  text-wrap: balance;
}
.title .hl { color: var(--gold); }
.lede {
  font-size: 1.1rem;
  color: var(--text-70);
  max-width: 32rem;
  margin: 22px auto 0;
  text-wrap: balance;
}
.cta-row {
  margin-top: 30px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.03);
  padding: 32px 0;
}
.site-footer .bar {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-35);
}
.site-footer .links { display: flex; flex-wrap: wrap; column-gap: 22px; row-gap: 8px; }
.site-footer a {
  color: var(--text-55);
  text-decoration: none;
  font-weight: 700;
}
.site-footer a:hover { color: var(--gold); }

/* Legal / content pages — the app's translucent panel, not white paper. */
.doc {
  background: var(--panel);
  border-radius: 24px;
  border: 1px solid var(--hairline);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 40px;
  margin: 36px 0;
}
.doc h1 {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 6px;
  text-wrap: balance;
}
.doc .updated {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-35);
  margin: 0 0 10px;
}
.doc h2 {
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 2.1rem 0 0.5rem;
}
.doc h2.major {
  font-size: 1.6rem;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--hairline);
}
.doc h3 {
  font-weight: 800;
  font-size: 1.02rem;
  color: rgba(255, 255, 255, 0.88);
  margin: 1.3rem 0 0.4rem;
}
.doc p, .doc li { color: var(--text-70); }
.doc strong { color: rgba(255, 255, 255, 0.92); }
.doc .lead { color: var(--text); font-size: 1.05rem; }
.doc ul { padding-left: 1.3rem; }
.doc li { margin-bottom: 0.35rem; }
.doc table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.94rem; }
.doc th, .doc td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-70);
  vertical-align: top;
}
.doc th { color: var(--text); font-weight: 800; }

/* "This document is provided in English" note on a translated legal page. */
.doc .translation-note {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 193, 7, 0.08);
  border: 1px solid rgba(255, 193, 7, 0.22);
  color: var(--text-70);
  font-size: 0.86rem;
}

/* ── Two gates i18n.js opens on <html>. Both are "hide, then reveal", never
   "show, then correct": the thing being avoided is a visitor reading one answer
   and watching it change. ───────────────────────────────────────────────── */

/* The legal body while its translation is still downloading. Every page ships
   its English text inline, so without this a Japanese reader gets a full
   English policy and then a swap. i18n.js sets the attribute from <head> and
   ALWAYS clears it — on the swap, on failure, and on a 2.5s deadline — so a
   dead network degrades to the inline English rather than to a blank page.
   `visibility` rather than `display` keeps the page height stable. */
html[data-legal-pending] [data-legal] { visibility: hidden; }

/* US-only footer links ("Do Not Sell or Share"). Hidden until /api/geo answers;
   see applyGeoGates in i18n.js for why an UNKNOWN country reveals them. */
html:not([data-geo-us]) [data-us-only] { display: none; }

@media (max-width: 560px) {
  .doc { padding: 24px; border-radius: 20px; }
  .hero, .invite { padding: 40px 0 32px; }
  .site-header .bar { padding: 12px 16px; gap: 8px; }
  .nav { gap: 6px; }
  .nav .btn { padding: 10px 14px; font-size: 0.8rem; }
  .nav .btn-ghost { display: none; }
}
