/* SAMSEL Web — layout & components (colors: css/skins.css = V3 PRO skins) */
:root {
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* Aliases to generated --skin-* tokens */
  --bg0: var(--skin-bg0);
  --bg1: var(--skin-bg1);
  --bg2: var(--skin-bg2);
  --accent: var(--skin-accent);
  --accent2: var(--skin-accent2);
  --text: var(--skin-text);
  --muted: var(--skin-muted);
  --danger: var(--skin-danger);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(145deg, var(--skin-bg0) 0%, var(--skin-grad1) 45%, var(--skin-grad2) 100%);
}

img,
video {
  max-width: 100%;
  height: auto;
}

#app {
  max-width: min(1100px, 100%);
  width: 100%;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
  overflow-x: clip;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

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

/* Spinning title logo — matches desktop SpinningLogoLabel (~4.8s/rev, white mat) */
.spin-logo-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--skin-white);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(var(--skin-accent-rgb), 0.45);
}

.spin-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  animation: samsel-logo-spin 4.8s linear infinite;
}

@keyframes samsel-logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.sub {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.skin-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.skin-select {
  min-width: min(168px, 100%);
  max-width: min(220px, 100%);
}

.pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--skin-bg2);
  border: 1px solid var(--accent);
  color: var(--muted);
}

.phone-lan-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--skin-bg2);
  border: 1px solid var(--accent);
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-word;
}

.am-localhost-hint {
  margin-bottom: 8px;
}

.am-probe-line {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.am-lan-hint-line {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.am-lan-token-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.am-lan-token-row label {
  flex: 0 0 auto;
  font-size: 0.85rem;
}

.am-token-input {
  flex: 1;
  min-width: min(180px, 100%);
  max-width: 100%;
}

@media (max-width: 640px) {
  .am-actions .btn,
  .am-source-row .btn {
    min-height: 44px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .am-source-types {
    flex-direction: column;
    align-items: flex-start;
  }

  .am-radio {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .am-actions .btn,
  .am-log-actions .btn,
  .am-out-actions .btn {
    min-height: 44px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .am-output-row .btn {
    min-height: 44px;
  }
}

.automix-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.automix-section-title {
  margin: 14px 0 8px;
  font-size: 1rem;
}

.automix-col-left .automix-section-title:first-child {
  margin-top: 0;
}

/* Downloader tab: title row with spinning logo (matches main header) */
.am-automix-panel-brand {
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.am-automix-panel-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--skin-h2, var(--text));
  letter-spacing: 0.02em;
}

.am-automix-panel-sub {
  margin: 4px 0 0;
  font-size: 0.8rem;
}

.am-source-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 8px;
}

.am-radio {
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.am-source-row {
  align-items: stretch;
  flex-wrap: wrap;
  gap: 8px;
}

.am-upload-row {
  margin-bottom: 4px;
}

.automix-text {
  flex: 1;
  min-width: min(220px, 100%);
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--skin-bg2);
  color: var(--text);
  font-size: 0.9rem;
}

.am-out-row,
.am-ff-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.am-out-row label,
.am-ff-row label {
  flex: 0 0 auto;
}

.am-format-row {
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 8px 0;
}

.am-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 10px;
  margin: 8px 0;
}

.am-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.am-save-phone-hint {
  margin-bottom: 8px;
}

.am-save-folder-status {
  margin: 6px 0 8px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.am-pending-delivery {
  margin: 10px 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: rgba(var(--skin-accent-rgb), 0.14);
}

.am-outputs-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: min(280px, 42vh);
  overflow: auto;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--skin-bg2);
}

.am-output-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--skin-bg2);
  font-size: 0.82rem;
}

.am-output-row:last-child {
  border-bottom: none;
}

.am-output-name {
  flex: 1;
  min-width: min(200px, 100%);
  word-break: break-word;
  color: var(--muted);
}

.automix-table-wrap {
  overflow: auto;
  max-height: min(240px, 40vh);
  max-width: 100%;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.automix-jobs {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.automix-jobs th,
.automix-jobs td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--skin-bg2);
  vertical-align: top;
}

