/* DMX Remote: the phone remote for the DMX Console. Same dark console look. */
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('../../barlow-semi-condensed-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #1c1e20;
  --surface: #25282b;
  --surface-2: #2d3134;
  --well: #141617;
  --line: #3a3f43;
  --ink: #e8eaeb;
  --muted: #9aa1a6;
  --accent: #3fb8a0;
  --accent-deep: #215859;
  --cap-channel: #2f6fed;
  --cap-channel-hi: #6f9cff;
  --cap-playback: #e5383b;
  --cap-playback-hi: #ff7a7c;
  --cap-gm: #d9a520;
  --cap-gm-hi: #ffd76a;
  --danger: #ff6b6b;
  --display: 'Barlow Semi Condensed', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.hint { color: var(--muted); font-size: 13px; }
.screen { position: absolute; inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); display: flex; flex-direction: column; }

/* ---------- Pairing ---------- */
.join { align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.join-box { width: 100%; max-width: 360px; text-align: center; }
.join h1 { margin: 0 0 8px; font: 800 30px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.join h1::before { content: ''; display: block; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px; background: url('icon-192.png') center / cover; }
#join-form { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
#join-code {
  width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--well); color: var(--ink);
  font: 800 40px/1 var(--display); letter-spacing: .14em; text-align: center; text-transform: uppercase;
  -webkit-user-select: text; user-select: text;
}
#join-code:focus { outline: none; border-color: var(--accent); }
#join-go { padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: #0b2a24; font-weight: 700; font-size: 17px; }
#join-go:disabled { opacity: .5; }
.join-msg { min-height: 1.4em; margin: 6px 0 14px; font-weight: 600; }
.join-msg.error { color: var(--danger); }
.back { display: inline-block; margin-top: 10px; color: var(--accent); }
.install { margin: 4px 0 8px; }
.app-mode .install { display: none; }
.install-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.install-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-help { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left; font-size: 14px; }
.install-help ol { margin: 0 0 8px; padding-left: 20px; }
.install-help li { margin-bottom: 6px; }
.install-help p { margin: 0; color: var(--muted); }

