/* ── Sections (glass cards) ───────────────── */
.section {
  margin-bottom: 6px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.section:hover {
  border-color: rgba(255, 255, 255, 0.10);
}

.section.open {
  background: rgba(22, 22, 32, 0.65);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s var(--ease-out-expo);
  position: relative;
}

.section-head:hover {
  background: rgba(255, 255, 255, 0.025);
}

.section-head:active {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Section icons (frosted badges) ───────────────── */
.section-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.section-head:hover .section-icon {
  transform: scale(1.1);
}

.section-icon svg {
  width: 11px;
  height: 11px;
}

.icon-image {
  background: rgba(212, 255, 78, 0.10);
  color: var(--accent);
  box-shadow: 0 0 0 0 transparent;
}

.section.open .icon-image {
  box-shadow: 0 0 10px rgba(212, 255, 78, 0.08);
}

.icon-tone {
  background: rgba(78, 255, 212, 0.10);
  color: var(--teal);
}

.section.open .icon-tone {
  box-shadow: 0 0 10px rgba(78, 255, 212, 0.08);
}

.icon-aesthetic {
  background: rgba(255, 78, 160, 0.10);
  color: var(--pink);
}

.section.open .icon-aesthetic {
  box-shadow: 0 0 10px rgba(255, 78, 160, 0.08);
}

.icon-advanced {
  background: rgba(255, 170, 78, 0.10);
  color: var(--amber);
}

.section.open .icon-advanced {
  box-shadow: 0 0 10px rgba(255, 170, 78, 0.08);
}

.icon-display {
  background: rgba(107, 180, 255, 0.10);
  color: #6bb4ff;
}

.section.open .icon-display {
  box-shadow: 0 0 10px rgba(107, 180, 255, 0.08);
}

/* ── Section title & chevron ───────────────── */
.section-title {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-2);
  transition: color 0.2s;
}

.section.open .section-title {
  color: var(--text);
}

.section-chevron {
  color: var(--text-3);
  display: flex;
  align-items: center;
  transition: transform 0.3s var(--ease-out-expo), color 0.2s;
}

.section-chevron svg {
  width: 10px;
  height: 10px;
}

.section.open .section-chevron {
  transform: rotate(90deg);
  color: var(--text-2);
}

/* ── Section body (animated expand) ───────────────── */
.section-body {
  display: none;
  padding: 10px 11px 14px;
  border-top: 1px solid var(--glass-border);
  position: relative;
}

/* Inner top highlight */
.section-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
}

.section.open .section-body {
  display: block;
  animation: sectionExpand 0.35s var(--ease-out-expo);
}

@keyframes sectionExpand {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Controls ───────────────── */
.ctrl {
  margin-bottom: 12px;
}

.ctrl:last-child {
  margin-bottom: 0;
}

.ctrl-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.ctrl-val {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(212, 255, 78, 0.08);
  transition: background 0.2s, border-color 0.2s;
}

/* ── Range sliders (glass track + glowing thumb) ───────────────── */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
  transition: background 0.2s;
}

input[type=range]:hover {
  background: rgba(255, 255, 255, 0.09);
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.35);
  box-shadow: 0 0 14px var(--accent-glow);
}

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

/* ── Select dropdowns (glass) ───────────────── */
select {
  width: 100%;
  background: var(--surface-3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 8px 30px 8px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%236666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  transition: border-color 0.25s var(--ease-out-expo), box-shadow 0.25s;
}

select:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 12px var(--accent-glow);
}

/* ── Toggle switches (glow on check) ───────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 0;
}

.toggle-row+.toggle-row {
  margin-top: 2px;
}

.toggle-row label {
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  flex: 1;
  transition: color 0.2s;
}

input[type=checkbox] {
  -webkit-appearance: none;
  width: 30px;
  height: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s var(--ease-out-expo), border-color 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
}

input[type=checkbox]::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-3);
  top: 1px;
  left: 1px;
  transition: left 0.3s var(--ease-out-expo), background 0.3s, box-shadow 0.3s;
}

input[type=checkbox]:checked {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  box-shadow: 0 0 10px var(--accent-glow);
}

input[type=checkbox]:checked::after {
  left: 15px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

/* ── Sub controls ───────────────── */
.sub-ctrl {
  margin-top: 6px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--glass-border);
  display: none;
}

/* ── Color pickers (glass cards) ───────────────── */
.color-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.color-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--surface-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  transition: border-color 0.2s, background 0.2s;
}

.color-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(30, 30, 42, 0.65);
}

.color-item label {
  font-size: 11px;
  color: var(--text-2);
}

input[type=color] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s var(--ease-spring);
}

input[type=color]:hover {
  transform: scale(1.1);
}

@keyframes color-flash {
  0%   { outline: 2px solid var(--accent); outline-offset: 2px; }
  100% { outline: 2px solid transparent; outline-offset: 6px; }
}

.color-flash {
  animation: color-flash 0.6s ease-out forwards;
}

/* ── Font preview (glass card) ───────────────── */
.font-preview {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  transition: border-color 0.2s;
}

.font-preview:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ── Charset preview ───────────────── */
#charset-preview {
  transition: opacity 0.3s var(--ease-out-expo);
}

/* ── Render button (premium gradient) ───────────────── */
.btn-render {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent), #b8e63c);
  color: #000;
  border: none;
  border-radius: var(--r);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s var(--ease-out-expo);
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

/* Shimmer effect on render button */
.btn-render::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.6s;
}

.btn-render:hover::before {
  left: 100%;
}

.btn-render svg {
  width: 12px;
  height: 12px;
  stroke: #000;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-render:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px var(--accent-glow), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-render:active {
  transform: translateY(0) scale(0.98);
}

.spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.5s linear infinite;
}