/* Sheri Garba Live v1.1.1 · phone camera PWA */
html, body { height: 100%; }
body.cam { background: var(--maroon-950); min-height: 100vh; min-height: 100dvh; overscroll-behavior: none; }

/* ---------------------------------------------------------------- join */
.join {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; gap: 18px;
  padding: calc(20px + var(--safe-t)) calc(18px + var(--safe-r)) calc(18px + var(--safe-b)) calc(18px + var(--safe-l));
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(140, 32, 46, 0.55), transparent 60%),
    radial-gradient(90% 50% at 50% 115%, rgba(242, 154, 31, 0.12), transparent 60%),
    var(--maroon-950);
  max-width: 560px; margin: 0 auto;
}
.join-head { display: flex; align-items: center; gap: 14px; }
.join-mark { width: 56px; height: 56px; flex: none; }
.join-mark svg { width: 100%; height: 100%; display: block; }
.join-title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 34px; line-height: 1; }
.join-sub { margin: 6px 0 0; color: var(--cream-dim); font-size: 13px; }

.join-card {
  display: grid; gap: 16px; padding: 20px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(51, 10, 18, 0.9), rgba(34, 6, 11, 0.92));
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(244, 213, 141, 0.08);
}
.field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field .label, .seg-field legend { font-size: 13px; color: var(--gold-400); padding: 0; }
.field input {
  width: 100%; font-size: 17px; /* >=16px: no iOS focus zoom */
  padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: rgba(15, 5, 7, 0.6); color: var(--text);
}
.field input::placeholder { color: rgba(205, 187, 159, 0.5); }
.field input:focus { border-color: var(--gold-400); outline: none; box-shadow: 0 0 0 3px rgba(232, 192, 106, 0.18); }
.hint { color: var(--cream-dim); font-size: 13px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span {
  display: grid; place-items: center; text-align: center; min-height: 54px; padding: 8px;
  border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(15, 5, 7, 0.45);
  font-weight: 600; font-size: 16px; color: var(--cream-dim); line-height: 1.15;
}
.seg em { display: block; font-style: normal; font-weight: 500; font-size: 12px; color: var(--ink-mute); }
.seg input:checked + span { border-color: var(--gold-400); color: var(--cream); background: rgba(232, 192, 106, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--gold-400); outline-offset: 2px; }

.consent { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 15px; color: var(--cream-dim); }
.consent input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--gold-500); }

.join-err { margin: 0; min-height: 1.2em; color: #ff9aa0; font-size: 15px; }

.btn-primary {
  min-height: 56px; padding: 0 22px; border: 0; border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500));
  color: #2a0710; font-family: var(--f-label); font-weight: 700; font-size: 19px; letter-spacing: 0.08em; text-transform: uppercase;
  box-shadow: 0 8px 20px rgba(212, 162, 76, 0.25);
}
.btn-primary:disabled { opacity: 0.6; }
.btn-ghost { min-height: 44px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: transparent; color: var(--cream); font-weight: 600; }

.tips { margin: 0; padding: 0 0 0 18px; color: var(--ink-mute); font-size: 14px; display: grid; gap: 4px; }
.join-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; color: var(--ink-mute); font-size: 13px; }

