/* Tool dock, phones only (owner 2026-11-04): preview on top, one sideways row
   of tool chips, only the picked tool's settings, play + primary in the thumb
   zone. No page scroll. Active only while cutflux-tooldock.js has put
   html.td-on (screens up to 820px). Loaded after cutflux-labtools.css and
   uses its --lt-* tones, so light and dark both follow cf-theme. */

html.td-on[data-lab-tool] { height: 100%; overflow: hidden; }
html.td-on[data-lab-tool] body.lt-polish {
  height: 100%; height: 100dvh; min-height: 0 !important; overflow: hidden;
  display: flex; flex-direction: column;
}
html.td-on[data-lab-tool] body.lt-polish .bar { flex: none; position: relative !important; }
html.td-on[data-lab-tool] body.lt-polish .bar .brand { font-size: 17px !important; }

html.td-on[data-lab-tool] body.lt-polish main {
  flex: 1 1 auto; min-height: 0; width: 100%; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 10px) !important;
}
html.td-on[data-lab-tool] body.lt-polish main > * { animation: none !important; }
/* the long intro (title, blurb, first-run tip) and the old two-card grid */
html.td-on[data-lab-tool] body.lt-polish main > :is(h1, .sub, .hl-flow, .tr-tip, .sr-tip, .vs-tip, .grid) { display: none !important; }
html.td-on[data-lab-tool] body.lt-polish main > .card:not(.td-panel-card .card) { display: none !important; }

