:root {
  color-scheme: dark;
  --panel-w: max(390px, 32vw);
  --panel-card-w: calc(var(--panel-w) - 44px);
  --bg: #1B1B1F;
  --card: #343B4A;
  --card-hover: #3B4251;
  --field: #22262F;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #E4E4E7;
  --muted: #A9A9AF;
  --faint: #8A8A90;
  --heading: #E3E3E6;
  --accent: #3E8E5F;
  --accent-hover: #469C6A;
  --brand: #6FA3D9;
  --brand-bright: #8FBCE8;
  --radius: 10px;
  --header-h: 84px;
}

* { box-sizing: border-box; }

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

.app-header {
  padding: 6px 16px 8px;
  border-top: 3px solid var(--brand);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}

.header-top { display: flex; align-items: center; gap: 12px; }

.header-library {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.header-library #presetName {
  flex: 1 1 140px;
  min-width: 0;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 9px;
  font-family: inherit;
  font-size: 0.82rem;
}

.header-library .btn { flex: 0 0 auto; width: auto; margin: 0; padding: 5px 10px; font-size: 0.8rem; }
.header-top .btn { flex: 0 0 auto; margin-left: auto; }

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

.brand img { width: 24px; height: 24px; border-radius: 50%; }

.app-header h1 { font-size: 0.95rem; margin: 0; font-weight: 700; color: var(--heading); white-space: nowrap; }

.tagline { margin: 0; color: var(--faint); font-size: 0.76rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layout {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  gap: 0;
  min-height: calc(100vh - 116px);
}

.panel {
  border-right: 1px solid var(--border);
  padding: 16px;
  position: sticky;
  top: var(--header-h);
  align-self: start;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

.tab-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--card-hover) transparent;
}

.tab-hidden { display: none; }

#panelTabs { flex-shrink: 0; margin: 0 0 10px; }
#panelTabs button { font-size: 0.84rem; padding: 7px 2px; }

.panel .section summary { pointer-events: none; }
.panel .section summary::after { display: none; }

.promo-card > summary { pointer-events: none; }
.promo-card > summary::after { display: none; }

.panel-foot { flex-shrink: 0; margin-top: auto; padding-top: 10px; }
.panel-foot .btn { width: auto; margin: 0; }

.card-sets .number-range input[type="number"] { flex: 0 0 62px; }
.card-sets .row .set-go { flex: 0 0 auto; width: auto; margin: 0; }
.card-onstate .seg { margin: 10px 0; }
.card-onstate .on-colours { margin: 0; }

.panel .row { margin: 7px 0; }
.panel .row textarea { height: 42px; }

.btn.small { padding: 4px 10px; font-size: 0.78rem; width: auto; }

.edit-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(860px, 100%);
  min-height: 52px;
  margin: -8px 0 0;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.edit-status.one { border-color: var(--brand); color: var(--text); }
.edit-status.idle { visibility: hidden; }
.edit-status .btn.small { flex-shrink: 0; }

.section {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.38);
}

.section summary {
  cursor: pointer;
  padding: 11px 16px;
  font-weight: 600;
  color: var(--heading);
  list-style: none;
  user-select: none;
}

.section summary::-webkit-details-marker { display: none; }

.section summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.section[open] summary::after { content: "-"; }

.section-body { padding: 4px 16px 16px; }

#controls .section summary { display: flex; align-items: center; gap: 8px; }
#controls .section summary::after { margin-left: auto; }

.card-icon { width: 16px; height: 16px; flex: none; color: var(--brand-bright); }

.card-bg {
  background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.022) 0% 25%, transparent 0% 50%);
  background-size: 16px 16px;
}

.pos-row { position: relative; }

.pos-row::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
  width: 115px;
  height: 115px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

.card-image .pos-row::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' fill-opacity='0.06' d='M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z'/%3E%3C/svg%3E");
}

.card-text .pos-row::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' fill-opacity='0.06' d='M18.5,4L19.66,8.35L18.7,8.61C18.25,7.74 17.79,6.87 17.26,6.43C16.73,6 16.11,6 15.5,6H13V16.5C13,17 13,17.5 13.33,17.75C13.67,18 14.33,18 15,18V19H9V18C9.67,18 10.33,18 10.67,17.75C11,17.5 11,17 11,16.5V6H8.5C7.89,6 7.27,6 6.74,6.43C6.21,6.87 5.75,7.74 5.3,8.61L4.34,8.35L5.5,4H18.5Z'/%3E%3C/svg%3E");
}

.card-shape { border-radius: 18px; border-color: rgba(111, 163, 217, 0.5); }

