:root {
  color-scheme: dark;
  --bg: #090a0a;
  --border: #26282c;
  --border-strong: #353840;
  --text: #f2f2ee;
  --muted: #8f949c;
  --accent: #5fae7e;
  --accent-deep: #2d5a41;
  --font-display: 'Unbounded', 'Segoe UI', sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }
body { min-height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a, button { -webkit-tap-highlight-color: transparent; }

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-width: none;
}
html::-webkit-scrollbar { display: none; }

.bg-glow {
  position: fixed;
  width: 46vw;
  height: 46vw;
  min-width: 420px;
  min-height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  will-change: transform;
}
.bg-glow-a { top: -22vw; left: -12vw; background: var(--accent-deep); opacity: 0.35; animation: driftA 24s ease-in-out infinite alternate; }
.bg-glow-b { right: -18vw; bottom: -26vw; background: var(--accent); opacity: 0.12; animation: driftB 28s ease-in-out infinite alternate; }

@keyframes driftA { to { transform: translate3d(8vw, 6vw, 0) scale(1.12); } }
@keyframes driftB { to { transform: translate3d(-8vw, -5vw, 0) scale(1.15); } }

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 65% 60% at 50% 50%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 60% at 50% 50%, #000 10%, transparent 75%);
}

.logo3d {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.55;
  filter: drop-shadow(0 30px 60px rgba(95, 174, 126, 0.25));
  animation: logoIn 1400ms var(--ease) 200ms both;
}

@keyframes logoIn {
  from { opacity: 0; }
  to { opacity: 0.55; }
}

.logo3d-stage {
  width: min(86vmin, 760px);
  height: min(86vmin, 760px);
  perspective: 1400px;
  will-change: transform;
}

.logo3d-obj {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.logo3d-obj i {
  position: absolute;
  inset: 0;
  -webkit-mask: url('/source/logo.png') center / contain no-repeat;
  mask: url('/source/logo.png') center / contain no-repeat;
}

.pages { position: relative; z-index: 1; }

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.dots {
  position: fixed;
  right: 22px;
  top: 50%;
  z-index: 5;
  display: grid;
  gap: 12px;
  transform: translateY(-50%);
}
.dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background 200ms ease, transform 200ms var(--ease), border-color 200ms ease;
}
.dot:hover { border-color: var(--accent); }
.dot.active { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }

.login {
  position: relative;
  width: min(100%, 380px);
  text-align: center;
  animation: itemIn 800ms var(--ease) 150ms both;
}

.login::before {
  content: '';
  position: absolute;
  inset: -90px -120px;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(9, 10, 10, 0.78), transparent);
}

.login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 6vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.login-sub { margin: 10px 0 30px; color: var(--muted); font-size: 14px; }

@keyframes itemIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.more-hint {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: max-content;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
  animation: itemIn 800ms var(--ease) 900ms both;
  transition: color 160ms ease;
}
.more-hint:hover { color: var(--text); }

.more-mouse {
  position: relative;
  width: 22px;
  height: 34px;
  border: 1.5px solid currentColor;
  border-radius: 12px;
}
.more-mouse i {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel {
  0% { opacity: 0; transform: translate(-50%, 0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 12px); }
}

.discord-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 12px;
  background: #5865f2;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.3);
  transition: transform 160ms var(--ease), box-shadow 200ms ease, background 160ms ease;
}

.discord-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.18) 50%, transparent 75%);
  transform: translateX(-120%);
  transition: transform 700ms var(--ease);
}

