/* Temple console: full-viewport two-column layout; only the queue scrolls. */
body.temple { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--cream); }
body.temple .site-header { position: relative; flex: none; }
body.temple #login { flex: 1; overflow: auto; }

.conn { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.conn .dot { width: 8px; height: 8px; }
.conn.ok .dot { background: #22B35E; }
.conn.bad .dot { background: var(--red); }
@media (max-width: 560px) { .conn-label { display: none; } }

.console { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 30%) minmax(0, 1fr); }
.console[hidden] { display: none; }

/* ---------- queue ---------- */
.queue { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); background: linear-gradient(180deg, #FFFCF7, var(--cream)); scroll-padding-top: 150px; }
.q-head { position: sticky; top: 0; z-index: 2; padding: 14px 16px 12px; background: rgba(255, 252, 247, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.q-date { display: flex; flex-direction: column; gap: 8px; }
.q-day { font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--maroon); line-height: 1.1; }
.q-count { font-size: .85rem; color: var(--muted); font-weight: 600; }
.progress { height: 6px; border-radius: 999px; background: #F1E7DA; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width .4s ease; }
.tabs { display: flex; padding: 3px; border-radius: 999px; background: var(--cream-2); border: 1px solid var(--line); gap: 2px; }
.tab { flex: 1; border: 0; background: transparent; padding: 6px 10px; border-radius: 999px; font-weight: 600; font-size: .82rem; color: var(--muted); cursor: pointer; min-height: 34px; }
.tab[aria-selected="true"] { background: #fff; color: var(--maroon); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

.q-list { list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.q-item { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(43, 27, 18, .04); transition: box-shadow .2s, border-color .2s; }
.q-item:hover { box-shadow: var(--shadow); }
.q-item.is-live { border-color: #F2A38F; background: linear-gradient(135deg, #FFF4EC, #FFFFFF 60%); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12), var(--shadow); }
.q-item.is-next { border-color: #F5CB8E; }
.q-item.is-done { opacity: .72; }
.q-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.q-time { font-weight: 700; font-size: .95rem; color: var(--navy); }
.q-date-sm { font-size: .78rem; color: var(--muted); }
.q-tag-next { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--terracotta-deep); background: var(--saffron-soft); padding: 2px 8px; border-radius: 999px; }
.q-top .badge { margin-left: auto; }
.q-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.q-sub { color: var(--muted); font-size: .86rem; }
.q-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.q-ready { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.q-ready.on { color: var(--green); }
.q-empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.q-foot { padding: 18px 12px calc(18px + var(--safe-bottom)); }

/* ---------- stage ---------- */
.stage-col { min-height: 0; padding: 14px; display: flex; background: #F3ECE1; }
.stage { position: relative; flex: 1; min-height: 0; border-radius: 22px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #33231A, #0D0806 72%); box-shadow: var(--shadow-lg); isolation: isolate; }
.stage > #main { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.stage[data-mode="off"] > #main { visibility: hidden; }
.stage[data-mode="idle"] > #main { transform: scaleX(-1); filter: saturate(.9) brightness(.82); }
.stage .pip { position: absolute; right: 16px; bottom: 96px; width: clamp(140px, 22%, 300px); aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .9); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); background: #2A1C14; z-index: 3; }
.stage .pip.off { opacity: .35; }
.mirror { transform: scaleX(-1); }

.overlay { position: absolute; inset: 0; z-index: 2; color: #FBF1E4; }
.overlay.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; gap: 6px; }
.overlay h2 { color: #FFE7C2; font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.overlay p { max-width: 46ch; color: #EADBC8; }
.ov-emblem { width: 120px; margin-bottom: 6px; filter: drop-shadow(0 6px 24px rgba(247, 150, 29, .45)); }
#ov-off { background: radial-gradient(circle at 50% 30%, rgba(247, 150, 29, .2), transparent 60%); }
#ov-off .err { color: #FFB4A6; margin-top: 10px; }
.overlay.waiting { background: rgba(13, 8, 6, .55); backdrop-filter: blur(3px); }
.overlay.waiting .spinner { width: 40px; height: 40px; border-color: rgba(255, 255, 255, .2); border-top-color: var(--saffron); margin-bottom: 10px; }

.overlay.idle { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 22px; background: linear-gradient(180deg, rgba(0, 0, 0, .25), transparent 30%, transparent 55%, rgba(0, 0, 0, .55)); }
.ready-pill { background: rgba(255, 248, 238, .94); color: var(--maroon); font-weight: 700; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: clamp(.9rem, 1.4vw, 1.05rem); text-align: center; }
.next-card { width: min(560px, 100%); background: rgba(255, 252, 247, .96); color: var(--ink); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.next-card:empty { display: none; }
.next-card .nc-info { flex: 1; min-width: 200px; }
.next-card .nc-label { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--terracotta); }
.next-card .nc-name { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; color: var(--maroon); line-height: 1.1; }
.next-card .nc-sub { color: var(--muted); font-size: .9rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.sankalpa { position: absolute; left: 18px; top: 18px; z-index: 3; max-width: min(440px, 60%); background: linear-gradient(135deg, rgba(255, 250, 240, .96), rgba(255, 238, 214, .94)); border: 1px solid rgba(212, 160, 23, .55); border-radius: 18px; padding: 14px 18px 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, .35); color: var(--ink); }
.sk-label { font-size: .7rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--terracotta); }
.sk-name { font-family: var(--serif); font-weight: 700; font-size: clamp(1.6rem, 2.8vw, 2.4rem); color: var(--maroon); line-height: 1.05; margin: 2px 0 8px; }
.sk-row { display: flex; gap: 10px; align-items: baseline; font-size: clamp(1rem, 1.5vw, 1.2rem); }
.sk-row span { width: 52px; flex: none; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sk-row strong { font-weight: 700; }

.call-meta { position: absolute; right: 18px; top: 18px; z-index: 3; display: flex; gap: 8px; align-items: center; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .5); padding: 6px 12px; border-radius: 999px; font-size: 1rem; backdrop-filter: blur(6px); }
.rec { font-weight: 800; font-size: .78rem; letter-spacing: .08em; color: #fff; background: rgba(192, 57, 43, .9); padding: 6px 10px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; }
.rec::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }

.controls { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 999px; background: rgba(20, 12, 8, .6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.ctl { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; flex: none; }
.ctl svg { width: 22px; height: 22px; }
.ctl:hover { background: rgba(255, 255, 255, .26); }
.ctl[aria-pressed="true"] { background: #fff; color: var(--red); }
.ctl-wide { min-height: 52px; padding: 0 20px; }
.lbl-short { display: none; }

/* ---------- portrait / mobile: stack, stage sticky on top ---------- */
@media (orientation: portrait), (max-width: 900px) {
  body.temple { overflow: hidden; }
  .console { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
  .stage-col { order: -1; flex: none; position: sticky; top: 0; z-index: 5; padding: 0; background: #000; }
  .queue { flex: none; }
  .stage { aspect-ratio: 16 / 9; flex: none; width: 100%; border-radius: 0; }
  .queue { overflow: visible; border-right: 0; scroll-padding-top: 0; }
  .q-head { top: 0; position: relative; }
  .sankalpa { left: 10px; top: 10px; padding: 8px 12px; border-radius: 12px; max-width: 64%; }
  .sk-name { font-size: 1.25rem; margin-bottom: 4px; }
  .sk-row { font-size: .9rem; }
  .sk-row span { width: 44px; font-size: .68rem; }
  .call-meta { right: 10px; top: 10px; }
  .timer { font-size: .85rem; padding: 4px 10px; }
  .stage .pip { width: 26%; right: 10px; bottom: 64px; border-radius: 10px; }
  .controls { bottom: 8px; gap: 8px; padding: 6px 8px; }
  .ctl { width: 40px; height: 40px; }
  .ctl svg { width: 18px; height: 18px; }
  .ctl-wide { min-height: 40px; padding: 0 12px; font-size: .82rem; }
  .ctl-wide .lbl-long { display: none; }
  .ctl-wide .lbl-short { display: inline; }
  .overlay.center { padding: 14px; }
  .overlay.center p { display: none; }
  .ov-emblem { width: 56px; }
  .overlay.idle { padding: 10px; }
  .ready-pill { font-size: .82rem; padding: 6px 12px; }
  .next-card { padding: 10px 12px; gap: 10px; }
  .next-card .nc-name { font-size: 1.2rem; }
}
@media (orientation: portrait) and (min-width: 700px) {
  .ctl { width: 48px; height: 48px; }
  .ctl-wide .lbl-long { display: inline; }
  .ctl-wide .lbl-short { display: none; }
}

/* phones: compact idle overlay so the 16:9 stage stays readable */
@media (max-width: 600px) {
  .ready-pill { font-size: .75rem; padding: 4px 10px; }
  .next-card { flex-wrap: nowrap; padding: 8px 10px; gap: 10px; border-radius: 14px; }
  .next-card .nc-info { min-width: 0; }
  .next-card .nc-label { font-size: .64rem; }
  .next-card .nc-name { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .next-card .nc-sub { font-size: .78rem; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  .next-card .nc-sub .q-ready { display: none; }
  .next-card .btn-lg { min-height: 40px; padding: 8px 14px; font-size: .88rem; flex: none; }
}
@media (max-width: 480px) {
  .conn { display: none; }
}
