/*
 * The typography-effects design system. Every playground in this repo links this
 * one file and keeps only what is its own inline, so a fix to a slider or a
 * chip lands in all of them at once. It is pixelated-text's stylesheet as it
 * shipped, lifted out token for token.
 */
@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;
  gap: 0;
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .panel { border-left: none; border-top: 1px solid var(--panel-border); }
}

/* ── Stage (canvas side) ────────────────────────────────────── */
.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;
}
.stage-title {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}
.stage-meta {
  font-size: 12px;
  color: var(--text-dimmer);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.stage-meta strong { color: var(--text-dim); font-weight: 500; }

.canvas-frame {
  flex: 1;
  position: relative;
  background: #000;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.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 (controls side) ──────────────────────────────────── */
.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-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 28px;
  letter-spacing: -0.025em;
  margin: 0 0 8px 0;
  color: var(--text);
}
.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;
}

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: 64px;
  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;
}
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;
}
.color-swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.16);
  cursor: pointer;
  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;
}

/* ── 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;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%;
  max-width: 920px;
  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-close {
  position: absolute;
  top: 16px; right: 20px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.export-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.export-row:last-of-type { border-bottom: none; }
.export-label {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 400;
}
.export-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.seg {
  display: inline-flex;
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 140ms ease;
}
.seg-btn.active { background: rgba(255,255,255,0.08); color: var(--text); }
.select-native {
  background: #0a0a0a;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  min-width: 220px;
  cursor: pointer;
}
.select-native:focus { outline: none; border-color: var(--accent); }
.toggle {
  width: 44px; height: 24px;
  background: #222;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  position: relative;
  transition: background 160ms ease;
}
.toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #666;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: all 160ms ease;
}
.toggle.on { background: var(--accent); }
.toggle.on::after { background: var(--bg); left: 23px; }

.big-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  margin-top: 24px;
  transition: background 140ms ease;
}
.big-btn:hover { background: var(--accent-hover); }
.big-btn:disabled { background: #333; color: var(--text-dim); cursor: not-allowed; }

.code-block {
  background: #060606;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #d8d4cf;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  max-height: 280px;
  overflow: auto;
}

.copy-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.secondary-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}
.secondary-btn:hover { background: rgba(255,255,255,0.06); }

.modal-title {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  font-size: 22px;
  margin: 0 0 4px 0;
}
.modal-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.recording-pulse {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--terracotta);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* "Export" button in the stage header */
.export-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.export-btn:hover { background: var(--accent-hover); }
.export-btn svg { width: 13px; height: 13px; }
