:root {
  --bg: #0a0a0f;
  --bg-card: #14131f;
  --border: #24232f;
  --text: #f2f2f5;
  --text-dim: #8a8a9a;
  --accent: #7c5cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { font-weight: 800; font-size: 18px; }
.nav-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.nav-link:hover { border-color: var(--accent); }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.stage-wrap { margin-bottom: 28px; }
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.stage-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.action-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.action-btn:hover { border-color: var(--accent); }
.action-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }

.controls { display: flex; flex-direction: column; gap: 10px; }
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.control-name { font-weight: 700; font-size: 14px; min-width: 90px; }
.control-picker { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }
.control-label {
  font-size: 13px;
  color: var(--text-dim);
  width: 140px;
  flex-shrink: 0;
  text-align: center;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.arrow-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 480px) {
  .control-label { width: 100px; font-size: 12px; }
  .control-name { min-width: 70px; font-size: 13px; }
}

/* Desktop: preview+download on the left, selector panel on the right,
   stretched to match the left column's height so both look like one unit. */
@media (min-width: 860px) {
  .container {
    max-width: 900px;
    display: flex;
    align-items: stretch;
    gap: 28px;
  }
  .stage-wrap {
    flex: 0 0 400px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }
  .controls {
    flex: 1;
    margin: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    align-self: stretch;
    overflow-y: auto;
  }
}
