:root {
  --bg: #0c0e13;
  --panel: #12151d;
  --line: #1f2532;
  --text: #e8ecf4;
  --dim: #8b97ac;
  --faint: #6b7688;
  --accent: #7db1ff;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- header ---------- */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { font-weight: 650; font-size: 14px; letter-spacing: .02em; }
.bar-actions { display: flex; align-items: center; gap: 10px; }
#status { color: var(--faint); font-size: 12px; }

/* ---------- buttons ---------- */
.ghost {
  appearance: none;
  background: transparent;
  border: 1px solid #2a3244;
  color: var(--text);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  min-height: 34px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.ghost:hover:not(:disabled) { border-color: #3d4a63; background: #161a24; }
.ghost:disabled { opacity: .4; cursor: default; }
.ghost.strong { border-color: var(--accent); color: var(--accent); }
.ghost.small { padding: 4px 10px; min-height: 28px; font-size: 12px; }

/* ---------- intro ---------- */
#intro { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.intro-card { text-align: center; max-width: 420px; }
.intro-line { font-size: 17px; margin: 0 0 6px; }
.intro-sub { color: var(--dim); font-size: 13px; margin: 0 0 22px; }
.intro-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.intro-hint { color: var(--faint); font-size: 12px; margin: 0; }
#intro.dropping .intro-card { outline: 1.5px dashed var(--accent); outline-offset: 18px; border-radius: 4px; }

/* ---------- editor ---------- */
#editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 14px calc(10px + env(safe-area-inset-bottom));
  gap: 10px;
}

#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#preview {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    conic-gradient(#1a1f2c 0 25%, #141824 0 50%, #1a1f2c 0 75%, #141824 0) 0 0/20px 20px;
}
#tapLayer {
  position: absolute;
  border-radius: 10px;
  cursor: crosshair;
}
#tapLayer .dot {
  position: absolute;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(12,14,19,.65);
  pointer-events: none;
}
#video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
}

/* ---------- toolbar ---------- */
#toolbar {
  flex: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pillset { display: flex; gap: 6px; }
.pill {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--dim);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  min-height: 30px;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.pill:hover:not(:disabled) { color: var(--text); }
.pill:disabled { opacity: .4; cursor: default; }
.pill.selected {
  color: #d4e3ff;
  background: rgba(125,177,255,.13);
  border-color: rgba(125,177,255,.5);
}

.ctrls { justify-content: flex-start; }
.ctl { flex: 1 1 180px; min-width: 150px; }
.ctl.narrow { flex: 0 1 130px; }
.ctl label {
  display: flex; justify-content: space-between;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint);
  margin-bottom: 2px;
}
.ctl label span { color: var(--accent); font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }
.ctl .ghost.small { margin-top: 2px; }

input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px; background: #272f40;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  margin-top: -5.5px;
  border: none;
}
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: #272f40; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: none; }

input[type="color"] {
  width: 46px; height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  padding: 1px;
}

@media (max-width: 560px) {
  #status { display: none; }
  .ctl { flex: 1 1 44%; min-width: 130px; }
}
