:root {
  --bg: #0b1020;
  --bg2: #131a33;
  --fg: #e8ecf7;
  --muted: #9aa6c4;
  --accent: #4f8cff;
  --accent2: #23e0c8;
  --line: rgba(255, 255, 255, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1c2a55 0%, rgba(28, 42, 85, 0) 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
}
.nav-back {
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}
.nav-back:active { background: rgba(255, 255, 255, 0.12); }
.nav-tag {
  font-size: 12px;
  color: var(--accent2);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Hero */
.hero { padding: 2px 2px 0; }
.hero-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #ffffff, #a9c4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Stage */
.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: radial-gradient(60% 60% at 50% 30%, #1a2550 0%, #0a1024 100%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.stage {
  position: absolute;
  inset: 0;
}
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-loading {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.stage-loading.is-hidden { opacity: 0; }
.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Controls */
.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.btn {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #fff;
  transition: transform 0.06s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(90deg, var(--accent), #6ea8ff);
  box-shadow: 0 6px 20px rgba(79, 140, 255, 0.35);
}
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--fg);
}
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Status */
.status {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 1.2em;
  text-align: center;
}

/* Footer */
.footer {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.footer p { margin: 3px 0; }
.footer-org { color: #c7d2ee; font-weight: 600; }
.footer a { color: var(--accent2); text-decoration: none; }
.footer-src { line-height: 1.6; }

@media (min-width: 640px) {
  .hero-title { font-size: 24px; }
  .stage-wrap { aspect-ratio: 4 / 3; }
}
