@font-face {
    font-family: 'TikTokDisplay';
    src: url('TikTokDisplay-Bold.ttf') format('truetype');
    font-weight: bold;
  }
  :root {
    --ice:        #eaf7ff;
    --aqua:       #24c0f0;
    --gel-clear:  rgba(255,255,255,.10);
    --gel-light:  rgba(255,255,255,.22);
    --gel-line:   rgba(255,255,255,.38);
    --deep:       #073a78;
    --glow-blue:  #63d7ff;
    --shadow:     0 10px 30px rgba(0,20,60,.45);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'TikTokDisplay', monospace; }
  body {
    background:
      radial-gradient(120% 90% at 50% -10%, #6fd3ff 0%, transparent 55%),
      linear-gradient(180deg, #3ba6ef 0%, #1f7fdd 45%, #1355b6 100%);
    background-attachment: fixed;
    color: var(--ice); font-family: 'TikTokDisplay', monospace; font-size: 13px;
    display: flex; flex-direction: column; min-height: 100vh; overflow-y: auto;
    --font-family: 'TikTokDisplay', monospace;
  }

  #top-bar {
    background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.06));
    backdrop-filter: blur(10px) saturate(140%);
    padding: 6px 12px; display: flex; align-items: center;
    gap: 8px; border-bottom: 1px solid var(--gel-line);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5); flex-shrink: 0;
  }
  #top-bar h1 {
    font-size: 13px; font-weight: bold; flex: 1; letter-spacing: 1px;
    color: #fff; text-shadow: 0 0 14px var(--glow-blue), 0 1px 2px rgba(0,0,40,.4);
  }
  #welcome-message {
    flex: 0 0 auto;
    padding: 12px 16px;
    color: #fff;
    background: linear-gradient(90deg, rgba(255,170,30,.96), rgba(255,74,80,.96), rgba(172,65,220,.96));
    border-bottom: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 4px 16px rgba(0,20,60,.3), inset 0 1px 0 rgba(255,255,255,.45);
    font-size: clamp(14px, 2vw, 20px);
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 3px rgba(70,20,0,.45);
  }
  button, label.toolbar-btn {
    background: linear-gradient(180deg, #ffffff 0%, #dff6ff 50%, #9ce0ff 100%);
    color: #095fae; border: 1px solid rgba(255,255,255,.9);
    padding: 4px 11px; cursor: pointer;
    font-family: 'TikTokDisplay', Arial, sans-serif; font-weight: bold; font-size: 12px;
    border-radius: 9px;
    box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(0,30,70,.35);
    transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
  }
  button:hover:not(:disabled), label.toolbar-btn:not(.disabled):hover {
    filter: brightness(1.06); transform: translateY(-1px);
    box-shadow: inset 0 1px 0 #fff, 0 4px 12px var(--glow-blue);
  }
  button:active:not(:disabled), label.toolbar-btn:not(.disabled):active { transform: translateY(0px); }
  button:disabled { color: rgba(255,255,255,.4); background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); box-shadow: none; cursor: default; }
  label.toolbar-btn.disabled { color: rgba(255,255,255,.4); background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); box-shadow: none; cursor: default; pointer-events: none; }
  #cancelBtn { border-color: #ffb066; color: #fff; background: linear-gradient(180deg,#ffb066,#f9741f); }
  #cancelBtn:hover:not(:disabled) { filter: brightness(1.06); box-shadow: inset 0 1px 0 #ffd, 0 4px 12px rgba(255,150,60,.7); }

  #canvas-panel {
    flex: 0 0 38vh; display: flex; align-items: center;
    justify-content: center; position: relative; overflow: hidden;
    background:
      radial-gradient(90% 60% at 50% 0%, rgba(120,220,255,.28), transparent 70%),
      linear-gradient(180deg,#0a2547,#061630);
    border-top: 1px solid rgba(255,255,255,.12);
    border-bottom: 1px solid rgba(255,255,255,.30);
    box-shadow: inset 0 0 60px rgba(0,90,180,.35);
  }
  #glCanvas { display: block; max-width: 100%; max-height: 100%; filter: drop-shadow(0 6px 24px rgba(0,120,220,.5)); }
  #no-video  { color: rgba(255,255,255,.4); font-size: 12px; position: absolute; text-shadow: 0 0 8px rgba(120,220,255,.6); }
  #webgl-error {
    color: #ffb2a0; font-size: 12px; position: absolute;
    text-align: center; padding: 20px; display: none;
  }

  #layers-section {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: rgba(8,60,120,.16); backdrop-filter: blur(8px) saturate(1.2);
    border-top: 1px solid rgba(255,255,255,.14);
  }
  #layers-header {
    padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.22);
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.02));
  }
  #layers-header span { flex: 1; font-weight: bold; font-size: 12px; letter-spacing: 2px; color:#fff; text-shadow: 0 0 10px var(--glow-blue); }
  #layers-list { padding: 8px; display: flex; flex-direction: column; gap: 10px; }

  @keyframes aeroIn {
    0%   { opacity: 0; transform: translateY(10px) scale(.985); }
    60%  { transform: translateY(-1px) scale(1.002); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
  }
  .layer-item {
    border: 1px solid rgba(255,255,255,.34); background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.06));
    width: 100%;
    flex-shrink: 0; display: flex; flex-direction: column;
    border-radius: 12px; overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 18px rgba(0,20,60,.35);
    animation: aeroIn .38s cubic-bezier(.2,.7,.3,1) both;
  }
  .layer-header {
    display: flex; align-items: center; gap: 4px; padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.16);
    background: linear-gradient(90deg, rgba(90,200,255,.25), rgba(255,255,255,.03));
  }
  .layer-title { flex: 1; font-weight: bold; font-size: 11px; color: #eaf7ff; text-shadow: 0 1px 1px rgba(0,40,90,.4); }
  .layer-del { background: linear-gradient(180deg,#ff9c84,#f14020); border-color: #ffc0a8; color:#fff; font-size: 10px; padding: 2px 7px; }
  .layer-move { background: linear-gradient(180deg,#7fd9ff,#2f7ccf); border-color: #bfeaff; color:#fff; font-size: 10px; padding: 2px 7px; }
  .layer-move:disabled { opacity: .35; cursor: default; }
  .layer-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; }
  .effect-row { display: flex; align-items: center; gap: 6px; }
  .effect-type-btn {
    background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(180,230,255,.55));
    border: 1px solid rgba(255,255,255,.7); color: #074a8f; padding: 3px 9px;
    cursor: pointer; font-family: 'TikTokDisplay', monospace; font-size: 11px; font-weight: bold;
    border-radius: 7px; box-shadow: inset 0 1px 0 #fff;
  }
  .effect-type-btn:hover { background: linear-gradient(180deg,#fff, #a9ddff); }
  .trig-active { background: linear-gradient(180deg,#8ee6ff,#27a8e8) !important; border-color: #ffffff !important; color: #fff !important; box-shadow: 0 0 12px var(--glow-blue) !important; }
  .param-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
  .param-label { font-size: 10px; color: rgba(235,247,255,.75); white-space: nowrap; letter-spacing:.04em; }
  .param-input {
    background: rgba(255,255,255,.10); color: #fff; border: 1px solid rgba(255,255,255,.30);
    width: 58px; padding: 3px 4px;
    font-family: 'TikTokDisplay', monospace; font-size: 11px;
    border-radius: 6px; transition: border-color .15s, box-shadow .15s, background .15s;
  }
  .param-input:focus { outline: none; border-color: #8ee6ff; background: rgba(255,255,255,.16); box-shadow: 0 0 10px rgba(90,220,255,.5); }
  .param-input[type="range"] { width: 100px; padding: 0; accent-color: #8ee6ff; }
  @media (max-width: 768px) { .param-input, .pitch-semitones-input, .pitch-volume-input, #repeat-bar input[type=number], #durationInput { font-size: 16px; } }
  .toggle-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
  .toggle-label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 11px; color: rgba(235,247,255,.8); }
  .toggle-label input[type=checkbox] { accent-color: var(--glow-blue); width: 15px; height: 15px; cursor: pointer; }

  .kf-section {
    border-top: 1px dashed rgba(255,255,255,.2); margin-top: 4px; padding-top: 6px;
    display: flex; flex-direction: column; gap: 4px;
  }
  .gm-preview { height: 18px; border: 1px solid rgba(255,255,255,.35); width: 100%; border-radius: 5px; }
  .gm-swatch { width: 16px; height: 16px; border: 1px solid rgba(255,255,255,.4); display: inline-block; border-radius: 4px; }
  .gm-color { width: 34px; height: 22px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.3); padding: 0; cursor: pointer; border-radius: 5px; }

  .curve-graph { width: 100%; display: flex; flex-direction: column; gap: 3px; margin: 2px 0; }
  .curve-svg {
    display: block; aspect-ratio: 1 / 1; max-width: 260px; width: 100%; margin: 0 auto; background:
      linear-gradient(135deg, rgba(0,0,0,.35), rgba(20,60,120,.25));
    border: 1px solid rgba(255,255,255,.28); border-radius: 7px; cursor: crosshair;
    touch-action: none;
  }
  .curve-point { cursor: pointer; }
  .curve-point:hover { filter: brightness(1.3); }

  .remap-table { border-collapse: collapse; font-size: 10px; }
  .remap-table th, .remap-table td { padding: 2px 7px; text-align: center; }
  .remap-col-label, .remap-row-label {
    color: rgba(235,247,255,.7); font-weight: bold; font-size: 10px; letter-spacing: 1px;
  }
  .remap-radio { accent-color: var(--glow-blue); width: 14px; height: 14px; cursor: pointer; }
  .remap-hint { font-size: 10px; color: rgba(235,247,255,.5); margin-top: 2px; }

  @keyframes dropIn {
    0%   { opacity: 0; transform: translateY(-8px) scale(.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
  }
  #effect-dropdown {
    position: fixed; background: linear-gradient(180deg, rgba(20,80,160,.92), rgba(8,45,95,.92));
    backdrop-filter: blur(12px) saturate(1.3);
    border: 1px solid rgba(255,255,255,.35); border-radius: 12px; z-index: 1000; display: none;
    min-width: 150px; padding: 5px; box-shadow: 0 14px 40px rgba(0,20,60,.6), inset 0 1px 0 rgba(255,255,255,.4);
    max-height: 70vh; overflow-y: auto; animation: dropIn .18s ease-out;
  }
  .dd-item {
    padding: 8px 14px; cursor: pointer; font-family: 'TikTokDisplay', monospace; font-size: 12px;
    white-space: nowrap; color: #d9f2ff; letter-spacing: 0.5px;
    border-radius: 8px; transition: background .12s, color .12s, transform .12s;
  }
  .dd-item:last-child { border: none; }
  .dd-item:hover, .dd-item:active { background: rgba(190,240,255,.25); color: #fff; transform: translateX(2px); }
  .dd-item.active { color: #fff; background: linear-gradient(90deg, rgba(90,200,255,.5), rgba(90,200,255,.15)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }

  #chain-mgmt-section {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: rgba(120,90,0,.14); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.12);
  }
  #chain-mgmt-header {
    padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.18);
    background: linear-gradient(180deg, rgba(255,240,150,.16), rgba(255,240,150,.02));
  }
  #chain-mgmt-header span { font-weight: bold; font-size: 12px; letter-spacing: 2px; color: #fff3c8; text-shadow: 0 0 10px rgba(255,220,120,.8); }
  #chain-mgmt-actions { padding: 6px 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

  #video-sources-section {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: rgba(120,40,200,.10); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.12);
  }
  #video-sources-header {
    padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.18); display: flex;
    align-items: center; gap: 8px; background: linear-gradient(180deg, rgba(220,160,255,.16), rgba(220,160,255,.02));
  }
  #video-sources-header span { flex: 1; font-weight: bold; font-size: 12px; letter-spacing: 2px; color:#f3e6ff; text-shadow: 0 0 10px rgba(200,140,255,.9); }
  #video-sources-list { padding: 6px 8px; display: flex; flex-direction: column; gap: 6px; }
  .vs-item {
    border: 1px solid rgba(220,170,255,.35); background: linear-gradient(180deg, rgba(210,150,255,.16), rgba(100,40,170,.10));
    padding: 8px 10px; border-radius: 10px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  }
  .vs-title { font-size: 11px; font-weight: bold; color: #f3e6ff; white-space: nowrap; text-shadow: 0 1px 1px rgba(40,0,90,.4); }
  .vs-name { font-size: 10px; color: #e2ccf0; }
  .vs-file { font-size: 10px; color: #e2ccf0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .vs-label { font-size: 10px; color: rgba(240,220,255,.65); white-space: nowrap; }
  .vs-input, .vs-select {
    background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(220,170,255,.4);
    padding: 2px 4px; border-radius: 6px; font-family: 'TikTokDisplay', monospace; font-size: 12px;
  }
  .vs-input:focus, .vs-select:focus { outline: none; border-color: #d79fff; box-shadow: 0 0 10px rgba(190,120,255,.5); }
  .vs-input { width: 56px; }
  .vs-del { background: linear-gradient(180deg,#ff9c94,#f1403a); border-color: transparent; color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 7px; }
  .vs-share { padding: 4px 8px; border: 1px solid rgba(220,170,255,.5); border-radius: 7px; background: rgba(210,150,255,.18); color: #fff; font: inherit; font-size: 10px; cursor: pointer; }
  .vs-share:disabled { opacity: .45; cursor: not-allowed; }
  .vs-hint { font-size: 10px; color: rgba(220,190,240,.5); padding: 0 10px 6px; font-style: italic; }
  video.hidden-src-video {
    position: fixed; left: -99999px; top: 0; width: 2px; height: 2px;
    opacity: 0.01; pointer-events: none;
  }

  #audio-pitch-section {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: rgba(0,120,60,.10); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.12);
  }
  #audio-pitch-header {
    padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.18); display: flex;
    align-items: center; gap: 8px; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(120,255,160,.14), rgba(120,255,160,.02));
  }
  #audio-pitch-header span { flex: 1; font-weight: bold; font-size: 12px; letter-spacing: 2px; color:#e4ffe9; text-shadow: 0 0 10px rgba(120,255,170,.8); }
  .pitch-list-tools {
    display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
    padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .pitch-list-tools > button {
    padding: 4px 8px; font-size: 10px; border-radius: 7px; white-space: nowrap;
  }
  .pitch-list-tools > button:disabled { opacity: .48; cursor: not-allowed; }
  .pitch-volume-all-label {
    display: inline-flex; align-items: center; gap: 5px;
    color: #c8ffd6; font-size: 10px; font-weight: bold; white-space: nowrap;
  }
  #pitchAllVolumeInput { width: 52px; }
  #audio-pitch-list {
    padding: 5px 8px;
    display: flex; flex-direction: column; gap: 5px;
  }
  .pitch-engine-label {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; color: #c8ffd6; font-weight: bold; letter-spacing: .04em;
    white-space: nowrap; cursor: pointer; user-select: none;
  }
  .pitch-engine-label select {
    background: rgba(255,255,255,.1); color: #c8ffd6; border: 1px solid rgba(120,255,160,.4); font-size: 10px;
    font-family: 'TikTokDisplay', monospace; padding: 2px 4px; cursor: pointer; border-radius: 6px;
  }
  .pitch-engine-label select:focus { outline: none; border-color: #7dffc0; }
  .pitch-layer-item {
    border: 1px solid rgba(120,255,160,.32);
    background: linear-gradient(180deg, rgba(120,255,160,.14), rgba(20,120,60,.08));
    display: flex; align-items: center; gap: 6px; padding: 8px 10px; flex-shrink: 0;
    border-radius: 10px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  }
  .pitch-layer-title { font-size: 11px; font-weight: bold; color: #c8ffd6; white-space: nowrap; }
  .pitch-semitones-input {
    background: rgba(255,255,255,.1); color: #c8ffd6; border: 1px solid rgba(120,255,160,.4); width: 54px;
    padding: 2px 3px; border-radius: 6px; font-family: 'TikTokDisplay', monospace; font-size: 12px;
  }
  .pitch-semitones-input:focus { outline: none; border-color: #7fffe0; box-shadow: 0 0 10px rgba(120,255,170,.5); }
  .pitch-volume-input {
    background: rgba(255,255,255,.1); color: #c8ffd6; border: 1px solid rgba(120,255,160,.4); width: 54px;
    padding: 2px 3px; border-radius: 6px; font-family: 'TikTokDisplay', monospace; font-size: 12px;
  }
  .pitch-volume-input:focus { outline: none; border-color: #7fffe0; }
  .pitch-layer-hint { font-size: 10px; color: rgba(180,240,200,.5); flex: 1; }
  .pitch-layer-del { background: linear-gradient(180deg,#ff9a94,#f1403a); border-color: transparent; font-size: 10px; padding: 2px 7px; color: #fff; border-radius: 7px; }
  .pitch-mix-hint { font-size: 10px; color: rgba(160,230,185,.5); padding: 3px 8px; font-style: italic; }

  #audio-effects-section {
    flex-shrink: 0; display: flex; flex-direction: column;
    background: rgba(180,30,10,.10); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.12);
  }
  #audio-effects-header {
    padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.18); display: flex;
    align-items: center; gap: 8px; flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,170,140,.15), rgba(255,170,140,.02));
  }
  #audio-effects-header span { flex: 1; font-weight: bold; font-size: 12px; letter-spacing: 2px; color:#ffe8dd; text-shadow: 0 0 10px rgba(255,150,110,.8); }
  .ae-select {
    background: rgba(255,255,255,.1); color: #ffc9b8; border: 1px solid rgba(255,150,110,.4);
    font-family: 'TikTokDisplay', monospace; font-size: 11px; padding: 2px 4px; cursor: pointer; border-radius: 6px;
  }
  .ae-select:focus { outline: none; border-color: #ff9a70; }
  #audio-effects-list { padding: 6px 8px; display: flex; flex-direction: column; gap: 8px; }
  .ae-item {
    border: 1px solid rgba(255,150,110,.32);
    background: linear-gradient(180deg, rgba(255,150,110,.12), rgba(120,20,10,.08));
    display: flex; flex-direction: column; flex-shrink: 0;
    border-radius: 12px; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
    animation: aeroIn .38s cubic-bezier(.2,.7,.3,1) both;
  }
  .ae-header {
    display: flex; align-items: center; gap: 6px; padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.14);
    background: linear-gradient(90deg, rgba(255,175,140,.2), rgba(255,255,255,.02));
  }
  .ae-title { flex: 1; font-weight: bold; font-size: 11px; color: #ffe3d6; }
  .ae-del { background: linear-gradient(180deg,#ff9a94,#f1403a); border-color: transparent; color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 7px; }
  .ae-module {
    border: 1px solid rgba(255,160,120,.2); background: rgba(60,10,0,.18); margin: 6px 7px 0;
    padding: 5px 7px; display: flex; flex-direction: column; gap: 5px; border-radius: 9px;
  }
  .ae-module:last-of-type { margin-bottom: 7px; }
  .ae-module-label { font-size: 11px; font-weight: bold; color: #ffd9cc; letter-spacing: 1px; }
  .ae-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
  .ae-label { font-size: 10px; color: rgba(255,200,180,.7); white-space: nowrap; }
  .ae-input {
    background: rgba(255,255,255,.1); color: #ffd0c0; border: 1px solid rgba(255,150,110,.4); width: 62px;
    padding: 2px 3px; border-radius: 6px; font-family: 'TikTokDisplay', monospace; font-size: 11px;
  }
  .ae-input:focus { outline: none; border-color: #ff9a70; box-shadow: 0 0 10px rgba(255,150,110,.5); }
  .ae-input-sm { width: 52px; }
  .ae-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 11px; color: rgba(255,210,190,.8); }
  .ae-toggle input[type=checkbox] { accent-color: #ff9a70; width: 15px; height: 15px; cursor: pointer; }
  .ae-graph { border: 1px solid rgba(255,150,120,.4); background: rgba(0,0,0,.25); display: block; width: 100%; touch-action: none; cursor: crosshair; border-radius: 8px; }
  @media (max-width: 768px) { .ae-input, .ae-select { font-size: 16px; } }

  #repeat-bar {
    background: linear-gradient(180deg, rgba(30,120,200,.35), rgba(10,50,110,.25));
    backdrop-filter: blur(8px);
    padding: 6px 10px; font-size: 11px;
    border-top: 1px solid rgba(255,255,255,.16); border-bottom: 1px solid rgba(255,255,255,.2);
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  }
  #repeat-bar label { color: #cfeaff; white-space: nowrap; letter-spacing: 1px; font-weight: bold; }
  #repeat-bar input[type=number] {
    background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.3); width: 54px;
    padding: 2px 4px; border-radius: 6px; font-family: 'TikTokDisplay', monospace; font-size: 12px;
  }
  #repeat-bar input[type=number]:focus { outline: none; border-color: var(--glow-blue); box-shadow: 0 0 10px rgba(90,220,255,.5); }
  #repeat-bar .repeat-hint { color: rgba(220,240,255,.6); font-size: 10px; flex: 1; }
  #repeat-bar .repeat-hint .rep-seq { color: var(--glow-blue); text-shadow: 0 0 8px rgba(90,220,255,.8); }

  #status-bar {
    background: linear-gradient(180deg, rgba(20,90,180,.4), rgba(8,40,100,.4));
    backdrop-filter: blur(8px);
    padding: 3px 10px; font-size: 11px; color: #cfeaff;
    flex-shrink: 0;
  }
  #progress-bar { height: 5px; background: rgba(255,255,255,.15); margin-top: 3px; border-radius: 8px; overflow: hidden; }
  #progress-fill {
    height: 5px; border-radius: 8px;
    background: linear-gradient(90deg, #39e6c0, #24c0f0, #5f8bff);
    width: 0%; transition: width 0.15s;
    box-shadow: 0 0 12px rgba(60,220,255,.9);
  }

  #output-strip {
    display: none; backdrop-filter: blur(10px);
    background: rgba(8,50,110,.5);
    border-top: 1px solid rgba(255,255,255,.28);
    padding: 8px 12px; flex-shrink: 0;
    align-items: center; justify-content: center; gap: 14px;
  }
  #output-strip.visible { display: flex; animation: dropIn .25s ease-out; }
  #output-strip-label { font-size: 11px; color: #cfeaff; white-space: nowrap; align-self: flex-start; padding-top: 4px; letter-spacing: 1px; }
  #outputVideo { max-height: 160px; max-width: 55%; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: #04131f; display: block; box-shadow: 0 6px 20px rgba(0,120,200,.4); }
  #output-strip-actions { display: flex; flex-direction: column; gap: 6px; align-self: flex-start; }

  video#srcVideo {
    position: fixed;
    left: -99999px;
    top: 0;
    width: 2px;
    height: 2px;
    opacity: 0.01;
    pointer-events: none;
  }

  @media (max-width: 600px) {
    #top-bar {
      padding: max(8px, env(safe-area-inset-top)) 10px 8px;
      gap: 7px;
    }
    #top-bar h1 { flex: 0 0 100%; font-size: 14px; }
    #top-bar button,
    #top-bar label.toolbar-btn {
      min-height: 38px;
      padding-inline: 10px;
      flex: 1 1 auto;
      text-align: center;
    }
    #canvas-panel { flex-basis: 34svh; min-height: 220px; }
    #repeat-bar { flex-wrap: wrap; row-gap: 8px; }
    #repeat-bar > span[style*="margin:0 4px"] { display: none; }
    #output-strip {
      flex-wrap: wrap;
      justify-content: flex-start;
      gap: 10px;
      padding: 10px;
    }
    #outputVideo {
      width: 100%;
      max-width: 100%;
      max-height: min(48svh, 340px);
    }
    #output-strip-actions {
      flex: 1 1 100%;
      flex-direction: row;
      flex-wrap: wrap;
      align-self: stretch;
    }
    #output-strip-actions button { flex: 1 1 145px; min-height: 38px; }
  }