.automix-jobs th {
  background: var(--skin-bg2);
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}

.am-tips {
  margin: 0 0 12px;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.am-tips code {
  font-size: 0.78rem;
}

.am-log-header {
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.am-log-title {
  margin: 0;
}

.am-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.automix-log {
  margin: 0;
  min-height: min(280px, 36vh);
  max-height: min(420px, 50vh);
  overflow: auto;
  padding: 10px;
  font-size: 0.75rem;
  line-height: 1.35;
  font-family: ui-monospace, Consolas, monospace;
  background: var(--skin-bg2);
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  white-space: pre-wrap;
  word-break: break-word;
}

.automix-footer {
  margin-top: 12px;
  padding: 10px 12px;
}

.automix-progress {
  width: 100%;
  height: 10px;
  margin-bottom: 8px;
}

.am-footer-row {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.am-footer-status {
  font-weight: 600;
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .automix-grid {
    grid-template-columns: 1fr;
  }
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.tab {
  padding: 8px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 2px solid #4a3d28;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  --lbl: #fff47a;
  color: var(--lbl);
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.92),
    0 1px 0 #000,
    0 2px 5px rgba(0, 0, 0, 0.75);
  position: relative;
  z-index: 0;
  overflow: hidden;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.42) 100%);
  background-repeat: no-repeat;
  background-color: transparent;
}

.tab:hover {
  filter: brightness(1.1) saturate(1.1);
}

.tab.active {
  border-color: var(--skin-accent);
  --lbl: #7dffb3;
  background-image: linear-gradient(180deg, rgba(0, 80, 60, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
  background-size: auto;
}

main {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.panel {
  display: none;
  min-width: 0;
}

.panel.active {
  display: block;
  min-width: 0;
}

.card {
  background: var(--skin-bg1);
  border: 2px groove var(--skin-card-br);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  min-width: 0;
  max-width: 100%;
}

.grid-play {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 800px) {
  .grid-play {
    grid-template-columns: 1fr;
  }
}

.drop-zone {
  text-align: center;
  padding: 24px;
  border-style: dashed;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(var(--skin-accent-rgb), 0.12);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.btn-file input {
  display: none;
}

.btn-file {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  border: 2px outset #4a3d28;
  --lbl: #ffe74d;
  color: var(--lbl);
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.95),
    0 1px 0 #000,
    0 0 2px #000,
    0 2px 6px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 0;
  overflow: hidden;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.48) 100%);
  background-repeat: no-repeat;
  background-color: transparent;
}

.btn-file:hover {
  filter: brightness(1.12) saturate(1.12);
}

.playlist-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.playlist-head h2 {
  margin: 0;
  font-size: 1rem;
}

.playlist-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.chk-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.chk-inline input {
  margin: 0;
  cursor: pointer;
}

.playlist {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--skin-playlist-br);
  border-radius: 6px;
  background: linear-gradient(165deg, var(--skin-playlist-g1), var(--skin-playlist-g2));
}

.playlist li {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--skin-pl-row-br);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.playlist li:last-child {
  border-bottom: none;
}

.playlist li:hover {
  background: var(--skin-pl-hover);
}

.playlist li.active {
  background: var(--skin-pl-active);
}

.playlist li .rm {
  opacity: 0.6;
  font-size: 0.75rem;
  padding: 2px 6px;
}

.playlist li .rm:hover {
  opacity: 1;
  color: var(--danger);
}

.playlist li .pl-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.playlist li .pl-name {
  word-break: break-word;
}

.playlist li .lrc-tag,
p.hint .lrc-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--skin-lrc-tag);
}

.transport-card .transport {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.transport-ic {
  display: inline-block;
  font-size: 1.15rem;
  line-height: 1;
  font-style: normal;
  font-variant: normal;
  speak: none;
}

.btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 2px outset #4a3d28;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  --lbl: #ffe74d;
  color: var(--lbl);
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.95),
    0 1px 0 #000,
    0 0 2px #000,
    0 2px 6px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 0;
  overflow: hidden;
  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.48) 100%);
  background-repeat: no-repeat;
  background-color: transparent;
}