/* ---------------------------------------------------------------- live */
.live { position: fixed; inset: 0; background: #000; overflow: hidden; touch-action: manipulation; }
.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.preview.mirror { transform: scaleX(-1); }

.tally-ring { position: absolute; inset: 0; pointer-events: none; border: 0 solid transparent; transition: border-color 0.2s, border-width 0.2s; }
.live[data-tally="live"] .tally-ring { border-width: 7px; border-color: var(--tally-pgm); animation: ring-pulse 1.8s ease-in-out infinite; }
.live[data-tally="preview"] .tally-ring { border-width: 5px; border-color: var(--tally-pvw); }
@keyframes ring-pulse { 50% { border-color: rgba(236, 43, 52, 0.55); } }

.live-top {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) 24px calc(14px + var(--safe-l));
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}
.tally {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px;
  background: rgba(30, 30, 30, 0.8); color: #fff;
  font-family: var(--f-label); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 15px;
}
.tally i { width: 10px; height: 10px; border-radius: 50%; background: #9a9a9a; }
.tally[data-state="live"] { background: var(--tally-pgm); }
.tally[data-state="live"] i { background: #fff; animation: dot 1s ease-in-out infinite; }
.tally[data-state="preview"] { background: var(--tally-pvw); color: #04210e; }
.tally[data-state="preview"] i { background: #04210e; }
.tally[data-state="standby"] i { background: var(--gold-400); }
.tally[data-state="offline"] i, .tally[data-state="waiting"] i, .tally[data-state="connecting"] i { background: var(--warn); animation: dot 1.2s ease-in-out infinite; }
@keyframes dot { 50% { opacity: 0.3; } }

.live-name { flex: 1; min-width: 0; color: rgba(255, 255, 255, 0.85); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sig { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, 0.85); font-size: 12px; }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { width: 4px; background: rgba(255, 255, 255, 0.25); border-radius: 1px; }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 9px; } .bars i:nth-child(3) { height: 14px; }
.bars[data-level="1"] i:nth-child(1) { background: #ff6b6b; }
.bars[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.bars[data-level="3"] i { background: #4ade80; }

.cue {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(86vw, 520px); padding: 18px 20px; border-radius: var(--r-lg); text-align: center;
  background: rgba(15, 5, 7, 0.9); border: 2px solid var(--gold-400); color: var(--cream);
  font-family: var(--f-label); font-weight: 700; font-size: 28px; letter-spacing: 0.03em; line-height: 1.15;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: cue-in 0.25s ease-out;
}
@keyframes cue-in { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.live-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 28px calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.65), transparent);
}
.ctl-group { display: flex; gap: 10px; }
.ctl {
  min-width: 64px; min-height: 52px; padding: 0 16px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(20, 20, 20, 0.6); color: #fff;
  font-family: var(--f-label); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ctl[aria-pressed="true"] { background: var(--gold-400); color: #2a0710; border-color: var(--gold-400); }
.ctl-leave { border-color: rgba(255, 120, 120, 0.5); }
.live-center { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: center; }
.lens-chips { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.lens-chips::-webkit-scrollbar { display: none; }
.lens-chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(20, 20, 20, 0.6); color: #fff;
  font-family: var(--f-label); font-weight: 700; font-size: 14px; letter-spacing: 0.04em;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lens-chip[aria-checked="true"] { background: var(--gold-400); color: #2a0710; border-color: var(--gold-400); }
.zoom { width: 100%; display: flex; align-items: center; gap: 8px; max-width: 320px; color: #fff; font-size: 13px; }

.frame-box {
  position: absolute; pointer-events: none; border: 2px dashed rgba(244, 213, 141, 0.95); border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}
.live[data-tally="live"] .frame-box { border: 3px solid var(--tally-pgm); }
.frame-box span {
  position: absolute; left: -2px; top: -26px; padding: 3px 8px; border-radius: 4px 4px 0 0;
  background: rgba(244, 213, 141, 0.95); color: #2a0710; font-family: var(--f-label); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap;
}
.live[data-tally="live"] .frame-box span { background: var(--tally-pgm); color: #fff; }
.ptz-note {
  position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  padding: 6px 12px; border-radius: 999px; background: rgba(15, 5, 7, 0.85); border: 1px solid var(--line-strong);
  color: var(--cream); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.zoom input { flex: 1; accent-color: var(--gold-400); height: 32px; }

.rotate-hint, .paused {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; text-align: center;
  background: rgba(10, 2, 4, 0.78); color: var(--cream); padding: 24px;
  font-size: 20px; font-weight: 600;
}
.rotate-hint p, .paused p { margin: 0; }
.rotate-icon {
  width: 46px; height: 76px; border: 4px solid var(--gold-400); border-radius: 10px;
  animation: rot 2.2s ease-in-out infinite;
}
@keyframes rot { 0%, 25% { transform: rotate(0); } 55%, 100% { transform: rotate(-90deg); } }
@media (orientation: landscape) { .rotate-hint { display: none !important; } }

/* ---------------------------------------------------------------- ended */
.ended { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--maroon-950); }
.ended-card { width: min(440px, 100%); display: grid; gap: 14px; padding: 24px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-strong); text-align: center; }
.ended-card h2 { margin: 0; font-family: var(--f-display); font-weight: 400; color: var(--gold-400); font-size: 28px; }
.ended-card p { margin: 0; color: var(--cream-dim); }
