/* ─────────────────────────────────────────────────────────────────────────────
   control.css  —  Operator Control Panel
   Dark, high-contrast theme suited for dimly-lit live event environments.
───────────────────────────────────────────────────────────────────────────── */

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0f1117;
  --surface:      #1a1d27;
  --surface-2:    #22263a;
  --border:       #2e3348;
  --border-light: #3a4060;
  --text:         #e8eaf6;
  --text-muted:   #7b82a8;
  --text-dim:     #4a5080;
  --accent:       #c8a951;
  --accent-dim:   rgba(200,169,81,.15);
  --green:        #4caf50;
  --red:          #f44336;
  --blue:         #5c7cfa;
  --show-btn:     #2e7d32;
  --show-btn-h:   #388e3c;
  --clear-btn:    #c62828;
  --clear-btn-h:  #d32f2f;
  --radius:       8px;
  --radius-sm:    4px;
  --font:         system-ui, -apple-system, 'Segoe UI', sans-serif;
  --settings-panel-expanded: 430px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── App Shell ────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 0 40px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
}

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

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background .2s, color .2s;
}

.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-off  { background: rgba(120,120,140,.2); color: var(--text-muted); }
.status-live { background: rgba(244,67,54,.2);   color: #ff5252; animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* Session ID Badge — click to copy output URL */
.btn-session-id {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: rgba(200,169,81,.1);
  border: 1px solid rgba(200,169,81,.25);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: monospace;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-session-id svg { width: 11px; height: 11px; flex-shrink: 0; }
.btn-session-id:hover { background: rgba(200,169,81,.2); border-color: var(--accent); color: var(--accent); }
.btn-session-id.copied { color: var(--green); border-color: var(--green); background: rgba(76,175,80,.15); }

/* New Session Button */
.btn-session {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn-session svg { width: 13px; height: 13px; }
.btn-session:hover { background: var(--surface-2); border-color: var(--border-light); color: var(--text-muted); }

/* Output Window Button */
.btn-output-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-output-link svg { width: 14px; height: 14px; }
.btn-output-link:hover { background: var(--border); border-color: var(--accent); color: var(--accent); }

.btn-settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-settings-toggle svg { width: 14px; height: 14px; }
.btn-settings-toggle:hover,
.btn-settings-toggle.active {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Mode Toggle ──────────────────────────────────────────────────────────── */
.mode-toggle {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.mode-tab svg { width: 18px; height: 18px; }
.mode-tab:hover { color: var(--text); background: var(--surface-2); }
.mode-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface-2);
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
.app-main {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.app-main.settings-open {
  grid-template-columns: minmax(0, 1fr) clamp(360px, 34vw, var(--settings-panel-expanded));
}
.app-main.settings-open .text-effects-grid { grid-template-columns: 1fr; }

.app-main > :not(.settings-panel) {
  grid-column: 1;
}

.control-column {
  grid-column: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Panels ───────────────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.panel.hidden { display: none; }

/* ── Field Grid ───────────────────────────────────────────────────────────── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px 14px;
}

/* Compact Bible form layout (desktop):
   Row 1: Book | Chapter | Verse(s)
   Row 2: Translation | Reference Language
   Row 3: Line options checkboxes */
.bible-grid {
  grid-template-columns: minmax(220px, 1.45fr) minmax(120px, 0.7fr) minmax(220px, 1.15fr);
  gap: 12px 12px;
}
.bible-grid .bible-book { grid-column: 1; }
.bible-grid .bible-chapter { grid-column: 2; }
.bible-grid .bible-verse { grid-column: 3; }
.bible-grid .bible-translation { grid-column: 1 / span 2; }
.bible-grid .bible-ref-lang { grid-column: 3; }
.bible-grid .bible-line-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 14px;
  margin-top: -2px;
}

/* Compact Speaker layout (desktop): Name + Title on one row */
.speaker-grid {
  grid-template-columns: minmax(280px, 1.3fr) minmax(220px, 1fr);
  gap: 12px;
}
.speaker-grid .speaker-name { grid-column: 1; }
.speaker-grid .speaker-title { grid-column: 2; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group.span-2  { grid-column: span 2; }
.field-group.span-full { grid-column: 1 / -1; }

label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  margin-left: 4px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .95rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b82a8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

input::placeholder { color: var(--text-dim); }

/* ── Verse Reference Validation ───────────────────────────────────────────── */
.verse-validation {
  font-size: .78rem;
  min-height: 1.2em;
  padding: 2px 0;
  transition: color .15s;
}
.verse-validation.valid   { color: #4caf50; }
.verse-validation.invalid { color: #f44336; }
.verse-validation.warning { color: #ff9800; }

/* ── Program + Preview Monitors ───────────────────────────────────────────── */
.monitors-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.monitors-section .monitor-block { order: 1; }
#monitor-program-block { order: 2; }

.monitor-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.monitor-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.monitor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* PGM — grey when off air, red + pulse when live */
.monitor-label-pgm { color: var(--text-dim); }
#monitor-program-block.live .monitor-label-pgm {
  color: #ff5252;
  animation: pulse 1.5s infinite;
}

/* PVW — blue */
.monitor-label-pvw { color: var(--blue); }

/* Shared viewport used by both monitors */
.monitor-viewport,
.preview-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s;
}

/* PGM viewport — red glow when live */
#monitor-program-block.live .monitor-viewport {
  border-color: #f44336;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, .2);
}

/* PVW viewport — blue border always */
.monitor-label-pvw ~ .preview-viewport,
.monitor-label-pvw ~ .monitor-viewport {
  border-color: rgba(92, 124, 250, .4);
}

/* Off-air overlay inside PGM when nothing is live */
.monitor-off-air {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.preview-bg {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      #1a1d27 0, #1a1d27 10px,
      #1e2130 10px, #1e2130 20px
    );
}

/* Custom template preview is positioned like the output wrapper. */
.preview-custom-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  padding: 0 4%;
  overflow: hidden;
  pointer-events: none;
}
.preview-custom-wrap.pos-upper  { bottom: auto; top: 8%; }
.preview-custom-wrap.pos-center { bottom: auto; top: 50%; transform: translateY(-50%); }

.lower-third-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  padding: 0 4%;
}
.lower-third-wrap.pos-upper  { bottom: auto; top: 8%; }
.lower-third-wrap.pos-center { bottom: auto; top: 50%; transform: translateY(-50%); }

/* Scale a 1920x1080 custom-template stage into monitor viewport. */
.monitor-custom-stage {
  position: relative;
  width: 1920px;
  min-height: 1px;
  transform-origin: top left;
  pointer-events: none;
  will-change: transform;
}

.lower-third {
  display: flex;
  align-items: stretch;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  transition: opacity .4s, transform .4s;
}

/* Accent variants set via JS */
.lt-accent {
  width: 5px;
  background: var(--accent);
  flex-shrink: 0;
  transition: background .3s;
}

/* Logo in preview — mirrors output.css logic; JS sets --logo-max-h-preview */
.lt-logo {
  display: block;
  height: auto;
  max-height: var(--logo-max-h-preview, 36px);
  width: auto;
  max-width: 22%;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  align-self: center;
  padding: 2px 3px;
  background: transparent;
}
.lt-logo.hidden { display: none; }

.lt-text {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  gap: 2px;
  background: rgba(0,0,0,.82);
  flex: 1;
  min-width: 0;
}

.lt-line1 {
  font-size: var(--monitor-line1-size, 1.15em);
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lt-line2 {
  font-size: var(--monitor-line2-size, .72em);
  font-weight: 400;
  color: rgba(255,255,255,.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: var(--monitor-line2-lh, 1.2);
}

.lt-line2 .verse-num {
  font-size: 0.62em;
  line-height: 0;
  vertical-align: super;
  position: relative;
  top: -0.12em;
  margin-right: 0.22em;
  font-weight: 700;
}

/* ── Action Buttons ───────────────────────────────────────────────────────── */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-show, .btn-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-show svg, .btn-clear svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-show {
  background: var(--show-btn);
  color: #fff;
  box-shadow: 0 2px 8px rgba(46,125,50,.4);
}
.btn-show:hover { background: var(--show-btn-h); box-shadow: 0 4px 14px rgba(56,142,60,.5); }
.btn-show:active { transform: scale(.97); }
.btn-show:disabled {
  background: #2b3f2c;
  color: rgba(255,255,255,.45);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-show:disabled svg { opacity: .55; }

.btn-clear {
  background: var(--clear-btn);
  color: #fff;
  box-shadow: 0 2px 8px rgba(198,40,40,.4);
}
.btn-clear:hover { background: var(--clear-btn-h); box-shadow: 0 4px 14px rgba(211,47,47,.5); }
.btn-clear:active { transform: scale(.97); }

/* ── Settings Panel ───────────────────────────────────────────────────────── */
.settings-panel {
  grid-column: 2;
  grid-row: 1 / span 20;
  display: none;
  position: sticky;
  top: 84px;
  align-self: start;
  height: calc(100vh - 100px);
  max-height: calc(100vh - 100px);
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}
.app-main.settings-open .settings-panel { display: flex; }

.settings-panel summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color .15s, background .15s;
}
.settings-panel summary svg { width: 16px; height: 16px; }
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary:hover { color: var(--text); background: var(--surface-2); }
.settings-panel[open] summary { color: var(--accent); border-bottom: 1px solid var(--border); }
.settings-panel:not([open]) summary {
  justify-content: center;
  padding: 14px 8px;
}
.settings-panel:not([open]) .settings-summary-label { display: none; }

.settings-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.setting-group.span-full { grid-column: 1 / -1; }

.setting-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

/* Chroma key swatches */
.chroma-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chroma-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  transition: border-color .15s;
}
.chroma-opt:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.chroma-opt input[type="radio"] { accent-color: var(--accent); }

.chroma-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,.2);
  flex-shrink: 0;
}

/* Checkerboard swatch for the Transparent chroma option */
.chroma-swatch-alpha {
  background-image:
    linear-gradient(45deg, #666 25%, transparent 25%),
    linear-gradient(-45deg, #666 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #666 75%),
    linear-gradient(-45deg, transparent 75%, #666 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0px;
  background-color: #aaa;
}

/* Transparent mode helper note */
.chroma-transparent-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 12px;
  background: rgba(92,124,250,.08);
  border: 1px solid rgba(92,124,250,.25);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.chroma-transparent-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; color: var(--blue); }
.chroma-transparent-note strong { color: var(--text); }
.chroma-transparent-note em { color: var(--accent); font-style: normal; }

/* Browser Source info block */
.browser-source-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
}

.bsi-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bsi-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bsi-url {
  flex: 1;
  font-family: monospace;
  font-size: .72rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.bsi-copy {
  flex-shrink: 0;
  padding: 3px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.bsi-copy svg { width: 12px; height: 12px; display: block; }
.bsi-copy:hover { color: var(--accent); border-color: var(--accent); }

.bsi-help {
  position: relative;
  margin-left: auto;
}
.bsi-help > summary {
  list-style: none;
}
.bsi-help > summary::-webkit-details-marker { display: none; }
.bsi-help-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, color .15s, background .15s;
}
.bsi-help[open] .bsi-help-btn,
.bsi-help-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200,169,81,.12);
}

.bsi-notes {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 25;
  width: min(520px, calc(100vw - 80px));
  max-height: 62vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  color: var(--text-dim);
  line-height: 1.55;
}
.bsi-notes p { margin: 0; }
.bsi-notes strong { color: var(--text-muted); }
.bsi-notes code {
  font-family: monospace;
  font-size: .9em;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-muted);
}
.bsi-notes em { color: var(--accent); font-style: normal; }

.custom-chroma-opt input[type="color"] {
  width: 32px;
  height: 24px;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: 3px;
}

input[type="color"] {
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 2px;
  height: 36px;
  width: 100%;
}

/* ── Text Alignment Options ───────────────────────────────────────────────── */
.align-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.align-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  color: var(--text);
  transition: border-color .15s, color .15s;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.align-opt:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.align-opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.align-opt svg {
  width: 20px;
  height: 14px;
  flex-shrink: 0;
}

/* ── File Upload Rows ─────────────────────────────────────────────────────── */
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.file-btn svg { width: 14px; height: 14px; }
.file-btn:hover { background: var(--border); border-color: var(--accent); color: var(--accent); }
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
  width: 100%;
  height: 100%;
}

.file-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  background: rgba(198,40,40,.15);
  border: 1px solid rgba(198,40,40,.3);
  border-radius: var(--radius-sm);
  color: #ef9a9a;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.file-clear-btn svg { width: 12px; height: 12px; }
.file-clear-btn:hover { background: rgba(198,40,40,.3); }

.file-name {
  font-size: .82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.file-preview-wrap {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  max-height: 80px;
}

.file-preview-img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
}

/* ── Logo Controls ────────────────────────────────────────────────────────── */
.logo-controls {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-preview-wrap {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: repeating-linear-gradient(45deg, #22263a 0, #22263a 6px, #1a1d27 6px, #1a1d27 12px);
  height: 60px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview-img {
  max-height: 56px;
  max-width: 116px;
  object-fit: contain;
}

/* ── Slider Controls ─────────────────────────────────────────────────────── */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.slider-value {
  font-size: .8rem;
  color: var(--text-muted);
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Background Image Fit Controls ──────────────────────────────────────── */
.bg-fit-controls {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.bg-fit-controls .setting-group.span-full { grid-column: 1 / -1; }

/* ── Text Effects Controls ──────────────────────────────────────────────── */
.text-effects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.textfx-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.textfx-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}
.textfx-tab:hover { color: var(--text); }
.textfx-tab.active {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.text-effects-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.text-effects-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Template Example Row ───────────────────────────────────────────────── */
.template-example-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.template-example-row select {
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  cursor: pointer;
}

.template-preset-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.template-preset-select {
  min-width: 240px;
  max-width: 100%;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: .82rem;
}

/* ── Lower Third Style Variants (preview) ─────────────────────────────────── */

/* accent-only */
.style-accent .lt-text {
  background: transparent;
  border-top: 3px solid var(--accent, #C8A951);
  padding-left: 0;
  padding-bottom: 0;
}
.style-accent .lt-accent    { display: none; }
.style-accent .lt-line1     { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.style-accent .lt-line2     { color: rgba(255,255,255,.85); }

/* minimal */
.style-minimal .lt-text     { background: transparent; }
.style-minimal .lt-accent   { display: none; }
.style-minimal .lt-line1    { color: #fff; text-shadow: 0 0 16px rgba(0,0,0,1), 0 2px 4px rgba(0,0,0,.9); }
.style-minimal .lt-line2    { color: rgba(255,255,255,.85); text-shadow: 0 0 12px rgba(0,0,0,1); }
.style-minimal .lower-third { box-shadow: none; }

/* outline */
.style-outline .lt-text     { background: transparent; }
.style-outline .lt-accent   { display: none; }
.style-outline .lt-line1    { color: #fff; -webkit-text-stroke: 1.5px rgba(0,0,0,.9); text-shadow: 0 0 14px rgba(0,0,0,.7); }
.style-outline .lt-line2    { color: rgba(255,255,255,.85); -webkit-text-stroke: 1px rgba(0,0,0,.8); }
.style-outline .lower-third { box-shadow: none; }

/* gradient fade */
.style-gradient .lt-text    { background: linear-gradient(to right, rgba(0,0,0,.88) 0%, rgba(0,0,0,.60) 60%, rgba(0,0,0,0) 100%); padding-right: 24px; }
.style-gradient .lt-line1   { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.style-gradient .lt-line2   { color: rgba(255,255,255,.85); }
.style-gradient .lower-third { box-shadow: none; overflow: visible; }

/* scripture wrap */
.style-scripture .lower-third { box-shadow: none; overflow: visible; }
.style-scripture .lt-text {
  background: linear-gradient(to right, rgba(0,0,0,.9) 0%, rgba(0,0,0,.7) 72%, rgba(0,0,0,.35) 100%);
  padding: 14px 24px;
  gap: 8px;
}
.style-scripture .lt-line1 { font-size: clamp(20px, 2vw, 30px); letter-spacing: .02em; }
.style-scripture .lt-line2 {
  font-size: clamp(16px, 1.55vw, 24px);
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* scripture panel (highest capacity) */
.style-scripture-panel .lower-third { box-shadow: none; overflow: visible; }
.style-scripture-panel .lt-accent { width: 5px; }
.style-scripture-panel .lt-text {
  background: rgba(0,0,0,.82);
  border: 1px solid rgba(255,255,255,.18);
  padding: 12px 20px;
  gap: 10px;
}
.style-scripture-panel .lt-line1 {
  font-size: clamp(18px, 1.8vw, 26px);
  color: #f8e7b5;
  letter-spacing: .06em;
}
.style-scripture-panel .lt-line2 {
  font-size: clamp(15px, 1.45vw, 22px);
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* solid accent fill */
.style-solid .lt-text       { background: var(--accent, #C8A951); }
.style-solid .lt-accent     { background: rgba(0,0,0,.25); width: 4px; }
.style-solid .lt-line1      { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.style-solid .lt-line2      { color: rgba(255,255,255,.88); }

/* split lines */
.style-split .lt-text       { background: rgba(0,0,0,.65); border-top: 2px solid var(--accent, #C8A951); border-bottom: 2px solid var(--accent, #C8A951); padding-left: 0; }
.style-split .lt-accent     { display: none; }
.style-split .lt-line1      { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.9); }
.style-split .lt-line2      { color: rgba(255,255,255,.85); }
.style-split .lower-third   { box-shadow: none; }

/* frosted glass */
.style-frosted .lt-text     { background: rgba(255,255,255,.75); }
.style-frosted .lt-accent   { width: 4px; }
.style-frosted .lt-line1    { color: #111; text-shadow: none; }
.style-frosted .lt-line2    { color: rgba(0,0,0,.60); text-shadow: none; }

/* ── WebSocket Indicator ──────────────────────────────────────────────────── */
.ws-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-dim);
  transition: background .3s;
}
.ws-indicator[data-state="online"]  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ws-indicator[data-state="offline"] { background: var(--text-dim); }
.ws-indicator[data-state="error"]   { background: var(--red); }

/* ── Multiple Output Targets counter badge ────────────────────────────────── */
.btn-output-link { position: relative; }
.btn-output-link[data-count]:not([data-count=""])::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ── Verse Text Lookup ────────────────────────────────────────────────────── */
.lookup-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.btn-lookup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-lookup svg { width: 13px; height: 13px; flex-shrink: 0; }
.btn-lookup:hover { background: var(--border); border-color: var(--accent); color: var(--accent); }

.lookup-status {
  font-size: .78rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}
.lookup-status.lookup-loading { color: var(--blue); }
.lookup-status.lookup-error   { color: var(--red); }

.verse-text-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.verse-text-content {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.55;
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}
.verse-ref-note {
  font-size: .75rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0;
}
.verse-text-include input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
.verse-text-include:has(input:disabled) { opacity: .55; cursor: not-allowed; }

.verse-text-include {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--text-muted);
  cursor: pointer;
}
.verse-text-include input[type="checkbox"] { cursor: pointer; }

/* ── Presets ──────────────────────────────────────────────────────────────── */
.presets-section {
  padding: 10px 20px 4px;
  border-bottom: 1px solid var(--border);
}

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

.presets-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

.presets-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-save-preset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-save-preset svg { width: 12px; height: 12px; }
.btn-save-preset:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }

/* Export / Import buttons */
.btn-preset-io {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .72rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-preset-io svg { width: 11px; height: 11px; }
.btn-preset-io:hover { background: var(--surface-2); border-color: var(--border-light); color: var(--text-muted); }

.presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 10px;
  min-height: 28px;
}

.settings-profiles {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  padding-bottom: 8px;
}

.settings-profiles-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.settings-profiles-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.settings-profiles-select {
  min-width: 220px;
  max-width: 300px;
  flex: 1 1 240px;
  height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: .78rem;
}

.presets-empty {
  font-size: .78rem;
  color: var(--text-dim);
  font-style: italic;
  align-self: center;
}

.preset-chip {
  display: inline-flex;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 220px;
}

.preset-load {
  flex: 1;
  padding: 5px 10px;
  background: none;
  border: none;
  color: var(--text);
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.preset-load:hover { background: var(--border); color: var(--accent); }

.preset-delete {
  flex-shrink: 0;
  padding: 0 8px;
  background: none;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  line-height: 1;
}
.preset-delete:hover { background: rgba(244,67,54,.15); color: var(--red); }

/* ── Custom Template Editor ───────────────────────────────────────────────── */
.template-section-label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.template-section-label svg { width: 15px; height: 15px; color: var(--accent); }

.template-enable-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 10px;
}

.template-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-reset-template {
  flex-shrink: 0;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .75rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-reset-template:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }

.template-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-field-group { display: flex; flex-direction: column; gap: 4px; }

.template-textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  font-size: .78rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color .15s;
}
.template-textarea:focus { outline: none; border-color: var(--accent); }

/* ── Ticker Tape ──────────────────────────────────────────────────────────── */

/* Live indicator pill for ticker status */
.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: rgba(204,0,0,.2);
  color: #ff5252;
}
.ticker-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.ticker-pill.live { animation: pulse 1.5s infinite; }

/* Ticker panel field layout */
.ticker-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.ticker-panel-grid .span-full { grid-column: 1 / -1; }

/* Compact Ticker layout (desktop):
   Row 1: message
   Row 2: badge | speed | style | position */
.ticker-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.ticker-grid .span-full { grid-column: 1 / -1; }
.ticker-grid .ticker-badge { grid-column: 1; }
.ticker-grid .ticker-speed { grid-column: 2; }
.ticker-grid .ticker-style { grid-column: 3; }
.ticker-grid .ticker-position { grid-column: 4; }

/* Custom color row — hidden unless "custom" is selected */
#ticker-custom-colors { display: none; }
#ticker-custom-colors.visible { display: contents; }

/* ── Ticker Preview (inside the preview viewport) ────────────────────────── */
.preview-ticker-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
.preview-ticker-wrap.pos-top { bottom: auto; top: 0; }

.preview-ticker-bar {
  display: flex;
  align-items: stretch;
  height: 18px;
  overflow: hidden;
}

.preview-ticker-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 5px;
  font-size: 5.5px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(0,0,0,.25);
  border-right: 1px solid rgba(255,255,255,.25);
}

.preview-ticker-text {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 5px;
  font-size: 7px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ── Keyboard Hint ────────────────────────────────────────────────────────── */
.kbd-hint {
  text-align: center;
  font-size: .75rem;
  color: var(--text-dim);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  font-family: monospace;
  font-size: .8em;
  color: var(--text-muted);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }
  .field-group.span-2 { grid-column: span 2; }

  .setting-row {
    grid-template-columns: 1fr;
  }
  .text-effects-grid {
    grid-template-columns: 1fr;
  }

  .actions { grid-template-columns: 1fr 1fr; }

  .align-options {
    flex-wrap: wrap;
  }

  h1 { font-size: 1rem; }

  .app-main { padding: 10px; gap: 12px; }
  .panel { padding: 12px; }
  .presets-section { padding: 8px 12px 2px; }
  .kbd-hint { font-size: .68rem; }

  /* Keep monitors side-by-side and shorter on small phones */
  .monitors-section { grid-template-columns: 1fr 1fr; gap: 6px; }
  .monitor-viewport,
  .preview-viewport { aspect-ratio: 16 / 7; }
  .monitor-label { font-size: .62rem; }

  .btn-show, .btn-clear {
    padding: 12px 10px;
    font-size: .82rem;
    letter-spacing: .07em;
  }

  .bible-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 10px;
  }
  .bible-grid .bible-book { grid-column: 1 / -1; }
  .bible-grid .bible-chapter { grid-column: 1; }
  .bible-grid .bible-verse { grid-column: 2; }
  .bible-grid .bible-translation { grid-column: 1 / -1; }
  .bible-grid .bible-ref-lang { grid-column: 1 / -1; }
  .bible-grid .bible-line-options { grid-template-columns: 1fr; gap: 6px; }

  .speaker-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .speaker-grid .speaker-name,
  .speaker-grid .speaker-title { grid-column: 1 / -1; }

  .ticker-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .ticker-grid .ticker-badge,
  .ticker-grid .ticker-speed,
  .ticker-grid .ticker-style,
  .ticker-grid .ticker-position { grid-column: auto; }
}

@media (max-width: 420px) {
  .ticker-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 1100px) {
  .app { max-width: 760px; }
  .btn-settings-toggle { display: none; }
  .app-main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .control-column {
    overflow: visible;
  }
  .settings-panel {
    display: flex;
    position: static;
    height: auto;
    max-height: none;
    width: 100%;
    overflow: hidden;
  }
  .settings-panel:not([open]) summary {
    justify-content: flex-start;
    padding: 14px 20px;
  }
  .settings-panel:not([open]) .settings-summary-label { display: inline; }
  .bsi-notes {
    width: min(440px, 85vw);
    right: 0;
  }
}

@media (max-width: 900px) {
  .monitors-section { grid-template-columns: 1fr 1fr; gap: 8px; }
  .bible-grid {
    grid-template-columns: minmax(170px, 1.1fr) minmax(110px, 0.7fr) minmax(170px, 1fr);
  }
  .bible-grid .bible-line-options {
    grid-template-columns: 1fr 1fr;
  }

  .ticker-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .app-header {
    padding: 10px 10px;
  }
  .header-right {
    gap: 6px;
    min-width: 0;
  }
  .btn-session {
    display: none;
  }
  .btn-session-id {
    padding: 4px 7px;
  }
  #session-id-text {
    display: none;
  }
  .status-pill {
    font-size: .66rem;
    padding: 3px 8px;
  }
  .btn-output-link,
  .btn-settings-toggle {
    padding: 6px 8px;
    font-size: .74rem;
  }
  .btn-output-link {
    width: 34px;
    justify-content: center;
    font-size: 0;
    padding: 6px;
  }
  .mode-tab {
    padding: 11px 8px;
    font-size: .82rem;
  }

  .app-main { padding: 12px; gap: 14px; }
  .control-column { gap: 14px; }
  .panel { padding: 14px; }
  .field-grid { gap: 12px 10px; }
  .label-hint { display: inline; }

  .monitors-section { grid-template-columns: 1fr 1fr; gap: 7px; }
  .monitor-viewport,
  .preview-viewport { aspect-ratio: 16 / 8; }

  .actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding-top: 6px;
    background: linear-gradient(to top, rgba(15,17,23,1) 70%, rgba(15,17,23,0));
  }

  .bible-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 10px;
  }
  .bible-grid .bible-book { grid-column: 1 / -1; }
  .bible-grid .bible-chapter { grid-column: 1; }
  .bible-grid .bible-verse { grid-column: 2; }
  .bible-grid .bible-translation { grid-column: 1 / -1; }
  .bible-grid .bible-ref-lang { grid-column: 1 / -1; }
  .bible-grid .bible-line-options { grid-template-columns: 1fr; gap: 6px; }

  .speaker-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .speaker-grid .speaker-name,
  .speaker-grid .speaker-title { grid-column: 1 / -1; }

  .ticker-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .ticker-grid .ticker-badge,
  .ticker-grid .ticker-speed,
  .ticker-grid .ticker-style,
  .ticker-grid .ticker-position { grid-column: auto; }
}

@media (min-width: 1101px) {
  html, body {
    overflow: hidden;
  }
  .app {
    height: 100vh;
    max-width: min(1600px, 100vw);
    padding-bottom: 0;
  }
  .app-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }
  .control-column {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    overscroll-behavior: contain;
  }
  .actions {
    position: sticky;
    bottom: 0;
    z-index: 6;
    padding-top: 8px;
    background: linear-gradient(to top, rgba(15,17,23,1) 60%, rgba(15,17,23,0));
  }
  .settings-panel {
    position: relative;
    top: 0;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }
  .settings-panel[open] .settings-body {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
  }
}
