/*
 * TifoXR pre-Unity auth + loading shell.
 * Shares the visual language of the in-Unity LoadingView; the loading shell is the
 * one loading screen from sign-in until the fan is in the world.
 */

/* The game's UI font, so the fan sees one typeface from the first screen into the world. One variable file covers
   every weight used here (400-700). It holds only the in-game character list (Assets/Fonts/UiFontCharacterSet.txt),
   which already covers every character on these pages; text that adds a character outside it needs the file rebuilt:
     hb-subset Assets/Fonts/Inter-VariableFont_opsz,wght.ttf --unicodes-file=Assets/Fonts/UiFontCharacterSet.txt
       --variations="opsz=14,wght=400:700" --layout-features="rvrn,ccmp,locl,mark,mkmk,kern,calt,liga,clig,rlig"
       --name-IDs="0,1,2,3,4,5,6,13,14"
   Give a rebuilt file a new name: this url carries no version, so a reused name can be served from a stale cache. */
@font-face {
  font-family: "TifoXR Inter";
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Inter-Subset-Text.ttf") format("truetype");
}

:root {
  --tifo-bg: #06130d;
  --tifo-bg-2: #0a1c12;
  --tifo-text: #f3fff7;
  --tifo-muted: #b8c8bf;
  --tifo-accent: #6ef74d;
  --tifo-accent-deep: #3fbf2c;
  --tifo-danger: #ff5240;
  --tifo-card: rgba(255, 255, 255, 0.045);
  --tifo-border: rgba(110, 247, 77, 0.28);
  --tifo-font: "TifoXR Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tifo-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  font-family: var(--tifo-font);
  color: var(--tifo-text);
  background:
    radial-gradient(1200px 680px at 18% -10%, rgba(110, 247, 77, 0.10), transparent 60%),
    radial-gradient(1000px 620px at 108% 120%, rgba(63, 191, 44, 0.10), transparent 60%),
    linear-gradient(160deg, var(--tifo-bg-2) 0%, var(--tifo-bg) 62%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.tifo-shell[hidden] { display: none; }

.tifo-card {
  width: 100%;
  max-width: 460px;
  padding: 40px 36px 34px;
  box-sizing: border-box;
  text-align: center;
  border: 1px solid var(--tifo-border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    var(--tifo-card);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
}

.tifo-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--tifo-accent);
}

.tifo-title {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tifo-copy {
  margin: 0 auto 26px;
  max-width: 340px;
  font-size: 14.5px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--tifo-muted);
}

/* ---- buttons ---- */
.tifo-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.tifo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 20px;
  font-family: var(--tifo-font);
  font-size: 15.5px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.tifo-btn:focus-visible { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }
.tifo-btn:active { transform: translateY(1px); }
.tifo-btn[disabled] { opacity: 0.55; cursor: default; pointer-events: none; }
/* .tifo-btn sets an author `display`, which outranks the user-agent `[hidden] { display: none }` rule, so a
   button hidden from JS would stay visible without this. Same fix as .tifo-shell[hidden] above. Applies to every
   sign-in button: each can be switched off (Google or Microsoft by an empty clientId, Guest by GuestAccessConfig). */
.tifo-btn[hidden] { display: none; }
/* Same trap for the loading card's action row, which must stay hidden until a Retry is actually offered. */
.tifo-actions[hidden] { display: none; }

/* Google shares the Microsoft rule rather than copying its values, so the two can never drift apart. White fill
   with near-black text also sits inside Google's light-theme spec (#FFFFFF / #1F1F1F). */
.tifo-btn--microsoft,
.tifo-btn--google {
  color: #1b1b1b;
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}
.tifo-btn--microsoft:hover,
.tifo-btn--google:hover { background: #f4f4f4; }

/* Google's official artwork, unaltered. 20px is the footprint of the Microsoft mark's 9 + 2 + 9 grid. */
.tifo-google-logo {
  display: block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

/* The visible Google button is ours; Google's real sign-in button is layered over it, invisible, to take the click. */
.tifo-google-signin {
  position: relative;
  display: flex;
  flex-direction: column;
}
.tifo-google-signin[hidden] { display: none; }

.tifo-google-gis {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  opacity: 0;
}

/* Google's button is 40px tall and at most 400px wide; stretched past ours and clipped, every edge stays clickable. */
.tifo-google-gis > div {
  flex: 0 0 auto;
  transform: scale(1.05, 1.6);
}

.tifo-google-signin:hover .tifo-btn--google:not([disabled]) { background: #f4f4f4; }
.tifo-google-signin:focus-within .tifo-btn--google { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }
.tifo-btn--google[disabled] ~ .tifo-google-gis { pointer-events: none; }

/* Before Google's button exists the overlay is empty, so it must not swallow the click meant for ours. */
.tifo-google-gis:empty { pointer-events: none; }

/* Connecting: the click is taken, so the button stops inviting another one. */
.tifo-google-signin--connecting .tifo-btn--google { cursor: progress; }
.tifo-google-signin--connecting:hover .tifo-btn--google:not([disabled]) { background: #ffffff; }

/* Ready: Google's button now lies invisibly over ours, so the glow marks where the next tap belongs. It keeps the drop
   shadow, stays outside the white face Google's branding fixes, pulses twice and then holds. */
.tifo-google-signin--ready .tifo-btn--google {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), 0 0 0 6px rgba(110, 247, 77, 0.22), 0 0 26px 6px rgba(110, 247, 77, 0.5);
  animation: tifo-google-ready 0.9s ease-in-out 2;
}
@keyframes tifo-google-ready {
  50% { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), 0 0 0 10px rgba(110, 247, 77, 0.14), 0 0 40px 12px rgba(110, 247, 77, 0.7); }
}

.tifo-ms-logo {
  display: inline-grid;
  grid-template-columns: 9px 9px;
  grid-template-rows: 9px 9px;
  gap: 2px;
  flex: 0 0 auto;
}
.tifo-ms-logo i { display: block; width: 9px; height: 9px; }
.tifo-ms-logo i:nth-child(1) { background: #f25022; }
.tifo-ms-logo i:nth-child(2) { background: #7fba00; }
.tifo-ms-logo i:nth-child(3) { background: #00a4ef; }
.tifo-ms-logo i:nth-child(4) { background: #ffb900; }

.tifo-btn--guest {
  color: var(--tifo-text);
  background: rgba(110, 247, 77, 0.10);
  border-color: var(--tifo-border);
}
.tifo-btn--guest:hover { background: rgba(110, 247, 77, 0.18); }

/* ---- status / error ---- */
.tifo-status {
  min-height: 20px;
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--tifo-muted);
}
.tifo-status--error { color: var(--tifo-danger); }

.tifo-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--tifo-text);
  border-radius: 50%;
  animation: tifo-spin 0.8s linear infinite;
}
.tifo-btn--microsoft .tifo-spinner,
.tifo-btn--google .tifo-spinner { border-color: rgba(0, 0, 0, 0.25); border-top-color: #1b1b1b; }

/* ---- loading shell ---- */
.tifo-progress {
  position: relative;
  width: 100%;
  height: 8px;
  margin: 26px 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.tifo-progress__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(110, 247, 77, 0.35), var(--tifo-accent), rgba(110, 247, 77, 0.35));
  box-shadow: 0 0 16px rgba(110, 247, 77, 0.55);
  animation: tifo-indeterminate 1.35s ease-in-out infinite;
}
.tifo-stage {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--tifo-muted);
}

@keyframes tifo-spin { to { transform: rotate(360deg); } }
@keyframes tifo-indeterminate {
  0% { left: -36%; }
  100% { left: 100%; }
}

@media (max-width: 520px) {
  .tifo-card { padding: 32px 22px 26px; border-radius: 16px; }
  .tifo-title { font-size: 22px; }
  .tifo-copy { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .tifo-spinner,
  .tifo-progress__bar,
  .tifo-google-signin--ready .tifo-btn--google { animation: none; }
  .tifo-progress__bar { left: 0; width: 100%; opacity: 0.85; }
  .tifo-btn { transition: none; }
}

/* =========================================================================
   LANDING LAYOUT (auth shell only) — logo header, hero, login card, footer,
   over an atmospheric grid + diagonal streaks + radial glows. The loading
   shell deliberately stays a plain centered card to match Unity's own screen.
   ========================================================================= */
.tifo-landing {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3.2vw, 44px) clamp(22px, 4vw, 64px);
  overflow: hidden;
  background:
    radial-gradient(900px 540px at 86% 28%, rgba(110, 247, 77, 0.16), transparent 60%),
    radial-gradient(760px 520px at 4% 94%, rgba(63, 191, 44, 0.12), transparent 62%),
    linear-gradient(160deg, #0a1c12 0%, var(--tifo-bg) 60%);
}

/* faint tech grid, faded toward the edges */
.tifo-landing::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(110, 247, 77, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 247, 77, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(125% 105% at 62% 42%, #000 42%, transparent 100%);
  mask-image: radial-gradient(125% 105% at 62% 42%, #000 42%, transparent 100%);
}

/* bright diagonal energy streaks */
.tifo-landing::after {
  content: "";
  position: absolute;
  inset: -20% -12%;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 45%, rgba(110, 247, 77, 0.32) 48.5%, rgba(110, 247, 77, 0.05) 51%, transparent 55%),
    linear-gradient(115deg, transparent 61%, rgba(110, 247, 77, 0.16) 63.5%, transparent 67%);
  filter: blur(2px);
  opacity: 0.65;
}

.tifo-header,
.tifo-landing__main,
.tifo-footer { position: relative; z-index: 1; width: 100%; max-width: 1320px; margin: 0 auto; }

/* ---- header ---- */
.tifo-header { display: flex; align-items: center; justify-content: space-between; }
.tifo-brand { display: flex; align-items: center; gap: 14px; }
.tifo-brand__logo {
  width: 48px; height: 48px; border-radius: 12px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(110, 247, 77, 0.25), 0 8px 24px rgba(0, 0, 0, 0.5);
}
.tifo-brand__word { font-size: 24px; font-weight: 600; color: var(--tifo-accent); }
.tifo-portal { display: flex; flex-direction: column; gap: 3px; text-align: right; }
.tifo-portal__label { font-size: 12px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--tifo-muted); }
.tifo-portal__ver { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--tifo-accent); }

/* ---- main: hero + login ---- */
.tifo-landing__main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(28px, 5vw, 72px);
}
.tifo-hero { flex: 1 1 auto; max-width: 640px; text-align: left; }
.tifo-hero__title {
  margin: 12px 0 18px;
  font-size: clamp(34px, 5.2vw, 66px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}
.tifo-hero__copy {
  margin: 0 0 26px;
  max-width: 540px;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.6;
  color: var(--tifo-muted);
}
.tifo-chips { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; list-style: none; }
.tifo-chips li {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--tifo-border);
  background: rgba(110, 247, 77, 0.06);
  font-size: 14px;
  font-weight: 600;
  color: var(--tifo-text);
}

.tifo-login { flex: 0 0 auto; }
.tifo-landing .tifo-login .tifo-card { width: 420px; max-width: 100%; text-align: left; }
.tifo-landing .tifo-login .tifo-eyebrow,
.tifo-landing .tifo-login .tifo-title { text-align: left; }
.tifo-landing .tifo-login .tifo-copy { margin: 0 0 22px; max-width: none; text-align: left; }
.tifo-fineprint { margin: 16px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--tifo-muted); opacity: 0.85; }

/* ---- footer ---- */
.tifo-footer { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--tifo-muted); }
.tifo-footer__links { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tifo-footer__links em { font-style: normal; opacity: 0.45; margin: 0 6px; }
.tifo-footer__accent { color: var(--tifo-accent); }

/* Legal links. Underline only on interaction so the footer stays quiet, and a visible focus ring because a
   legal link must be reachable by keyboard. Hit area is padded to stay tappable on a phone without changing
   the footer's height. */
.tifo-footer__link {
  color: inherit;
  text-decoration: none;
  padding: 6px 2px;
  border-radius: 4px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
.tifo-footer__link:hover,
.tifo-footer__link:focus-visible { color: var(--tifo-accent); text-decoration: underline; }
.tifo-footer__link:focus-visible { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }

/* Any display value we set here outranks the browser's [hidden] { display: none }, so a link with no URL would
   render anyway - which is exactly the dead legal link the hiding exists to prevent. Restate it explicitly. */
.tifo-footer__link[hidden],
.tifo-footer__links em[hidden] { display: none !important; }


@media (max-width: 900px) {
  .tifo-landing { overflow-x: hidden; overflow-y: auto; justify-content: flex-start; gap: 30px; }
  .tifo-landing__main { flex-direction: column; align-items: stretch; justify-content: center; text-align: center; gap: 30px; }
  .tifo-hero { max-width: 640px; margin: 0 auto; text-align: center; }
  .tifo-hero__copy { margin-left: auto; margin-right: auto; }
  .tifo-chips { justify-content: center; }
  .tifo-login { width: 100%; }
  .tifo-landing .tifo-login .tifo-card { width: 100%; max-width: 440px; margin: 0 auto; text-align: center; }
  .tifo-landing .tifo-login .tifo-eyebrow,
  .tifo-landing .tifo-login .tifo-title,
  .tifo-landing .tifo-login .tifo-copy { text-align: center; }
}

@media (max-width: 560px) {
  .tifo-portal { display: none; }
  .tifo-footer { flex-direction: column; gap: 6px; text-align: center; }
  .tifo-hero__title { font-size: clamp(28px, 8vw, 42px); }
}

/* GMS globe in the brand lockup (matches Unity's header GMSLogo) */
.tifo-brand__gms { width: 30px; height: auto; object-fit: contain; opacity: 0.95; }

/* Environment tag (DEV / TEST) — driven by auth-config.json.environmentTag; hidden on prod. */
.tifo-env-tag {
  align-self: center;
  padding: 5px 13px;
  border-radius: 999px;
  font-family: var(--tifo-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #06130d;
  background: var(--tifo-accent);
  box-shadow: 0 0 16px rgba(110, 247, 77, 0.4);
  white-space: nowrap;
}
.tifo-env-tag[hidden] { display: none; }

/* =========================================================================
   LOADING SHELL — styled after Unity's LoadingScreen_TifoXR prefab (colors are
   lifted from its components). It is the only loading screen after sign-in:
   Unity claims it and fills the bar instead of drawing its own overlay.
   ========================================================================= */

/* Calmer background than the landing: soft green glows left+right of centre,
   the same faint grid, and NO bright diagonal streaks (Unity's loading bg). */
/* Pure black base + two soft green edge glows, NO grid (sampled from the prefab). */
.tifo-landing--loading {
  background:
    radial-gradient(58% 92% at 0% 50%, rgba(92, 255, 59, 0.17), transparent 70%),
    radial-gradient(58% 92% at 100% 50%, rgba(92, 255, 59, 0.15), transparent 70%),
    #000000;
}
/* Base .tifo-landing clips both axes to contain the diagonal streaks. This shell switches those off, so
   there is nothing to contain vertically - and a progress bar the visitor cannot reach reads as a hang. */
.tifo-landing--loading { overflow-y: auto; }
.tifo-landing--loading::before { display: none; } /* Unity's loading bg has no grid */
.tifo-landing--loading::after { display: none; }  /* nor diagonal streaks */
.tifo-landing--loading .tifo-landing__main { justify-content: center; align-items: center; }

/* Card sampled from LoadingScreen_TifoXR: dark-green interior #123606, bright-green
   frame (#246B14 body + #75FF45 edge line) and a soft green outer glow. */
/* min() rather than width + max-width: the two used to live in different rules, and the more specific one
   (#app-loading-shell .tifo-card) pinned the card at 520px, so the max-width:100% that was meant to let it
   shrink never applied and the card hung off both edges of every phone. One declaration cannot disagree
   with itself. */
.tifo-loading-card {
  width: min(520px, 100%);
  text-align: center;
  border-radius: 12px;
  border: 2px solid rgba(117, 255, 69, 0.78);
  background: #123606;
  box-shadow:
    0 0 0 4px rgba(36, 107, 20, 0.6),
    0 0 40px rgba(97, 255, 61, 0.25),
    0 22px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: none;
}

/* SmallLabel #94FF61 · Title #FBFFFB · Subtitle #D1E8D6 · Percent #EBFFDB · StageText #C2E0C7 */
.tifo-loading-card__label { color: #94ff61; }
.tifo-loading-card__title {
  margin: 10px 0 12px;
  font-size: clamp(23px, 3vw, 31px);
  font-weight: 700;
  color: #fbfffb;
}
.tifo-loading-card__sub { margin: 0 auto 22px; max-width: 430px; font-size: clamp(14px, 3.8vw, 16px); color: #d1e8d6; }
.tifo-loading-card__percent { margin: 0 0 12px; font-size: clamp(16px, 4.2vw, 18px); font-weight: 700; letter-spacing: 0.02em; color: #ebffdb; }
.tifo-loading-card .tifo-stage { color: #c2e0c7; font-size: clamp(13px, 3.5vw, 15px); }

/* progress: track #020705, fill #6EF74C (+glow #6BFF38), shimmer #F2FFD1 */
.tifo-progress--unity {
  height: 8px;
  margin: 4px 0 16px;
  background: #020705;
  border: 1px solid rgba(110, 247, 77, 0.14);
}
.tifo-progress--unity .tifo-progress__bar {
  width: 34%;
  background: #6ef74c;
  box-shadow: 0 0 14px rgba(107, 255, 56, 0.55);
}
.tifo-progress__shimmer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 72px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(242, 255, 209, 0.30), transparent);
  animation: tifo-indeterminate 1.05s ease-in-out infinite;
}

/* Boot outcome on the loading card. A stall only reveals the Retry action; a failure also stops the bar,
   fills it in the danger colour and colours the stage text, so the card reads as a finished state, not a
   slower one. Geometry is untouched so the card does not jump when the action appears. */
.tifo-loading-card__actions { flex-direction: row; margin: 16px auto 0; max-width: 280px; }
/* Retry and Refresh share the row, as on Unity's card; a lone Retry still spans it. */
.tifo-loading-card__actions .tifo-btn { flex: 1 1 0; min-width: 0; }
.tifo-loading-card--failed .tifo-progress__bar {
  animation: none;
  left: 0;
  width: 100%;
  background: var(--tifo-danger);
  box-shadow: none;
}
.tifo-loading-card--failed .tifo-progress__shimmer { animation: none; opacity: 0; }
.tifo-loading-card--failed .tifo-stage { color: var(--tifo-danger); }
/* Loaded and waiting for the tap: a settled, full bar, or "Ready / 100%" would still read as loading. */
.tifo-loading-card--ready .tifo-progress__bar { animation: none; left: 0; width: 100%; }
.tifo-loading-card--ready .tifo-progress__shimmer { animation: none; opacity: 0; }

/* Footer copyright only, centred (Unity's loading footer) */
.tifo-footer--center { justify-content: center; text-align: center; }

/* "Tap anywhere to enter": the whole screen is the target, since a phone's card is far too small to be one. Fixed
   rather than absolute so it still covers the screen when a short viewport has scrolled the card. */
.tifo-loading-enter {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0;
  padding: 0 24px max(14vh, calc(env(safe-area-inset-bottom) + 16px));
  border: 0;
  background: transparent;
  color: #ffffff;
  font-family: var(--tifo-font);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tifo-loading-enter[hidden] { display: none; }
.tifo-loading-enter:focus-visible { outline: none; }
.tifo-loading-enter:focus-visible .tifo-loading-enter__hint { outline: 2px solid var(--tifo-accent); outline-offset: 3px; }
.tifo-loading-enter__hint {
  padding: 12px 24px;
  border: 1px solid var(--tifo-border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 24px rgba(97, 255, 61, 0.25);
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: tifo-enter-pulse 1.6s ease-in-out infinite;
}
@keyframes tifo-enter-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .tifo-progress__shimmer { animation: none; opacity: 0; }
  .tifo-loading-enter__hint { animation: none; }
}

/* ============================================================================
   AGE GATE
   ============================================================================ */

/* Screen-reader-only label: the grouping must be announced without adding visible chrome. */
.tifo-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The gate is a single centred card rather than the hero+login split. */
.tifo-landing__main--single { justify-content: center; }
.tifo-agegate { width: 100%; max-width: 520px; margin: 0 auto; }

.tifo-dob { display: flex; gap: 12px; margin: 22px 0 4px; }
.tifo-dob__field { display: flex; flex-direction: column; gap: 7px; flex: 1 1 0; min-width: 0; }
.tifo-dob__field > span {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--tifo-muted);
}

/* min-height 52px matches .tifo-btn, so every control on this screen clears the 44px touch target.
   font-size 16px is not cosmetic: iOS Safari zooms the whole page when a focused control is smaller. */
.tifo-dob__field select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  font-family: var(--tifo-font);
  font-size: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239aa5a0' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.tifo-dob__field select:focus-visible { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }
.tifo-dob__field select option { color: #fff; background: #12211b; }

.tifo-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* The blocked state replaces the form entirely — leaving the inputs on screen would invite another guess. */
.tifo-agegate--blocked .tifo-dob,
.tifo-agegate--blocked .tifo-actions { display: none; }

/* The blocked copy's "contact us" is built in JS (showAgeBlocked) and carries no class, so it would render
   in the browser's default blue-underline against this dark green card. It is the only remedy a refused
   visitor is offered, so it has to read as ours and stay legible. Matches the consent sentence's links. */
.tifo-agegate .tifo-copy a {
  color: var(--tifo-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tifo-agegate .tifo-copy a:hover { color: var(--tifo-text); }
.tifo-agegate .tifo-copy a:focus-visible { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
   CONSENT GATE
   Same single-card shape as the age gate. The card is centred, but this sentence is not: a two-line
   agreement centred under a checkbox reads as decoration, and people skim it. Left-aligned prose next to
   the control it belongs to reads as something to act on.
   --------------------------------------------------------------------------- */
.tifo-consent { width: 100%; max-width: 520px; margin: 0 auto; }

.tifo-consent__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 22px 0 4px;
  text-align: left;
}

/* Built from scratch rather than styled natively: a platform checkbox renders grey-on-grey against this
   card on every OS, and cannot carry the accent. appearance:none drops the platform paint; everything
   visible below is ours. */
.tifo-consent__box {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  /* Aligns the box with the CENTRE OF THE FIRST LINE of the sentence beside it, which is where the eye
     expects it. 11px label padding + half of a 22.5px line = 22.25px; the box's own half is 12px. */
  margin: 10px 0 0;
  background: rgba(255, 255, 255, 0.06);
  /* Not the rgba(255,255,255,0.16) the DOB selects use. That resting border lands near 1.7:1 on this card,
     under the 3:1 WCAG 2.1 SC 1.4.11 asks of a control's boundary. A select still reads as a control when
     its border is faint — it carries a chevron and a label. An unticked checkbox is nothing BUT its border,
     and this is the one control the whole screen depends on, so it gets an opacity that clears the bar. */
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 7px;
  cursor: pointer;
}

/* The visible box is 24px because a 44px square of accent green beside two lines of text is a traffic
   light. This restores the 44px TOUCH target without touching layout — an invisible centred overlay, so a
   thumb aimed anywhere near the box still lands. */
.tifo-consent__box::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}

.tifo-consent__box:checked {
  background: var(--tifo-accent);
  border-color: var(--tifo-accent);
}

/* The tick is drawn from two borders rather than an SVG or a glyph: no extra request, and no dependence on
   a font that may not have loaded when this screen paints. */
.tifo-consent__box:checked::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 8px;
  width: 5px;
  height: 10px;
  border: solid var(--tifo-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

/* Full text colour, not the muted tone .tifo-copy uses. This is the sentence being agreed to, so it must
   not read as supporting detail.
   NO `display: flex` here, deliberately: this label holds running prose with two inline links, and a flex
   context would make each text run and each anchor a separate flex ITEM — laying the sentence out as five
   side-by-side columns instead of a sentence. The 11px vertical padding is what buys the 44px row height
   that flex centring was reaching for, without taking the text out of normal inline flow. */
.tifo-consent__label {
  flex: 1 1 auto;
  padding: 11px 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--tifo-text);
  cursor: pointer;
}

/* Underlined by default, unlike the footer links: inside a sentence, colour alone is not a reliable signal
   that a phrase is tappable, and it is the only thing distinguishing them from the words around them. */
.tifo-consent__label a {
  color: var(--tifo-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tifo-consent__label a:hover { color: var(--tifo-text); }
.tifo-consent__label a:focus-visible { outline: 2px solid var(--tifo-accent); outline-offset: 2px; }

/* ============================================================================
   RESPONSIVE PASS
   ============================================================================ */

/* Notched phones: keep content clear of the home indicator and the cutout. */
.tifo-shell { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.tifo-landing { padding-bottom: max(clamp(20px, 3.2vw, 44px), env(safe-area-inset-bottom)); }

@media (max-width: 720px) {
  /* Seven legal links cannot sit on one line on a phone. Centre them, give them room to wrap, and keep
     each one a comfortable tap target rather than a 12px sliver between two separators. */
  .tifo-footer { flex-direction: column; gap: 10px; text-align: center; }
  .tifo-footer__links { justify-content: center; row-gap: 2px; }

  /* 44px is the minimum comfortable touch target. Text this size is ~15px tall, so the padding has to do the
     work — otherwise these are 31px slivers sitting between separators, and a fat thumb opens the wrong page. */
  .tifo-footer__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 8px;
  }
  .tifo-agegate { max-width: 100%; }
}

@media (max-width: 420px) {
  /* Day/Month/Year stop fitting side by side once the year select needs four digits plus its chevron. */
  .tifo-dob { flex-direction: column; gap: 14px; }
  .tifo-header { gap: 10px; }
  .tifo-brand__word { font-size: 20px; }
  .tifo-footer__links em { margin: 0 4px; }
}

/* Short viewports: the shell is centred and would otherwise clip the card off-screen. Deliberately NOT
   qualified by `orientation: landscape` any more - a short viewport is a short viewport, and the qualifier
   let a short PORTRAIT window (a resized desktop browser, a phone with the keyboard up) fall through to the
   centred layout it was written to rescue. */
@media (max-height: 560px) {
  .tifo-landing { justify-content: flex-start; overflow-y: auto; }
  .tifo-card { padding: 24px 20px 20px; }

  /* Every other screen here can be scrolled to reach what it is asking for. The loading screen asks for
     nothing, so anything pushed past the fold is simply never seen - and a progress bar the visitor cannot
     see reads as a frozen tab. On a landscape phone (the orientation touch sessions are locked to) the card
     and footer overran a 390px-tall viewport by ~55px, so this trims the vertical rhythm to fit. */
  .tifo-landing--loading { gap: 14px; }
  .tifo-brand__logo { width: 36px; height: 36px; }
  .tifo-brand__word { font-size: 20px; }
  .tifo-loading-card { padding: 18px 20px 16px; }
  .tifo-loading-card__title { margin: 6px 0 8px; font-size: clamp(19px, 2.4vw, 24px); }
  .tifo-loading-card__sub { margin-bottom: 12px; }
  .tifo-loading-card__percent { margin-bottom: 8px; }
  .tifo-progress--unity { margin: 2px 0 10px; }

  /* The error row and the enter prompt are the two things this screen asks for, so both must fit above the fold. */
  .tifo-loading-card__actions { margin-top: 10px; }
  .tifo-loading-card__actions .tifo-btn { min-height: 44px; }
  .tifo-loading-enter { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .tifo-loading-enter__hint { padding: 10px 20px; font-size: 16px; }
  .tifo-loading-enter:not([hidden]) ~ .tifo-footer { visibility: hidden; }
}
