:root {
  --bg: #101218; --panel: #1a1d26; --panel2: #232733; --line: #2f3442;
  --text: #e9ebf0; --muted: #9aa1b2; --accent: #ffb040; --accent-text: #1a1204;
  --ok: #4cc38a; --bad: #ff6b6b; --warn: #ffb040; --lockred: #d94b4b;
  --tap: 56px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.msg { min-height: 1.4em; color: var(--bad); margin: 8px 0 0; }

button, select, input { font: inherit; color: inherit; }
button {
  min-height: var(--tap); border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel2); padding: 0 16px; cursor: pointer; touch-action: manipulation;
}
button:active { filter: brightness(1.25); }
button:disabled, input:disabled, select:disabled { opacity: 0.4; cursor: not-allowed; }
button.big { width: 100%; font-weight: 600; margin-top: 14px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.small-btn { min-height: 44px; font-size: 15px; }
input, select {
  width: 100%; min-height: var(--tap); border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); padding: 0 14px;
}
label { display: block; color: var(--muted); font-size: 14px; margin: 12px 0 4px; }
.row { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.row > label { margin: 0; flex: 0 0 auto; }
.row > select { flex: 1; }
input[type=range] { padding: 0; min-height: 44px; accent-color: var(--accent); }

/* sign in */
.login { max-width: 420px; margin: 0 auto; padding: 48px 16px 24px; }
.assistant-label { font-size: 13px; color: var(--muted); margin-top: 18px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
}
.topbar .assistant-label { margin-top: 4px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.church { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.up { background: var(--ok); } .dot.down { background: var(--bad); }

.lock-switch {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px 0 8px;
  border-radius: 28px; font-weight: 700; background: var(--panel2); flex: 0 0 auto;
}
.lock-switch .knob { width: 40px; height: 40px; border-radius: 50%; background: var(--ok); }
.lock-switch.on { background: #3a1d1d; border-color: var(--lockred); }
.lock-switch.on .knob { background: var(--lockred); }
.lock-switch.fixed { cursor: default; }

.banner {
  background: var(--lockred); color: #fff; font-weight: 700; text-align: center; padding: 12px 14px;
}
.banner.info { background: var(--panel2); color: var(--text); font-weight: 400; }

/* content */
#content { padding: 4px 14px 150px; max-width: 720px; margin: 0 auto; }
.intro { margin: 12px 0 0; color: var(--text); }
h2 + .muted.small { margin: -4px 0 10px; }

/* suggested sets */
.sets { display: grid; gap: 10px; }
.set {
  display: flex; align-items: center; gap: 14px; text-align: left; min-height: 76px; padding: 10px 12px;
  background: var(--panel);
}
.strip { display: flex; flex: 0 0 auto; width: 84px; height: 48px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.strip i { flex: 1; }
.set-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-name { font-weight: 600; }
.set-mood { color: var(--muted); font-size: 14px; line-height: 1.25; }

/* pick your own */
.tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 12px; }
.slot {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 8px; min-height: 108px;
  border-radius: 14px; border: 1px dashed var(--line); background: var(--panel); text-align: left; font: inherit; color: inherit;
}
.slot i { display: block; height: 44px; border-radius: 8px; background: var(--panel2); }
.slot span { font-size: 14px; font-weight: 600; }
.slot small { color: var(--muted); font-size: 12px; }
button.slot.full { border-style: solid; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sw { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-height: 84px; padding: 8px; background: var(--panel); }
.sw i { display: block; height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); }
.sw span { font-size: 13px; line-height: 1.15; text-align: center; overflow-wrap: anywhere; }
.mix { margin: 14px 0 0; }
.mix summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; color: var(--accent); }
.mixer { display: flex; gap: 12px; align-items: stretch; }
.mix-preview { flex: 0 0 84px; border-radius: 14px; border: 1px solid var(--line); }
.mix-sliders { flex: 1; min-width: 0; }
.mix-sliders label { margin: 0 0 4px; }
input.hue { background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); height: 18px; min-height: 44px; border-radius: 12px; }
#pick-clear { margin-top: 10px; width: 100%; }
.placement { white-space: pre-wrap; color: var(--muted); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 12px 0 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; }
.card h3 { margin: 0 0 6px; font-size: 19px; }
.card .k { color: var(--muted); font-size: 13px; margin-top: 8px; }
.card .size-row { display: flex; align-items: center; gap: 10px; }
.card .size-row output { min-width: 3ch; text-align: right; }

.tap {
  width: 100%; min-height: 190px; margin: 12px 0; font-size: 44px; font-weight: 800; letter-spacing: 2px;
  border-radius: 24px; background: #2a3042; border: 2px solid var(--accent);
}
.tap:active { background: #3a4260; }
.bpm-row { display: flex; align-items: center; gap: 10px; }
/* tempo wheel: ridges like the edge of a scroll wheel, shaded darker at the ends so it reads as round */
.bpm-wheel {
  flex: 1; position: relative; border-radius: 16px; border: 1px solid var(--line); padding: 8px 0 6px;
  cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.75), rgba(0,0,0,0) 22%, rgba(0,0,0,0) 78%, rgba(0,0,0,.75)),
    repeating-linear-gradient(90deg, #2b3040 0 6px, #3b4256 6px 8px, #1d212c 8px 12px);
}
.bpm-wheel.turning, .bpm-wheel:focus-visible { border-color: var(--accent); outline: none; }
.bpm-box { text-align: center; position: relative; }
.bpm-box input { text-align: center; font-size: 34px; font-weight: 800; min-height: 60px; width: 130px; margin: 0 auto; display: block;
  background: rgba(16,18,24,.82); border-color: transparent; }
.bpm-box span { display: block; color: var(--text); text-shadow: 0 1px 2px #000; }
.wheel-hint { margin: 6px 0 0; text-align: center; }
.note-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.note-btn { flex: 1 1 22%; min-width: 72px; min-height: 60px; font-size: 20px; font-weight: 700; }
.note-btn[aria-pressed="true"] { background: var(--accent); color: #1a1405; border-color: var(--accent); }
.beat { flex: 0 0 34px; height: 34px; border-radius: 50%; background: #3a3320; }
.beat.flash { background: var(--accent); box-shadow: 0 0 22px var(--accent); }

.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history .t { color: var(--muted); }
.history .no { color: var(--bad); }

/* result bar and tabs */
.result {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 6;
  padding: 14px 16px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line);
  font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.result.ok { border-color: var(--ok); } .result.bad { border-color: var(--bad); } .result.warn { border-color: var(--warn); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--panel);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; border-radius: 0; min-height: 68px; background: transparent; font-size: 15px; color: var(--muted);
}
.tabbar button.active { color: var(--accent); font-weight: 700; box-shadow: inset 0 3px 0 var(--accent); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; width: min(92vw, 380px); }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog .row .big { margin-top: 0; }
.topline .help-btn { margin-left: auto; }
.help-btn { flex: 0 0 auto; min-height: 44px; padding: 0 14px; }
.help-btn.wide { width: 100%; margin-top: 18px; }
.logo { display: block; width: 140px; height: auto; margin: 0 0 18px; }
.logo.small-logo { width: 96px; }
.brand { margin: 32px 0 0; text-align: center; }
.brand .logo { margin: 0 auto 8px; }
.help-email { font-size: 20px; font-weight: 700; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }

/* demo mode */
.demo-ribbon {
  position: sticky; top: 0; z-index: 8; background: #5b3fb0; color: #fff; text-align: center;
  font-size: 13px; line-height: 1.3; padding: 6px 10px;
}
.demo-ribbon strong { background: #fff; color: #5b3fb0; border-radius: 6px; padding: 1px 7px; margin-right: 6px; letter-spacing: 1px; text-transform: uppercase; font-size: 12px; }
body.demo .topbar { top: var(--ribbon-h, 30px); }
.demo-tag { display: inline-block; font-size: 12px; color: #cdbdff; border: 1px solid #5b3fb0; border-radius: 8px; padding: 1px 8px; margin-bottom: 6px; }
.stage { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 4px; margin: 10px 0 6px; }
.stage svg { display: block; width: 100%; height: auto; }
.stage-edge { fill: var(--panel2); stroke: var(--line); }
.stage-lbl { fill: var(--muted); font-size: 9.5px; }
.stage-lbl.side { text-anchor: middle; }
.stage-lbl.mid { text-anchor: middle; font-size: 8.5px; }
.stage-fx { fill: var(--accent); font-size: 8.5px; }
.stage-fix { stroke: #3a4054; stroke-width: 0.8; }
@media (max-width: 400px) {
  .lock-switch { font-size: 15px; padding-right: 12px; gap: 8px; }
  .lock-switch .knob { width: 34px; height: 34px; }
}

.notice { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--bg); color: var(--text);
  padding: 48px 20px 32px; max-width: 520px; margin: 0 auto; }
.notice[hidden] { display: none; }
.notice ul { padding-left: 20px; line-height: 1.5; }
.notice li { margin-bottom: 10px; }

/* 3D venue view (demo, D-029) */
.venue canvas { display: block; border-radius: 10px; touch-action: pan-y; cursor: grab; }
.venue-cap { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); padding: 6px 2px 2px; }
.venue-reset { min-height: 36px; font-size: 13px; padding: 0 10px; flex: 0 0 auto; }

/* effects: sections, directions, running (D-035) */
.fx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fx-head h2 { margin-bottom: 6px; }
.stop-btn { flex: 0 0 auto; min-height: 40px; font-size: 14px; padding: 0 12px; }
.dir-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.dir-btn { min-height: 44px; font-size: 14px; padding: 0 12px; flex: 1 1 auto; }
.dir-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.card.running { border-color: var(--accent); }
.run-tag { margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--accent-text); background: var(--accent); border-radius: 8px; padding: 1px 8px; vertical-align: middle; }
/* lights in the scene (D-035) */
.lg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lg-head h3 { margin: 0; }
.group-switch { min-height: 44px; min-width: 112px; font-size: 14px; font-weight: 700; }
.group-switch.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { min-height: 44px; min-width: 52px; padding: 0 8px; font-size: 14px; color: var(--muted); }
.chip.on { color: var(--text); border-color: var(--accent); }
.stage.tappable { outline: 2px dashed var(--line); outline-offset: 2px; }
.stage.tappable .stage-fix { cursor: pointer; }
/* six tabs fit a 320-375 px phone (D-035) */
.tabbar button { flex: 1 1 0; min-width: 0; padding: 0 2px; font-size: 14px; }
@media (max-width: 360px) { .tabbar button { font-size: 13px; } }
/* Effects: Color / Movement switch and card label (D-035) */
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 12px 0 4px; }
.seg-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; font-weight: 700; }
.seg-btn small { font-weight: 400; font-size: 12px; color: var(--muted); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.seg-btn[aria-pressed="true"] small { color: var(--accent-text); }
.fx-kind { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 1px 8px; margin: 0 6px 6px 0; border: 1px solid var(--line); }
.fx-kind.color { color: #ffd08a; border-color: #7a5a20; }
.fx-kind.movement { color: #9fd0ff; border-color: #2f5a86; }
.fx-kind.intensity { color: #f2f2f2; border-color: #5a5f6e; }
/* colors for the color effect */
.fx-colours { padding: 10px 12px; }
.fx-tray { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }
.fx-slot { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 64px; padding: 6px; background: var(--panel2); }
.fx-slot i { display: block; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); }
.fx-slot small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.fx-quick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.fx-sw { min-height: 44px; padding: 5px; background: var(--panel2); }
.fx-sw i { display: block; height: 100%; min-height: 32px; border-radius: 6px; border: 1px solid rgba(255,255,255,.18); }
/* groups for the next effect (D-038) */
.fx-groups { padding: 10px 12px; }
.area-lbl { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 10px 0 0; }
.chip.grp { min-width: 0; padding: 0 12px; }
.chip.grp.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.area-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.area-head .area-lbl { margin: 0; }
.area-all { min-height: 36px; font-size: 13px; padding: 0 10px; }
.area-btns { display: flex; gap: 6px; }
.lights-area h2 { margin: 18px 0 6px; }
