:root {
  --bg: #f6f7f9; --fg: #1d2330; --muted: #6a7280; --line: #d6dae1; --card: #fff;
  --kept: #2f6fd6; --cut: #b9c0cc; --head: #138a4b; --tail: #c0392b; --play: #f0a020; --primary: #1f5fbf;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1100px; margin: 0 auto; padding: 12px 16px 32px; }
header { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.brand { font-weight: 700; font-size: 18px; }
.proto { color: var(--muted); font-size: 13px; }
h1 { font-size: 24px; margin: 6px 0 2px; overflow-wrap: anywhere; }
h1 .sep { color: var(--muted); }
.rule { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 12px 0; }
.status { min-height: 1.4em; color: var(--muted); font-size: 14px; }
.status.error { color: var(--tail); }
.wave { display: block; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.overview { height: 90px; margin-bottom: 6px; }
.detail { height: 170px; }
.markers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.marker { background: var(--card); border: 2px solid var(--line); border-radius: 8px; padding: 10px; }
.marker.active#headBox { border-color: var(--head); }
.marker.active#tailBox { border-color: var(--tail); }
.mlabel { font-weight: 600; margin-bottom: 6px; }
#headBox .mlabel { color: var(--head); }
#tailBox .mlabel { color: var(--tail); }
.mtime { font-variant-numeric: tabular-nums; color: var(--fg); margin-left: 6px; }
.nudges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
button { font: inherit; border: 1px solid var(--line); background: #eef1f5; color: var(--fg); border-radius: 6px;
  padding: 8px 10px; min-height: 40px; cursor: pointer; touch-action: manipulation; }
button:hover { background: #e3e8ef; }
button:disabled { opacity: .5; cursor: default; }
button.big { width: 100%; min-height: 52px; font-size: 17px; font-weight: 600; }
button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover { background: #194f9f; }
button.play.playing { background: var(--play); border-color: var(--play); color: #fff; }
button.quiet { background: transparent; font-weight: 500; }
button.chosen { background: var(--fg); color: #fff; }
.actions { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr; gap: 12px; margin-top: 14px; }
.reasons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
#note { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.row { display: flex; gap: 8px; }
.keys { color: var(--muted); font-size: 13px; margin-top: 16px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #fff; font-size: 12px; }
#startBtn { max-width: 260px; }
@media (max-width: 700px) {
  .markers, .actions { grid-template-columns: 1fr; }
  .reasons { grid-template-columns: 1fr 1fr; }
  .keys { display: none; }
}

/* play and pause from the line; scrubbing hint */
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.transport .hint { color: var(--muted); font-size: 0.9rem; }

/* the list of trimmed songs */
.overlay { position: fixed; inset: 0; background: rgba(20,25,35,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 10; }
.overlay[hidden] { display: none; }
.dialog { background: var(--card); border-radius: 10px; padding: 16px; width: 100%; max-width: 640px; max-height: 86vh; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.dialog h2 { margin: 0 0 4px; font-size: 20px; }
.songs { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--muted); }
.songs button.song { display: flex; justify-content: space-between; gap: 12px; text-align: left; width: 100%; background: #fff; }
.songs button.song:hover { background: #eef3fb; border-color: var(--primary); }
.songs button.song.current { border-color: var(--primary); }
.sname { font-weight: 600; overflow-wrap: anywhere; }
.sinfo { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions #backBtn { grid-column: 1 / -1; }

/* put a marker at the line */
button.here { width: 100%; margin-top: 8px; }
.transport .hint { flex: 1 1 320px; }

/* sign-in on the start screen */
#signin { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
#signinFields { display: flex; flex-direction: column; gap: 10px; }
#signinFields[hidden] { display: none; }
#signin input { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
#startBtn { max-width: none; }

/* ---- phone (owner's iPhone 13 mini is 375 px wide): the two pictures stay at the top while the page scrolls, Done stays
   at the bottom, head and tail sit side by side, the long hints go. A touch on a picture never scrolls the page; anything
   below the pictures does. */
html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: contain; }
button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
@media (max-width: 700px) {
  main { padding: 6px 10px calc(84px + env(safe-area-inset-bottom)); }
  header { margin-bottom: 2px; }
  .brand { font-size: 15px; }
  h1 { font-size: 17px; line-height: 1.25; margin: 2px 0; }
  #work > .rule, .transport .hint { display: none; }
  .status { font-size: 13px; min-height: 1.3em; }
  .overview { height: 52px; margin-bottom: 4px; position: sticky; top: 0; z-index: 5; }
  .detail { height: 128px; position: sticky; top: 56px; z-index: 5; }
  .transport { margin: 6px 0 0; }
  .markers { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
  .marker { padding: 6px; }
  .mlabel { font-size: 14px; margin-bottom: 4px; }
  .mtime { margin-left: 2px; }
  .nudges { grid-template-columns: repeat(4, 1fr); gap: 3px; margin-bottom: 6px; }
  .nudges button { min-height: 42px; padding: 2px 0; font-size: 13px; }
  button.big { min-height: 46px; font-size: 15px; }
  button.here { min-height: 40px; font-size: 13px; padding: 4px 2px; margin-top: 6px; }
  .actions { grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
  #doneBtn { position: fixed; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; z-index: 6;
    min-height: 54px; font-size: 18px; box-shadow: 0 0 0 10px var(--bg); }
  .dialog { max-height: 80vh; }
  .songs button.song { flex-direction: column; gap: 2px; }
}

/* the link back to the admin console (only when opened as admin.musicdatasystems.com/songtrim/) */
.console_link { margin-left: auto; font-size: 13px; color: inherit; opacity: 0.8; }
