:root {
  --navy: #14183D;
  --deep: #05061A;
  --blue: #2F6BFF;
  --violet: #8B5CF6;
  /* avatar diameter (incl. ring) and wordmark width, horizontal layout */
  --d: min(27vw, 50vh, 420px);
  --w: calc(var(--d) * 1.129);
  --gap: calc(var(--d) * 0.13);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--deep);
  color: #F3F4FF;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(120% 90% at 50% 45%, #10143A 0%, #0A0C26 45%, var(--deep) 100%);
  /* single-finger drags reach the page (spark trail); pinch-zoom still works; no double-tap zoom */
  touch-action: pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

img { -webkit-user-drag: none; -webkit-touch-callout: none; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------------ logo */
.logo {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  gap: var(--gap);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  z-index: 2;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.avatar {
  flex: none;
  width: var(--d); height: var(--d);
  border-radius: 50%;
  padding: calc(var(--d) * 0.0442);
  background: linear-gradient(90deg, var(--blue), var(--violet));
  box-shadow: 0 0 calc(var(--d) * 0.18) rgba(91, 92, 246, .35);
  transition: opacity .6s ease;
}

.avatar img {
  display: block; width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #1A2052 0%, #0E1132 55%, #080A22 100%);
}

.wordmark {
  flex: none;
  display: block;
  width: var(--w); height: auto;
  filter: drop-shadow(0 0 calc(var(--d) * .06) rgba(5, 6, 26, .95));
  margin-top: calc(var(--d) * -0.015);
}

/* portrait tablets: same layout, larger share of the width */
@media (max-aspect-ratio: 1/1) {
  :root { --d: min(34vw, 40vh, 420px); }
}

/* narrow / tall screens: stack */
@media (max-aspect-ratio: 5/8), (max-width: 560px) {
  :root {
    --d: min(62vw, 36vh, 340px);
    --w: min(80vw, 380px, 38vh * 2.33);
    --gap: calc(var(--d) * 0.16);
  }
  .logo { flex-direction: column; margin-top: -3vh; }
}

/* ------------------------------------------------------------------ canvas */
#fx {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.2s ease;
}

html.gpu #fx { opacity: 1; }
html.gpu .avatar { opacity: 0; transition-delay: .25s; }
html.gpu .bg { opacity: 0; transition: opacity 1.2s ease; }

/* ------------------------------------------------------------------ CSS/SVG background (fallback, and before the GPU is ready) */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }

.blob {
  position: absolute;
  width: 70vmax; height: 70vmax;
  border-radius: 50%;
  filter: blur(8vmax);
  opacity: .32;
  will-change: transform;
}
.b1 { left: -25vmax; top: -30vmax; background: radial-gradient(circle, var(--blue), transparent 65%); animation: drift1 38s ease-in-out infinite alternate; }
.b2 { right: -30vmax; bottom: -35vmax; background: radial-gradient(circle, var(--violet), transparent 65%); animation: drift2 44s ease-in-out infinite alternate; }
.b3 { left: 20vw; top: 30vh; width: 45vmax; height: 45vmax; opacity: .16; background: radial-gradient(circle, #5B5CF6, transparent 65%); animation: drift1 52s ease-in-out infinite alternate-reverse; }

@keyframes drift1 { to { transform: translate(12vw, 10vh) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-10vw, -8vh) scale(1.08); } }

.lines { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.lines path { stroke-width: 1.2; opacity: .55; }
.lines .pulse { stroke-width: 2.2; opacity: .9; stroke-dasharray: 90 1900; animation: pulse 9s linear infinite; }
.lines .p2 { animation-duration: 12s; animation-delay: -4s; }
@keyframes pulse { from { stroke-dashoffset: 1990; } to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------------ tap burst (fallback only; WebGPU draws its own) */
.tap {
  position: fixed; left: var(--x); top: var(--y);
  width: 0; height: 0; z-index: 1; pointer-events: none;
}
.tap b, .tap i, .spark { position: absolute; display: block; border-radius: 50%; pointer-events: none; }
.tap .ring {
  left: -110px; top: -110px; width: 220px; height: 220px;
  border: 1.5px solid rgba(196, 184, 255, .9);
  box-shadow: 0 0 14px rgba(139, 92, 246, .7), inset 0 0 12px rgba(47, 107, 255, .55);
  transform: scale(.04); opacity: 0;
  animation: tap-ring 1.1s cubic-bezier(.15, .7, .3, 1) forwards;
}
.tap .core {
  left: -28px; top: -28px; width: 56px; height: 56px;
  background: radial-gradient(circle, rgba(255, 255, 255, .85), rgba(139, 92, 246, .35) 45%, transparent 70%);
  animation: tap-core .5s ease-out forwards;
}
.tap i {
  left: -2.5px; top: -2.5px; width: 5px; height: 5px;
  background: #fff;
  box-shadow: 0 0 8px 2px rgba(160, 140, 255, .9);
  animation: tap-spark var(--t) cubic-bezier(.1, .7, .3, 1) forwards;
}
.spark {
  position: fixed; left: var(--x); top: var(--y); z-index: 1;
  margin: -2.5px 0 0 -2.5px; width: 5px; height: 5px;
  background: #fff; box-shadow: 0 0 8px 2px rgba(139, 92, 246, .8);
  animation: spark .75s ease-out forwards;
}
@keyframes tap-ring { 0% { opacity: 1; transform: scale(.04); } 45% { opacity: .85; } 100% { opacity: 0; transform: scale(1); } }
@keyframes tap-core { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: scale(1.4); } }
@keyframes tap-spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(1); }
  70% { opacity: .9; }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(.4); }
}
@keyframes spark { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: translateY(-14px) scale(.3); } }

@media (prefers-reduced-motion: reduce) {
  .tap, .spark { display: none; }
  .blob, .lines .pulse { animation: none; }
  .lines .pulse { display: none; }
  #fx, .avatar { transition: none; }
}