.card-title { white-space: nowrap; }
.card-sep { margin: 0 0.14em; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0;
}

.row label {
  flex: 0 0 80px;
  color: var(--muted);
  font-size: 0.88rem;
}

.row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--brand); }

.row label.inline-check { flex: 0 0 auto; margin-left: auto; }

.merged-row label:not(:first-child) { flex: 0 0 auto; margin-left: 6px; }
.merged-row select, .merged-row input[type="range"] { min-width: 0; }
.merged-row #textFont { flex: 2; }

.row input[type="color"] {
  width: 44px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field);
  padding: 2px;
  cursor: pointer;
}

.row input[type="text"],
.row input[type="number"],
.row input[type="search"],
.row select,
.row textarea {
  flex: 1;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 9px;
  font-family: inherit;
  font-size: 0.92rem;
  min-width: 0;
}

.row textarea { resize: none; height: 52px; line-height: 1.4; }
.row input[type="number"] { flex: 0 0 80px; }

.number-range { flex-wrap: wrap; }
.number-range label { flex: 0 0 auto; }
.number-range label:last-of-type { margin-left: 6px; }
.number-range input[type="number"] { flex: 0 0 68px; }

.row input[type="file"] { flex: 1; color: var(--muted); font-size: 0.85rem; min-width: 0; }

.val {
  flex: 0 0 44px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}

.row input.val {
  flex: 0 0 44px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 4px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.row input.val::-webkit-outer-spin-button,
.row input.val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.row input.val:hover, .row input.val:focus {
  border-color: var(--border-strong);
  color: var(--text);
  outline: none;
}

.hint { color: var(--muted); font-size: 0.82rem; margin: 6px 0; line-height: 1.5; }

.seg {
  display: flex;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 6px 0 10px;
}

.seg button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  padding: 7px 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
}

.seg button.active { background: var(--brand); color: #16181c; font-weight: 600; }

.seg button:active { transform: scale(0.96); }

.btn {
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  width: 100%;
  margin: 4px 0;
  transition: transform 0.08s;
}

.btn:hover:not(:disabled) { border-color: var(--border-strong); background: var(--card-hover); }

.btn:active:not(:disabled) { transform: scale(0.97); }

.btn:disabled { opacity: 0.4; cursor: default; }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #16181c;
}

.btn.primary:hover:not(:disabled) { background: var(--brand-bright); border-color: var(--brand-bright); }

.btn.ghost { background: none; }

.row .btn { width: auto; flex: 1; }

.align-grid {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  gap: 4px;
}

.align-grid button {
  width: 26px;
  height: 26px;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}

.align-grid button.active { background: var(--brand); border-color: var(--brand); }

.align-grid button:active { transform: scale(0.92); }

.layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}

.layer-chips button {
  background: var(--field);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 14px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

.layer-chips button.active { background: var(--brand); border-color: var(--brand); color: #16181c; }

.layer-chips button:active { transform: scale(0.94); }

.layer-chips button.chip-action { border-style: dashed; }

.chip-x {
  margin-left: 11px;
  padding: 0 3px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.12s;
  cursor: pointer;
}
.layer-chips button:hover .chip-x { opacity: 0.6; }
.layer-chips button .chip-x:hover,
.layer-chips button .chip-x:focus-visible { opacity: 1; color: var(--text); background: rgba(255, 255, 255, 0.14); }

.seg button:disabled { opacity: 0.4; cursor: default; }

.row input[type="checkbox"] { accent-color: var(--brand); }

.edge-toggles { display: flex; flex: 1; gap: 16px; }

.edge-toggles label { flex: none; display: flex; align-items: center; gap: 5px; color: var(--text); font-size: 0.9rem; }

.edge-toggles input { accent-color: var(--brand); }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 24px 40px;
  gap: 18px;
  min-width: 0;
}



.library-open {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 100%;
  text-align: left;
  background: var(--brand);
  border: none;
  border-radius: 6px;
  padding: 5px 11px;
  cursor: pointer;
  font-family: inherit;
  color: #16181c;
  transition: background 0.12s;
}

@media (min-width: 900px) {
  .library-open { flex: 0 0 var(--panel-card-w); margin-right: 22px; }
}

@media (min-width: 821px) and (max-width: 999px) {
  :root { --header-h: 117px; }
  .header-library { flex-wrap: wrap; row-gap: 0; }
  .header-library #presetName { flex: 1 1 50%; }
  .header-library .btn { flex: 1 1 calc(25% - 5px); order: 1; margin-top: 6px; justify-content: center; }
}

.library-open:hover { background: var(--brand-bright); }
.library-open:active { transform: scale(0.995); }

.library-title { font-size: 0.84rem; font-weight: 700; flex: 0 0 auto; white-space: nowrap; }
.library-sub { font-size: 0.73rem; opacity: 0.8; min-width: 0; white-space: nowrap; }


.strip-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--card-hover);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.strip-del:hover { color: var(--text); border-color: var(--brand); }




