/* ═══════════════════════════════════════════════════════════════
   Point Cloud Playground

   Control language carried over from the pixelated-text playground so
   the two read as the same tool: near-black stage, #111 panel on the
   right, Inter, 10px/0.18em section labels, mono tabular values, chips
   for choices.
   ═══════════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-border: rgba(255,255,255,0.08);
  --text: #FAF8F5;
  --text-dim: rgba(250,248,245,0.55);
  --text-dimmer: rgba(250,248,245,0.35);
  --accent: #FAF8F5;
  --accent-hover: #ffffff;
  --terracotta: #C45D35;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
* { box-sizing: border-box; }

/* ── Layout ─────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 100vh;
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .panel { border-left: none; border-top: 1px solid var(--panel-border); position: static; max-height: none; }
}

/* ── Stage ──────────────────────────────────────────────────── */
.stage {
  position: relative;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  padding: 32px 40px 24px 40px;
}
.stage-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.stage-title {
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.015em;
  margin: 0;
}
.stage-meta {
  font-size: 12px;
  color: var(--text-dimmer);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-left: auto;
}
.stage-meta strong { color: var(--text-dim); font-weight: 500; }

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 140ms ease;
}
.export-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.export-btn svg { width: 13px; height: 13px; }

.canvas-frame {
  flex: 1;
  position: relative;
  background: #000;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  min-height: 420px;
}
.canvas-frame canvas { display: block; width: 100%; height: 100%; }

/* Same vignette the pixel playground uses — keeps the subject centred. */
.canvas-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
  mix-blend-mode: multiply;
}

.stage-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  align-items: center;
}

.btn {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.25); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn .dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.7;
}

.progress-rail {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  margin: 0 4px;
}
.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent);
  width: 0%;
  transition: width 80ms linear;
}

/* ── Panel ──────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border-left: 1px solid var(--panel-border);
  padding: 32px 28px 40px 28px;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
}
.panel-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.panel-brand-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 2px; }
.panel-brand-name {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
}
.panel-title { font-weight: 300; font-size: 28px; letter-spacing: -0.025em; margin: 0 0 8px 0; }
.panel-sub { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin: 0 0 28px 0; }

.section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
}
.section:last-child { border-bottom: none; margin-bottom: 0; }
.section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.field-name { font-size: 12px; color: var(--text); font-weight: 500; }
.field-value {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.field-note { font-size: 11px; color: var(--text-dimmer); line-height: 1.5; margin-top: 8px; }
.field.is-disabled { opacity: 0.4; pointer-events: none; }

textarea.text-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 20px;
  letter-spacing: -0.015em;
  padding: 12px 14px;
  border-radius: 6px;
  resize: vertical;
  min-height: 56px;
  line-height: 1.2;
  transition: border-color 140ms ease;
}
textarea.text-input:focus { outline: none; border-color: var(--accent); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
  margin: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
  transition: transform 120ms ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}

.select-row { display: flex; gap: 6px; flex-wrap: wrap; }
.select-chip {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 140ms ease;
  white-space: nowrap;
}
.select-chip:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.select-chip.active { background: rgba(255,255,255,0.10); border-color: var(--accent); color: var(--text); }

.color-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.16);
  cursor: pointer;
  padding: 0;
  transition: transform 120ms ease, border-color 140ms ease;
}
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px rgba(255,255,255,0.2); }
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

.footer-note { font-size: 11px; color: var(--text-dimmer); line-height: 1.5; margin-top: 24px; }
.footer-note a { color: var(--text-dim); }

/* ── Export modal ──────────────────────────────────────────── */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 160ms ease;
}
.modal-scrim[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%;
  max-width: 720px;
  max-height: min(680px, 90vh);
  background: #111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  display: grid;
  grid-template-columns: 180px 1fr;
  overflow: hidden;
}
.modal-tabs {
  background: #0d0d0d;
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modal-tab {
  padding: 12px 16px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: all 140ms ease;
  letter-spacing: -0.005em;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--text); border-color: var(--accent); background: rgba(255,255,255,0.06); }
.modal-body { padding: 32px 36px; overflow-y: auto; display: flex; flex-direction: column; }
.modal-title { font-weight: 300; font-size: 24px; letter-spacing: -0.02em; margin: 0 0 20px 0; }
.modal-pane[hidden] { display: none; }

.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 140ms ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: rgba(255,255,255,0.10); border-color: var(--accent); color: var(--text); }

.big-btn {
  margin-top: auto;
  width: 100%;
  padding: 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease;
}
.big-btn:hover { background: var(--accent-hover); }
.secondary-btn {
  margin-top: 10px;
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
}
.secondary-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }

pre.code-out {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  overflow: auto;
  max-height: 340px;
  margin: 0;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
