/* MOTI — Bead Snake · page shell + the 5-second loading page. The game itself is one canvas. */
:root { --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #3b0f2a; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#game { position: absolute; inset: 0; display: block; touch-action: none; }

/* ---------- loading page ---------- */
#loading { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #fff8ee;
  background: radial-gradient(ellipse at 50% 38%, #6a2049 0%, #4a1434 45%, #2a0a1e 100%); transition: opacity .35s ease; }
#loading.out { opacity: 0; pointer-events: none; }
#loading .corner { position: absolute; width: 96px; height: 96px; opacity: .85; }
#loading .corner.tl { left: calc(10px + var(--sal)); top: calc(10px + var(--sat)); }
#loading .corner.tr { right: calc(10px + var(--sar)); top: calc(10px + var(--sat)); transform: scaleX(-1); }
#loading .corner.bl { left: calc(10px + var(--sal)); bottom: calc(10px + var(--sab)); transform: scaleY(-1); }
#loading .corner.br { right: calc(10px + var(--sar)); bottom: calc(10px + var(--sab)); transform: scale(-1, -1); }
#loading .box { width: min(360px, 88vw); text-align: center; padding: 10px 0; }
#loading .emblem { display: block; margin: 0 auto 10px; width: 132px; height: 132px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); animation: bob 2.6s ease-in-out infinite; }
#loading h1 { margin: 0; font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; font-size: 52px; letter-spacing: 12px; text-indent: 12px; color: #e9c46a; font-weight: 700; text-shadow: 0 2px 0 #7a4f0c, 0 6px 16px rgba(0,0,0,.4); }
#loading .sub { margin: 4px 0 26px; font-size: 12px; letter-spacing: 6px; text-indent: 6px; color: #fff0b8; opacity: .85; font-weight: 700; }
#loading .thread { position: relative; height: 34px; margin: 0 24px; }
#loading .thread .line { position: absolute; left: 0; right: 0; top: 16px; height: 2px; background: linear-gradient(90deg, rgba(233,196,106,.15), #e9c46a 30%, #e9c46a 70%, rgba(233,196,106,.15)); border-radius: 2px; }
#loading .thread .beads { position: absolute; left: 0; right: 0; top: 6px; display: flex; justify-content: space-between; padding: 0 16px; }
#loading .thread .beads b { width: 22px; height: 22px; border-radius: 50%; display: inline-block; opacity: 0; transform: scale(.4); box-shadow: inset -4px -5px 8px rgba(0,0,0,.35), inset 4px 5px 8px rgba(255,255,255,.55), 0 3px 6px rgba(0,0,0,.4); }
#loading .thread .beads b.on { opacity: 1; transform: scale(1); transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .2s; }
#loading .thread .beads .r { background: #e5383b; } #loading .thread .beads .s { background: #3a86ff; } #loading .thread .beads .e { background: #2dc653; } #loading .thread .beads .a { background: #ffb703; } #loading .thread .beads .p { background: #f1e4e8; }
#loading .thread .needle { position: absolute; top: 7px; left: -10px; width: 100px; height: 20px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#loading .tip { margin: 22px 0 0; font-size: 13px; color: #fff0b8; opacity: .8; font-style: italic; font-family: Georgia, serif; min-height: 18px; }
#loading .ready { margin: 6px 0 0; font-size: 11px; letter-spacing: 4px; text-indent: 4px; color: #e9c46a; font-weight: 800; opacity: .7; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (max-height: 520px) { #loading .emblem { width: 84px; height: 84px; margin-bottom: 4px; } #loading h1 { font-size: 36px; } #loading .sub { margin-bottom: 12px; } #loading .tip { margin-top: 10px; } }