.btn:hover {
  filter: brightness(1.12) saturate(1.12);
}

.btn.primary {
  min-width: 72px;
  font-weight: 800;
  --lbl: #5cfffa;
}

.btn.small {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.btn-lbl-cyan {
  --lbl: #5cfffa;
}
.btn-lbl-amber {
  --lbl: #ffbf00;
}
.btn-lbl-rose {
  --lbl: #ff7a9a;
}
.btn-lbl-violet {
  --lbl: #e0aaff;
}
.btn-lbl-lime {
  --lbl: #c8ff4d;
}
.btn-lbl-gold {
  --lbl: #ffe74d;
}
.btn-lbl-mint {
  --lbl: #9fffc9;
}

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

.time {
  font-family: Consolas, monospace;
  font-size: 0.85rem;
  min-width: 44px;
}

.seek {
  flex: 1;
  accent-color: var(--accent);
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vol-row input[type="range"] {
  flex: 1;
  max-width: 280px;
  accent-color: var(--accent2);
}

.eq-sliders {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--skin-eq-bg);
  border-radius: 8px;
  max-width: 100%;
}

.eq-band {
  display: grid;
  grid-template-columns: minmax(4.25rem, auto) minmax(0, 1fr) 2.85rem;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
}

.eq-band label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
  justify-self: end;
}

.eq-band input[type="range"] {
  width: 100%;
  min-width: 0;
  height: 1.35rem;
  accent-color: var(--skin-eq-accent);
}

.eq-band .db {
  font-family: Consolas, monospace;
  font-size: 0.7rem;
  color: var(--skin-eq-db);
  text-align: right;
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

.meta {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--skin-meta);
  margin: 0;
}

.foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}

#status.ok {
  color: var(--skin-status-ok);
}

/* Desktop-style multi-line tooltips (SAMSEL V3 PRO TooltipHelper) */
#samsel-tip {
  position: fixed;
  z-index: 100000;
  left: 0;
  top: 0;
  display: none;
  max-width: min(440px, calc(100vw - 20px));
  max-width: min(440px, calc(100dvw - 20px));
  padding: 11px 14px;
  font-size: 0.78rem;
  line-height: 1.42;
  white-space: pre-wrap;
  color: #f8f6e8;
  background: rgba(16, 20, 14, 0.97);
  border: 1px solid rgba(124, 255, 180, 0.55);
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 12px 36px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 8px 0;
}

.row-inline label {
  font-size: 0.85rem;
  color: var(--muted);
}

.inp-num {
  width: 88px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 2px inset var(--skin-inp-br);
  background: var(--skin-inp-bg);
  color: var(--text);
}

.inp-sel {
  min-width: min(180px, 100%);
  padding: 4px 8px;
  border-radius: 4px;
  border: 2px groove var(--skin-sel-br);
  background: var(--skin-sel-bg);
  color: var(--text);
}

.chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-file.small {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.hotcue-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hotcue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.status-txt {
  font-size: 0.9rem;
  color: var(--skin-stat-txt);
  margin: 8px 0 0;
}

.ly-display {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  background: var(--skin-ly-bg);
  border: 1px solid var(--skin-playlist-br);
  border-radius: 6px;
  line-height: 1.6;
}

.ly-embed-card .ly-embed-hint {
  margin: 0 0 8px;
  font-size: 0.8rem;
}

.ly-display.ly-embed {
  max-height: 160px;
  min-height: 72px;
  font-size: 0.9rem;
}

.ly-line {
  margin: 4px 0;
  font-size: 0.95rem;
  color: var(--skin-ly-muted);
  transition: color 0.15s, background 0.15s;
}

.ly-line.ly-cur {
  color: var(--skin-ly-cur);
  font-weight: 700;
  background: rgba(var(--skin-accent-rgb), 0.25);
  border-radius: 4px;
  padding: 2px 6px;
}

h2,
h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--skin-h2);
}

.card h3 {
  font-size: 0.95rem;
  color: var(--skin-h2);
}

