/* presenter/app.css — Version: v006 — Slide numbers in the bottom-right corner of thumbnails.
   Version: v005 — Unfilled placeholders in the running order sheet (.os-fill).
   Version: v004 — Control's running order sheet; cue pills.
   Version: v003 — Builds 2 and 3: the On air bar and band,
   sign-in with both ways at once, thumbnails' own number badge (.th-no; the old
   rule styled every span of the slide), the Preaching mode header row and menu,
   Add to Home Screen, tap zones by thirds (no overlay), Continue never wraps.
   Version: v002 — sign-in form (stack).
   Version: v001 — Build 2. Portal styling, phone and iPad. */
:root { --bg: #FCFCFB; --panel: #fff; --text: #14161A; --muted: #5D6470; --faint: #8A909C; --rule: #E6E8EC; --fill: #F2F3F5;
  --accent: #533E8A; --accent-tint: #F1EEF8; --live: #C8312B; --live-tint: #FBEAE9; --green: #2D6A4F; --green-tint: #D8EFE4; --amber: #C4660A; --note: #F5A623;
  --radius: 12px; --safe-t: env(safe-area-inset-top); --safe-b: env(safe-area-inset-bottom); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: "Presenter Poppins", -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
button { font-family: inherit; font-size: 15px; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
svg { display: block; flex-shrink: 0; }
.btn, .btn-sec, .btn-danger { min-height: 44px; padding: 0 16px; border: none; border-radius: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn { background: var(--accent); color: #fff; }
.btn-sec { background: var(--fill); color: var(--muted); font-weight: 500; }
.btn-danger { background: var(--live-tint); color: var(--live); }
.note { color: var(--faint); font-size: 13.5px; }
.warn { color: var(--amber); background: #FBF5EB; border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Service list */
.page { max-width: 760px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(32px + var(--safe-b)); }
.page h1 { font-size: 22px; font-weight: 600; margin: 8px 0 2px; }
.svc { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.svc-t { font-weight: 600; }
.svc-d { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.live-tag { display: inline-block; background: var(--live); color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 10px; padding: 1px 8px; margin-left: 6px; vertical-align: 2px; }
.modes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--fill); border-radius: 10px; }
.seg button { min-height: 36px; padding: 0 12px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.08); }

/* Live views */
.live { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; color: #fff; }
.live.light { background: var(--bg); color: var(--text); }
.bar { display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-t)) 10px 6px; background: #14161A; color: #fff; min-height: 50px; flex-shrink: 0; }
.live.light .bar { background: var(--panel); color: var(--text); border-bottom: 1px solid var(--rule); }
.bar .t { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .t small { display: block; font-weight: 400; font-size: 12px; opacity: .7; }
.ib { width: 40px; height: 40px; border: none; border-radius: 10px; background: rgba(255,255,255,.1); display: inline-flex; align-items: center; justify-content: center; color: inherit; flex-shrink: 0; }
.live.light .ib { background: var(--fill); color: var(--muted); }
.bar .seg { background: rgba(255,255,255,.12); }
.bar .seg button { color: rgba(255,255,255,.75); min-height: 32px; }
.bar .seg button.active { background: #fff; color: #14161A; }
.live.light .bar .seg { background: var(--fill); }
.live.light .bar .seg button { color: var(--muted); }
.live.light .bar .seg button.active { color: var(--text); }
.conn { width: 10px; height: 10px; border-radius: 50%; background: #8A909C; flex-shrink: 0; }
.conn.ok { background: #3DBE7A; }
.conn.bad { background: var(--live); }
.view { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.stage { position: relative; }
.view.ctl { touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.status-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #9AA0A6; font-size: 15px; z-index: 4; }
.strip { flex-shrink: 0; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px calc(8px + var(--safe-b)); background: #14161A; scroll-snap-type: x proximity; }
.strip .th { flex-shrink: 0; border-radius: 4px; overflow: hidden; outline: 3px solid transparent; outline-offset: -1px; position: relative; background: #000; scroll-snap-align: center; }
.strip .th.on { outline-color: var(--live); }
.th-slide { position: absolute; inset: 0; pointer-events: none; }
.th-no { position: absolute; right: 3px; bottom: 3px; font: 600 10px "Presenter Poppins", sans-serif; background: rgba(0,0,0,.6); color: #fff; padding: 0 5px; border-radius: 6px; pointer-events: none; }
.ms-th .th-no { left: 4px; top: 4px; bottom: auto; font-size: 11px; padding: 0 6px; border-radius: 8px; }
.strip.previewing .th.on { outline-color: #8A909C; }
.ctlbar { display: flex; gap: 8px; padding: 8px 10px; background: #14161A; flex-shrink: 0; }
.ctlbar .btn-sec { background: rgba(255,255,255,.12); color: #fff; flex: 1; }
.ctlbar .btn-sec.on { background: #fff; color: #14161A; }

/* Edit */
.edit { flex: 1; display: flex; min-height: 0; background: var(--bg); color: var(--text); }
.edit-list { width: 300px; border-right: 1px solid var(--rule); overflow-y: auto; padding: 8px 0 30px; flex-shrink: 0; }
.edit-main { flex: 1; overflow-y: auto; padding: 14px 16px 40px; min-width: 0; }
.el-sec { padding: 12px 14px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.el-it { display: block; width: 100%; text-align: left; border: none; background: none; padding: 10px 14px; border-left: 3px solid transparent; }
.el-it.on { border-left-color: var(--live); background: var(--live-tint); }
.el-it.sel { background: var(--accent-tint); }
.el-it small { display: block; color: var(--faint); font-size: 12px; }
.in { width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--rule); border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
textarea.in { line-height: 1.5; resize: vertical; }
.rich { min-height: 260px; border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 12px; line-height: 1.55; background: #fff; outline: none; }
.label { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin: 12px 0 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) {
  .edit { flex-direction: column; }
  .edit-list { width: auto; max-height: 34vh; border-right: none; border-bottom: 1px solid var(--rule); }
}

/* Preaching mode */
.preach { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; }
.ms { max-width: 980px; margin: 0 auto; padding: 18px 18px 50vh; }
.ms-b { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; padding: 6px 0; }
.ms-margin { display: flex; flex-direction: column; gap: 8px; }
.ms-text { font-size: var(--ms-size, 21px); line-height: 1.55; }
.ms-text h1, .ms-text h2, .ms-text h3 { font-size: 1.1em; margin: .4em 0; }
.ms-text p { margin: 0; }
.ms-text blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--faint); }
.ms-th { position: relative; border-radius: 6px; overflow: hidden; cursor: pointer; outline: 3px solid transparent; outline-offset: 1px; background: #000; }
.ms-th.on { outline-color: var(--live); }

.ms-note { border-top: 1.5px solid var(--note); color: var(--note); font-size: 12px; font-weight: 600; letter-spacing: .06em; padding-top: 3px; margin: 6px 0 2px; }
.ms-note.cur { border-top-width: 4px; }
.ms-note-body { color: var(--amber); }
.live.dark .ms-note-body { color: var(--note); }
.ms-mark { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; margin-right: 6px; vertical-align: 2px; cursor: pointer; }
.ms-mark.on { background: var(--live); }
.pslides { display: flex; gap: 8px; overflow-x: auto; padding: 8px 10px; flex-shrink: 0; background: var(--fill); }
.live.dark .pslides { background: #14161A; }
.pbar { display: flex; align-items: center; gap: 8px; }
.pclock { font: 600 20px "Presenter League Spartan", sans-serif; min-width: 70px; }
.ptimer { font: 600 17px "Presenter League Spartan", sans-serif; display: inline-flex; align-items: center; gap: 6px; }
.rec { width: 9px; height: 9px; border-radius: 50%; background: var(--live); display: inline-block; }
.follow-on { background: var(--accent) !important; color: #fff !important; }
.pfoot { display: flex; gap: 8px; padding: 8px 10px calc(8px + var(--safe-b)); border-top: 1px solid var(--rule); background: var(--panel); flex-shrink: 0; }
.live.dark .pfoot { background: #14161A; border-top-color: #2A2D33; }
.pfoot .btn, .pfoot .btn-sec { flex: 1; min-width: 0; }
.pfoot .pcont { flex: 1.6; white-space: nowrap; padding: 0 10px; }
.pbar { min-width: 0; overflow: hidden; white-space: nowrap; }
.pnote { font-size: 13px; opacity: .8; }
.grow { flex: 1; }
.pmenu { position: absolute; right: 10px; top: calc(56px + var(--safe-t)); z-index: 20; background: var(--panel); color: var(--text); border: 1px solid var(--rule); border-radius: 12px; padding: 8px 12px; box-shadow: 0 8px 24px rgba(16,24,40,.18); display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
.live.dark .pmenu { background: #22252B; color: #fff; border-color: #33363D; }
.pmenu .ib { background: var(--fill); color: var(--text); }
.live.dark .pmenu .ib { background: rgba(255,255,255,.1); color: #fff; }
@media (max-width: 420px) { .pclock { font-size: 17px; min-width: 0; } .ptimer { font-size: 15px; } .bar { gap: 6px; } }
@media (max-width: 700px) {
  .ms-b { grid-template-columns: minmax(0, 1fr); }
  .ms-margin { display: none; }
}

/* On air and off air */
.airband { flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 30px; padding: 4px 10px; font-size: 13px; font-weight: 600; text-align: center; }
.airband.on { background: var(--live); color: #fff; letter-spacing: .04em; text-transform: uppercase; }
.airband.off { background: #3A3D44; color: #E6E8EC; font-weight: 500; }
.live.light .airband.off { background: var(--fill); color: var(--muted); }
.airband .dot, .onair-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; display: inline-block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.onair-bar { position: sticky; top: 0; z-index: 10; width: 100%; display: flex; align-items: center; gap: 10px; border: none; background: var(--live); color: #fff; font-weight: 600; font-size: 15px;
  padding: calc(12px + var(--safe-t)) 16px 12px; text-align: left; }
.onair-bar svg { margin-left: auto; }
.svc-live { border-color: var(--live); }
.open-tag { background: var(--accent); }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.a2hs { display: flex; align-items: center; gap: 8px; background: var(--accent-tint); color: var(--accent); border-radius: 10px; padding: 8px 8px 8px 12px; font-size: 13.5px; margin-top: 10px; }
.a2hs span { flex: 1; }
.a2hs .ib { background: transparent; color: var(--accent); width: 32px; height: 32px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: #14161A; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; max-width: 86vw; text-align: center; }
#toast.show { opacity: 1; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack .label { margin: 0; }

/* Control: the running order (v004) */
.ordersheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; justify-content: flex-start; }
.os-card { width: min(360px, 86vw); height: 100%; background: var(--panel); color: var(--text); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(10px + var(--safe-t)) 8px calc(16px + var(--safe-b)); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
.os-list { display: flex; flex-direction: column; gap: 2px; }
.os-sec { border: none; background: none; text-align: left; padding: 14px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.os-sec:disabled { color: var(--faint); }
.os-it { display: flex; align-items: center; gap: 10px; border: none; background: none; text-align: left; padding: 10px; border-radius: 8px; border-left: 3px solid transparent; min-height: 44px; font-size: 15px; }
.os-it small { width: 58px; flex-shrink: 0; color: var(--faint); font-size: 12px; }
.os-it span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.os-it.on { background: var(--accent-tint); }
.os-it.air { background: var(--live-tint); border-left-color: var(--live); font-weight: 600; }
.os-it:disabled { opacity: .5; }
.os-tag { font-size: 11px; color: var(--live); text-transform: uppercase; letter-spacing: .06em; }
.os-cue { padding: 2px 10px 2px 78px; }
.cuepill { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 10px; background: #F2F3F5; color: #5D6470; font-size: 12px; line-height: 18px; }
.cuepill .cuedot { width: 7px; height: 7px; border-radius: 1px; background: #5D6470; }
.cuepill.cue-recStart { background: #FBEDEB; color: #8B2B22; } .cue-recStart .cuedot { border-radius: 50%; background: #C0392B; }
.cuepill.cue-timerStart { background: #F4F2FA; color: #533E8A; } .cue-timerStart .cuedot { border-radius: 50%; background: #533E8A; }
/* v005: a placeholder not filled yet: no slides, so nothing to tap */
.os-fill { border: 1px dashed #D9A13B; background: #FFF8EA; color: #8A5A00; font-style: italic; margin: 2px 0; }
.os-fill small { font-style: normal; }
