/*
 * TifoXR pre-Unity auth + loading shell.
 * Shares the visual language of the in-Unity LoadingView so the browser loading
 * screen and the Unity loading screen read as one continuous flow.
 */

@font-face {
  font-family: "TifoXR Montserrat";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Montserrat-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "TifoXR Montserrat";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Montserrat-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "TifoXR Montserrat";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Montserrat-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "TifoXR Montserrat";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Montserrat-Bold.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 Montserrat", "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--microsoft {
  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 { background: #f4f4f4; }

.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 { border-color: rgba(0, 0, 0, 0.25); border-top-color: #1b1b1b; }

/* ---- loading shell ---- */
#app-loading-shell .tifo-card { max-width: 520px; }

.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 { 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 em { font-style: normal; opacity: 0.45; margin: 0 6px; }
.tifo-footer__accent { color: var(--tifo-accent); }

@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; }

/* =========================================================================
   LOADING SHELL — a 1:1 replica of Unity's LoadingScreen_TifoXR prefab so the
   browser loading screen and Unity's loading screen read as one screen through
   the cross-fade. Colors are lifted directly from the prefab's components.
   ========================================================================= */

/* 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;
}
.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. */
.tifo-loading-card {
  width: 560px;
  max-width: 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: 16px; color: #d1e8d6; }
.tifo-loading-card__percent { margin: 0 0 12px; font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: #ebffdb; }
.tifo-loading-card .tifo-stage { color: #c2e0c7; font-size: 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;
}

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

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