.download-card, .promo-card { width: min(860px, 100%); margin-bottom: 0; }


.download-row { flex-wrap: wrap; }

#effectScopeHint { margin: 10px 0 0; font-size: 0.78rem; color: var(--muted); }

.copy-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.copy-row .btn { flex: 0 0 auto; width: auto; margin: 0; }
.download-row .btn { flex: 1 1 0; min-width: 110px; margin: 0; }

.modal-box.help-box { width: min(760px, 92vw); }
.help-scroll { overflow-y: auto; padding-right: 4px; }
.help-scroll .hint { margin: 9px 0; }
.help-scroll .hint b { color: var(--text); font-weight: 600; }

.preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 4px; }

#preview {
  width: 288px;
  height: 288px;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  background:
    repeating-conic-gradient(#2b2b30 0% 25%, #222226 0% 50%) 0 0 / 24px 24px;
}

.preview-frame { position: relative; width: 288px; height: 288px; }

.preview-guides {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  overflow: hidden;
}
.preview-guides::before,
.preview-guides::after {
  content: '';
  position: absolute;
  background: rgba(111, 163, 217, 0.6);
}
.preview-guides::before { left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; }
.preview-guides::after { top: 50%; left: 0; right: 0; height: 1px; margin-top: -0.5px; }

.guide-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.guide-toggle input { accent-color: var(--brand); }

.series-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  max-width: 760px;
  min-height: 117px;
}

.series-preview canvas {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.series-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; padding: 4px; border-radius: 8px; border: 2px solid transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.series-item:active { cursor: grabbing; }

.series-item.selected { border-color: var(--brand); }
.series-item.sel-multi,
.series-item.sel-all { border-color: rgba(111, 163, 217, 0.65); }

.series-item.selected .series-num { color: var(--text); }

.series-del {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card-hover);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  font-size: 0.72rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
  padding: 0 0 2px;
}

.series-item:hover .series-del { opacity: 1; }

.series-del:hover { color: var(--text); border-color: var(--brand); }

.series-add {
  width: 96px;
  height: 96px;
  margin: 6px 4px 25px;
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  align-self: flex-start;
}

.series-add:hover, .series-add.drop-target { border-color: var(--brand); color: var(--brand); }

.undo-row { display: none; gap: 8px; }

.series-item.touch-dragging { opacity: 0.55; }
.series-item.touch-target { border-color: var(--brand); }

.series-add-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 4px; }
.series-add-tile .series-add { margin: 0; align-self: center; }
.series-add-tile span { color: var(--muted); font-size: 0.8rem; }

#preview.drop-ready { outline: 2px dashed var(--border-strong); outline-offset: 5px; }

#preview.drop-target { outline: 3px dashed var(--brand); outline-offset: 5px; }

.series-caption { display: flex; align-items: center; gap: 6px; }

.series-num { color: var(--muted); font-size: 0.8rem; }

.series-on-badge {
  background: var(--brand);
  color: #16181c;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 7px;
  line-height: 1.55;
}

.series-preview.compact { gap: 10px; }
.series-preview.compact canvas { width: 64px; height: 64px; }
.series-preview.compact .series-add { width: 64px; height: 64px; font-size: 1.4rem; }

.series-preview.tiny { gap: 8px; }
.series-preview.tiny canvas { width: 48px; height: 48px; }
.series-preview.tiny .series-add { width: 48px; height: 48px; font-size: 1.1rem; }

.color-pop {
  position: fixed;
  z-index: 60;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.cp-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.cp-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.cp-swatches button {
  aspect-ratio: 1;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}

.cp-swatches button:hover { transform: scale(1.12); }

.cp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.cp-row span {
  flex: 0 0 38px;
  color: var(--muted);
  font-size: 0.78rem;
}

.cp-row input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 14px;
  border-radius: 7px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
}

.cp-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #16181c;
}

.cp-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #16181c;
}

.cp-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.cp-preview {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  flex: none;
}

.cp-foot input {
  flex: 1;
  min-width: 0;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 0.85rem;
  font-family: inherit;
}

