:root {
  --ink: #06070b;
  --panel: #0a0b10;
  --panel-line: rgba(255, 255, 255, 0.07);
  --card: rgba(255, 255, 255, 0.022);
  --card-line: rgba(255, 255, 255, 0.08);
  --text: #f2f4f9;
  --text-dim: #97a2b4;
  --text-faint: #59647a;
  --sun-core: #ffe2a6;
  --sun-mid: #ff9d4a;
  --sun-edge: #ff6a2c;
  --accent: #ff9a45;
  --accent-soft: rgba(255, 154, 69, 0.14);
  --danger: #ff7a7a;
  --shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============ Boot loader ============ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--ink);
}

/* ============ Gate (full-bleed sunrise sign-in) ============ */
.gate {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  overflow: hidden;
}

/* Full-bleed sunrise sky */
.sky { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.sky::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(125% 80% at 50% 118%, rgba(255, 150, 60, 0.55) 0%, rgba(255, 110, 45, 0.26) 26%, rgba(70, 32, 12, 0.10) 50%, transparent 66%),
    linear-gradient(180deg, #04050a 0%, #08080f 36%, #120d0b 66%, #221507 100%);
}
.sky__sun {
  position: absolute;
  left: 50%;
  bottom: -44vh;
  width: 86vh;
  height: 86vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(255, 226, 150, 0.62), rgba(255, 150, 70, 0.34) 40%, rgba(255, 110, 50, 0) 66%);
  filter: blur(8px);
  animation: rise 1.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.sky__stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 18% 16%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 72% 12%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 44% 26%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 86% 22%, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1px 1px at 12% 34%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 60% 8%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 30% 6%, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 58%);
  mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 58%);
}
.sky__grain, .phero__grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Centered content */
.gate__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}
.gate__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: rise-in 0.8s ease 0.1s both;
}
.gate__logo { border-radius: 16px; box-shadow: 0 12px 44px -8px rgba(255, 140, 60, 0.65); }
.gate__title {
  margin: 0;
  font-size: clamp(40px, 7vw, 58px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff 0%, #ffe9cf 58%, #ffb877 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 60px rgba(255, 160, 80, 0.3);
}
.gate__tag { margin: -2px 0 0; font-size: 14px; color: var(--text-dim); }

.signin-card {
  width: 100%;
  background: rgba(16, 15, 21, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
  box-shadow: 0 40px 90px -36px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  padding: 32px 30px;
  animation: rise-in 0.8s ease 0.18s both;
}
.eyebrow { margin: 0 0 12px; font-size: 11.5px; font-weight: 600; letter-spacing: 2.6px; text-transform: uppercase; color: var(--accent); }
.signin-card__title { margin: 0 0 8px; font-size: 25px; font-weight: 680; letter-spacing: -0.02em; }
.signin-card__sub { margin: 0 0 26px; font-size: 14.5px; line-height: 1.55; color: var(--text-dim); }
.signin-card__sub strong, .step__desc strong { color: #d8deea; font-weight: 600; }
.signin-card__error { margin: 16px 0 0; font-size: 13px; line-height: 1.5; color: var(--danger); }
.signin-card__fine { margin: 20px 0 0; font-size: 12px; color: var(--text-faint); }

.gate__foot, .pfoot { display: flex; gap: 8px; justify-content: center; font-size: 12px; color: var(--text-faint); }
.gate__foot { animation: rise-in 0.8s ease 0.26s both; }
.gate__foot .dot, .pfoot .dot { opacity: 0.5; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn--google { background: #fff; color: #20242c; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.9); }
.btn--google:hover { background: #eef1f6; transform: translateY(-1px); }
.btn--google .g { flex: none; }
.btn .os { flex: none; margin-right: 1px; }
.btn--primary { background: linear-gradient(135deg, var(--sun-edge), var(--sun-mid) 75%, var(--sun-core)); color: #2a1606; box-shadow: 0 14px 30px -12px rgba(255, 130, 55, 0.7); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 18px 36px -12px rgba(255, 130, 55, 0.8); }
.btn--ghost { background: rgba(255, 255, 255, 0.045); border-color: var(--card-line); color: var(--text-dim); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.btn--sm { width: auto; padding: 8px 14px; font-size: 12.5px; border-radius: 10px; }
.btn__sub { font-weight: 500; opacity: 0.72; font-size: 12px; }

.badge {
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 154, 69, 0.28);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  vertical-align: middle;
}

.dl__actions { display: flex; flex-direction: column; gap: 10px; min-height: 46px; align-items: stretch; justify-content: center; }
.dl__actions .spinner--sm { align-self: center; }
.dl__note { margin: 14px 0 0; font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }

/* ============ Portal: topbar ============ */
.portal { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px clamp(18px, 5vw, 48px);
  background: rgba(7, 8, 12, 0.62);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--panel-line);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.topbar__brand img { border-radius: 8px; }
.topbar__user { display: flex; align-items: center; gap: 12px; }
.topbar__avatar {
  position: relative;
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--sun-core);
  background: linear-gradient(150deg, rgba(255, 154, 69, 0.28), rgba(255, 106, 44, 0.08));
  border: 1px solid rgba(255, 154, 69, 0.32);
}
.topbar__avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.topbar__avatar-fallback { width: 19px; height: 19px; opacity: 0.85; }
.topbar__meta { display: flex; flex-direction: column; line-height: 1.25; text-align: right; max-width: 40vw; }
.topbar__name { font-size: 13px; font-weight: 600; }
.topbar__email { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ Portal: hero ============ */
.phero { position: relative; overflow: hidden; text-align: center; padding: clamp(72px, 13vh, 150px) 20px clamp(56px, 9vh, 104px); }
.phero__sun {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(52% 62% at 50% -12%, rgba(255, 184, 96, 0.30) 0%, rgba(255, 120, 55, 0.07) 46%, transparent 70%);
}
.phero__inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.phero__eyebrow { margin: 0 0 18px; font-size: 11.5px; font-weight: 600; letter-spacing: 2.6px; text-transform: uppercase; color: var(--accent); }
.phero__title {
  margin: 0;
  font-size: clamp(34px, 5.4vw, 60px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(180deg, #fff 0%, #f3f5fa 55%, #cdd4e0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.phero__name {
  background: linear-gradient(120deg, var(--sun-core), var(--sun-mid) 55%, var(--sun-edge));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.phero__sub { margin: 20px auto 0; max-width: 52ch; font-size: clamp(14.5px, 1.4vw, 17px); line-height: 1.6; color: var(--text-dim); }
.phero__start {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 34px; padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: #2a1606;
  background: linear-gradient(135deg, var(--sun-edge), var(--sun-mid) 75%, var(--sun-core));
  box-shadow: 0 14px 32px -12px rgba(255, 130, 55, 0.7);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.phero__start:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(255, 130, 55, 0.85); }
.phero__start svg { animation: nudge 1.8s ease-in-out infinite; }

/* ============ Portal: steps timeline ============ */
.steps { position: relative; max-width: 760px; margin: 0 auto; width: 100%; padding: 10px clamp(20px, 5vw, 32px) 70px; }
.steps__spine {
  position: absolute;
  z-index: 0;
  left: calc(clamp(20px, 5vw, 32px) + 21px);
  top: 54px; bottom: 116px; width: 2px;
  background: linear-gradient(180deg, rgba(255, 154, 69, 0.55) 0%, rgba(255, 154, 69, 0.5) 100%);
}
.step { position: relative; display: flex; gap: clamp(16px, 3vw, 28px); padding: 22px 0; }
.step__rail { flex: none; width: 44px; display: flex; justify-content: center; }
.step__node {
  position: relative;
  z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: var(--sun-core);
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 154, 69, 0.28), rgba(12, 13, 18, 0.96)),
    var(--ink);
  border: 1px solid rgba(255, 154, 69, 0.5);
  box-shadow: 0 0 24px -2px rgba(255, 154, 69, 0.4);
}
.step__body { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--card-line); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow); }
.step__head { display: flex; gap: 14px; align-items: flex-start; }
.step__icon {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center; border-radius: 12px;
  color: var(--sun-core);
  background: linear-gradient(150deg, rgba(255, 154, 69, 0.20), rgba(255, 106, 44, 0.06));
  border: 1px solid rgba(255, 154, 69, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.step__title { margin: 2px 0 6px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.step__desc { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.step__body .dl__actions { margin-top: 18px; }

.apps { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.appchip { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--card-line); border-radius: 11px; background: rgba(255, 255, 255, 0.025); font-size: 13px; font-weight: 600; }
.appchip em { font-style: normal; font-weight: 400; color: var(--text-faint); }
.appchip__icon { width: 20px; height: 20px; border-radius: 5px; object-fit: cover; flex: none; }
.appchip--soon { opacity: 0.72; }
.appchip__soon {
  margin-left: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-line);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ============ Portal: help + footer ============ */
.help { max-width: 760px; margin: 0 auto; width: 100%; padding: 6px clamp(20px, 5vw, 32px) 72px; }
.help__title { margin: 0 0 8px; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.help__desc { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-dim); }
.help__link { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(255, 154, 69, 0.35); }
.help__link:hover { border-bottom-color: var(--accent); }
.pfoot { padding: 28px 20px 46px; border-top: 1px solid var(--panel-line); margin-top: auto; }

/* ============ Spinner ============ */
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.spinner--sm { width: 22px; height: 22px; border-width: 2.5px; }

/* ============ Scroll reveal ============ */
.has-js .reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1); }
.has-js .reveal.in { opacity: 1; transform: none; }

/* ============ Animations ============ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateX(-50%) translateY(26vh); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ============ Responsive ============ */
@media (max-width: 880px) {
  .topbar__email { display: none; }
}
@media (max-width: 560px) {
  .step__head { flex-wrap: wrap; }
  .topbar__brand span { display: none; }
}
@media (max-width: 460px) {
  .gate { padding: 36px 18px; }
  .signin-card { padding: 26px 22px; }
  .step__body { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sky__sun, .gate__brand, .signin-card, .gate__foot, .phero__start svg { animation: none; }
  .has-js .reveal { opacity: 1; transform: none; transition: none; }
  .spinner { animation-duration: 1.3s; }
}
