/* ── VARIABLES ───────────────────────────────────────────────────────────── */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --c-bg:       #0a0a0a;
  --c-sidebar:  #171717;
  --c-border:   #262626;
  --c-track:    #404040;
  --c-muted:    #737373;
  --c-sec:      #a3a3a3;
  --c-primary:  #e5e5e5;
  --c-white:    #ffffff;
}

/* ── RESET ───────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── BASE ────────────────────────────────────────────────────────────────── */

body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--c-bg);
  color: var(--c-primary);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SCROLLBAR ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar              { width: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--c-border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover  { background: var(--c-muted); }

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR / PANEL ─────────────────────────────────────────────────────── */

.panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--c-sidebar);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  z-index: 50;
}

.panel-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.panel-header h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-primary);
}

.panel-header span {
  display: block;
  font-size: 10px;
  color: var(--c-muted);
  margin-top: 3px;
  letter-spacing: .03em;
}


/* ── DETAILS / SUMMARY SECTIONS ──────────────────────────────────────────── */

.section-details {
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.section-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.2s ease;
}

.section-summary::-webkit-details-marker { display: none; }
.section-summary::marker { display: none; }
.section-summary:hover { background: color-mix(in oklab, var(--c-white), transparent 95%); }

.summary-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.summary-chevron {
  font-size: 11px;
  color: var(--c-muted);
  display: inline-block;
  transition: transform 0.2s ease;
  line-height: 1;
}

.section-details[open] .summary-chevron {
  transform: rotate(180deg);
}

.section-body {
  padding: 4px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── CONTROLS ────────────────────────────────────────────────────────────── */

.text-input {
  width: 100%;
  border: 1px solid var(--c-track);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--c-bg);
  color: var(--c-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.text-input:focus { border-color: var(--c-sec); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-label {
  font-size: 10px;
  color: var(--c-muted);
}

.slider-val {
  font-size: 10px;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--c-sec);
}

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  height: 2px;
  background: var(--c-track);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-white);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

input[type=color] {
  width: 28px;
  height: 24px;
  border: 1px solid var(--c-track);
  border-radius: 4px;
  padding: 1px;
  cursor: pointer;
  background: none;
}

.btn {
  padding: 6px 12px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid var(--c-track);
  border-radius: 4px;
  background: transparent;
  color: var(--c-sec);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.btn.active {
  background: var(--c-primary);
  color: var(--c-bg);
  border-color: var(--c-primary);
}

.btn-sm {
  padding: 4px 9px;
  font-size: 10px;
}

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-label {
  font-size: 10px;
  color: var(--c-muted);
  min-width: 70px;
}

.noise-cb label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--c-muted);
  cursor: pointer;
  user-select: none;
}

.noise-cb input[type=checkbox] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: var(--c-primary);
}

.font-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-label {
  font-size: 10px;
  color: var(--c-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-error {
  color: #f87171;
  font-size: 10px;
}

/* ── MAIN AREA ───────────────────────────────────────────────────────────── */

.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-bg);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.presets-label {
  font-size: 10px;
  color: var(--c-muted);
  letter-spacing: .05em;
  margin-left: 4px;
}

.scroll-area {
  flex: 1;
  overflow: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* ── PREVIEW (canvas-only, portrait SVG centered) ────────────────────────── */

.main-preview {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SVG fits inside container preserving aspect ratio */
.main-preview svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* ── PRESETS GRID (sidebar) ──────────────────────────────────────────────── */

.preset-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-block {
  width: 100%;
  text-align: left;
}

/* ── MY PRESETS ──────────────────────────────────────────────────────────── */

.preset-save-row {
  display: flex;
  gap: 6px;
}

.preset-name-inp {
  flex: 1;
  border: 1px solid var(--c-track);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 11px;
  font-family: inherit;
  background: var(--c-bg);
  color: var(--c-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.preset-name-inp:focus { border-color: var(--c-sec); }
.preset-name-inp::placeholder { color: var(--c-muted); }

.custom-presets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.custom-preset-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.custom-preset-row .btn-block {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-delete {
  padding: 5px 9px;
  color: var(--c-muted);
  border-color: var(--c-border);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.btn-delete:hover {
  color: #f87171;
  border-color: #f87171;
  background: transparent;
}

.no-presets {
  font-size: 10px;
  color: var(--c-muted);
  font-style: italic;
}

/* ── SEED ROW ────────────────────────────────────────────────────────────── */

.seed-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seed-row .slider-label { flex: 1; }

/* ── TOOLBAR SEPARATOR ───────────────────────────────────────────────────── */

.toolbar-sep {
  flex: 1;
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 14px;
  right: 14px;
  background: var(--c-border);
  border: 1px solid var(--c-track);
  color: var(--c-primary);
  font-size: 11px;
  letter-spacing: .03em;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

