/* Design tokens, page background, layout and typography. */

:root:not(:lang(en)) { --display-weight: 900; }
/* Pick a system CJK font that matches the language, so characters render with the right glyphs and weight. */
:root:lang(ja) { --cjk-font: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Yu Gothic', Meiryo; }
:root:lang(zh-Hant) { --cjk-font: 'PingFang TC', 'PingFang HK', 'Noto Sans CJK TC', 'Microsoft JhengHei'; }
:root:lang(zh-Hans) { --cjk-font: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei'; }

:root {
  --ink: #1b0b3a;
  --pink: #ff3d8b;
  --yellow: #ffd23f;
  --cyan: #3ee8ff;
  --green: #4dff9a;
  --purple: #7b2ff7;
  --paper: #fff8ec;
  --radius: 22px;
  --bounce: cubic-bezier(0.2, 1.6, 0.4, 1);
  --snap: cubic-bezier(0.7, 0, 0.3, 1);
  /* Bungee has no Chinese/Japanese glyphs, so those fall through to a bold system CJK font. */
  --cjk-font: 'Hiragino Sans', 'PingFang TC', 'PingFang SC', 'Noto Sans CJK JP';
  --display: 'Bungee', 'Arial Black', var(--cjk-font), Impact, sans-serif;
  --display-weight: 400;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 800;
  color: #fff;
  background: #24074f;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  /* The stage fills the screen. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Background ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, #5b1bb5 0, transparent 55%),
    radial-gradient(circle at 85% 90%, #a3147f 0, transparent 55%),
    linear-gradient(160deg, #2a0a5e, #14052e);
}
.sunburst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 250vmax;
  height: 250vmax;
  translate: -50% -50%;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.055) 0 9deg, transparent 9deg 18deg);
  animation: spin 80s linear infinite;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.45;
  animation: float 16s ease-in-out infinite alternate;
}
.b1 { width: 45vmax; height: 45vmax; background: var(--pink); top: -15vmax; left: -15vmax; }
.b2 { width: 40vmax; height: 40vmax; background: var(--cyan); bottom: -15vmax; right: -12vmax; animation-delay: -5s; opacity: 0.3; }
.b3 { width: 30vmax; height: 30vmax; background: var(--yellow); top: 40%; left: 60%; animation-delay: -9s; opacity: 0.2; }

@keyframes spin { to { rotate: 360deg; } }
@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8vmax, 6vmax) scale(1.15); }
  100% { transform: translate(-4vmax, 10vmax) scale(0.9); }
}

/* ---------- Layout ---------- */
.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Top padding leaves room for the language picker in the corner. */
  padding: max(76px, calc(env(safe-area-inset-top) + 64px)) 16px 24px;
}

/* ---------- Type ---------- */
.headline { font-family: var(--display); font-weight: var(--display-weight); margin: 0; line-height: 1; }
.small-line {
  display: block;
  font-size: clamp(24px, 7vw, 38px);
  color: var(--yellow);
  transform: rotate(-4deg);
  margin-bottom: 6px;
  text-shadow: 0 4px 0 var(--ink);
}
.logo {
  display: block;
  font-size: clamp(46px, 15vw, 100px);
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink), 0 12px 0 var(--pink);
  white-space: nowrap;
}
.logo-sm { font-size: clamp(34px, 10vw, 68px); white-space: normal; }
.ltr {
  display: inline-block;
  animation:
    dropIn 0.75s var(--bounce) backwards,
    wave 2.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * 60ms + 0.35s), calc(var(--i) * 110ms + 1.6s);
}
.word { white-space: nowrap; display: inline-block; }
@keyframes dropIn {
  0% { opacity: 0; transform: translateY(-120px) rotate(-30deg) scale(0.4); }
  100% { opacity: 1; transform: none; }
}
@keyframes wave {
  0%, 60%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-10px) rotate(-4deg); }
}

.h2 {
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(30px, 8.5vw, 48px);
  line-height: 1.05;
  margin: 0;
  color: var(--yellow);
  text-shadow: 0 4px 0 var(--ink), 0 7px 0 var(--pink);
}
.h3 { font-family: var(--display); font-weight: var(--display-weight); font-size: 26px; margin: 0; color: var(--ink); }
.lede { font-size: clamp(16px, 4.4vw, 19px); line-height: 1.45; margin: 0; color: #f3eaff; }
.lede.small { font-size: 15px; color: #4a3a6b; }
.lede b { color: var(--yellow); }
.fine { font-size: 14px; margin: 0; color: #cdb8f5; letter-spacing: 0.02em; }
.progress { margin: 0; text-align: center; color: var(--cyan); font-size: 16px; }
.error { margin: 0; min-height: 1.2em; color: var(--yellow); text-align: center; }
.error:empty { display: none; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-10px) rotate(6deg); }
}