/* ---------- preview ---------- */
html.td-on body.lt-polish .td-stage { flex: 1 1 auto; min-height: 150px; position: relative; padding: 0 16px; }
html.td-on body.lt-polish .td-stage-in { position: absolute; inset: 0 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
html.td-on body.lt-polish .td-stage .preview-wrap {
  height: 100%; width: auto; max-width: 100%; aspect-ratio: 9 / 16; margin: 0 auto;
  border-radius: 16px !important; background: #000; box-shadow: none !important;
}
html.td-on body.lt-polish .td-stage canvas.preview { width: 100%; height: 100%; object-fit: contain; }

/* Hook: the waveform is the preview */
html.td-on[data-td="hook"] body.lt-polish .td-stage-in { justify-content: center; }
html.td-on[data-td="hook"] body.lt-polish .td-stage canvas.wave { width: 100%; height: 46%; max-height: 260px; min-height: 90px; flex: 0 1 auto; border-radius: 14px; }
html.td-on[data-td="hook"] body.lt-polish .td-stage .stats { width: 100%; margin: 0 !important; gap: 8px !important; }
html.td-on[data-td="hook"] body.lt-polish .td-stage .stat { padding: 10px 8px !important; }
html.td-on[data-td="hook"]:not(.td-ready) body.lt-polish .td-stage :is(canvas.wave, .stats) { display: none !important; }
html.td-on[data-td="hook"].td-ready body.lt-polish .td-empty { display: none; }
/* before a song is in, the big "Add a song" is the only step: no chips yet */
html.td-on[data-td="hook"]:not(.td-ready) body.lt-polish :is(.td-tabs, .td-panels) { display: none !important; }
html.td-on body.lt-polish .td-empty {
  width: 100%; height: 100%; max-height: 360px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--lt-l1); color: var(--lt-ink); font: 700 16px var(--cf-font, 'Inter', sans-serif);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
html.td-on body.lt-polish .td-empty::before {
  content: ""; width: 52px; height: 52px; border-radius: 50%;
  background: var(--lt-acc-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233B82F6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E") center / 24px no-repeat;
}

/* ---------- chip row (swipe sideways) ---------- */
html.td-on body.lt-polish .td-tabs {
  flex: none; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
  padding: 2px 16px; scroll-padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
html.td-on body.lt-polish .td-tabs::-webkit-scrollbar { display: none; }
html.td-on body.lt-polish .td-chip {
  flex: none; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--lt-l2); color: var(--lt-ink2); box-shadow: none;
  font: 700 14px var(--cf-font, 'Inter', sans-serif); letter-spacing: -.005em; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s ease, color .15s ease;
}
html.td-on body.lt-polish .td-chip.is-on { background: var(--lt-acc); color: #fff; }
/* a file is in: small check, no dot */
html.td-on body.lt-polish .td-chip.is-set::after {
  content: ""; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
html.td-on body.lt-polish .td-chip:not(.is-on).is-set::after { background: var(--lt-acc); }
html.td-on body.lt-polish .td-chip:focus-visible { outline: 2px solid var(--lt-acc); outline-offset: 2px; }

/* ---------- the picked tool's settings ---------- */
html.td-on body.lt-polish .td-panels { flex: none; padding: 0 16px; }
html.td-on body.lt-polish .td-panel-card .card {
  padding: 12px !important; border-radius: 16px !important; margin: 0 !important;
  max-height: 32vh; max-height: 32dvh; overflow-y: auto; overscroll-behavior: contain;
}
html.td-on body.lt-polish .td-panel-card .card > :not(.td-panel) { display: none !important; }
html.td-on body.lt-polish .td-panel[hidden] { display: none !important; }
html.td-on body.lt-polish .td-panel { animation: tdIn .2s ease both; }
@keyframes tdIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.td-on body.lt-polish .td-panel { animation: none; } }

/* uploads: one compact row */
html.td-on body.lt-polish .td-panel .drop {
  flex-direction: row !important; justify-content: flex-start; text-align: left !important; gap: 12px !important;
  padding: 10px 14px !important; min-height: 64px;
}
html.td-on body.lt-polish .td-panel .drop::before { width: 40px; height: 40px; margin: 0; flex: none; }
html.td-on body.lt-polish .td-panel .drop .big { font-size: 15px !important; margin: 0 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
html.td-on body.lt-polish .td-panel .drop p:not(.big) { display: none !important; }
/* VS: two clips side by side, slot name under the title */
html.td-on.td-keep-sub body.lt-polish .td-panel .two-col { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
html.td-on body.lt-polish .td-panel .two-col > * { min-width: 0; }
html.td-on body.lt-polish .td-panel .drop { min-width: 0; max-width: 100%; }
html.td-on.td-keep-sub body.lt-polish .td-panel .two-col .drop { flex-direction: column !important; align-items: flex-start; gap: 0 !important; padding: 10px 12px !important; }
html.td-on.td-keep-sub body.lt-polish .td-panel .two-col .drop::before { display: none; }
html.td-on.td-keep-sub body.lt-polish .td-panel .two-col .drop .big { width: 100%; flex: none; }
html.td-on.td-keep-sub body.lt-polish .td-panel .two-col .drop p:not(.big) { display: block !important; font-size: 12px !important; margin: 0 !important; }
html.td-on body.lt-polish .td-panel .two-col input[type="text"] { margin-top: 8px; min-height: 44px; width: 100%; padding: 8px 12px; }
html.td-on body.lt-polish .td-panel > input[type="text"] { min-height: 48px; width: 100%; padding: 10px 14px; font-weight: 700 !important; }

/* option pills: one row, swipe if they don't fit */
html.td-on body.lt-polish .td-panel :is(.modes, .templates) {
  flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px;
}
html.td-on body.lt-polish .td-panel :is(.modes, .templates)::-webkit-scrollbar { display: none; }
html.td-on body.lt-polish .td-panel :is(.modes, .templates) button { flex: 1 0 auto; min-height: 44px !important; white-space: nowrap; }

/* sliders: label + value on one line, big thumb */
html.td-on body.lt-polish .td-panel > label { display: flex !important; justify-content: space-between; align-items: center; margin: 0 0 4px !important; font-size: 14px !important; color: var(--lt-ink2) !important; }
html.td-on body.lt-polish .td-panel > label .pill { font-size: 13px !important; font-weight: 700; padding: 3px 10px; background: var(--lt-acc-soft) !important; color: var(--lt-ink) !important; }
html.td-on body.lt-polish .td-panel > input[type="range"] { width: 100%; height: 44px; margin: 0; display: block; }
html.td-on body.lt-polish .td-panel .ramp-vis { height: 52px; margin-top: 4px; }
html.td-on body.lt-polish .td-panel .motion-vis { margin-top: 0; }
html.td-on body.lt-polish .td-panel .hint { margin: 8px 0 0 !important; }

/* Lyric Punch */
html.td-on body.lt-polish .td-panel textarea#lyrics { min-height: 96px; height: 18dvh; max-height: 150px; margin: 0; resize: none; }
html.td-on body.lt-polish .td-panel .lp-try { margin: 0 0 8px !important; }
html.td-on body.lt-polish .td-panel .lp-dot { display: none !important; }
html.td-on body.lt-polish .td-panel .lp-try button { min-height: 36px; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; align-items: end; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"][hidden] { display: none !important; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] label { margin: 0 !important; font-size: 12px !important; line-height: 1.3; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] :is(input, select) { min-height: 44px; width: 100%; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] label:nth-of-type(1) { grid-column: 1; grid-row: 1; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] #fbBpm { grid-column: 1; grid-row: 2; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] label:nth-of-type(2) { grid-column: 2; grid-row: 1; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] #fps { grid-column: 2; grid-row: 2; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] label:nth-of-type(3) { grid-column: 1 / -1; grid-row: 3; margin-top: 6px !important; }
html.td-on body.lt-polish .td-panel[data-td-panel="more"] #titleText { grid-column: 1 / -1; grid-row: 4; }

/* Hook: listen panel */
html.td-on body.lt-polish .td-panel .play-bar { margin: 0 !important; gap: 8px !important; }
html.td-on body.lt-polish .td-panel .play-bar + .play-bar { margin-top: 10px !important; }
html.td-on body.lt-polish .td-panel .play-bar button { margin: 0 !important; min-height: 44px; flex: 1; padding: 0 10px !important; white-space: nowrap; }
html.td-on body.lt-polish .td-panel .play-bar #stopBtn { flex: 0 0 48px; }
html.td-on body.lt-polish .td-panel .play-bar #timeLabel { color: var(--lt-ink3) !important; font-size: 12px !important; }

/* ---------- action bar (thumb zone) ---------- */
html.td-on body.lt-polish .td-action { flex: none; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
html.td-on body.lt-polish .td-meta { display: flex; flex-direction: column; gap: 6px; min-height: 18px; }
html.td-on body.lt-polish .td-meta .progress { margin: 0 !important; height: 4px; }
html.td-on body.lt-polish .td-meta .progress > div { background: var(--lt-acc) !important; }
html.td-on body.lt-polish .td-meta .status {
  margin: 0 !important; min-height: 18px; font-size: 13px !important; line-height: 1.35 !important; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
html.td-on body.lt-polish .td-row { display: flex; gap: 8px; align-items: stretch; }
html.td-on body.lt-polish .td-row button.primary { flex: 1; width: auto !important; margin: 0 !important; min-height: 52px; }
html.td-on body.lt-polish .td-row .td-icon {
  flex: 0 0 52px; width: 52px; min-height: 52px; padding: 0 !important; margin: 0 !important;
  font-size: 0 !important; color: var(--lt-ink) !important; background: var(--lt-l2) !important; border-radius: 12px !important;
  border: 0 !important; box-shadow: none !important; outline: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
html.td-on body.lt-polish .td-row .td-icon::before { content: ""; width: 20px; height: 20px; background: currentColor; }
html.td-on body.lt-polish .td-row .td-play::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15a1 1 0 0 0 1.5.86l12.5-7.5a1 1 0 0 0 0-1.72L8.5 3.64A1 1 0 0 0 7 4.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
html.td-on body.lt-polish .td-row .td-stop::before {
  width: 16px; height: 16px; border-radius: 3px; -webkit-mask: none; mask: none;
}
html.td-on body.lt-polish .td-row .td-icon:disabled { color: var(--lt-ink3) !important; opacity: .55; }

/* very short screens: give the preview what is left, keep the rest */
@media (max-height: 640px) {
  html.td-on body.lt-polish .td-panel-card .card { max-height: 38dvh; }
  html.td-on body.lt-polish .td-stage { min-height: 110px; }
}

/* hook progress track: visible on both themes, blue fill */
html.td-on body.lt-polish .td-panel .play-bar progress { background: var(--lt-l2) !important; height: 6px; }
html.td-on body.lt-polish .td-panel .play-bar progress::-webkit-progress-bar { background: var(--lt-l2) !important; }
html.td-on body.lt-polish .td-panel .play-bar progress::-webkit-progress-value { background: var(--lt-acc) !important; }

/* the settings box keeps one height per tool so the preview never jumps
   when you switch chips (taller content scrolls inside the box) */
html.td-on body.lt-polish .td-panel-card .card { min-height: 118px; }
html.td-on[data-td="tempo"] body.lt-polish .td-panel-card .card { min-height: 150px; }
html.td-on[data-td="vs"] body.lt-polish .td-panel-card .card { min-height: 142px; }
html.td-on[data-td="hook"] body.lt-polish .td-panel-card .card { min-height: 96px; }
html.td-on[data-td="lyric"] body.lt-polish .td-panel-card .card { min-height: 176px; display: flex !important; flex-direction: column; }
html.td-on[data-td="lyric"] body.lt-polish .td-panel:not([hidden]) { flex: 1 1 auto; }
html.td-on[data-td="lyric"] body.lt-polish .td-panel[data-td-panel="lyrics"]:not([hidden]) { display: flex; flex-direction: column; }
html.td-on[data-td="lyric"] body.lt-polish .td-panel[data-td-panel="lyrics"] textarea#lyrics { flex: 1 1 auto; height: auto; max-height: none; min-height: 88px; }
html.td-on body.lt-polish .td-panel .lp-try button { min-height: 44px !important; }
html.td-on body.lt-polish .td-panel .lp-try .lp-x { width: 44px !important; height: 44px !important; }
html.td-on body.lt-polish .td-panel .lp-try { padding-top: 4px !important; padding-bottom: 4px !important; }
