:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: #111519;
  --line: #2a3035;
  --muted: #98a2aa;
  --green: #39e58c;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { background: var(--bg); color: #fff; }
button, a { font: inherit; }

.home {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.card {
  width: min(100%, 500px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.badge {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--green);
  color: #06140d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
}

h1 { margin: 18px 0 8px; font-size: clamp(32px, 8vw, 48px); }
.lead { margin: 0 0 28px; color: var(--muted); }
.primary {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: #06140d;
  font-weight: 900;
  cursor: pointer;
}

.links { display: grid; gap: 12px; }
.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #090c0e;
}
.link-copy { display: grid; gap: 4px; min-width: 0; }
.link-copy span { color: var(--muted); font-size: 13px; }
.link-copy strong { font-size: 15px; }
.secondary, .preview {
  border: 1px solid #3b444b;
  border-radius: 10px;
  padding: 10px 12px;
  background: #181d21;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.preview { display: block; text-align: center; }
.hint { min-height: 20px; margin-top: 14px; color: var(--green); font-size: 13px; text-align: center; }

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.stage video.mirror { transform: scaleX(-1); }

.start-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 22px;
  text-align: center;
  background: radial-gradient(circle at 50% 20%, #1c252b, #050607 68%);
}
.start-panel h1 { margin: 14px 0 6px; }
.start-panel p { margin: 0 0 24px; color: var(--muted); }
.red-dot { width: 13px; height: 13px; border-radius: 50%; background: #ff3d56; box-shadow: 0 0 0 8px #ff3d561f; }
.start-button {
  min-width: 220px;
  min-height: 58px;
  border: 0;
  border-radius: 15px;
  background: var(--green);
  color: #04120b;
  font-size: 18px;
  font-weight: 900;
}
.start-button:disabled { opacity: .65; }
.orientation-note { margin-top: 14px; color: #b7c0c7; font-size: 12px; }

.status {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: #050708bf;
  backdrop-filter: blur(10px);
  color: #d4d9dc;
  font-size: 13px;
}
.status.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.quality {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  padding: 9px 12px;
  border-radius: 999px;
  background: #050708bf;
  backdrop-filter: blur(10px);
  color: #d4d9dc;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.controls {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}
.controls button {
  min-width: 108px;
  min-height: 46px;
  border: 1px solid #ffffff33;
  border-radius: 13px;
  background: #07090ac7;
  color: #fff;
  font-weight: 700;
}
.controls button.danger { background: #d92d47; }
.error {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 10px;
  background: #bd263d;
  font-size: 13px;
  text-align: center;
}
.tap-sound {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: #000000b8;
  color: #fff;
  font-size: 18px;
}
.hidden { display: none !important; }

@media (max-width: 540px) {
  .card { padding: 26px 19px; }
  .link-row { align-items: flex-start; }
}