/* ---------- Bar and banks ---------- */
.bar { display: flex; align-items: center; gap: 8px; flex: none; height: 50px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #17191a; }
.layer { display: flex; padding: 3px; gap: 3px; border-radius: 9px; background: var(--well); border: 1px solid var(--line); }
.layer button { padding: 6px 12px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-weight: 600; }
.layer button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.layer button[data-layer="c"][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--cap-channel); }
.layer button[data-layer="p"][aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--cap-playback); }
.conn { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--well); color: var(--muted); font-size: 13px; }
.conn #conn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #e0a526; }
.conn.live { color: var(--ink); }
.conn.live .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.banks { display: flex; gap: 6px; flex: none; padding: 8px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.banks::-webkit-scrollbar { display: none; }
.banks button { flex: 1 0 auto; min-width: 58px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px; }
.banks button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: #1b3a35; }

/* ---------- Strips ---------- */
.strips { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)) minmax(0, 1.15fr); gap: 4px; padding: 6px; touch-action: none; }
.strip { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 3px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.strip.gm { background: #24272a; }
.name {
  position: relative; flex: none; height: 44px; padding: 0 2px; border: 1px solid #00000066; border-radius: 5px;
  background: #34393d; color: var(--ink); overflow: hidden; text-align: center;
  font: 800 13px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; white-space: nowrap;
}
.name .num { position: absolute; top: 2px; left: 3px; font: 600 9px/1 system-ui, sans-serif; opacity: .8; letter-spacing: 0; }
/* Names (up to 6 characters) wrap onto two lines on narrow phones, e.g. "WASH" / "1" */
.name .txt { display: flex; align-items: center; justify-content: center; height: 100%; padding-top: 9px; font-size: clamp(10px, 2.75vw, 15px); letter-spacing: 0; line-height: 1.05; white-space: normal; overflow: hidden; }
.name.empty .txt { opacity: .35; }
.name.holding { transform: scale(.95); filter: brightness(1.3); transition: transform .4s, filter .4s; }
.strip.gm .name { background: var(--well); color: var(--cap-gm-hi); }
.strip.selected .name { box-shadow: 0 0 0 2px var(--accent); }
.readout { flex: none; height: 15px; text-align: center; font: 600 11px/15px ui-monospace, Menlo, monospace; color: var(--muted); font-variant-numeric: tabular-nums; }
.readout.on { color: var(--ink); }
.track { position: relative; flex: 1; min-height: 80px; --cap-h: 34px; touch-action: none; }
.slot { position: absolute; left: 50%; width: 6px; margin-left: -3px; top: calc(var(--cap-h) / 2); bottom: calc(var(--cap-h) / 2); border-radius: 3px; background: #0b0c0d; overflow: hidden; }
.fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--pos, 0) * 100%); background: var(--fill); opacity: .6; }
.cap {
  position: absolute; left: 6%; right: 6%; height: var(--cap-h); bottom: calc(var(--pos, 0) * (100% - var(--cap-h)));
  border-radius: 5px; background: linear-gradient(#ffffff40, transparent 45%, #00000040), var(--cap);
  box-shadow: 0 2px 4px #000a, inset 0 1px 0 #ffffff55;
}
.cap::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; margin-top: -1px; background: #ffffffcc; }
.strip.touching .cap { filter: brightness(1.25); }
.desk[data-layer="c"] .strip:not(.gm) { --cap: var(--cap-channel); --fill: var(--cap-channel-hi); }
.desk[data-layer="p"] .strip:not(.gm) { --cap: var(--cap-playback); --fill: var(--cap-playback-hi); }
.strip.gm { --cap: var(--cap-gm); --fill: var(--cap-gm-hi); }
.btn {
  flex: none; height: 46px; border-radius: 6px; border: 1px solid #00000080;
  background: linear-gradient(#3c4145, #2c3033); color: var(--muted);
  font: 800 13px/1 var(--display); letter-spacing: .06em;
}
.btn:active, .btn.pressed { background: #2a2e31; transform: translateY(1px); }
.strip.selected .btn { background: linear-gradient(#4fd1b6, var(--accent)); color: #0b2a24; }
.desk[data-layer="p"] .btn.flash { background: linear-gradient(#ff8a8c, var(--cap-playback)); color: #2a0606; }
.strip.gm .btn.on { background: linear-gradient(#ff8a8c, #c62828); color: #fff; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { filter: brightness(.6); } }

/* ---------- Colour page ---------- */
.colour-body { flex: 1; overflow: auto; padding: 12px 14px 24px; }
.back-btn { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.colour .bar b { font: 800 18px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#colour-who { margin: 0 0 10px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.swatch { position: relative; height: 64px; padding: 0; border-radius: 8px; border: 1px solid #0008; background: var(--c); box-shadow: inset 0 1px 0 #ffffff40; }
.swatch span { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 2px; border-radius: 0 0 7px 7px; background: #000a; color: #fff; font-size: 11px; font-weight: 600; }
.swatch.current { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch:active { transform: scale(.96); }
.picker { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.picker input { width: 64px; height: 40px; padding: 0; border: 0; border-radius: 6px; background: none; }
.extra { display: grid; grid-template-columns: 58px 70px 1fr; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; }
.extra input[type="range"] { width: 100%; height: 34px; accent-color: var(--accent); }
.extra input:disabled { opacity: .4; }
.auto { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
.auto input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Connection menu ---------- */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: #0008; }
.sheet-box { width: 100%; max-width: 420px; margin: 10px; padding: 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; margin-bottom: calc(10px + env(safe-area-inset-bottom)); }
.sheet-box p { margin: 0 0 6px; text-align: center; }
.sheet-box button { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }

/* Landscape phones: a little less chrome */
@media (max-height: 480px) {
  .bar { height: 42px; }
  .banks { padding: 5px 10px; }
  .name { height: 36px; }
  .name .txt { padding-top: 8px; }
  .btn { height: 38px; }
}

.sheet-dev { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 4px 2px; font-size: 14px; color: var(--muted, #9aa1a6); }
.sheet-dev small { flex-basis: 100%; font-size: 12px; padding-left: 26px; }

/* ---------- Patch tab ---------- */
.pview { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); }
.plist { display: flex; flex-direction: column; gap: 4px; }
.prow { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 8px; width: 100%; padding: 10px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.prow.empty { background: transparent; color: var(--muted); border-style: dashed; }
.pnum { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.pname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pname small { margin-left: 6px; font-weight: 500; color: var(--accent); }
.paddr { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.pbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pbar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pstep { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 16px; }
.pstep:disabled { opacity: .35; }
.pactions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pbtn { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 15px/1.1 inherit; font-family: inherit; }
.pbtn.danger { color: #ff8a8a; }
.pbtn.primary { background: var(--accent-deep); border-color: var(--accent); }
.pbtn.wide { width: 100%; padding: 13px; }
.pbtn:disabled { opacity: .45; }
.pbtn.hl[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; box-shadow: 0 0 14px #fff8; }
.paddrbox { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.paddrbox input { width: 72px; padding: 9px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 16px; }
.pbody { display: flex; flex-direction: column; gap: 6px; }
#pa-search { width: 100%; margin-bottom: 8px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 16px; }
.pres-list { display: flex; flex-direction: column; gap: 4px; }
.pres { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; font: inherit; }
.pres small { color: var(--muted); }
.pform { display: flex; flex-direction: column; gap: 8px; }
.pform-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pform-head .link { border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; }
.pfield { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pfield input, .pfield select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--well); color: var(--ink); font: inherit; font-size: 16px; }
.pfield input[readonly] { opacity: .6; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pchips { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .03em; }
.psummary { margin: 0; color: var(--muted); font-size: 13px; }
.psummary.bad { color: #ff8a8a; }

/* Fixture details (shared with the console's Patch screen) */
.fx-head h3 { margin: 0 0 2px; font-size: 20px; }
.fx-sub { margin: 12px 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.fx-table th, .fx-table td { text-align: left; padding: 6px 6px; border-bottom: 1px solid #ffffff12; vertical-align: top; }
.fx-table th { width: 44%; font-weight: 600; color: var(--muted); }
.fx-chans thead th { width: auto; font-size: 11px; text-transform: uppercase; }
.fx-chans td:first-child, .fx-chans td:nth-child(2) { width: 58px; font-variant-numeric: tabular-nums; }
.fx-role { margin-left: 4px; padding: 0 5px; border-radius: 4px; background: var(--accent-deep); font-size: 11px; }
.fx-credit { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.fx-credit a { color: var(--accent); }
.dip { display: inline-block; align-self: flex-start; padding: 8px 10px 6px; border-radius: 6px; background: #1f5fd1; color: #fff; }
.dip-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.dip-row { display: flex; gap: 6px; }
.dip-sw { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dip-sw i { position: relative; display: block; width: 16px; height: 36px; background: #3b3f45; }
.dip-sw i::after { content: ''; position: absolute; left: 0; right: 0; height: 15px; bottom: 0; background: #fff; }
.dip-sw.on i::after { top: 0; bottom: auto; }
.dip-sw b { font-size: 12px; font-weight: 600; }
.dip.big .dip-sw i { width: 22px; height: 46px; }
.dip.big .dip-sw i::after { height: 19px; }
.dip.big .dip-row { gap: 8px; }
.dip-note { margin: 0; font-size: 12px; }
.layer { flex-wrap: nowrap; }

/* Trigger: straight to 100% */
.tbtn { flex: none; height: 34px; border-radius: 6px; border: 1px solid #00000080; background: linear-gradient(#34383c, #26292c); color: #f0c45a; font: 800 12px/1 var(--display); letter-spacing: .06em; }
.tbtn:active { background: linear-gradient(#f0c45a, #c9971e); color: #2a1e02; }
.desk.no-trig .tbtn { display: none; }
