:root {
  --paper: #faf9f5; --ink: #111; --ink-soft: #55524b; --line: #e6e2d8;
  --c1: #e8502a; --c2: #f2b705; --c3: #17a398; --c4: #3b4cca; --c5: #ff7aa8; --c6: #7cc242; --c7: #4cc9f0; --c8: #8e5ad7;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
  --mono: "Space Grotesk", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--sans); overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; background: var(--paper); touch-action: none; }
#stage canvas { touch-action: none; }
.screen { position: fixed; inset: 0; z-index: 10; background: var(--paper); display: flex; }
.screen.center { align-items: center; justify-content: center; flex-direction: column; gap: 16px; font-size: 14px; color: var(--ink-soft); z-index: 30; }

/* ---------- intro ---------- */
#intro { align-items: center; justify-content: center; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px); overflow: hidden; }
.intro-body { position: relative; z-index: 2; max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0; }
.brand { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: .32em; text-transform: uppercase; margin: 0 0 28px; color: var(--ink-soft); }
h1 { font-family: var(--serif); font-weight: 800; font-size: clamp(34px, 10.5vw, 52px); line-height: 1.22; margin: 0; letter-spacing: .02em; }
h1 { background: linear-gradient(100deg, #111 0 35%, var(--c1) 55%, var(--c4) 100%); background-size: 260% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: ink 5s ease-in-out infinite alternate; }
@keyframes ink { to { background-position: 100% 0; } }
.sub { font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: .06em; color: var(--ink-soft); margin: 14px 0 34px; }
.lead { font-size: 14px; line-height: 1.8; color: var(--ink); margin: 0 0 20px; }
.cta { display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; border-radius: 999px; padding: 18px 32px; font-weight: 700; font-size: 17px; letter-spacing: .04em; box-shadow: 0 10px 0 -4px rgba(0,0,0,.14), 0 18px 40px rgba(0,0,0,.18); transition: transform .15s; }
.cta:active { transform: translateY(2px) scale(.98); }
.link { margin-top: 18px; padding: 10px 14px; font-size: 13px; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 4px; }
.privacy { margin: 22px 0 0; font-size: 11px; line-height: 1.7; color: #8a867c; }
.inapp { margin-top: 18px; padding: 14px; border: 1.5px dashed var(--c1); border-radius: 14px; font-size: 12px; line-height: 1.7; display: flex; flex-direction: column; gap: 10px; align-items: center; background: #fff; }
.inapp p { margin: 0; }
.chip { background: #fff; border: 1.5px solid var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 13px; box-shadow: 0 3px 0 var(--ink); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.chip.big { padding: 12px 22px; font-size: 14px; }
.chip.ghost { background: transparent; box-shadow: none; }
.lang { position: absolute; top: calc(var(--safe-t) + 16px); right: 16px; z-index: 3; font-family: var(--mono); }

.confetti i { position: absolute; width: 14px; height: 14px; border-radius: 50%; opacity: .9; animation: float 9s ease-in-out infinite; }
.confetti i:nth-child(1) { background: var(--c1); left: 8%; top: 14%; } .confetti i:nth-child(2) { background: var(--c2); left: 82%; top: 10%; width: 22px; height: 22px; animation-delay: -2s; }
.confetti i:nth-child(3) { background: var(--c3); left: 14%; top: 78%; width: 18px; height: 18px; animation-delay: -4s; } .confetti i:nth-child(4) { background: var(--c4); left: 88%; top: 72%; animation-delay: -1s; }
.confetti i:nth-child(5) { background: var(--c5); left: 50%; top: 5%; width: 10px; height: 10px; animation-delay: -6s; } .confetti i:nth-child(6) { background: var(--c6); left: 70%; top: 90%; width: 12px; height: 12px; animation-delay: -3s; }
.confetti i:nth-child(7) { background: var(--c7); left: 4%; top: 46%; width: 10px; height: 10px; animation-delay: -5s; } .confetti i:nth-child(8) { background: var(--c8); left: 93%; top: 40%; width: 16px; height: 16px; animation-delay: -7s; }
@keyframes float { 50% { transform: translateY(-18px) scale(1.15); } }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--c1); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#hud > * { pointer-events: none; }
#hud button { pointer-events: auto; }
.hud-top { gap: 8px; position: absolute; top: calc(var(--safe-t) + 14px); left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; }
.meter { display: flex; align-items: center; gap: 10px; background: rgba(250,249,245,.92); backdrop-filter: blur(8px); border: 1.5px solid var(--ink); border-radius: 999px; padding: 4px 16px 4px 6px; box-shadow: 0 3px 0 var(--ink); }
.meter small { display: block; font-size: 10px; letter-spacing: .1em; color: var(--ink-soft); line-height: 1; }
.meter b { font-family: var(--mono); font-size: 18px; line-height: 1.2; }
#ring { transition: stroke-dashoffset .5s ease; }
.hint { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translateX(-50%); margin: 0; max-width: 88vw; text-align: center; background: var(--ink); color: #fff; border-radius: 999px; padding: 11px 20px; font-size: 14px; font-weight: 500; letter-spacing: .03em; transition: opacity .3s, transform .3s; white-space: nowrap; }
.hint.off { opacity: 0; transform: translate(-50%, 8px); }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 22px); display: flex; justify-content: center; gap: 12px; }

/* ---------- sheet ---------- */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--paper); border-top: 2px solid var(--ink); border-radius: 26px 26px 0 0; padding: 14px 22px calc(var(--safe-b) + 26px); max-width: 560px; margin: 0 auto; box-shadow: 0 -20px 60px rgba(0,0,0,.2); animation: up .38s cubic-bezier(.2,.9,.25,1.05); max-height: 82vh; overflow: auto; }
@keyframes up { from { transform: translateY(100%); } }
.grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.x { position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; background: #fff; border: 1.5px solid var(--ink); }
.shape { display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; font-size: 26px; font-weight: 700; color: #fff; margin-bottom: 14px; }
.sheet h2 { font-family: var(--serif); font-weight: 800; font-size: 26px; line-height: 1.3; margin: 0 0 8px; }
.sheet p { margin: 0 0 18px; line-height: 1.8; font-size: 14.5px; color: var(--ink-soft); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 999px; border: 1.5px solid var(--ink); font-weight: 700; font-size: 14px; background: #fff; text-decoration: none; color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.btn.solid { background: var(--ink); color: #fff; }
.btn.line { background: #06c755; border-color: #06c755; color: #fff; box-shadow: 0 3px 0 #04913d; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.contacts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.contacts .btn { box-shadow: none; font-weight: 500; font-size: 13px; padding: 12px 10px; }
.finale-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.finale-dots i { width: 16px; height: 16px; border-radius: 50%; }
.toast { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%); background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 18px; font-size: 13px; line-height: 1.6; max-width: 86vw; text-align: center; }

#stage video { object-fit: cover; }
