:root {
  color-scheme: dark;
  --bg: #05070f;
  --panel: rgba(14, 22, 40, 0.78);
  --line: rgba(94, 234, 255, 0.16);
  --text: #e8f3ff;
  --muted: #8ea3c4;
  --cyan: #5eeaff;
  --violet: #7c8bff;
  --magenta: #ff6ad5;
  --gold: #ffd666;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(120% 80% at 50% -10%, #17244a 0%, #070b16 55%, #04060d 100%);
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 14px 20px;
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--magenta));
  box-shadow: 0 0 18px rgba(94, 234, 255, 0.55);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.06em;
  font-weight: 650;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(6px);
}

.stat dt {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat dd {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#field {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 640px);
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(4, 8, 20, 0.65), inset 0 0 40px rgba(94, 234, 255, 0.06);
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(6, 10, 22, 0.62), rgba(6, 10, 22, 0.86));
  text-align: center;
}

.overlay[hidden] { display: none; }

.overlay-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 24px rgba(94, 234, 255, 0.5);
}

.overlay-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 26ch;
  line-height: 1.6;
}

button {
  font: inherit;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid rgba(94, 234, 255, 0.28);
  background: rgba(18, 30, 52, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

button:hover { border-color: rgba(94, 234, 255, 0.6); }
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.primary {
  margin-top: 6px;
  padding: 11px 26px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  color: #04070f;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 10px 26px rgba(94, 234, 255, 0.28);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.buttons {
  display: flex;
  gap: 8px;
}

.buttons button { flex: 1; }

.hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.status {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.status[data-tone="ok"] { color: #6ef7c1; }
.status[data-tone="warn"] { color: var(--gold); }
.status[data-tone="error"] { color: #ff8a9b; }

@media (max-width: 380px) {
  .app { padding: 12px 10px 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand h1 { font-size: 15px; }
}
