/* BCC Service. Bethany City Church brand: raspberry #B63D65, navy #24264f, cream #f8f2f1. */
@font-face { font-family: "Kumbh Sans"; src: url("fonts/kumbh-sans.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("fonts/nunito.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --brand: #B63D65;
  --brand-hi: #e2578a;
  --violet: #8a5cf6;
  --navy: #24264f;
  --ink: #14152e;
  --ink-2: #1b1d3d;
  --cream: #f8f2f1;
  --text: #f4eef3;
  --muted: #a9a8c6;
  --line: rgba(255,255,255,.09);
  --glass: rgba(255,255,255,.055);
  --glass-2: rgba(255,255,255,.09);
  --ok: #34d399;
  --warn: #ffb547;
  --over: #ff4d6a;
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(0,0,0,.6);
  --head: "Kumbh Sans", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 800px at 80% -10%, #2c2c63 0%, transparent 60%), var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .time, .btn, button { font-family: var(--head); }
a { color: var(--brand-hi); }

/* Soft moving colour blobs behind everything */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .28; animation: drift 26s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: var(--brand); left: -20vmax; top: -20vmax; }
.aurora span:nth-child(2) { background: var(--violet); right: -25vmax; bottom: -30vmax; animation-duration: 32s; opacity: .2; }
.aurora span:nth-child(3) { background: #2f6fd6; left: 30vmax; top: 40vh; width: 40vmax; height: 40vmax; animation-duration: 38s; opacity: .12; }
@keyframes drift { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(6vmax, 4vmax) scale(1.12); } }

/* ───────────── Admin shell ───────────── */
body.admin { display: grid; grid-template-columns: 250px 1fr; }
.side { position: sticky; top: 0; height: 100vh; z-index: 2; display: flex; flex-direction: column; gap: 22px; padding: 26px 18px; background: rgba(20,21,46,.72); backdrop-filter: blur(18px); border-right: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); padding: 0 8px; }
.brand img { width: 150px; height: auto; }
.brand span { font-family: var(--head); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 700; transition: background .2s, color .2s, transform .2s; }
.side nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side nav a:hover { background: var(--glass); color: var(--text); transform: translateX(2px); }
.side nav a.on { background: linear-gradient(135deg, rgba(182,61,101,.35), rgba(138,92,246,.22)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.who { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--glass); font-size: 14px; }
.main { position: relative; z-index: 1; padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.top h1 { margin: 0 0 22px; font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.01em; }

.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(14px); animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.card h2 { margin: 0 0 14px; font-size: 18px; }
.card h2 small { font-family: var(--body); font-weight: 600; color: var(--muted); font-size: 13px; margin-left: 6px; }
.card + .card { margin-top: 18px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; color: #fff; text-decoration: none; background: var(--glass-2); box-shadow: inset 0 0 0 1px var(--line); transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.14); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--brand), #d04f80); box-shadow: 0 10px 24px -10px rgba(182,61,101,.9); }
.btn.go { background: linear-gradient(135deg, #10b981, #34d399); color: #052e22; box-shadow: 0 10px 24px -10px rgba(52,211,153,.8); }
.btn.danger { background: linear-gradient(135deg, #e11d48, #ff4d6a); }
.btn.warn { background: linear-gradient(135deg, #f59e0b, #ffb547); color: #3b2300; }
.btn.big { padding: 18px 22px; font-size: 18px; border-radius: 16px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
button.link { background: none; border: 0; color: var(--brand-hi); cursor: pointer; font: inherit; font-weight: 700; padding: 0; }

label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: rgba(0,0,0,.25); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-hi); box-shadow: 0 0 0 4px rgba(226,87,138,.2); }
select option { background: var(--ink-2); }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 700; animation: rise .4s both; }
.flash.ok { background: rgba(52,211,153,.14); color: #8ff0c7; box-shadow: inset 0 0 0 1px rgba(52,211,153,.3); }
.flash.err { background: rgba(255,77,106,.14); color: #ffb3c0; box-shadow: inset 0 0 0 1px rgba(255,77,106,.35); }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; background: rgba(0,0,0,.35); padding: 12px; border-radius: 10px; border: 1px dashed rgba(255,255,255,.2); }

table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th { text-align: left; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
.table-wrap table.list td, .table-wrap table.list th { white-space: nowrap; }
table.list td input:not([type]) { min-width: 190px; }
table.list td select { min-width: 130px; }
table.list td input[type=number] { min-width: 90px; }
table.list td input[type=time] { min-width: 120px; }
table.list tr { transition: background .2s; }
table.list tbody tr:hover { background: rgba(255,255,255,.03); }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; background: var(--glass-2); }
.tag.ok { background: rgba(52,211,153,.16); color: #8ff0c7; }
.tag.over { background: rgba(255,77,106,.16); color: #ffb3c0; }
.tag.warn { background: rgba(255,181,71,.16); color: #ffd79a; }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; align-items: center; }

.stat { padding: 18px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); animation: rise .5s both; }
.stat b { display: block; font-family: var(--head); font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bars .b i { width: 100%; max-width: 42px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--brand-hi), var(--violet)); transform-origin: bottom; animation: grow .9s cubic-bezier(.2,.8,.2,1) both; }
.bars .b i.over { background: linear-gradient(180deg, #ff8a3d, var(--over)); }
.bars .b small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.bars .b em { font-style: normal; font-size: 12px; font-weight: 800; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Control page */
.live { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; }
.mini-dial { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto; }
.mini-dial .dial-text .time { font-size: clamp(44px, 6vw, 64px); }
.ctrls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
.ctrls .wide { grid-column: span 2; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.preset { position: relative; overflow: hidden; }
.preset.mic { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.status-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); font-weight: 800; font-size: 14px; transition: background .3s, color .3s; }
.pill i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.pill.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.7); animation: ping 2s infinite; }
.pill.off { background: rgba(255,77,106,.18); color: #ffc2cc; animation: blinkbg 1s steps(2) infinite; }
.pill.off i { background: var(--over); }
.pill.waiting { background: rgba(255,181,71,.18); color: #ffd79a; animation: blinkbg 1s steps(2) infinite; }
.pill.acked { background: rgba(52,211,153,.18); color: #8ff0c7; }
.pill.unanswered { background: rgba(255,77,106,.18); color: #ffc2cc; animation: blinkbg 1s steps(2) infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 80%, 100% { box-shadow: 0 0 0 10px rgba(52,211,153,0); } }
@keyframes blinkbg { 50% { filter: brightness(1.5); } }

/* ───────────── Login ───────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; z-index: 1; }
.login .card { width: 100%; max-width: 400px; padding: 34px 28px; }
.login img { width: 170px; display: block; margin: 0 auto 6px; }
.login h1 { text-align: center; font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 24px; }
.login .btn { width: 100%; margin-top: 6px; }

/* ───────────── Screens (iPad and room displays) ───────────── */
body.screen { overflow: hidden; height: 100vh; height: 100dvh; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: background-color .8s; }
.screen > * { position: relative; z-index: 1; }
.screen .aurora { z-index: 0; }
.s-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(16px, env(safe-area-inset-top)) 24px 8px; }
.s-logo { height: 34px; width: auto; }
.s-service { font-family: var(--head); font-weight: 700; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 14px; flex: 1; text-align: center; }
.s-right { display: flex; align-items: center; gap: 14px; }
.s-clock { font-family: var(--head); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); }
.conn i { width: 10px; height: 10px; border-radius: 50%; background: var(--warn); }
.conn.ok i { background: var(--ok); animation: ping 2s infinite; }
.conn.ok b { display: none; }
.conn.bad i { background: var(--over); }
.conn.bad { color: #ffb3c0; }

.dial-wrap { flex: 1; display: grid; place-items: center; padding: 8px 16px 24px; min-height: 0; }
.dial { position: relative; width: min(82vmin, 760px); aspect-ratio: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: rgba(255,255,255,.07); }
.ring .warnmark { stroke: rgba(255,181,71,.35); stroke-width: 9; }
.ring .arc { stroke: url(#g-run); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .6s; filter: drop-shadow(0 0 10px rgba(226,87,138,.55)); }
.stage-warning .ring .arc { stroke: url(#g-warn); filter: drop-shadow(0 0 12px rgba(255,181,71,.6)); }
.stage-overtime .ring .arc { stroke: url(#g-over); filter: drop-shadow(0 0 16px rgba(255,77,106,.8)); }
.dial-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.dial-text .label { font-family: var(--head); font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: clamp(14px, 2.4vmin, 24px); color: var(--muted); transition: color .4s; }
.dial-text .time { font-weight: 800; font-size: clamp(72px, 21vmin, 220px); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin: 1.5vmin 0; transition: color .4s, transform .4s; }
.dial-text .sub { font-weight: 700; font-size: clamp(16px, 3vmin, 30px); color: var(--muted); }
.stage-idle .dial-text .time { opacity: .35; }
.stage-paused .dial-text .time { opacity: .5; }
.stage-paused .dial-text .label { color: #a5b4fc; }
.stage-warning .dial-text .label { color: var(--warn); }
.stage-warning .dial-text .time { color: #ffe1b0; }
.stage-overtime .dial-text .label { color: #ffb3c0; }
.stage-overtime .dial-text .time { color: #fff; }

/* Overtime: a gentle red pulse, once a second (well under 3 flashes per second). */
.flashwash { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(circle at 50% 55%, rgba(255,77,106,.55), rgba(217,30,72,.25) 60%, transparent 80%); opacity: 0; }
.stage-overtime .flashwash { animation: wash 2s ease-in-out infinite; }
.stage-warning .flashwash { background: radial-gradient(circle at 50% 55%, rgba(255,181,71,.18), transparent 70%); opacity: 1; animation: none; }
@keyframes wash { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
.stage-overtime .dial { animation: beat 2s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.015); } }

.desk-strip { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; padding: 0 16px 28px; }

/* Room displays */
.room { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 16px 6vw 40px; gap: 2vmin; }
.room-kicker { font-family: var(--head); font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); font-size: clamp(14px, 2.5vmin, 26px); }
.room-status { font-family: var(--head); font-weight: 800; font-size: clamp(44px, 12vmin, 150px); line-height: 1.05; letter-spacing: -.02em; background: linear-gradient(135deg, #fff, #f3c2d4); -webkit-background-clip: text; background-clip: text; color: transparent; transition: all .5s; }
.stage-warning .room-status { background-image: linear-gradient(135deg, #ffe1b0, var(--warn)); }
.stage-overtime .room-status { background-image: linear-gradient(135deg, #fff, #ff8fa3); }
.room-time { font-family: var(--head); font-weight: 700; font-size: clamp(24px, 6vmin, 64px); font-variant-numeric: tabular-nums; color: var(--muted); }
.bar { position: relative; width: min(900px, 100%); height: 14px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 2vmin; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--violet)); transition: width 1s linear, background .5s; }
.stage-warning .bar i { background: linear-gradient(90deg, #ffcf5a, #ff8a3d); }
.stage-overtime .bar i { background: linear-gradient(90deg, #ff5a5f, #d91e48); }
.bar em { position: absolute; top: -4px; bottom: -4px; width: 3px; background: rgba(255,181,71,.8); border-radius: 2px; }
.is-finished .room-status { background-image: linear-gradient(135deg, #d1fae5, var(--ok)); }
.is-finished .bar i { background: linear-gradient(90deg, #10b981, var(--ok)); }
.is-finished .flashwash { opacity: 1; animation: none; background: radial-gradient(circle at 50% 50%, rgba(52,211,153,.22), transparent 70%); }
/* While the ding dong plays, the status word rings like a bell */
.chiming .room-status { animation: ring 1s ease-in-out 4; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-4deg) scale(1.04); } 35% { transform: rotate(3deg) scale(1.04); } 55% { transform: rotate(-2deg); } 75% { transform: rotate(1deg); } }
.room-sub { font-weight: 700; color: var(--muted); font-size: clamp(16px, 3vmin, 28px); }

/* Message sheet on the pulpit and kids screens */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 0 16px max(16px, env(safe-area-inset-bottom)); background: rgba(10,10,25,0); pointer-events: none; transition: background .4s; }
.sheet.show { background: rgba(10,10,25,.45); pointer-events: auto; }
.sheet-card { width: min(980px, 100%); padding: 4vmin 5vmin; border-radius: 28px 28px 22px 22px; text-align: center; background: linear-gradient(160deg, rgba(182,61,101,.96), rgba(98,52,170,.96)); box-shadow: 0 -20px 80px -10px rgba(182,61,101,.7); transform: translateY(120%); transition: transform .55s cubic-bezier(.2,1.2,.3,1); }
.sheet.show .sheet-card { transform: none; }
.sheet.acked .sheet-card { background: linear-gradient(160deg, rgba(16,185,129,.96), rgba(5,150,105,.96)); }
.sheet-kicker { font-family: var(--head); font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: clamp(12px, 2vmin, 18px); opacity: .85; }
.sheet-text { font-family: var(--head); font-weight: 800; font-size: clamp(34px, 7vmin, 84px); line-height: 1.1; margin: 1.6vmin 0 3vmin; letter-spacing: -.01em; }
.bigbtn { font-family: var(--head); font-weight: 800; font-size: clamp(22px, 4vmin, 40px); color: #2a1030; background: #fff; border: 0; border-radius: 99px; padding: 2vmin 10vmin; min-height: 64px; cursor: pointer; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); transition: transform .15s; }
.bigbtn:active { transform: scale(.95); }
.mic-anim { display: none; position: relative; width: 16vmin; height: 16vmin; margin: 0 auto 2vmin; }
.mic-anim svg { position: absolute; inset: 22%; width: 56%; height: 56%; fill: #fff; }
.mic-anim .ripple { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(255,255,255,.8); animation: ripple 2s ease-out infinite; }
.mic-anim .r2 { animation-delay: 1s; }
@keyframes ripple { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.sheet.kind-mic .mic-anim { display: block; }
.sheet.kind-mic .sheet-card { background: linear-gradient(160deg, rgba(14,165,233,.96), rgba(99,102,241,.96)); }
.sheet.kind-mic.acked .sheet-card { background: linear-gradient(160deg, rgba(16,185,129,.96), rgba(5,150,105,.96)); }

/* Tap to start gate (needed so the screen can stay awake) */
.gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(14,15,35,.86); backdrop-filter: blur(10px); opacity: 0; pointer-events: none; transition: opacity .4s; }
.gate.show { opacity: 1; pointer-events: auto; }
.gate-card { text-align: center; max-width: 460px; animation: rise .6s both; }
.gate-card img { width: 220px; animation: breathe 4s ease-in-out infinite; }
.gate-card h2 { font-size: 30px; margin: 18px 0 6px; }
.gate-card p { color: var(--muted); font-size: 18px; margin: 0 0 26px; }
@keyframes breathe { 50% { transform: scale(1.04); filter: drop-shadow(0 0 20px rgba(226,87,138,.6)); } }

@media (max-width: 860px) {
  body.admin { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 16px; gap: 12px; }
  .brand img { width: 110px; }
  .brand span { display: none; }
  .side nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .side nav a { white-space: nowrap; padding: 9px 11px; }
  .who { margin: 0 0 0 auto; padding: 8px 10px; }
  .live { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 50px; }
  .s-service { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .stage-overtime .flashwash { opacity: .7; }
}
