/* Rabbit House Recorder. The rig's look: a dark club booth. Single dark look on purpose.
   Two views of one page: field (phones, up to about 600 px wide or 500 px tall) and studio (iPad, desktop). */
:root {
  color-scheme: dark;
  --bg: #0c0a0b;
  --panel: #141012;
  --panel-2: #1c1719;
  --well: #0f0c0d;
  --lcd-bg: #070506;
  --line: #2c2427;
  --bone: #e6dccb;
  --muted: #9b8f85;
  --faint: #6b6159;
  --blood: #b3161f;
  --blood-hi: #e2444d;
  --amber: #f0a63a;
  --ok: #5fbf77;
  --warn: #e8b73a;
  --f-ui: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, -apple-system, sans-serif;
  --f-gear: 'Barlow Condensed', 'Arial Narrow', 'Helvetica Neue', system-ui, sans-serif;
  --f-lcd: 'Share Tech Mono', ui-monospace, Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --padl: max(16px, var(--sal));
  --padr: max(16px, var(--sar));
  --tabbar: 57px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--bone); }
/* Only the root's value reaches the viewport: no pull-to-refresh or bounce on this fixed page (a downward swipe
   during a take would reload it). manipulation blocks double-tap zoom everywhere and keeps pinch zoom. */
html { overscroll-behavior: none; touch-action: manipulation; }
body { touch-action: manipulation; }
body {
  font-family: var(--f-ui); font-size: 16px; line-height: 1.35; overflow: hidden; overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, select, input, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
button, select, label, .switch, .brand, #tabs, .rec-status, .rec-label, .lcd, .mscale, .mlab, .day, .trow, .chips, .clip, .lbl, h2 {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
select, input, textarea, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
p { margin: 0; }
.small { font-size: 14px; }
.muted { color: var(--muted); }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
#top {
  flex: none; display: flex; align-items: center; gap: 10px; z-index: 25;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: calc(var(--sat) + 6px) var(--padr) 6px var(--padl); min-height: calc(var(--sat) + 56px);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.brand .mark { width: 32px; height: 32px; flex: none; }
.brand-name { font-family: var(--f-gear); font-weight: 700; font-size: 20px; letter-spacing: .6px; color: var(--blood-hi); text-transform: uppercase; white-space: nowrap; }
.brand-sub { font-family: var(--f-gear); font-weight: 600; font-size: 13px; letter-spacing: 2.4px; color: var(--muted); text-transform: uppercase; white-space: nowrap; }

#tabs { display: none; }
body.field #tabs { display: flex; }
#tabs button {
  display: flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: none; color: var(--muted);
  font-family: var(--f-gear); font-weight: 600; font-size: 14px; letter-spacing: 1.6px; text-transform: uppercase; position: relative;
}
#tabs svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
#tabRec svg { fill: var(--blood-hi); }
#tabs button[aria-selected="true"] { color: var(--bone); }
#tabs .count { font-family: var(--f-lcd); font-weight: 400; font-size: 13px; letter-spacing: 0; color: var(--amber); }
body.field.port #tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--panel); border-top: 1px solid var(--line);
  padding: 0 var(--sar) var(--sab) var(--sal); height: calc(var(--tabbar) + var(--sab));
}
body.field.port #tabs button { flex: 1 1 0; flex-direction: column; gap: 2px; height: var(--tabbar); }
body.field.port #tabs button[aria-selected="true"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--blood-hi); }
body.field.land #tabs { gap: 4px; }
body.field.land #tabs button { min-height: 44px; padding: 0 12px; border-radius: 9px; border: 1px solid transparent; }
body.field.land #tabs button[aria-selected="true"] { border-color: var(--line); background: var(--panel-2); }
body.field.land .brand-sub { display: none; }

