/* ================================================================
   Lustre demo — futuristic glass playground
   ================================================================ */

:root {
  --bg: #05070d;
  --bg-soft: #0a0e1a;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8edf7;
  --muted: #8b94ad;
  --accent-1: #00e5ff;
  --accent-2: #7c4dff;
  --accent-grad: linear-gradient(120deg, var(--accent-1), var(--accent-2));
  --chip-bg: rgba(255, 255, 255, 0.05);
  --chip-active: rgba(0, 229, 255, 0.12);
  --input-bg: rgba(255, 255, 255, 0.06);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius: 16px;
}

body[data-theme='light'] {
  --bg: #e9edf5;
  --bg-soft: #f6f8fc;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-border: rgba(25, 35, 65, 0.1);
  --text: #1c2333;
  --muted: #67718c;
  --chip-bg: rgba(255, 255, 255, 0.75);
  --chip-active: rgba(72, 52, 212, 0.1);
  --input-bg: rgba(25, 35, 65, 0.06);
  --shadow: 0 20px 60px rgba(40, 55, 100, 0.14);
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 500px at 75% -10%, rgba(124, 77, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(0, 229, 255, 0.1), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  transition: background 0.35s ease, color 0.35s ease;
}

/* ----------------------------------------------------------------
   Top bar
---------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-gem { filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.45)); }
.brand-name {
  margin: 0;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag { color: var(--muted); font-size: 12.5px; margin-left: 4px; letter-spacing: 0.02em; }

.topnav { display: flex; align-items: center; gap: 6px; }
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  opacity: 0.82;
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  padding: 7px 13px;
  border-radius: 10px;
  transition: opacity 0.15s, background 0.15s;
}
.topnav a:hover { opacity: 1; background: var(--chip-bg); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--chip-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { border-color: var(--accent-1); transform: translateY(-1px); }
body[data-theme='dark'] .ico-sun { display: none; }
body[data-theme='light'] .ico-moon { display: none; }

/* ----------------------------------------------------------------
   Layout
---------------------------------------------------------------- */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.panel {
  width: 316px;
  flex: none;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 140, 180, 0.3) transparent;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: rgba(128, 140, 180, 0.25); border-radius: 8px; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 15px 15px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.card.hidden { display: none; }
.card h3 {
  margin: 0 0 11px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.card h3 .count-badge {
  float: right;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--accent-1);
  font-size: 8.5px;
  letter-spacing: 0.07em;
}

.stage-wrap {
  flex: 1;
  min-width: 0;
  padding: 16px 16px 16px 4px;
  display: flex;
}
#stage {
  flex: 1;
  min-height: 320px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

/* ----------------------------------------------------------------
   Controls
---------------------------------------------------------------- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  background: var(--input-bg);
  border-radius: 12px;
  padding: 4px;
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  color: var(--text);
  background: var(--chip-active);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.35);
}
body[data-theme='light'] .segmented button.active { box-shadow: inset 0 0 0 1px rgba(72, 52, 212, 0.4); }

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 4px 8px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--chip-bg);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}
.chip:hover { transform: translateY(-1px); border-color: var(--accent-1); }
.chip.active {
  border-color: transparent;
  background: var(--chip-active);
  box-shadow: inset 0 0 0 1.5px var(--accent-1), 0 4px 18px -6px rgba(0, 229, 255, 0.4);
}
body[data-theme='light'] .chip.active { box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.chip.has-edits::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 7px var(--accent-1);
}
body[data-theme='light'] .chip.has-edits::after { background: var(--accent-2); box-shadow: none; }
.chip .swatch {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

/* material swatch flavors */
.swatch-glossy { background: radial-gradient(circle at 30% 25%, #fff 0%, #ff5e7a 22%, #c22850 90%); }
.swatch-glass { background: linear-gradient(150deg, rgba(160, 230, 255, 0.9), rgba(70, 120, 255, 0.35)); border: 1px solid rgba(255, 255, 255, 0.5); }
.swatch-metal { background: conic-gradient(from 210deg, #6b7683, #e8eef4 25%, #9aa7b4 50%, #f6fafd 75%, #6b7683); }
.swatch-neon { background: #0a0f1e; box-shadow: inset 0 0 0 2px #00f0ff, inset 0 0 12px #00f0ff, 0 0 10px rgba(0, 240, 255, 0.6); }
.swatch-hologram { background: linear-gradient(135deg, #7ef7ff, #a78bfa 45%, #f472b6 80%); opacity: 0.9; }
.swatch-matte { background: #8f9dc0; }
.swatch-toon { background: linear-gradient(145deg, #fff2bd 0 27%, #ff4577 28% 66%, #14131d 67%); box-shadow: inset 0 0 0 2px #11121a; }
.swatch-halftone { background-color: #ffd84a; background-image: radial-gradient(#15131c 28%, transparent 30%); background-size: 6px 6px; box-shadow: inset 0 0 0 2px #15131c; }
.swatch-iridescent { background: conic-gradient(from 35deg, #52f7e8, #5f6dff, #ec4bda, #ffd95e, #52f7e8); box-shadow: inset 0 0 8px rgba(255,255,255,.65); }
.swatch-crystal { background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(63,225,255,.4) 38%, rgba(234,77,255,.45) 70%, rgba(255,226,91,.65)); border: 1px solid rgba(255,255,255,.72); }
.swatch-acrylic { background: linear-gradient(145deg, rgba(217,245,255,.92), rgba(68,135,255,.48)); border: 1px solid rgba(255,255,255,.6); box-shadow: inset 5px 5px 10px rgba(255,255,255,.28); }
.swatch-subsurface { background: radial-gradient(circle at 72% 28%, #fff6c9 0%, #a9ff85 15%, #28c969 44%, #07512f 100%); box-shadow: inset -5px -6px 12px rgba(0,35,20,.6), inset 4px 4px 8px rgba(255,255,210,.55); }
.swatch-tricolor { background: conic-gradient(from 215deg, #0d6cba, #31e5d0 34%, #7966ed 68%, #0d6cba); border: 1px solid rgba(255,255,255,.48); box-shadow: inset 3px 3px 8px rgba(255,255,255,.38); }
.swatch-velvet { background: radial-gradient(ellipse at 72% 24%, #d8abff 0%, #7145a9 24%, #211134 74%); }
.swatch-inset { background: #fff; border: 4px solid #6140ad; box-shadow: 0 2px 5px rgba(40, 18, 82, 0.5); }

.material-note {
  min-height: 45px;
  margin: 10px 1px 0;
  padding-top: 9px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}
.material-note strong,
.material-note span { display: block; }
.material-note strong { color: var(--text); font-size: 11px; font-weight: 600; }

.card-title-row,
.material-editor-heading,
.material-control-head,
.material-control-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title-row h3 { margin-bottom: 0; }
.edit-count {
  color: var(--accent-1);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body[data-theme='light'] .edit-count { color: var(--accent-2); }
.material-editor-heading {
  margin: 11px 0 12px;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  background: var(--input-bg);
}
.material-editor-heading strong,
.material-editor-heading span { display: block; }
.material-editor-heading strong {
  color: var(--text);
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 13px;
  text-transform: capitalize;
}
.material-editor-heading span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
}
.text-btn,
.material-field-reset {
  border: 0;
  background: transparent;
  color: var(--accent-1);
  font: inherit;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
body[data-theme='light'] :is(.text-btn, .material-field-reset) { color: var(--accent-2); }
.text-btn:disabled { color: var(--muted); cursor: default; opacity: 0.45; }
.material-editor { display: flex; flex-direction: column; gap: 13px; }
.material-editor fieldset {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
}
.material-editor legend {
  padding: 0 6px;
  color: var(--muted);
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.material-control {
  position: relative;
  margin-bottom: 13px;
}
.material-control:last-child { margin-bottom: 0; }
.material-control-head label {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}
.material-field-reset {
  width: 22px;
  height: 20px;
  padding: 0;
  border-radius: 7px;
  background: var(--chip-active);
  font-size: 13px;
  line-height: 1;
}
.material-field-reset[hidden] { display: none; }
.material-control-meta {
  margin: 3px 0 7px;
  font-variant-numeric: tabular-nums;
}
.material-control-meta small {
  color: var(--muted);
  font-size: 8.5px;
}
.material-control-meta output {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
}
.material-control.is-edited .material-control-meta output { color: var(--accent-1); }
body[data-theme='light'] .material-control.is-edited .material-control-meta output { color: var(--accent-2); }
.material-control input[type='color'] {
  display: block;
  width: 100%;
  height: 29px;
  padding: 3px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: var(--input-bg);
  cursor: pointer;
}
.material-control input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
.material-control input[type='color']::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}
.material-control input[type='color']::-moz-color-swatch {
  border: 0;
  border-radius: 6px;
}
.material-control select {
  width: 100%;
  min-width: 0;
  padding-block: 6px;
  font-size: 11px;
}

.palette-list { display: flex; flex-direction: column; gap: 6px; }
.palette-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: capitalize;
}
.palette-row:hover { background: var(--chip-bg); }
.palette-row.active { border-color: var(--accent-1); background: var(--chip-active); }
body[data-theme='light'] .palette-row.active { border-color: var(--accent-2); }
.palette-dots { display: flex; gap: 4px; }
.palette-dots i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: 0 0 6px -1px currentColor;
}

.palette-editor {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--panel-border);
}
.editor-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.editor-section-heading strong,
.editor-section-heading span { display: block; }
.editor-section-heading strong { color: var(--text); font-size: 11px; }
.editor-section-heading span,
.editor-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}
.palette-color-list,
.data-editor,
.data-list,
.bar-series-list,
.bar-category-list { display: flex; flex-direction: column; gap: 7px; }
.palette-color-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 27px;
  align-items: center;
  gap: 7px;
}
.palette-color-row input[type='color'] {
  width: 34px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--input-bg);
  cursor: pointer;
}
.palette-color-row input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
.palette-color-row input[type='color']::-webkit-color-swatch { border: 0; border-radius: 5px; }
.palette-color-row input[type='color']::-moz-color-swatch { border: 0; border-radius: 5px; }
.editor-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  padding: 6px 8px;
}
.editor-input[type='number'] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.editor-input[aria-invalid='true'] { border-color: #ff5e7a; }
.icon-action {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.icon-action:hover:not(:disabled) { color: var(--text); border-color: var(--accent-1); }
.icon-action:disabled { cursor: default; opacity: 0.32; }
body[data-theme='light'] .icon-action:hover:not(:disabled) { border-color: var(--accent-2); }
.editor-add-btn {
  width: 100%;
  margin-top: 9px;
  padding-block: 7px;
  font-size: 11px;
}

.data-card .editor-note { margin: 9px 0 10px; }
.data-editor-columns,
.data-item-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 65px 27px;
  align-items: center;
  gap: 7px;
}
.data-editor-columns {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.data-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--row-color);
  box-shadow: 0 0 7px -1px var(--row-color);
}
.data-actions { margin-top: 11px; }
.data-actions .btn { padding-inline: 8px; font-size: 11px; }
.data-subsection + .data-subsection { margin-top: 13px; }
.data-subsection-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mini-btn {
  border: 0;
  background: transparent;
  color: var(--accent-1);
  font: inherit;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}
body[data-theme='light'] .mini-btn { color: var(--accent-2); }
.bar-series-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 27px;
  align-items: center;
  gap: 7px;
}
.bar-category-card {
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--input-bg), transparent 18%);
}
.bar-category-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 27px;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.bar-value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  gap: 6px;
}
.bar-value-field span {
  display: block;
  overflow: hidden;
  margin: 0 0 3px 1px;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.row:last-child { margin-bottom: 0; }
.row > span { color: var(--text); font-weight: 500; }

select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  min-width: 132px;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--accent-1); }
select option { background: var(--bg-soft); color: var(--text); }

.slider-row { display: block; margin-bottom: 11px; }
.slider-row:last-child { margin-bottom: 0; }
.slider-row > span {
  display: flex;
  justify-content: space-between;
  font-weight: 500;
  margin-bottom: 5px;
}
.slider-row em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }

.quality-note {
  margin: 11px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.45;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: var(--input-bg);
  outline: none;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent-grad);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
  transition: transform 0.12s ease;
}
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type='range']::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent-1);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
}

.toggles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
}
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: inset(50%);
}
.switch i {
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  position: relative;
  flex: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch i::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--muted);
  transition: all 0.18s ease;
}
.switch input:checked + i {
  background: var(--chip-active);
  border-color: var(--accent-1);
}
.switch input:checked + i::after {
  left: 17px;
  background: var(--accent-1);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
}
body[data-theme='light'] .switch input:checked + i { border-color: var(--accent-2); }
body[data-theme='light'] .switch input:checked + i::after { background: var(--accent-2); box-shadow: none; }

:where(button, a, select, input, summary):focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}
body[data-theme='light'] :where(button, a, select, input, summary):focus-visible {
  outline-color: var(--accent-2);
}
.switch input:focus-visible + i {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}
body[data-theme='light'] .switch input:focus-visible + i { outline-color: var(--accent-2); }