/* -------------------------------------------------------------------------- */
/* iOS / iPadOS — safe areas, touch targets (≥44pt), scroll, input zoom        */
/* -------------------------------------------------------------------------- */

html {
  -webkit-text-size-adjust: 100%;
  height: -webkit-fill-available;
  /* iOS / Safari: allow both schemes so form controls match light & dark skins */
  color-scheme: light dark;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  /* Softer tap flash than default iOS blue */
  -webkit-tap-highlight-color: rgba(var(--skin-accent-rgb), 0.25);
}

.top {
  padding-top: 0;
}

.foot {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Primary controls: Apple HIG minimum ~44×44 pt tap targets */
.tab {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn.small {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  box-sizing: border-box;
}

.btn-file {
  min-height: 44px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-file.small {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
}

.playlist {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.playlist li {
  min-height: 44px;
  padding: 10px 12px;
  touch-action: manipulation;
}

.playlist li .rm {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
}

.ly-display {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.chk {
  min-height: 44px;
  padding: 6px 0;
  box-sizing: border-box;
}

.chk input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.drop-zone {
  touch-action: manipulation;
}

/* Prevent iOS zoom on focus (font size must be ≥16px); applies to iPhone / iPad width */
@media screen and (max-width: 1024px) {
  .inp-num,
  .inp-sel,
  .automix-text,
  input.automix-text,
  .am-token-input,
  input[type="number"],
  input[type="text"],
  input[type="password"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  select,
  select.inp-sel,
  textarea {
    font-size: 16px !important;
    line-height: 1.3;
  }

  .am-radio {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px 4px 2px;
    box-sizing: border-box;
  }

  .am-radio input[type="radio"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  .chk-inline {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 4px 0;
    box-sizing: border-box;
  }

  .chk-inline input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
}

/* Scrollable regions: smooth momentum scroll on iOS */
.automix-log,
.am-outputs-list,
.automix-table-wrap,
.meta,
#meta {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.vol-row input[type="range"],
.seek,
.eq-band input[type="range"] {
  touch-action: manipulation;
}

/* Standalone / home-screen: extra bottom breathing room already in #app padding */

@media (prefers-reduced-motion: reduce) {
  .spin-logo {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}

/* Touch devices: avoid hover-only affordances feeling “stuck” */
@media (hover: none) and (pointer: coarse) {
  .playlist li:hover {
    background: inherit;
  }

  .playlist li.active {
    background: var(--skin-pl-active);
  }

  .playlist li:active {
    background: var(--skin-pl-hover);
  }
}

/* Silence trim tab (desktop-style queue + log) */
.trim-intro {
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid rgba(var(--skin-accent-rgb), 0.2);
}

.trim-intro-title {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--accent2);
}

.trim-intro-p {
  margin: 0 0 6px;
}

.trim-intro-p:last-child {
  margin-bottom: 0;
}

.trim-subcard {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--muted);
}

.trim-subcard-title {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.trim-sep {
  border: none;
  border-top: 1px solid var(--muted);
  margin: 14px 0;
}

.trim-db-lbl {
  white-space: nowrap;
  margin-left: 4px;
}

.trim-db-row {
  flex-wrap: wrap;
  align-items: center;
}

.trim-section-label {
  margin: 10px 0 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.trim-file-list {
  min-height: 48px;
  max-height: 120px;
  overflow-y: auto;
  margin: 0 0 8px;
}

.trim-file-list li {
  cursor: pointer;
}

.trim-output-label {
  flex: 1;
  min-width: 140px;
}

.trim-out-row {
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.trim-actions-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.trim-log {
  margin: 0;
  padding: 8px 10px;
  max-height: 180px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
  background: var(--bg2);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.trim-progress {
  display: block;
  width: 100%;
  height: 10px;
  margin: 6px 0;
}

/* -------------------------------------------------------------------------- */
/* Phones & narrow tablets — layout reflow, scrollable tabs, full-width forms */
/* -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .top {
    min-width: 0;
  }

  .header-actions {
    min-width: 0;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    scrollbar-width: thin;
    overscroll-behavior-x: contain;
  }

  .tabs::-webkit-scrollbar {
    height: 5px;
  }

  .tabs::-webkit-scrollbar-thumb {
    background: rgba(var(--skin-accent-rgb), 0.45);
    border-radius: 4px;
  }

  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 0.82rem;
  }
}

@media (max-width: 560px) {
  #app {
    padding-left: max(10px, env(safe-area-inset-left, 0px));
    padding-right: max(10px, env(safe-area-inset-right, 0px));
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: max(52px, env(safe-area-inset-bottom, 0px));
  }

  .top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .brand {
    width: 100%;
    min-width: 0;
  }

  .brand h1 {
    font-size: clamp(1rem, 4.8vw, 1.2rem);
    line-height: 1.2;
  }

  .sub {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .header-actions {
    width: 100%;
    justify-content: stretch;
    gap: 8px;
  }

  .skin-picker {
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
  }

  .skin-select {
    min-width: 0;
    flex: 1 1 140px;
    max-width: none;
    width: auto;
  }

  .pill {
    flex-shrink: 0;
    align-self: center;
  }

  .card {
    padding: 12px 12px;
    margin-bottom: 10px;
  }

  .drop-zone {
    padding: 16px 12px;
  }

  .file-add-row {
    flex-direction: column;
    align-items: stretch;
  }

  .file-add-row .btn-file {
    width: 100%;
    justify-content: center;
  }

  .playlist-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .playlist-head h2 {
    font-size: 0.95rem;
  }

  .playlist-tools {
    justify-content: flex-start;
    width: 100%;
  }

  .chk-inline {
    white-space: normal;
    align-items: flex-start;
    max-width: 100%;
  }

  .transport-card .transport {
    justify-content: center;
    gap: 8px;
  }

  .transport .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .transport .btn.primary {
    flex: 1.15 1 auto;
  }

  .progress-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .progress-row .time {
    flex: 0 0 auto;
  }

  .progress-row .seek {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  .vol-row {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .vol-row label {
    flex: 0 0 100%;
  }

  .vol-row input[type="range"] {
    flex: 1;
    max-width: none;
    min-width: 0;
  }

  .vol-row #vol-lbl {
    flex-shrink: 0;
  }

  .row-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .row-inline > label:first-child {
    margin-bottom: -4px;
  }

  .inp-sel {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .row-inline .inp-sel {
    width: 100%;
    max-width: 100%;
  }

  .inp-num {
    width: 100%;
    max-width: 220px;
  }

  .row-inline .chk {
    width: 100%;
    align-items: flex-start;
  }

  .trim-out-row {
    flex-direction: column;
    align-items: stretch !important;
  }

  .trim-output-label {
    min-width: 0;
    width: 100%;
  }

  .trim-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .trim-actions-row .btn {
    width: 100%;
    min-width: 0;
  }

  .trim-actions-row .btn-lbl-mint {
    grid-column: 1 / -1;
  }

  .trim-db-row {
    align-items: flex-start;
  }

  .trim-db-lbl {
    width: 100%;
    margin-left: 0;
    margin-top: 2px;
  }

  .eq-sliders {
    padding: 10px 8px;
    gap: 8px;
  }

  .eq-band {
    grid-template-columns: minmax(3.6rem, auto) minmax(0, 1fr) 2.5rem;
    gap: 6px 8px;
  }

  .ly-display {
    max-height: min(48vh, 300px);
  }

  .ly-display.ly-embed {
    max-height: min(28vh, 200px);
  }

  .hotcue-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;
  }

  .hotcue-row .btn {
    width: 100%;
    min-width: 0;
  }

  #samsel-tip {
    max-width: min(400px, calc(100vw - 24px));
    max-width: min(400px, calc(100dvw - 24px));
    font-size: 0.8rem;
    padding: 10px 12px;
  }

  .foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 0.72rem;
  }
}

@media (max-width: 380px) {
  .tab {
    padding: 10px 11px;
    font-size: 0.78rem;
  }

  .transport .btn {
    font-size: 0.8rem;
  }
}