.cp-foot .btn { width: auto; margin: 0; padding: 6px 14px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-box {
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: min(680px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
}

.modal-head { display: flex; gap: 10px; }

.modal-head input {
  flex: 1;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 1rem;
}

.modal-head .btn { width: auto; }

.icon-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 8px;
  overflow-y: auto;
  min-height: 120px;
}

.icon-results button {
  aspect-ratio: 1;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.icon-results button:hover { border-color: var(--brand); }

.icon-results button:active { transform: scale(0.94); }

.icon-results img { width: 100%; height: 100%; }

.modal-title { flex: 1; align-self: center; color: var(--heading); font-size: 1rem; font-weight: 600; }

.preset-picker-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  min-height: 120px;
}

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

.preset-picker-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.picker-user-tag { color: var(--faint); font-weight: 400; }

.preset-picker-name .picker-addset { margin-left: auto; }

.preset-picker-name .picker-del {
  position: static;
  opacity: 1;
}

.preset-picker-row { display: flex; flex-wrap: wrap; gap: 8px; }

.preset-picker-tile {
  flex: 0 0 auto;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px;
  cursor: pointer;
}

.preset-picker-tile:hover { border-color: var(--brand); background: var(--card-hover); }

.preset-picker-tile:active { transform: scale(0.94); }

.preset-picker-tile canvas { display: block; width: 54px; height: 54px; border-radius: 6px; }

.promo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  text-decoration: none;
  color: var(--text);
}

.promo-row + .promo-row { border-top: 1px solid var(--border); }

.promo-row img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.promo-text {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.promo-text b {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
}

.promo-row:hover .promo-text b { color: var(--brand-bright); }

.promo-all { margin: 12px 0 0; font-size: 0.85rem; }
.promo-all a { color: var(--brand); text-decoration: none; font-weight: 600; }
.promo-all a:hover { color: var(--brand-bright); text-decoration: underline; }


.app-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  color: var(--faint);
  font-size: 0.82rem;
}

.app-footer p { margin: 0; }

.app-footer a { color: var(--brand); text-decoration: none; }

.app-footer a:hover { color: var(--brand-bright); }

.hidden { display: none !important; }

@media (max-width: 820px) {
  .layout { display: flex; flex-direction: column; }
  .stage { display: contents; }
  .preview-wrap { order: 2; padding: 16px 12px; margin-top: 0; box-sizing: border-box; width: 100%; }
  #seriesPreview { order: 2; width: 100%; }
  .panel { order: 3; position: static; align-self: stretch; max-height: none; height: auto; overflow: visible; border-right: none; border-top: 1px solid var(--border); padding: 16px 12px; }
  .tab-area { overflow: visible; min-height: 0; }
  .edit-status { order: 2; width: calc(100% - 24px); margin: 0 12px 12px; }
  .download-card { order: 4; width: calc(100% - 24px); margin: 0 12px 12px; }
  .promo-card { order: 5; width: calc(100% - 24px); margin: 0 12px 12px; }
  .tools-card { order: 7; }
  .dead-preset-input { flex: 1 1 100%; }
  .library-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-header { position: static; }
  .header-top { flex-wrap: wrap; gap: 8px; }
  .tagline { display: none; }
  .header-library { flex-wrap: wrap; }
  .header-library #presetName { flex: 1 1 100%; }
  .header-library .library-open { flex: 1 1 100%; margin-right: 0; }
  .header-library .btn { flex: 1 1 calc(50% - 3px); justify-content: center; }
  .undo-row { display: flex; }
  .pos-row::after { width: 90px; height: 90px; right: 12px; }
}

.help-toggle {
  margin-left: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.help-toggle:hover { color: var(--text); border-color: var(--muted); }
.section:not(.hints-hidden) .help-toggle { background: var(--brand); border-color: var(--brand); color: #fff; }
.section.hints-hidden .section-body > .hint:not(#exportSummary) { display: none; }

.download-row select { flex: 0 0 auto; margin: 0; }

#miniPreview {
  display: none;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 40;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}
@media (max-width: 820px) {
  #miniPreview.visible { display: block; }
}

.on-colours { display: flex; gap: 8px; margin: 0 0 10px; }
.on-colours button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--field); border: 1px solid var(--border); border-radius: 8px; padding: 7px 4px 6px; cursor: pointer; font-family: inherit; font-size: 0.82rem; color: var(--muted); }
.on-colours button:hover { border-color: var(--border-strong); color: var(--text); }
.on-colours button.active { border-color: var(--brand); color: var(--text); }
.on-colours button:active:not(:disabled) { transform: scale(0.96); }
.on-colours.inert { opacity: 0.4; }
.on-colours.inert button { cursor: default; }
.on-colours.inert button:hover { border-color: var(--border); color: var(--muted); }
.on-colour-sw { width: 100%; height: 16px; border-radius: 5px; border: 1px solid var(--border-strong); }
