*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden;background:#0b0b10;color:#e8e8f0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;-webkit-font-smoothing:antialiased;touch-action:none;user-select:none;-webkit-user-select:none}
#stage{position:fixed;inset:0;width:100vw;height:100vh;display:block;cursor:crosshair;touch-action:none;-webkit-touch-callout:none}
#loader{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;background:radial-gradient(circle at 50% 40%,#16162a 0%,#0b0b10 70%);transition:opacity .7s ease,visibility .7s}
#loader.out{opacity:0;visibility:hidden}
.loader-grid{display:grid;grid-template-columns:repeat(10,14px);gap:4px}
.loader-grid i{width:14px;height:14px;border-radius:3px;background:var(--c);opacity:0;animation:pop 1.6s cubic-bezier(.2,.8,.2,1) infinite;animation-delay:var(--d)}
@keyframes pop{0%{opacity:0;transform:scale(.2) rotate(-30deg)}35%{opacity:1;transform:scale(1.08) rotate(0)}60%{opacity:.9;transform:scale(1)}100%{opacity:0;transform:scale(.3) rotate(20deg)}}
.loader-title{font-size:22px;letter-spacing:.6em;padding-left:.6em;font-weight:700;background:linear-gradient(90deg,#ff4d8d,#ffd166,#06d6a0,#4cc9f0,#b388ff);-webkit-background-clip:text;background-clip:text;color:transparent;background-size:200% 100%;animation:shimmer 2.4s linear infinite}
@keyframes shimmer{to{background-position:200% 0}}
.loader-bar{width:220px;height:4px;border-radius:4px;background:#1d1d2b;overflow:hidden}
.loader-bar span{display:block;height:100%;width:8%;background:linear-gradient(90deg,#4cc9f0,#b388ff);transition:width .35s ease}
.loader-sub{font-size:11px;letter-spacing:.2em;color:#7d7d96}
.hud{position:fixed;z-index:20;background:rgba(18,18,28,.72);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,.08);box-shadow:0 8px 30px rgba(0,0,0,.35)}
.hud-top{top:12px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:16px;padding:8px 14px;border-radius:999px;white-space:nowrap}
.brand{font-weight:700;letter-spacing:.12em;font-size:13px}
.brand span{color:#7d7d96;font-weight:400;letter-spacing:.02em}
.online{font-size:12px;color:#b9b9cc;display:flex;align-items:center;gap:6px}
.online i{width:7px;height:7px;border-radius:50%;background:#06d6a0;box-shadow:0 0 8px #06d6a0;animation:blink 2s ease-in-out infinite}
@keyframes blink{50%{opacity:.35}}
.coords{position:fixed;z-index:20;top:62px;left:50%;transform:translateX(-50%);font-size:12px;color:#b9b9cc;background:rgba(18,18,28,.6);padding:5px 10px;border-radius:8px;display:flex;align-items:center;gap:8px;white-space:nowrap;pointer-events:none}
.coords .sw{width:12px;height:12px;border-radius:3px;border:1px solid rgba(255,255,255,.3)}
.zoom{right:14px;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;border-radius:12px;overflow:hidden}
.zoom button{width:40px;height:40px;background:transparent;border:0;color:#e8e8f0;font:inherit;font-size:18px;cursor:pointer}
.zoom button+button{border-top:1px solid rgba(255,255,255,.08)}
.zoom button:hover{background:rgba(255,255,255,.08)}
.hud-bottom{bottom:16px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:18px;max-width:calc(100vw - 24px)}
.timer{position:relative;width:46px;height:46px;flex:0 0 46px;display:flex;align-items:center;justify-content:center}
.timer svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.timer circle{fill:none;stroke-width:3}
.timer .bg{stroke:rgba(255,255,255,.08)}
.timer .fg{stroke:#4cc9f0;stroke-linecap:round;stroke-dasharray:97.39;stroke-dashoffset:0;transition:stroke .3s}
.timer.ready .fg{stroke:#06d6a0}
.timer span{font-size:9px;letter-spacing:.04em;color:#e8e8f0;text-align:center;line-height:1.1}
.palette{display:grid;grid-template-columns:repeat(8,22px);gap:6px}
.swatch{width:22px;height:22px;border-radius:6px;border:1px solid rgba(255,255,255,.2);cursor:pointer;padding:0;transition:transform .15s ease,box-shadow .15s ease}
.swatch:hover{transform:translateY(-2px) scale(1.06)}
.swatch[aria-checked="true"]{box-shadow:0 0 0 2px #0b0b10,0 0 0 4px #fff;transform:scale(1.08)}
.toast{position:fixed;left:50%;bottom:100px;transform:translate(-50%,10px);opacity:0;z-index:30;background:#1d1d2b;border:1px solid rgba(255,255,255,.1);padding:8px 14px;border-radius:10px;font-size:12px;pointer-events:none;transition:opacity .25s,transform .25s;white-space:nowrap}
.toast.show{opacity:1;transform:translate(-50%,0)}
@media (max-width:640px){
  .hud-top{gap:10px;padding:7px 11px}
  .palette{grid-template-columns:repeat(8,20px);gap:5px}
  .swatch{width:20px;height:20px;border-radius:5px}
  .hud-bottom{gap:8px;padding:8px 10px;bottom:10px}
  .timer{width:40px;height:40px;flex-basis:40px}
  .zoom{right:8px}
  .coords{top:58px}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