.btn {
  min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--bone);
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn.primary { background: #2a1215; border-color: var(--blood); }
.btn.danger { background: #3a1416; border-color: var(--blood-hi); color: #fbe0e1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sq { width: 44px; padding: 0; font-size: 22px; line-height: 1; }
.btn:disabled { opacity: .45; cursor: default; }
#helpBtn { flex: none; }

/* ---------- notice ---------- */
.notice {
  flex: none; display: flex; align-items: center; gap: 10px; z-index: 24;
  background: #2a1215; border-bottom: 1px solid var(--blood); padding: 8px var(--padr) 8px var(--padl);
}
.notice p { flex: 1 1 auto; min-width: 0; font-size: 15px; }
body.field .notice p { font-size: 14px; max-height: 76px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- main ---------- */
#main { flex: 1 1 auto; min-height: 0; position: relative; }

/* field view */
body.field.port #main { padding-bottom: calc(var(--tabbar) + var(--sab)); }
body.field #colMain { height: 100%; }
body.field #setup { display: none; }
body.field[data-tab="takes"] #colMain { display: none; }
body.field[data-tab="record"] #takesView { display: none; }
body.field #takesView { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px var(--padr) 16px var(--padl); }
body.field #deck { height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 10px var(--padr) 10px var(--padl); }
body.field.land #deck {
  display: grid; grid-template-columns: minmax(0, 1fr) 248px; grid-template-rows: auto minmax(0, 1fr); gap: 8px 16px;
  padding-bottom: max(8px, var(--sab));
}
body.field.land #meterBox { grid-column: 1; grid-row: 1; }
body.field.land #stage { grid-column: 1; grid-row: 2; }
body.field.land #controls { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
#meterBox { flex: none; }
#stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
/* centred with auto margins, which fall to 0 when space runs out, so the top never scrolls out of reach */
body.field #timeBox { margin-top: auto; margin-bottom: auto; }
#controls { flex: none; }
/* a take open on the phone: the card gets the space of the timer and the notes (the mic-on label stays in the meter) */
body.field #deck.has-card #timeBox, body.field #deck.has-card .prenote { display: none; }
body.field.port #deck.has-card .mscale, body.field.port #deck.has-card .helpline { display: none; }
body.field.land #deck.has-card .mscale { display: none; }
/* with a take open the clip light and peak readout give way to the card (the meter bar stays in portrait) */
body.field #deck.has-card .mside { display: none; }
body.field.land #deck.has-card #meterArea { display: none; }
@media (max-height: 700px) { body.field.port #deck.has-card .rec-label { display: none; } }
/* no microphone (refused, none found): the message takes the timer's place and scrolls if it must */
body.field #deck.mic-error #timeBox { display: none; }
body.field #deck.mic-error:not(.has-card) #stage { display: none; }
body.field #deck.mic-error #meterBox { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
body.field.land #deck.mic-error { grid-template-rows: minmax(0, 1fr) auto; }
/* short screens (Safari with its toolbars on an iPhone SE, 548 px; landscape): a smaller timer, no meter scale,
   peak readout or Record label, so the timer never collapses */
@media (max-height: 620px) {
  body.field .mscale, body.field #peakOut, body.field .prenote, body.field .rec-label { display: none; }
  body.field #timeBox { padding: 6px 8px; }
  body.field .timer { font-size: 44px; }
  body.field .rec-status { margin-top: 4px; font-size: 14px; }
  body.field .rec-sub { min-height: 0; font-size: 13px; }
  body.field .helpline { margin-top: 4px; font-size: 12px; }
  body.field.port #deck { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  body.field #meterArea { margin-top: 4px; }
  /* with a take open the notice gives its room to the card (whose details say why the take stopped);
     it shows again when the card is closed */
  body.field.card-open #notice { display: none; }
}

/* studio view */
body.studio #main {
  display: grid; gap: 14px; grid-template-rows: minmax(0, 1fr);
  padding: 14px var(--padr) max(14px, var(--sab)) var(--padl);
}
body.studio.wide #main { grid-template-columns: 320px minmax(0, 1fr) 380px; grid-template-areas: "setup deck takes"; }
body.studio.wide #colMain { display: contents; }
body.studio.wide #setup { grid-area: setup; overflow-y: auto; min-height: 0; }
body.studio.wide #deck { grid-area: deck; overflow-y: auto; min-height: 0; }
body.studio.narrow #main { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "colmain takes"; }
body.studio.narrow #colMain { grid-area: colmain; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
body.studio #takesView { grid-area: takes; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
body.studio #deck { display: flex; flex-direction: column; gap: 12px; }
body.studio #stage { display: contents; }
body.studio #meterBox { order: 0; }
body.studio #timeBox { order: 1; }
body.studio #controls { order: 2; }
/* studio: the open take sits at the top of the takes column, so the meter and the gain are always in view */
body.studio #cardHost { margin-bottom: 14px; }
body.studio #cardHost:empty { display: none; }
body.studio #setup { display: flex; flex-direction: column; gap: 14px; }
body.studio #sheet { display: none !important; }
/* iPad Split View widths that still get the studio view */
@media (max-width: 759px) { body.studio.narrow #main { grid-template-columns: minmax(0, 1fr) 280px; } }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.panel h2, .takes-head h2 {
  font-family: var(--f-gear); font-weight: 600; font-size: 14px; letter-spacing: 2.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}
.lbl { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
.lblrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lblrow .lbl { margin-bottom: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.sel, .num {
  min-height: 44px; font-size: 16px; background: var(--well); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; width: 100%;
}
.sel { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.num.lcd-input { width: 112px; text-align: center; font-family: var(--f-lcd); color: var(--amber); font-size: 22px; background: var(--lcd-bg); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: #2a2225; }
/* the thumb is drawn 28 px wide but takes touches over 44 px (iOS moves a slider only by its thumb) */
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 44px; height: 44px; margin-top: -19px; border-radius: 50%; border: 8px solid transparent; background: var(--bone) padding-box; box-shadow: inset 0 0 0 2px var(--bg); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: #2a2225; }
.range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; border: 8px solid transparent; background: var(--bone) padding-box; box-shadow: inset 0 0 0 2px var(--bg); }

/* switches */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch .track { position: relative; flex: none; width: 48px; height: 28px; border-radius: 14px; background: #2a2225; border: 1px solid var(--line); transition: background .15s, border-color .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch input:checked + .track { background: #3d2a0e; border-color: var(--amber); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--amber); box-shadow: 0 0 8px rgba(240,166,58,.6); }
.switch input:focus-visible + .track { outline: 2px solid var(--amber); outline-offset: 2px; }
.switch-text { font-weight: 600; }

/* ---------- meter ---------- */
.input-line { display: flex; align-items: center; gap: 8px; min-height: 24px; min-width: 0; }
.led { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #3a2c22; box-shadow: inset 0 1px 1px rgba(0,0,0,.6); }
.led.on { background: var(--amber); box-shadow: 0 0 8px rgba(240,166,58,.75); }
.led.rec { background: var(--blood-hi); box-shadow: 0 0 10px rgba(226,68,77,.85); }
.mic-state { flex: none; font-family: var(--f-gear); font-weight: 700; font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--amber); }
.input-name { flex: 1 1 auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inputwarn { margin-top: 8px; padding: 8px; border-radius: 8px; border: 1px solid #6b4a17; background: #2a1d0b; display: flex; flex-direction: column; gap: 6px; }
.inputwarn p { font-size: 14px; color: #fbefd2; }
.warnline { color: var(--amber) !important; }
.input-info { flex: none; font-family: var(--f-lcd); font-size: 13px; color: var(--muted); white-space: nowrap; }
#meterArea { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.meter { flex: 1 1 auto; min-width: 0; }
.mrow { display: flex; align-items: center; gap: 6px; height: 14px; margin-bottom: 4px; }
.mlab { width: 10px; flex: none; font-family: var(--f-lcd); font-size: 11px; color: var(--faint); }
.mbar {
  position: relative; flex: 1 1 auto; height: 10px; border-radius: 2px; overflow: hidden;
  background: linear-gradient(to right, #7a4c16 0%, var(--amber) 55%, var(--amber) 80%, #f0733a 90%, var(--blood-hi) 95%, var(--blood-hi) 100%);
}
.mfill { position: absolute; inset: 0; background: var(--lcd-bg); box-shadow: inset 0 0 0 1px #221b1e; transform: translateX(0%); will-change: transform; }
.mhold { position: absolute; top: 0; bottom: 0; left: -4px; width: 2px; background: var(--bone); }
.meter.mono .mrow[data-c="1"] { display: none; }
.meter.mono .mrow { height: 18px; }
.meter.mono .mbar { height: 14px; }
.mscale { position: relative; height: 12px; margin-left: 16px; font-family: var(--f-lcd); font-size: 10px; color: var(--faint); }
.mscale span { position: absolute; top: 0; transform: translateX(-50%); }
.mscale span:first-child { transform: none; }
.mscale span:last-child { transform: translateX(-100%); }
.meter.tight .mscale span:nth-child(6) { display: none; }   /* -6 runs into -12 and 0 on a narrow meter */
.mside { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clip {
  min-width: 56px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #1d1214; color: #74424a;
  font-family: var(--f-gear); font-weight: 700; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase;
}
.clip.on { background: var(--blood); border-color: var(--blood-hi); color: #fff; box-shadow: 0 0 12px rgba(226,68,77,.7); }
.small-lcd { font-size: 13px; }
.lcd { font-family: var(--f-lcd); color: var(--amber); text-shadow: 0 0 8px rgba(240,166,58,.4); font-variant-numeric: tabular-nums; }
.micmsg { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.micmsg h3 { margin: 0; font-size: 16px; color: var(--blood-hi); }
.micmsg ol { margin: 0; padding-left: 20px; }
.micmsg .row { margin: 2px 0 0; }
.tapnote { margin-top: 6px; color: var(--amber); font-weight: 600; }

/* ---------- timer + controls ---------- */
#timeBox { background: var(--lcd-bg); border: 1px solid #221b1e; border-radius: 12px; padding: 14px 10px 12px; box-shadow: inset 0 2px 12px rgba(0,0,0,.6); }
.timer { font-size: 64px; line-height: 1; text-align: center; letter-spacing: 1px; white-space: nowrap; }
.rec-status { margin-top: 8px; text-align: center; font-family: var(--f-gear); font-weight: 600; font-size: 15px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--muted); }
.rec-status.live { color: var(--blood-hi); }
.rec-status.count { color: var(--amber); }
.rec-sub { min-height: 20px; text-align: center; font-size: 14px; color: var(--muted); }
.rec-warn { margin-top: 4px; text-align: center; font-size: 13px; line-height: 1.25; color: var(--amber); }
body.field.land .timer { font-size: 48px; }
/* Record in the middle, the pre-roll switch on its left, Mark on its right (in reach of a right thumb) */
.buttons { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.prerow { display: flex; justify-content: center; min-width: 0; }
.prerow .switch { flex-direction: column; gap: 4px; text-align: center; }
.prerow .switch-text { font-size: 14px; line-height: 1.15; max-width: 11ch; }
.prenote { margin-top: 6px; text-align: center; }
#deck.mic-error .prenote { display: none; }
.round-btn { justify-self: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--bone); }
.mark-btn {
  width: 78px; height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-family: var(--f-gear); font-weight: 700; font-size: 16px; letter-spacing: 1.6px; text-transform: uppercase;
}
.mark-btn:disabled { opacity: .3; cursor: default; }
.mark-btn.flash { background: var(--amber); color: #1a1206; border-color: var(--amber); }
.mk-count { font-family: var(--f-lcd); font-weight: 400; font-size: 14px; letter-spacing: 0; min-height: 16px; color: var(--amber); }
.mark-btn.flash .mk-count { color: #1a1206; }
.rec-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rec-btn {
  width: 128px; height: 128px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 28%, #4a4246 0%, #241e21 55%, #151113 100%);
  box-shadow: 0 0 0 2px #2c2427, 0 10px 28px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.08);
}
.rec-dot {
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #ff6b73 0%, var(--blood-hi) 28%, var(--blood) 64%, #6d0b12 100%);
  box-shadow: 0 0 0 4px var(--bg), 0 0 18px rgba(179,22,31,.45); transition: width .15s, height .15s, border-radius .15s;
}
.rec-btn.on { box-shadow: 0 0 0 3px var(--blood-hi), 0 0 30px rgba(226,68,77,.55), 0 10px 28px rgba(0,0,0,.65); }
.rec-btn.on .rec-dot { width: 46px; height: 46px; border-radius: 8px; background: var(--bone); box-shadow: 0 0 0 4px var(--bg); }
.rec-btn.wait .rec-dot { opacity: .6; }
.rec-btn:disabled { opacity: .55; cursor: default; }
.rec-label { font-family: var(--f-gear); font-weight: 700; font-size: 14px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--muted); }
.rec-btn.on + .rec-label { color: var(--blood-hi); }
.helpline { margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }
body.field.land .prenote { display: none; }
body.field.land .buttons { grid-template-columns: auto auto; grid-template-areas: "pre pre" "rec mark"; justify-content: center; row-gap: 4px; }
body.field.land .prerow { grid-area: pre; }
body.field.land .rec-wrap { grid-area: rec; }
body.field.land #markBtn { grid-area: mark; }
body.field.land .prerow .switch { flex-direction: row; gap: 10px; text-align: left; }
body.field.land .prerow .switch-text { max-width: none; font-size: 15px; }
body.field.land .mark-btn { width: 72px; height: 72px; }
body.field.land .rec-btn { width: 124px; height: 124px; }
body.field.land .helpline { font-size: 12px; }

/* ---------- take card ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.card-head { display: flex; gap: 8px; align-items: center; }
.card .name {
  flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 17px; font-weight: 600; padding: 0 10px;
  background: var(--well); border: 1px solid var(--line); border-radius: 8px;
}
.play-btn { flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; }
.play-btn svg { width: 20px; height: 20px; fill: var(--bone); }
.play-btn.on { border-color: var(--amber); background: #3d2a0e; }
.wavewrap { position: relative; }
.wave { display: block; width: 100%; height: 88px; border-radius: 8px; touch-action: none; cursor: pointer; }
.trimlab { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-family: var(--f-lcd); font-size: 12px; color: var(--muted); white-space: nowrap; }
.trimlab .tlen { color: var(--amber); }
.note {
  display: block; width: 100%; min-height: 44px; font-size: 16px; padding: 10px; resize: vertical; line-height: 1.3;
  background: var(--well); border: 1px solid var(--line); border-radius: 8px;
}
.seg { display: flex; gap: 6px; }
.seg button { flex: 1 1 0; min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #191416; color: var(--muted); font-weight: 600; font-size: 15px; }
.seg button.keep[aria-pressed="true"] { background: #173a22; border-color: var(--ok); color: #e3f6e8; }
.seg button.maybe[aria-pressed="true"] { background: #3d2e0e; border-color: var(--warn); color: #fbefd2; }
.seg button.skip[aria-pressed="true"] { background: #3a1416; border-color: var(--blood-hi); color: #fbe0e1; }
.card .meta { font-size: 13px; color: var(--muted); }
/* Save to Files and Delete stay at the bottom of the card area while the rest of the card scrolls under them */
.card-foot { position: sticky; bottom: 0; z-index: 1; margin: 0 -10px; padding: 8px 10px; background: var(--panel); box-shadow: 0 -8px 10px -8px rgba(0,0,0,.7); }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card .actions .save { flex: 1 1 auto; }
.card .confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #2a1215; border: 1px solid var(--blood); border-radius: 10px; padding: 8px; }
.card .confirm p { flex: 1 1 100%; }
body.field.port #deck .card .wave { height: 76px; }
body.field.land #deck .card .wave { height: 56px; }
@media (max-height: 700px) { body.field.port #deck .card .wave { height: 56px; } }
/* studio on shorter screens (iPad landscape): a lower waveform leaves more of the takes list in view */
@media (max-height: 900px) { body.studio #cardHost .card .wave { height: 60px; } body.studio #cardHost .card { gap: 6px; } }

/* ---------- takes list ---------- */
.takes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.takes-head h2 { margin: 0; }
.takes-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.search { width: 100%; min-height: 44px; font-size: 16px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--well); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 14px; }
.chips button[aria-pressed="true"] { color: var(--bone); border-color: var(--blood-hi); background: #2a1215; }
.day { margin: 14px 0 6px; font-family: var(--f-gear); font-weight: 600; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.trow {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; margin-bottom: 6px; padding: 8px 12px; text-align: left;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--bone);
}
.trow.current { border-color: var(--amber); }
.trow.live { border-color: var(--blood-hi); cursor: default; }
.tmain { flex: 1 1 auto; min-width: 0; }
.tname, .tsub { display: block; }
.tname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdur { flex: none; font-family: var(--f-lcd); color: var(--amber); font-size: 15px; }
.tmark { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.tmark.keep { color: #e3f6e8; background: #173a22; border-color: var(--ok); }
.tmark.maybe { color: #fbefd2; background: #3d2e0e; border-color: var(--warn); }
.tmark.skip { color: #fbe0e1; background: #3a1416; border-color: var(--blood-hi); }
.tick { flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; }
.tick svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; opacity: 0; }
.trow[aria-pressed="true"] { border-color: var(--blood-hi); background: #1f1315; }
.trow[aria-pressed="true"] .tick { background: var(--blood-hi); border-color: var(--blood-hi); }
.trow[aria-pressed="true"] .tick svg { opacity: 1; }
.empty { margin: 24px 0; color: var(--muted); text-align: center; }
.selbar { position: sticky; bottom: 0; z-index: 2; margin-top: 8px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 -8px 20px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 8px; }
.selrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.selcount { flex: 1 1 100%; font-weight: 600; }
.storage { margin-top: 14px; }
.storage b { color: var(--bone); font-weight: 600; }

/* ---------- sheet (a take opened from the list on the phone) ---------- */
.sheet { position: absolute; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 12px var(--padr) 16px var(--padl); }
body.field.port .sheet { bottom: calc(var(--tabbar) + var(--sab)); padding-bottom: 16px; }

/* ---------- dialog, toast ---------- */
.dialog { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(5,4,4,.75);
  padding: max(16px, var(--sat)) var(--padr) max(16px, var(--sab)) var(--padl); }
.dialog-box { width: min(580px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
/* the text scrolls; the button stays in view */
#dlgBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.dialog-box > .row.end { flex: none; padding-top: 12px; border-top: 1px solid var(--line); }
.dialog-box h2 { margin: 0 0 10px; font-family: var(--f-gear); font-weight: 700; font-size: 22px; letter-spacing: 1px; text-transform: uppercase; color: var(--bone); }
.dialog-box h3 { margin: 14px 0 4px; font-family: var(--f-gear); font-weight: 600; font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.dialog-box p { margin: 0 0 10px; }
.dialog-box ul { margin: 0 0 10px; padding-left: 20px; }
.dialog-box li { margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--sab)); z-index: 120; width: max-content; max-width: calc(100% - 32px); text-align: center;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  background: #241d20; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 15px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.studio .toast { bottom: calc(24px + var(--sab)); }
body.field .toast { bottom: auto; top: calc(var(--sat) + 64px); transform: translate(-50%, -16px); }
body.field .toast.show { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
