*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000;
  --green: #00e676;
  --green-bright: #5cff3d;
  --green-deep: #009b3a;
  --indicator: rgba(0, 230, 118, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fade: 300ms;
  --splash-ms: 1600ms;

  --page-max-w: 100%;
  --indicator-size: clamp(11px, 2.8vw, 14px);
  --indicator-pad: max(10px, env(safe-area-inset-bottom, 0px));
  --splash-logo: clamp(140px, 48vw, 220px);
  --splash-glow: clamp(220px, 70vw, 420px);
  --splash-ring: clamp(170px, 56vw, 280px);
  --splash-line: clamp(96px, 40vw, 160px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --stack-gap: 0px;
}

html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  width: 100dvw;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: #fff;
  font-family: Georgia, "Times New Roman", Times, serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ——— Splash Zero Grau ——— */
.splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding:
    max(16px, var(--safe-t))
    max(16px, var(--safe-r))
    max(16px, var(--safe-b))
    max(16px, var(--safe-l));
  background: #000;
  overflow: hidden;
  pointer-events: none;
  animation: splash-exit 420ms var(--ease) forwards;
  animation-delay: var(--splash-ms);
}

.splash.is-done {
  display: none;
}

.splash__glow {
  position: absolute;
  width: var(--splash-glow);
  height: var(--splash-glow);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 230, 118, 0.28) 0%, rgba(0, 230, 118, 0.08) 42%, transparent 70%);
  filter: blur(8px);
  animation: glow-in 900ms var(--ease) both;
}

.splash__ring {
  position: absolute;
  width: var(--splash-ring);
  height: var(--splash-ring);
  border-radius: 50%;
  border: 1px solid rgba(0, 230, 118, 0.22);
  box-shadow: 0 0 40px rgba(0, 230, 118, 0.12), inset 0 0 30px rgba(0, 230, 118, 0.06);
  animation: ring-in 1000ms var(--ease) both;
}

.splash__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 3vw, 22px);
  max-width: 100%;
  animation: mark-in 800ms var(--ease) both;
}

.splash__logo {
  width: var(--splash-logo);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 18px rgba(0, 230, 118, 0.35));
}

.splash__line {
  display: block;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green-bright), var(--green), transparent);
  box-shadow: 0 0 10px rgba(0, 230, 118, 0.65);
  animation: line-draw 700ms var(--ease) both;
  animation-delay: 280ms;
}

@keyframes mark-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(10px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes glow-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes ring-in {
  from { opacity: 0; transform: scale(0.82); }
  60% { opacity: 1; }
  to { opacity: 0.9; transform: scale(1.04); }
}

@keyframes line-draw {
  from { width: 0; opacity: 0; }
  to { width: var(--splash-line); opacity: 1; }
}

@keyframes splash-exit {
  from { opacity: 1; visibility: visible; }
  to { opacity: 0; visibility: hidden; }
}

.app {
  position: relative;
  width: 100%;
  height: var(--app-h, 100dvh);
  min-height: var(--app-h, 100dvh);
  background: var(--bg);
  overflow: hidden;
  opacity: 0;
  transition: opacity 420ms var(--ease);
}

.app.is-hidden { opacity: 0; }
.app.is-visible { opacity: 1; }

.viewport {
  position: absolute;
  top: var(--safe-t);
  right: var(--safe-r);
  bottom: calc(var(--safe-b) + 1.75rem);
  left: var(--safe-l);
  overflow: hidden;
  touch-action: none;
}

.canvas {
  position: absolute;
  left: 50%;
  top: 0;
  width: 100%;
  max-width: 100%;
  transform-origin: center top;
  will-change: transform;
  transition: none;
}

.canvas.is-animating {
  transition: transform var(--fade) var(--ease);
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: var(--stack-gap);
}

.page {
  display: block;
  width: var(--page-max-w);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center top;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  opacity: 0;
  transition: opacity var(--fade) ease;
}

.page.is-ready {
  opacity: 1;
}

.indicator {
  position: absolute;
  left: var(--safe-l);
  right: var(--safe-r);
  bottom: var(--indicator-pad);
  z-index: 2;
  text-align: center;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--indicator-size);
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--indicator);
  pointer-events: none;
  opacity: 0.9;
}

/* ——— Breakpoints ——— */
@media (max-width: 359px) {
  :root {
    --page-max-w: 100%;
    --splash-logo: clamp(120px, 56vw, 170px);
    --indicator-size: 11px;
  }
}

@media (min-width: 360px) and (max-width: 767px) {
  :root {
    --page-max-w: 100%;
    --splash-logo: clamp(150px, 50vw, 200px);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --page-max-w: 96%;
    --splash-logo: clamp(180px, 36vw, 240px);
    --splash-glow: clamp(280px, 52vw, 460px);
    --splash-ring: clamp(210px, 40vw, 300px);
    --indicator-size: 13px;
  }
}

@media (min-width: 1024px) and (max-width: 1439px) {
  :root {
    --page-max-w: 95%;
    --splash-logo: 240px;
    --splash-glow: 440px;
    --splash-ring: 300px;
    --splash-line: 180px;
    --indicator-size: 13px;
  }
}

@media (min-width: 1440px) and (max-width: 1919px) {
  :root {
    --page-max-w: min(95%, 1200px);
    --splash-logo: 260px;
    --splash-glow: 480px;
    --splash-ring: 320px;
    --indicator-size: 14px;
  }
}

@media (min-width: 1920px) {
  :root {
    --page-max-w: min(90%, 1400px);
    --splash-logo: clamp(280px, 18vw, 360px);
    --splash-glow: clamp(500px, 28vw, 640px);
    --splash-ring: clamp(340px, 20vw, 420px);
    --splash-line: 220px;
    --indicator-size: clamp(14px, 1.1vw, 20px);
    --indicator-pad: max(24px, env(safe-area-inset-bottom, 0px));
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --page-max-w: min(100%, 70vh);
    --splash-logo: clamp(96px, 28vh, 150px);
    --splash-glow: clamp(160px, 50vh, 260px);
    --splash-ring: clamp(120px, 40vh, 200px);
    --splash-line: clamp(80px, 24vh, 120px);
    --indicator-size: 11px;
  }

  .viewport {
    bottom: calc(var(--safe-b) + 1.35rem);
  }
}

@media (orientation: landscape) and (min-height: 501px) and (max-width: 1180px) {
  :root {
    --page-max-w: min(92%, 85vh);
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .viewport {
    top: var(--safe-t);
    bottom: calc(var(--safe-b) + 1.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash,
  .splash__glow,
  .splash__ring,
  .splash__content,
  .splash__line,
  .app,
  .canvas.is-animating,
  .page {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }

  .splash { display: none; }

  .app,
  .app.is-hidden {
    opacity: 1;
  }
}
