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

:root {
  --ink: #4a3f55;
  --pill: rgba(255, 255, 255, 0.55);
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
}

html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body { background: #1a1f4d; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }

#scroll { height: 900vh; }

/* ---------- stage ---------- */
.stage { position: fixed; inset: 0; overflow: hidden; }

.sky {
  position: absolute; inset: 0;
  --sky1: #bfe7ff; --sky2: #fff3d9;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 75%);
}
#stars, #fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#fx { z-index: 4; }

.sun, .moon { position: absolute; width: 18vmin; height: 18vmin; border-radius: 50%; }
.sun { background: #fff1a8; box-shadow: 0 0 0 3vmin rgba(255, 241, 168, .35), 0 0 12vmin 4vmin rgba(255, 220, 150, .45); }
.moon {
  width: 13vmin; height: 13vmin;
  background: radial-gradient(circle at 35% 35%, #fffdf2, #f1ecd2 70%);
  box-shadow: 0 0 10vmin 2vmin rgba(255, 250, 220, .25);
}
.moon::before, .moon::after { content: ""; position: absolute; border-radius: 50%; background: rgba(200, 190, 160, .35); }
.moon::before { width: 22%; height: 22%; left: 55%; top: 30%; }
.moon::after { width: 14%; height: 14%; left: 30%; top: 60%; }

#scenes { position: absolute; inset: 0; }
.scene { position: absolute; inset: 0; will-change: transform, opacity; }
.layer { position: absolute; top: 0; bottom: 0; left: -15%; width: 130%; will-change: transform; }
.layer > svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* character */
#cg-wrap {
  position: absolute; left: 50%; bottom: 13%;
  height: min(58vh, 115vw); aspect-ratio: 400 / 560;
  z-index: 3; will-change: transform;
}
#cg { width: 100%; height: 100%; overflow: visible; }

.greeting {
  position: absolute; left: 0; right: 0; top: 15vh; z-index: 2;
  text-align: center; pointer-events: none;
  font-family: "Pacifico", "Brush Script MT", cursive;
  font-size: clamp(42px, 8.5vw, 120px); line-height: 1.1; color: #fff;
  text-shadow: 0 0 18px rgba(255, 255, 255, .55), 0 0 42px rgba(0, 200, 5, .55), 0 4px 0 #00a804;
  visibility: hidden;
}
.greeting small {
  display: block; margin-top: 1em;
  font-family: var(--font); font-weight: 800; font-size: clamp(16px, 2.2vw, 30px); letter-spacing: .02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
.greeting small b { color: #3dff45; text-shadow: 0 0 12px rgba(0, 200, 5, .7); }
.vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse 80% 70% at 50% 55%, transparent 60%, rgba(40, 30, 70, .22));
}

/* ---------- ambient css loops ---------- */
.blade { animation: blade 3.2s ease-in-out infinite alternate; }
@keyframes blade { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.sway { animation: sway 5s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
.glint { animation: glint 2.4s ease-in-out infinite alternate; }
@keyframes glint { to { opacity: .15; transform: translateX(30px); } }
.wing { animation: flap .5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes flap { to { transform: scaleY(-.6); } }
.win { animation: win 9s steps(1) infinite; }
@keyframes win { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .35; } }
.neon { animation: neon 3s steps(1) infinite; filter: drop-shadow(0 0 8px currentColor); }
@keyframes neon { 0%, 88%, 92%, 100% { opacity: 1; } 90% { opacity: .2; } }
.rhneon { filter: drop-shadow(0 0 3px #b6ffb8) drop-shadow(0 0 12px rgba(0, 220, 8, .7)); animation: rhneon 4s steps(1) infinite; }
@keyframes rhneon { 0%, 80%, 84%, 88%, 100% { opacity: 1; } 82%, 86% { opacity: .35; } }
.ripple { animation: ripple 1.6s ease-out infinite; }
@keyframes ripple { from { transform: scale(.2); opacity: .9; } to { transform: scale(1.4); opacity: 0; } }
.lampglow, .lampcone { animation: lamp 4s ease-in-out infinite alternate; }
@keyframes lamp { to { opacity: .6; } }

/* ---------- UI ---------- */
.ui { position: fixed; z-index: 10; }

.logo {
  top: max(18px, env(safe-area-inset-top)); left: 20px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ink); text-decoration: none; font-weight: 800; font-size: 15px; letter-spacing: .02em;
  padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--pill);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.logo b { color: #00a804; font-weight: 800; }
.logo img { width: 28px; height: 28px; border-radius: 50%; background: #fff; object-fit: contain; }

.music {
  top: max(18px, env(safe-area-inset-top)); right: 20px;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  background: var(--pill); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.music i { width: 3px; height: 6px; border-radius: 2px; background: var(--ink); transition: height .3s; }
.music.on i { animation: eq .9s ease-in-out infinite alternate; }
.music.on i:nth-child(2) { animation-delay: -.3s; }
.music.on i:nth-child(3) { animation-delay: -.6s; }
.music.on i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { from { height: 4px; } to { height: 18px; } }

.dots {
  right: 22px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 12px;
}
.dots button {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .9);
  background: transparent; cursor: pointer; transition: transform .3s, background .3s;
  box-shadow: 0 0 0 1px rgba(74, 63, 85, .15);
}
.dots button.on { background: #fff; transform: scale(1.35); }

.hint {
  position: fixed; z-index: 9; right: 19px; bottom: max(4vh, 20px);
  width: 24px; height: 38px; border: 2.5px solid #fff; border-radius: 14px; opacity: .85;
  transition: opacity .6s;
}
.hint span { position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: #fff; animation: hint 1.6s ease-in-out infinite; }
@keyframes hint { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }
.hint.gone { opacity: 0; }

.socials {
  top: max(18px, env(safe-area-inset-top)); right: 72px;
  display: flex; gap: 8px;
}
.socials a {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--pill); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .25s, background .25s, color .25s;
}
.socials a:hover { transform: translateY(-2px); background: #00c805; color: #fff; }
.socials svg { width: 20px; height: 20px; fill: currentColor; }

.ca-box {
  left: 0; right: 0; bottom: max(4vh, 20px);
  display: flex; justify-content: center; padding: 0 12px; pointer-events: none;
}
.ca {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: 100%; padding: 8px 16px 8px 8px;
  border: 0; border-radius: 999px; background: var(--pill);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--ink); font: 600 14px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer; box-shadow: 0 6px 24px rgba(40, 30, 70, .15); transition: background .25s, transform .25s;
}
.ca[disabled] { cursor: default; }
.ca:not([disabled]):hover { background: rgba(255, 255, 255, .75); transform: translateY(-2px); }
.ca:focus-visible, .music:focus-visible, .dots button:focus-visible, .logo:focus-visible, .socials a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.ca-label { padding: 6px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; letter-spacing: .08em; }
.ca.copied .ca-label { background: #00c805; }
.ca-symbol { font-weight: 800; color: #00a804; }
/* full address, never truncated: wraps on small screens */
.ca-value { overflow-wrap: anywhere; word-break: break-all; text-align: left; user-select: all; }
.ca-icon { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; opacity: .7; }

.grain {
  position: fixed; inset: -50%; z-index: 20; pointer-events: none; opacity: .06;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, 3%); } }

@media (max-width: 640px) {
  .logo { font-size: 13px; gap: 6px; }
  .dots { right: 12px; }
  .ca { font-size: 11.5px; padding: 6px 12px 6px 6px; gap: 6px; border-radius: 18px; }
  .socials { right: 20px; top: calc(max(18px, env(safe-area-inset-top)) + 44px); flex-direction: column; gap: 6px; }
  .ca-value { flex-basis: 100%; text-align: center; font-size: min(1em, 3.2vw); }
  .socials a { width: 36px; height: 36px; }
  .socials svg { width: 17px; height: 17px; }
  .music { width: 36px; height: 36px; }
  #cg-wrap { bottom: 14%; height: min(48vh, 95vw); }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