.btn {
  border: 1px solid var(--panel-border);
  background: var(--chip-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 11px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.btn:hover { border-color: var(--accent-1); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-accent {
  width: 100%;
  margin-top: 10px;
  background: var(--accent-grad);
  border: none;
  color: #061018;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 22px -6px rgba(0, 229, 255, 0.55);
}
.btn-accent:hover { border: none; filter: brightness(1.08); }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; white-space: nowrap; }

.code-details { margin-top: 11px; }
.code-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
}
.code-details summary:hover { color: var(--text); }
#codeView {
  margin: 9px 0 0;
  padding: 11px 12px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--panel-border);
  color: #9fe8ff;
  font-family: 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 300px;
}
body[data-theme='light'] #codeView { background: rgba(25, 35, 65, 0.06); color: #4834d4; }

.panel-footer {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  padding: 4px 0 10px;
}
.panel-footer b { color: var(--text); font-weight: 600; }

/* ----------------------------------------------------------------
   Toast
---------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--panel);
  border: 1px solid var(--accent-1);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ----------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */
@media (max-width: 900px) {
  .layout { flex-direction: column-reverse; overflow-y: auto; }
  .panel { width: 100%; overflow: visible; }
  .stage-wrap { padding: 12px; min-height: 62vh; }
  #stage { min-height: 58vh; }
  .brand-tag { display: none; }
  body { overflow-y: auto; height: auto; min-height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
