* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: #000; color: #fff; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: "Noto Sans HK", -apple-system, "PingFang HK", sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; background: none; border: 0; outline: none; }
button { cursor: pointer; }

/* Wrapper = exactly the visible browser area; pages are scaled to fit inside */
#app { position: relative; overflow: hidden; z-index: 1; }

/* Blurred, darkened copy of the current page behind it, fills the side gaps */
#backdrop { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
#backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(18px) brightness(.45); transform: scale(1.15); }

/* One screen = background image + absolutely positioned hotspots, in design px */
.screen {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity .3s ease-out;
}
.screen.show { opacity: 1; }
.screen > .bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.screen > * { position: absolute; }

/* Invisible tap areas over the buttons drawn in the background image */
.hot { display: block; }
.hot:focus-visible { outline: 3px solid #1E9BD7; outline-offset: 2px; }

/* Option pills: pressed look comes from the q?-on image (set in app.js) */
.opt { background-repeat: no-repeat; }
.opt.on, .opt:active { background-image: var(--on); }
.hot.press:active { background: rgba(255,255,255,.15); }

/* Name input sits inside the drawn input box */
.name-input {
  color: #fff; caret-color: #1E9BD7;
  padding: 0 .9em;
  font-weight: 500;
}
.name-input::placeholder { color: rgba(255,255,255,.4); }

/* Loading screen */
.sweep {
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,255,255,.22) 0deg 52deg, transparent 52deg 360deg);
  animation: spin 2.4s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.track { background: #223150; overflow: hidden; }
.track > i { display: block; height: 100%; width: 0; background: #fff; }
.pct { font-family: "Darker Grotesque", sans-serif; font-weight: 700; color: #fff; line-height: 1; display: flex; align-items: center; }

/* Result card = the real download image; long-press saves it */
.card { display: block; object-fit: cover; box-shadow: 0 0 0 3px #fff, 0 6px 18px rgba(0,0,0,.35); -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; pointer-events: auto; }

/* 開始任務 button: pulse loop copied from the Figma motion (2.22 s, 3 pulses) */
.cta { padding: 0; transform-origin: 50% 50%; animation: ctaPulse 2.223s linear infinite; }
.cta img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
@keyframes ctaPulse {
  0%, 4.5% { transform: scale(1); animation-timing-function: ease-in-out; }
  8.5%  { transform: scale(.96); animation-timing-function: ease-out; }
  15.7% { transform: scale(1.08); animation-timing-function: ease-in-out; }
  22.5% { transform: scale(.99); animation-timing-function: ease-out; }
  30.6%, 37.8% { transform: scale(1); animation-timing-function: ease-in-out; }
  41.8% { transform: scale(.96); animation-timing-function: ease-out; }
  49%   { transform: scale(1.08); animation-timing-function: ease-in-out; }
  55.8% { transform: scale(.99); animation-timing-function: ease-out; }
  63.9%, 71.1% { transform: scale(1); animation-timing-function: ease-in-out; }
  75.1% { transform: scale(.96); animation-timing-function: ease-out; }
  82.3% { transform: scale(1.08); animation-timing-function: ease-in-out; }
  89.1% { transform: scale(.99); animation-timing-function: ease-out; }
  97.2%, 100% { transform: scale(1); }
}
.cta:active { animation-play-state: paused; filter: brightness(.9); }

/* "Long-press to save" sheet: always fits the screen, close button always visible */
.sheet { position: fixed; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,.9); z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
.sheet[hidden] { display: none; }
.sheet-inner { display: contents; }
.sheet-inner p { flex: none; font-size: 16px; text-align: center; }
.sheet-inner img { flex: 1 1 0; min-height: 0; width: 100%; object-fit: contain;
  -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.sheet-inner button { flex: none; border: 2px solid #fff; background: #000; padding: 12px 40px; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .sweep { animation: none; }
  .cta { animation: none; }
  .screen { transition: none; }
}
