:root {
  --bg: #eee; /* page */
  --panel: #000; /* editor */
  --card: #fff; /* canvas background */
  --ink: #111; /* UI text */
  --muted: #777;
  --line: #d0d0d0;
  --btn: #202020;
  --btnText: #fff;
  --btnPrimary: #111;
  --btnPrimaryText: #fff;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, "Courier New",
    monospace;
}

.container {
  max-width: 940px;
  margin: 24px auto 64px;
  padding: 0 16px;
}

.stack > * {
  margin-bottom: 22px;
}

.row.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

[hidden] {
  display: none !important;
}

.gap {
  gap: 12px;
}

.gap-lg {
  gap: 20px;
  flex-wrap: wrap;
}

/* Plinko toggle switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #202020;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  user-select: none;
  font: inherit;
}
.toggle-switch .toggle-label {
  font-weight: 600;
  letter-spacing: 0.5px;
}
.toggle-switch .toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  background: #555;
  border-radius: 12px;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}
.toggle-switch .toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle-switch .toggle-state {
  min-width: 28px;
  text-align: left;
  color: #888;
  font-size: 13px;
}
.toggle-switch.on .toggle-track {
  background: #00cc55;
}
.toggle-switch.on .toggle-knob {
  left: 20px;
}
.toggle-switch.on .toggle-state {
  color: #00cc55;
}

/* Plinko score chips */
.score-chip {
  background: #111;
  color: #00cc55;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.5px;
  border: 1px solid var(--line);
}
.score-chip .score-label {
  color: #777;
  margin-right: 8px;
  font-size: 12px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--btn);
  color: var(--btnText);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.btn.primary {
  background: var(--btnPrimary);
  color: var(--btnPrimaryText);
  border-color: #000;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.editor {
  width: 100%;
  min-height: 180px;
  background: var(--panel);
  color: #fff; /* make text visible (white) */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  resize: vertical;
  outline: none;
}

canvas {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  width: 360px;
  height: auto;
}

/* Camera overlay — sticks to TOP of iframe */
#camOverlay {
  position: fixed;
  inset: 0 0 auto 0;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  z-index: 9999;
  overflow: auto;
}
#camBox {
  margin: 0 auto;
  width: min(720px, 94vw);
  background: #000;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}
#video {
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #000;
}
#camButtons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
#camButtons .btn {
  background: #111;
}
#camButtons .primary {
  background: #0b5;
  border-color: #0b5;
}

@media (max-width: 640px) {
  .container {
    padding: 0 12px;
  }
  canvas {
    width: 86vw;
  }
  .row.center {
    flex-wrap: wrap;
  }
}
