* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #0b0d10;
  color: #eee;
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
  overflow: hidden;
}

#stage { position: fixed; inset: 0; }

#video, #canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* selfie mirror — landmark data is mirrored in JS to match */
#video { transform: scaleX(-1); }

#controls {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(12, 14, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  flex-wrap: wrap;
  justify-content: center;
  width: max-content;   /* single row on desktop... */
  max-width: 96vw;      /* ...wrap only when it can't fit (narrow screens) */
  z-index: 5;
}

.group { display: flex; gap: 4px; }

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
}
.pill.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.pill:disabled { opacity: 0.4; cursor: not-allowed; }

#scaleSel {
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 13px;
}

.sld, .chk { display: flex; align-items: center; gap: 6px; color: #bbb; }
.sld input[type="range"] { width: 74px; accent-color: #e08b3d; }
.chk input { accent-color: #e08b3d; }

.skip {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(12, 14, 18, 0.72);
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.skip:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.gone { display: none; }

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 8, 0.93);
  z-index: 10;
  transition: opacity 0.4s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

.card {
  max-width: 460px;
  margin: 20px;
  padding: 36px 34px;
  border-radius: 18px;
  background: #12151a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}
.card h1 { font-size: 30px; letter-spacing: 1px; }
.card .tagline { color: #e08b3d; margin: 6px 0 18px; font-size: 14px; }
.card p { line-height: 1.7; font-size: 14px; color: #ccc; }
.card .mode-line {
  text-align: left;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 13px;
  margin-top: 8px;
}
.card .hint-sm { margin-top: 12px; font-size: 12px; color: #888; }

#startBtn {
  margin-top: 22px;
  padding: 12px 42px;
  font-size: 17px;
  font-weight: 700;
  color: #14161a;
  background: linear-gradient(135deg, #f0b464, #e08b3d);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
#startBtn:hover { filter: brightness(1.08); }
#startBtn:disabled { opacity: 0.55; cursor: wait; }

.status { margin-top: 16px; min-height: 1.4em; font-size: 13px; color: #9ab; }
.fix-link {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(240, 180, 100, 0.16);
  color: #f0b464;
  font-weight: 600;
  text-decoration: none;
}
.fix-link:hover { background: rgba(240, 180, 100, 0.28); }
