* { box-sizing: border-box; }

:root {
  --w: min(calc(100vw - 24px), calc((100dvh - 190px) * 0.5625), 460px);
  --accent: #ff7a45;
  --accent-2: #ffb347;
}

html, body { margin: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #e9f1ff;
  background: radial-gradient(circle at 50% 0%, #1b3566 0%, #0a1226 55%, #04070f 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.top { text-align: center; padding: 4px 12px 8px; }
.top h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #8ff7ff, #ffd54a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub { margin: 4px 0 0; font-size: 13px; color: #9fb3d6; }

.stage {
  position: relative;
  width: var(--w);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(143, 247, 255, 0.15);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}

.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  background: rgba(4, 9, 22, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.panel p { margin: 0; font-size: 16px; }
.panel strong { font-size: 28px; color: var(--accent-2); }

.title {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 18px rgba(143, 247, 255, 0.6);
}

.tip { color: #b8c8e8; font-size: 14px !important; line-height: 1.7; }
.tip.small { font-size: 12px !important; color: #7f93b8; margin-top: 6px; }
.tip span { color: var(--accent-2); font-weight: 700; }

.msg { min-height: 1.4em; color: #8ff7ff !important; font-size: 14px !important; }

.btn {
  min-width: 190px;
  padding: 12px 28px;
  border: 0;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px rgba(255, 122, 69, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(255, 122, 69, 0.45); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:focus-visible { outline: 2px solid #8ff7ff; outline-offset: 3px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn.ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.18); box-shadow: none; }

.hidden { display: none !important; }

.foot {
  max-width: 420px;
  padding: 14px 18px 0;
  text-align: center;
}
.foot p { margin: 0; font-size: 12px; color: #6f83a8; line-height: 1.6; }

@media (max-width: 380px) {
  .btn { min-width: 160px; font-size: 16px; padding: 11px 22px; }
  .title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