.discord-button:hover { background: #6672f5; transform: translateY(-1px); box-shadow: 0 12px 32px rgba(88, 101, 242, 0.45); }
.discord-button:hover::before { transform: translateX(120%); }
.discord-button:active { transform: translateY(1px) scale(0.99); }
.discord-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.discord-icon { display: grid; place-items: center; width: 20px; height: 20px; }
.discord-icon svg { width: 20px; height: 20px; }

.discord-arrow {
  position: absolute;
  right: 18px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 180ms ease, transform 220ms var(--ease);
}
.discord-button:hover .discord-arrow { opacity: 1; transform: none; }
.discord-button.is-loading { opacity: 0.75; pointer-events: none; cursor: wait; }

.form-message {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 91, 108, 0.35);
  border-radius: 8px;
  background: rgba(255, 91, 108, 0.08);
  color: #ff8e9a;
  font-size: 12.5px;
  line-height: 1.4;
}
.form-message:empty { display: none; }
.form-message.error-refresh { animation: shake 420ms var(--ease); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.page-info { justify-items: end; padding-right: clamp(24px, 8vw, 140px); }

.info {
  width: min(100%, 520px);
  padding: 34px 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 16, 18, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.info h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.info-lead { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

.feats { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 16px; }
.feats li { display: flex; align-items: flex-start; gap: 14px; }

.feat-ico {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(95, 174, 126, 0.1);
  color: var(--accent);
}
.feat-ico svg { width: 18px; height: 18px; }

.feats b { display: block; font-size: 14px; font-weight: 700; }
.feats small { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.info-cta { margin-top: 28px; display: grid; gap: 10px; }

.back-up {
  padding: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
  transition: color 160ms ease;
}
.back-up:hover { color: var(--text); }

.page-info .info > * { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.page-info.in-view .info > * { opacity: 1; transform: none; }
.page-info.in-view .info > :nth-child(2) { transition-delay: 70ms; }
.page-info.in-view .info > :nth-child(3) { transition-delay: 140ms; }
.page-info.in-view .info > :nth-child(4) { transition-delay: 210ms; }
.page-info.in-view .info > :nth-child(5) { transition-delay: 280ms; }

@media (max-width: 860px) {
  .page-info { justify-items: center; padding: 24px 16px; }
  .info { padding: 26px 20px; }
  .info h2 { font-size: 24px; }
  .dots { right: 10px; }
  .logo3d { opacity: 0.4; }
  .logo3d-stage { width: 96vmin; height: 96vmin; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 860px) {
  .bg-glow { filter: blur(70px); min-width: 300px; min-height: 300px; animation: none; }
  .bg-grid { background-size: 36px 36px; }
  .logo3d { filter: none; }
  .info { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(15, 16, 18, 0.9); }

  .page {
    min-height: 100svh;
    padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .login { width: min(100%, 340px); }
  .login::before { inset: -60px -40px; }
  .login-sub { margin-bottom: 24px; font-size: 13px; }
  .discord-button { min-height: 56px; font-size: 15px; }
  .discord-arrow { display: none; }

  .more-hint { bottom: max(22px, env(safe-area-inset-bottom)); font-size: 12px; text-align: center; max-width: 80vw; }

  .dots { right: max(8px, env(safe-area-inset-right)); }

  .page-info { align-items: start; place-items: start center; padding-top: max(40px, env(safe-area-inset-top)); padding-bottom: 40px; }
  .info { width: 100%; padding: 24px 18px; }
  .info h2 { font-size: 23px; }
  .info-lead { font-size: 13.5px; }
  .feats { gap: 14px; margin-top: 22px; }
  .feat-ico { width: 36px; height: 36px; }
  .feats small { font-size: 12.5px; }
  .info-cta { margin-top: 22px; }
}

@media (max-width: 860px) and (max-height: 700px) {
  .login-title { font-size: 30px; }
  .more-hint .more-mouse { display: none; }
}

@media (max-width: 860px) {
  html { scroll-snap-type: y proximity; }
}

@media (hover: none) {
  .more-mouse { display: none; }
  .more-hint::after { content: '↑'; font-size: 18px; color: var(--accent); animation: nudge 1.6s ease-in-out infinite; }
}
@keyframes nudge { 0%, 100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(-5px); opacity: 1; } }

.sso {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 6, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 400ms var(--ease), background 600ms ease;
}
.sso[hidden] { display: none; }
.sso.show { opacity: 1; }

.sso-box {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
  transition: opacity 400ms var(--ease), transform 500ms var(--ease);
}

.sso-logo {
  width: 132px;
  height: 132px;
  overflow: visible;
  filter: drop-shadow(0 0 26px rgba(95, 174, 126, 0.35));
  animation: ssoFloat 4s ease-in-out infinite;
}
@keyframes ssoFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(2deg); } }

.sso-logo rect {
  fill: #2d5a41;
  opacity: 0.35;
  transform-box: fill-box;
  transform-origin: center;
  animation: ssoChase 1.8s var(--ease) infinite;
}
.sso-logo .q1 { animation-delay: 0s; }
.sso-logo .b1 { animation-delay: 0.15s; }
.sso-logo .q2 { animation-delay: 0.3s; }
.sso-logo .b2 { animation-delay: 0.45s; }
.sso-logo .q3 { animation-delay: 0.6s; }
.sso-logo .b3 { animation-delay: 0.75s; }
.sso-logo .q4 { animation-delay: 0.9s; }
.sso-logo .b4 { animation-delay: 1.05s; }

@keyframes ssoChase {
  0% { opacity: 0.3; fill: #2d5a41; transform: scale(0.82); }
  22% { opacity: 1; fill: #8fe0ad; transform: scale(1.06); }
  55%, 100% { opacity: 0.35; fill: #2d5a41; transform: scale(0.9); }
}

.sso-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.sso-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.sso-cancel {
  padding: 9px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--font-body);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.sso-cancel:hover { color: var(--text); border-color: var(--accent); background: rgba(95, 174, 126, 0.08); }

.sso-welcome {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 700ms var(--ease) 250ms, transform 700ms var(--ease) 250ms;
}
.sso-welcome small { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.sso-welcome h2 {
  margin: 0;
  max-width: 90vw;
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.sso.ok .sso-logo { animation: ssoDone 900ms var(--ease) forwards; }
.sso.ok .sso-logo rect { animation: none; opacity: 1; fill: #5fae7e; transform: scale(1); transition: fill 400ms ease, opacity 400ms ease; }
.sso.ok .sso-text, .sso.ok .sso-cancel { opacity: 0; transition: opacity 250ms ease; }
.sso.ok .sso-box { transform: translateY(-86px) scale(0.62); }
.sso.ok .sso-welcome { opacity: 1; transform: none; }

@keyframes ssoDone {
  0% { transform: scale(1); }
  45% { transform: scale(1.16); filter: drop-shadow(0 0 40px rgba(95, 174, 126, 0.9)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 30px rgba(95, 174, 126, 0.55)); }
}

.sso.leaving { background: #08090a; backdrop-filter: none; -webkit-backdrop-filter: none; }

@media (prefers-reduced-motion: reduce) {
  .sso-logo, .sso-logo rect { animation: none !important; opacity: 0.8; }
}

.pages, .logo3d, .dots { transition: filter 500ms var(--ease), opacity 500ms var(--ease); }
body.sso-open .pages,
body.sso-open .logo3d,
body.sso-open .dots { filter: blur(8px) brightness(0.3); }
.sso { background: rgba(5, 6, 6, 0.92); }
body.sso-open .pages { opacity: 0; }
body.sso-open .dots { opacity: 0; }
