:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --surface: #14171d;
  --surface-2: #1b1f27;
  --line: rgba(255,255,255,.09);
  --text: #f4f6f8;
  --muted: #969eaa;
  --accent: #9df0c5;
  --accent-ink: #0c2017;
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1500px, 100%); margin: 0 auto; padding: 22px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(22px, 3vw, 34px); font-weight: 700; }
h2 { font-size: 24px; }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: .16em; font-weight: 800; margin-bottom: 7px; }
.top-actions { display: flex; gap: 10px; }
.button, .icon-button { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button { padding: 11px 15px; font-weight: 700; }
.button:active, .icon-button:active { transform: scale(.97); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.button.ghost { background: rgba(255,255,255,.04); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .55fr); gap: 18px; min-height: calc(100dvh - 112px); }
.stage-card, .editor-card { background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.018)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stage-card { position: relative; min-height: 660px; }
.stage { position: absolute; inset: 0; touch-action: none; background: radial-gradient(circle at 50% 38%, #2c3340 0%, #171b22 44%, #0e1015 100%); }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 9px 13px; border-radius: 999px; background: rgba(8,10,13,.68); border: 1px solid rgba(255,255,255,.08); color: #b9c0c9; font-size: 12px; backdrop-filter: blur(12px); white-space: nowrap; }
.toast { position: absolute; top: 18px; left: 50%; transform: translate(-50%, -16px); opacity: 0; pointer-events: none; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 9px 14px; font-weight: 800; font-size: 12px; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.editor-card { display: flex; flex-direction: column; padding: 20px; }
.editor-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 17px; }
.icon-button { width: 40px; height: 40px; font-size: 19px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 5px; border-radius: 15px; background: rgba(0,0,0,.22); }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 11px; padding: 9px 6px; font-size: 11px; font-weight: 800; cursor: pointer; }
.tab.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.panels { flex: 1; }
.panel { display: none; padding-top: 19px; }
.panel.active { display: block; }
.control-label { display: block; margin: 18px 0 9px; color: #cbd0d7; font-size: 12px; font-weight: 800; }
.control-label:first-child { margin-top: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch { width: 34px; height: 34px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.17); }
.swatch.active { border-color: white; outline: 2px solid rgba(255,255,255,.2); outline-offset: 2px; }
.segmented { display: flex; flex-wrap: wrap; gap: 7px; }
.segmented button, .choice { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: #c8ced6; font-weight: 750; font-size: 12px; }
.segmented button.active, .choice.active { background: #ecf0f4; color: #14171d; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice { text-align: left; min-height: 46px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.editor-foot { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; }
.editor-foot strong { color: #d9dde2; }

@media (max-width: 860px) {
  .app-shell { padding: 12px; }
  .topbar { align-items: flex-start; }
  .top-actions .button { padding: 9px 11px; font-size: 12px; }
  .workspace { grid-template-columns: 1fr; min-height: auto; }
  .stage-card { min-height: 56dvh; }
  .editor-card { min-height: 460px; }
}

@media (max-width: 520px) {
  .topbar { flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions .button { flex: 1; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .stage-card { min-height: 52dvh; border-radius: 20px; }
  .editor-card { border-radius: 20px; padding: 16px; }
}
