:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(12, 16, 28, 0.72);
  --line: #1f2a44;
  --text: #eef3ff;
  --muted: #9aa8c7;
  --accent: #50dcff;
  --ok: #7dffa8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #152246, var(--bg) 55%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.topbar,
.help,
.hud {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.topbar p,
.help,
#status {
  color: var(--muted);
}

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

.modes button {
  border: 1px solid var(--line);
  background: #111827;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.modes button.active {
  background: var(--accent);
  color: #04202a;
  font-weight: 700;
}

.stage {
  position: relative;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  min-height: 420px;
  aspect-ratio: 16 / 10;
}

#webcam,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.hud {
  position: absolute;
  top: 16px;
  left: 16px;
  width: min(420px, calc(100% - 32px));
  padding: 14px 16px;
  border-radius: 14px;
  z-index: 2;
}

.hud h2 {
  color: var(--accent);
  margin-bottom: 8px;
}

.hud p,
.hud li {
  font-size: 15px;
  line-height: 1.45;
}

#log {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--ok);
}

#rep-badge {
  position: absolute;
  top: 18px;
  right: 20px;
  font-size: 64px;
  font-weight: 800;
  color: var(--ok);
  text-shadow: 0 4px 16px #000;
  z-index: 2;
}

.status {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--panel);
}

.start-btn {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  padding: 16px 28px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #04202a;
}

.help {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
}

@media (max-width: 800px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .stage {
    aspect-ratio: 3 / 4;
  }
}
