  :root {
    --bg: #14161a;
    --panel: #1c1f26;
    --panel-2: #23272f;
    --border: #2e333d;
    --text: #eceef1;
    --text-dim: #9aa1ac;
    --accent: #5b8def;
    --accent-hover: #4a7ce0;
    --danger: #e05b5b;
  }
  * { box-sizing: border-box; }
  input, select, textarea, button {
    font-family: inherit;
  }
  body {
    margin: 0;
    font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background:
      radial-gradient(circle at 12% -10%, rgba(91,141,239,0.10), transparent 42%),
      radial-gradient(circle at 100% 0%, rgba(91,141,239,0.05), transparent 35%),
      var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .layout {
    display: flex;
    gap: 24px;
    padding: 24px 28px;
    align-items: stretch;
    flex-wrap: nowrap;
    flex: 1;
    min-height: 0;
  }
  .panel {
    position: relative;
    background: linear-gradient(180deg, rgba(35,39,47,0.92), rgba(20,22,26,0.94));
    border: 1px solid rgba(91,141,239,0.22);
    border-radius: 14px;
    padding: 18px;
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.02),
      0 10px 30px rgba(0,0,0,0.35),
      0 0 24px rgba(91,141,239,0.05);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
  }
  .panel::-webkit-scrollbar {
    width: 8px;
  }
  .panel::-webkit-scrollbar-track {
    background: transparent;
  }
  .panel::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 8px;
    box-shadow: 0 0 6px rgba(91,141,239,0.6);
  }
  .panel::-webkit-scrollbar-thumb:hover {
    background: #75a0f5;
  }
  .panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(91,141,239,0.9), transparent);
    opacity: 0.7;
  }
  .controls {
    width: 360px;
    flex-shrink: 0;
  }
  .images-panel {
    width: 205px;
    flex-shrink: 0;
  }
  .images-panel .section {
    margin-bottom: 0;
  }
  .logo-section .logo {
    display: block;
    width: 70%;
    height: auto;
    margin: 0;
    filter: drop-shadow(0 0 14px rgba(91,141,239,0.25));
  }
  .logo-separator {
    margin: 14px -18px 0;
    height: 1px;
    background: rgba(91,141,239,0.5);
  }
  .logo-section + .section {
    padding-top: 0;
  }
  .logo-section + .section::before {
    display: none;
  }
  .section h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    color: var(--accent);
    margin: 0 0 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .section {
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
  }
  .panel > .section:last-child {
    margin-bottom: 0;
  }
  .section + .section {
    padding-top: 16px;
  }
  .section + .section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -18px;
    right: -18px;
    height: 1px;
    background: rgba(91,141,239,0.5);
  }
  .dropzone {
    border: 1.5px dashed rgba(91,141,239,0.35);
    border-radius: 10px;
    padding: 22px 12px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    background: rgba(91,141,239,0.03);
    transition: border-color .15s, color .15s, box-shadow .15s, background .15s;
  }
  .dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(91,141,239,0.07);
    box-shadow: 0 0 18px rgba(91,141,239,0.18);
  }
  .dropzone input { display: none; }
  #audioDropzone {
    position: relative;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  #audioDropzoneText {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
  }
  #audioDropzone.has-audio {
    border-style: solid;
    border-color: rgba(91,141,239,0.5);
    color: var(--text);
    background: rgba(91,141,239,0.07);
    justify-content: flex-start;
    text-align: left;
    /* Reserve room on the right so wrapped filename text never runs under
       the remove button pinned to the corner. */
    padding-right: 32px;
  }
  .dropzone-remove-btn {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.92);
    border: none;
    color: rgba(10,11,14,0.8);
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
    transition: color .15s, background .15s;
  }
  /* Only ever show the remove (✕) button once a song has actually been
     added — tied to the same .has-audio state as the rest of the filled
     dropzone styling, rather than relying solely on the `hidden` attribute
     (which a later `display` rule here could otherwise silently override). */
  #audioDropzone.has-audio .dropzone-remove-btn {
    display: inline-flex;
  }
  .dropzone-remove-btn:hover {
    color: var(--danger);
    background: #fff;
  }
  #imageList {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
  }
  #imageList li {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 6px;
    cursor: grab;
  }
  #imageList li.dragging { opacity: 0.4; }
  #imageList li.drag-over-top { border-top: 2px solid var(--accent); }
  #imageList li.drag-over-bottom { border-bottom: 2px solid var(--accent); }
  #imageList .handle {
    color: var(--text-dim);
    font-size: 13px;
    cursor: grab;
    flex-shrink: 0;
    letter-spacing: -1px;
  }
  #imageList img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
  }
  #imageList .meta {
    flex: 1;
    min-width: 0;
  }
  #imageList input[type="text"] {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text);
    font-size: 12px;
    padding: 2px 0;
  }
  #imageList input[type="text"]:focus {
    outline: none;
    border-bottom: 1px solid var(--accent);
  }
  #imageList .idx {
    font-size: 11px;
    color: var(--text-dim);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
  }
  #imageList button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    flex-shrink: 0;
  }
  #imageList button:hover { color: var(--danger); }
  #imageList .remove-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: rgba(10,11,14,0.8);
    transition: background .15s, color .15s;
  }
  #imageList .remove-btn:hover {
    background: #fff;
    color: var(--danger);
  }
  #imageList .cover-btn {
    font-size: 14px;
    transition: color .15s, text-shadow .15s;
  }
  #imageList .cover-btn:hover { color: #ffd257 !important; }
  #imageList .cover-btn.active {
    color: #ffd257;
    text-shadow: 0 0 8px rgba(255,210,87,0.65);
    cursor: default;
  }
  label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 7px;
  }
  select, input[type="number"], input[type="file"], input[type="text"], input[type="email"], textarea {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 13px;
    transition: border-color .15s, box-shadow .15s;
  }
  textarea { resize: vertical; font-family: inherit; }
  select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91,141,239,0.15), 0 0 10px rgba(91,141,239,0.2);
  }
  .row { display: flex; gap: 10px; flex-wrap: wrap; }
  .row > div { flex: 1 1 140px; }

  .app-footer {
    position: absolute;
    bottom: 14px;
    right: 18px;
    font-size: 11px;
    color: var(--text-dim);
    z-index: 2;
  }
  .app-footer a {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
  }
  .app-footer a:hover { text-decoration: underline; }
  .browser-limit-warning {
    position: absolute;
    bottom: 14px;
    left: 18px;
    max-width: 220px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-dim);
    z-index: 2;
  }
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,11,14,0.65);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
  }
  .modal-overlay[hidden] { display: none; }
  .modal-box {
    width: 320px;
    max-width: calc(100vw - 40px);
    background: linear-gradient(180deg, rgba(35,39,47,0.98), rgba(20,22,26,0.98));
    border: 1px solid rgba(91,141,239,0.28);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 24px rgba(91,141,239,0.08);
  }
  .modal-box h3 {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--text);
    font-weight: 700;
  }
  .modal-box label { margin-top: 10px; }
  .modal-box label:first-of-type { margin-top: 0; }

  input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 20px;
    background: transparent;
    padding: 0;
    margin: 8px 0 4px;
    cursor: pointer;
  }
  input[type="range"]:focus { outline: none; }
  input[type="range"]::-webkit-slider-runnable-track {
    height: 1px;
    border-radius: 0;
    background: rgba(91,141,239,0.35);
    box-shadow: inset 0 0 0 1px rgba(91,141,239,0.7), inset 0 1px 2px rgba(0,0,0,0.4);
  }
  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff, var(--accent) 65%);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 0 10px rgba(91,141,239,0.9), 0 0 2px rgba(255,255,255,0.8);
    transition: box-shadow .15s, transform .15s;
  }
  input[type="range"]:hover::-webkit-slider-thumb {
    box-shadow: 0 0 16px rgba(91,141,239,1), 0 0 4px rgba(255,255,255,0.9);
    transform: scale(1.12);
  }
  input[type="range"]::-moz-range-track {
    height: 1px;
    border-radius: 0;
    background: rgba(91,141,239,0.35);
    box-shadow: inset 0 0 0 1px rgba(91,141,239,0.7);
  }
  input[type="range"]::-moz-range-thumb {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff, var(--accent) 65%);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 0 10px rgba(91,141,239,0.9);
  }
  .slider-wrap {
    position: relative;
    padding-top: 8px;
  }
  .slider-value {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
  }
  .pacing-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .pacing-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 4px 7px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }
  .pacing-option svg { display: block; }
  .pacing-option path {
    fill: none;
    stroke: var(--text-dim);
    stroke-width: 2;
    stroke-linecap: round;
    transition: stroke 0.15s;
  }
  .pacing-option .pt {
    fill: var(--text-dim);
    transition: fill 0.15s;
  }
  .pacing-option span {
    font-size: 9.5px;
    color: var(--text-dim);
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
  }
  .pacing-option:hover {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(91,141,239,0.18);
  }
  .pacing-option.active {
    border-color: var(--accent);
    background: rgba(91,141,239,0.12);
    box-shadow: 0 0 12px rgba(91,141,239,0.28);
  }
  .pacing-option.active path { stroke: var(--accent); }
  .pacing-option.active .pt { fill: var(--accent); }
  .pacing-option.active span { color: var(--accent); }
  .hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 7px;
    line-height: 1.4;
  }
  .text-link {
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .text-link:hover { color: var(--danger); }
  button.primary, button.secondary {
    width: 100%;
    padding: 11px 12px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 7px;
  }
  button.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    box-shadow: 0 0 16px rgba(91,141,239,0.35);
    transition: box-shadow .15s, transform .1s;
  }
  button.primary:hover { box-shadow: 0 0 24px rgba(91,141,239,0.55); }
  button.primary:active { transform: translateY(1px); }
  button.primary:disabled { background: #3a3f4a; color: var(--text-dim); cursor: not-allowed; box-shadow: none; }
  button.secondary {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
  }
  button.secondary:hover { border-color: var(--accent); box-shadow: 0 0 12px rgba(91,141,239,0.2); }
  .preview {
    position: relative;
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .canvas-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
  }
  .size-label {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 11px;
    letter-spacing: 0.3px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    z-index: 2;
  }
  canvas {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    background: #000;
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(91,141,239,0.25), 0 0 40px rgba(91,141,239,0.12), 0 20px 40px rgba(0,0,0,0.5);
  }
  .transport {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: auto;
    margin: 16px auto 0;
  }
  .transport button {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
  }
  .transport button:hover { border-color: var(--accent); box-shadow: 0 0 12px rgba(91,141,239,0.2); }
  /* Full-size preview: let the canvas scale to fit the screen at its true
     aspect ratio instead of stretching to fill it. */
  canvas:fullscreen,
  canvas:-webkit-full-screen {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    border-radius: 0;
    box-shadow: none;
  }
  .timebar {
    font-size: 12px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  #status {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-dim);
    min-height: 16px;
  }
  #status.error { color: var(--danger); }
  #status.success { color: #5be0a3; }
  /* On wide screens, keep Export/Reset + status permanently visible at the
     bottom of the Controls column — never scrolling away with the rest of the
     column's content, regardless of content height. .controls-scroll becomes
     the actual scrolling area (a flex sibling above the footer); the footer
     itself sits in its own reserved strip below it, elevated above the
     scrolling content with its own background/shadow so it always reads as
     "on top of" the column. Mobile/tablet keep the separate full-width fixed
     bar defined in the max-width:1024px block below, which targets
     .export-actions directly and is unaffected by this rule. */
  @media (min-width: 1025px) {
    .controls {
      display: flex;
      flex-direction: column;
      padding-bottom: 0;
      overflow: hidden;
    }
    .controls-scroll {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      margin: -18px -18px 0;
      padding: 18px 18px 6px;
    }
    .export-sticky-footer {
      position: relative;
      flex-shrink: 0;
      margin: 0 -18px 0;
      padding: 12px 18px 18px;
      background: linear-gradient(180deg, rgba(28,31,38,0) 0%, rgba(20,22,26,0.92) 22%, rgba(20,22,26,0.98) 100%);
      border-radius: 0 0 14px 14px;
      box-shadow: 0 -12px 18px -12px rgba(0,0,0,0.45);
      z-index: 5;
    }
  }
  /* ---------- Responsive: tablet ---------- */
  @media (max-width: 1024px) {
    body {
      height: auto;
      min-height: 100vh;
      overflow-y: auto;
    }
    .layout {
      flex-direction: column;
      flex-wrap: wrap;
      padding: 18px;
      gap: 18px;
    }
    .images-panel,
    .controls {
      width: 100%;
      flex-shrink: 1;
    }
    .panel {
      overflow: visible;
      max-height: none;
    }
    /* Order: video preview on top, images (with logo) next, controls last */
    .images-panel { order: 2; }
    .preview {
      order: 1;
      min-width: 0;
      width: 100%;
      height: auto;
      min-height: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
    }
    .canvas-wrap {
      margin: 40px auto 0;
      width: fit-content;
    }
    .controls { order: 3; }
    /* Logo relocated by JS to the top of the video (preview) section */
    .preview .logo-section {
      width: 100%;
      margin: 0 0 10px;
    }
    .logo-section .logo {
      width: 10vw;
    }
    /* Relocated by JS to be direct children of .layout, after all 3 sections */
    .browser-limit-warning,
    .app-footer {
      order: 4;
      width: 100%;
    }
    .browser-limit-warning {
      position: static;
      max-width: none;
      margin: 0;
      text-align: left;
    }
    .app-footer {
      position: static;
      text-align: center;
      margin: 0;
    }
    canvas {
      max-height: 65vh;
    }
    .size-label {
      top: 60px;
      right: 14px;
    }
    #newProjectBtn {
      top: 60px !important;
      left: 14px !important;
    }

    /* Image list: 5-column grid, evenly filled */
    #imageList {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 6px;
      margin: 12px 0 0;
    }
    #imageList li {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      padding: 0;
      margin-bottom: 0;
      overflow: hidden;
    }
    #imageList .handle { display: none; }
    #imageList .meta { display: none; }
    #imageList img {
      width: 100%;
      height: auto;
      aspect-ratio: 1 / 1;
      border-radius: 0;
    }
    /* Number + star grouped into one vertical line, overlaid on the thumbnail */
    #imageList .idx,
    #imageList .cover-btn {
      position: absolute;
      left: 3px;
      width: auto;
      background: rgba(10,11,14,0.7);
      border-radius: 3px;
      color: var(--text);
      z-index: 2;
    }
    #imageList .idx {
      top: 3px;
      padding: 0 4px;
      font-size: 9px;
      line-height: 1.5;
    }
    #imageList .cover-btn {
      top: 19px;
      padding: 0 4px;
      font-size: 11px;
      line-height: 1.4;
    }
    #imageList .remove-btn {
      position: absolute;
      top: 3px;
      right: 3px;
      width: 17px;
      height: 17px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      background: rgba(255,255,255,0.92);
      border-radius: 50%;
      font-size: 9px;
      color: rgba(10,11,14,0.8);
      z-index: 2;
    }
    #imageList .remove-btn:hover {
      background: #fff;
      color: var(--danger);
    }

    /* Export/Reset always pinned to the bottom of the screen */
    .layout {
      padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }
    .export-actions {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      margin: 0 !important;
      padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
      background: linear-gradient(180deg, rgba(20,22,26,0.85), rgba(20,22,26,0.98));
      backdrop-filter: blur(6px);
      border-top: 1px solid rgba(91,141,239,0.28);
      z-index: 20;
    }
  }

  /* ---------- Responsive: mobile ---------- */
  @media (max-width: 600px) {
    .layout {
      padding: 12px 12px calc(96px + env(safe-area-inset-bottom));
      gap: 14px;
    }
    .panel {
      padding: 14px;
    }
    .logo-section .logo {
      width: 25vw;
    }
    .transport {
      flex-wrap: nowrap;
      gap: 6px;
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 2px;
    }
    .transport button {
      padding: 5px 8px;
      font-size: 11px;
      flex-shrink: 0;
      white-space: nowrap;
    }
    .transport label {
      font-size: 11px !important;
      gap: 4px !important;
      flex-shrink: 0;
    }
    .timebar {
      font-size: 10px;
      flex-shrink: 0;
    }
    canvas {
      max-height: 55vh;
    }
    button.primary, button.secondary {
      padding: 13px 12px;
      font-size: 14px;
    }

    /* Aspect-ratio picker relocated (via JS) next to the New Project button */
    .preview-topbar {
      position: absolute;
      top: 60px;
      left: 14px;
      display: flex;
      align-items: center;
      gap: 6px;
      z-index: 2;
      max-width: calc(100% - 28px);
    }
    .preview-topbar #newProjectBtn {
      position: static !important;
      flex-shrink: 0;
    }
    .preview-topbar #aspect {
      width: auto;
      max-width: clamp(60px, 20vw, 110px);
      flex-shrink: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding: 5px 6px;
      font-size: 10px;
      border-radius: 6px;
      margin: 0;
    }
    /* The now-empty "Size" section in Controls is hidden on mobile since its
       only content (the aspect select) has moved next to New Project. */
    .controls .section.size-section-hidden {
      display: none;
    }
    /* Since the hidden section is still in the DOM, the next section's
       divider line (::before) would otherwise render "floating" above it
       with nothing visible before it — suppress it. */
    .controls .section.size-section-hidden + .section {
      padding-top: 0;
    }
    .controls .section.size-section-hidden + .section::before {
      display: none;
    }
  }

  /* ---------- Touch-friendly tap targets ---------- */
  @media (pointer: coarse) {
    input[type="range"] {
      height: 28px;
      margin: 4px 0;
    }
    input[type="range"]::-webkit-slider-thumb {
      width: 18px;
      height: 18px;
      margin-top: -9px;
    }
    input[type="range"]::-moz-range-thumb {
      width: 18px;
      height: 18px;
    }
    #imageList button {
      padding: 6px 8px;
      font-size: 16px;
    }
    .pacing-option {
      padding: 10px 6px 9px;
    }
  }

  /* ---- Onboarding tour ---- */
  #tourOverlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
  }
  #tourOverlay .tour-spotlight {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 4px rgba(91, 141, 239, 0.55), 0 0 0 9999px rgba(10, 11, 14, 0.55);
    transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
    pointer-events: none;
  }
  #tourOverlay .tour-bubble {
    position: fixed;
    max-width: 280px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    pointer-events: auto;
    transition: top 0.25s ease, left 0.25s ease;
  }
  #tourOverlay .tour-step {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
  }
  #tourOverlay .tour-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
  }
  #tourOverlay .tour-text {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-dim);
    margin: 0 0 14px;
  }
  #tourOverlay .tour-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  #tourOverlay .tour-skip {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 2px;
  }
  #tourOverlay .tour-skip:hover { color: var(--text); }
  #tourOverlay .tour-next {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  #tourOverlay .tour-next:hover { background: var(--accent-hover); }
