* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #0b0d14;
  --panel: rgba(20, 22, 31, .74);
  --panel2: rgba(255,255,255,.10);
  --text: #fff;
  --muted: rgba(255,255,255,.72);
  --line: rgba(255,255,255,.18);
  --danger: #ff4d4d;
  --ok: #55ff33;
  --accent: #ef5a2f;
}
html, body { margin: 0; width: 100%; min-height: 100%; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
.hidden { display: none !important; }

/* AUTH */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at top, #262b45, #090a10 60%); }
.auth-card { width: min(420px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 28px; background: rgba(17,19,28,.88); box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.logo-tv { width: max-content; margin: 0 auto 8px; padding: 10px 18px; border: 5px solid var(--accent); border-radius: 18px; font-weight: 900; font-size: 34px; line-height: 1; background: #fff; color: var(--accent); position: relative; }
.logo-tv span { display: block; color: #45a27b; font-size: .62em; text-align: center; }
.logo-tv.big { transform: scale(1.15); margin-bottom: 44px; }
.brand-auth p { text-align: center; color: var(--muted); margin: 0 0 18px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.tab, .ghost, .primary, .select-btn, .start-btn { border-radius: 16px; padding: 14px 16px; color: #fff; background: var(--panel2); border: 1px solid var(--line); }
.tab.active, .primary, .start-btn { background: linear-gradient(135deg, #ef5a2f, #d7432b); border-color: transparent; font-weight: 800; }
.form { display: none; gap: 9px; }
.form.active { display: grid; }
label { color: var(--muted); font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: #fff; border-radius: 14px; padding: 13px 14px; outline: none; }
select option { color: #111; }
.msg { min-height: 22px; color: var(--muted); text-align: center; }
.msg.error { color: #ffb0b0; }

/* APP FULLSCREEN - v6 TRUE SQUARE UI */
.tv-page {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overscroll-behavior: none;
  touch-action: manipulation;
}
.tv-shell {
  --controls-h: 54px;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.video-stage {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: calc(var(--controls-h) + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  background: #000;
}
.video-pane {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.video-pane:last-child { border-bottom: 0; }
.stage-video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(100vw, 100%);
  height: min(100vw, 100%);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  background: #000;
  object-fit: cover;
  object-position: center center;
  border: 0;
  border-radius: 0;
  z-index: 1;
}
.local-video { transform: translate(-50%, -50%) scaleX(-1); }
.pane-blank {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.07), transparent 35%),
    repeating-radial-gradient(circle at center, rgba(255,255,255,.13) 0 1px, rgba(0,0,0,.22) 2px 4px),
    #141414;
}
.local-blank {
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(0,0,0,.36)),
    #050505;
}
.cam-note {
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: center;
  color: rgba(255,255,255,.72);
  background: rgba(0,0,0,.36);
  border: 1px solid rgba(255,255,255,.18);
  line-height: 1.35;
  font-size: 14px;
}
.live-logo {
  margin: 0 auto;
  transform: scale(.82);
}
.online-line {
  font-size: 18px;
  text-shadow: 0 2px 10px #000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,.22);
}
.online-line i {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 18px var(--ok);
}
.tv-top {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 2px;
  z-index: 12;
  background: linear-gradient(to bottom, rgba(0,0,0,.58), transparent);
  pointer-events: none;
}
.mini-logo {
  font-weight: 900;
  font-size: 18px;
  text-shadow: 0 2px 8px #000;
  pointer-events: auto;
}
.top-actions {
  display: flex;
  gap: 7px;
  pointer-events: auto;
}
.ghost {
  padding: 8px 11px;
  border-radius: 14px;
  color: #fff;
  background: rgba(30,30,30,.58);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(10px);
}
.status-pill {
  position: absolute;
  left: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  z-index: 9;
  max-width: calc(100vw - 24px);
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(10px);
  font-size: 14px;
  line-height: 1.15;
  text-shadow: 0 2px 8px #000;
}
.start-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 10;
  display: grid;
  gap: 7px;
  pointer-events: auto;
}
.select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.select-btn,
.interest,
.start-btn {
  min-height: 40px;
  border-radius: 14px;
  color: #fff;
  backdrop-filter: blur(12px);
  background: rgba(28,28,28,.68);
  border: 1px solid rgba(255,255,255,.34);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  font-weight: 800;
  text-align: center;
}
.interest {
  text-align: left;
  font-weight: 500;
  padding: 0 12px;
}
.start-btn {
  background: rgba(239,90,47,.94);
  border-color: rgba(255,255,255,.22);
  font-size: 16px;
}
.terms {
  margin: 0;
  padding: 0 3px;
  font-size: 11.5px;
  color: rgba(255,255,255,.84);
  text-shadow: 0 2px 8px #000;
  line-height: 1.22;
}
.tv-controls {
  position: absolute;
  z-index: 13;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0px);
  height: var(--controls-h);
  padding: 5px 8px 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  background: #050505;
  border-top: 1px solid rgba(255,255,255,.10);
  overflow: hidden;
}
.control {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  color: white;
  background: rgba(45,45,45,.72);
  border: 1px solid rgba(255,255,255,.24);
  backdrop-filter: blur(10px);
  font-weight: 800;
  font-size: 17px;
  display: grid;
  place-items: center;
  box-shadow: 0 7px 20px rgba(0,0,0,.18);
}
.control.big { font-size: 22px; background: rgba(0,0,0,.55); }
.control.danger { color: #ffd1d1; background: rgba(255,75,75,.24); }
.toast {
  position: fixed;
  z-index: 40;
  left: 16px;
  right: 16px;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(18,18,18,.92);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,.4);
}
.chat-box {
  position: absolute;
  z-index: 14;
  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--controls-h) + 8px);
  height: min(235px, 38dvh);
  border-radius: 20px;
  background: rgba(12,13,16,.84);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}
.chat-messages {
  padding: 10px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.chat-me,
.chat-other {
  width: fit-content;
  max-width: 78%;
  padding: 8px 10px;
  border-radius: 15px;
  background: rgba(255,255,255,.14);
  font-size: 14px;
}
.chat-me { align-self: flex-end; background: rgba(239,90,47,.65); }
.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid var(--line);
}
.chat-form input { min-height: 42px; }
.chat-form button {
  border-radius: 14px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
.reaction-float {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 45%;
  transform: translate(-50%,-50%);
  font-size: 76px;
  animation: pop 1.15s ease forwards;
  pointer-events: none;
}
@keyframes pop {
  0% { transform: translate(-50%,-50%) scale(.3); opacity:0; }
  20% { opacity:1; }
  100% { transform: translate(-50%,-95%) scale(1.3); opacity:0; }
}
@media (max-height: 720px) {
  .tv-shell { --controls-h: 50px; }
  .live-logo { transform: scale(.68); }
  .online-line { font-size: 16px; padding: 5px 10px; }
  .status-pill { top: calc(env(safe-area-inset-top, 0px) + 52px); font-size: 13px; padding: 7px 11px; }
  .start-panel { gap: 6px; bottom: 8px; }
  .select-btn, .interest, .start-btn { min-height: 36px; border-radius: 13px; }
  .terms { font-size: 10.5px; }
  .control { width: 34px; height: 34px; flex-basis: 34px; font-size: 15px; }
  .control.big { font-size: 20px; }
}
@media (min-width: 760px) {
  .tv-controls { gap: 12px; }
  .control { width: 42px; height: 42px; flex-basis: 42px; }
}
/* ADMIN */
.admin-page { min-height: 100vh; background: #0b0d14; overflow: auto; padding: 14px; }
.admin-wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 14px; }
.admin-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px; border-radius: 22px; border: 1px solid var(--line); background: rgba(15,17,25,.92); backdrop-filter: blur(14px); }
.admin-title h1 { margin: 0; font-size: 24px; }
.admin-title p { margin: 4px 0 0; color: var(--muted); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.admin-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.card { padding: 16px; border-radius: 20px; border: 1px solid var(--line); background: rgba(255,255,255,.06); }
.card b { display: block; font-size: 26px; }
.card span { color: var(--muted); font-size: 13px; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.055); overflow: hidden; }
.panel h2 { margin: 0; padding: 16px; border-bottom: 1px solid var(--line); font-size: 19px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid rgba(255,255,255,.09); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 12px; }
.badge.ok { background: rgba(85,255,51,.18); color: #9cff85; }
.badge.bad { background: rgba(255,77,77,.18); color: #ffb1b1; }
.btn { padding: 8px 10px; border-radius: 12px; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); margin: 2px; }
.btn.red { background: rgba(255,77,77,.22); }
.btn.green { background: rgba(85,255,51,.18); }
.settings-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 10px; padding: 14px; align-items: center; }
.report-img { width: 88px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #111; }
@media (max-width: 760px) {
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-head { align-items: flex-start; gap: 12px; flex-direction: column; }
  .settings-row { grid-template-columns: 1fr; }
}

/* v7 UI FIX: start panel tidak menutupi online, kontrol ringkas, monitor admin */
.stage-video { object-fit: contain; background: #000; }
.remote-blank { z-index: 2; }
.remote-blank .live-logo { margin-top: 16px; }
.remote-blank .online-line { margin-top: 4px; }
.local-pane .start-panel {
  left: 12px;
  right: 12px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  max-width: 680px;
  margin: 0 auto;
}
body.started .start-panel { display: none !important; }
.start-panel { gap: 8px; }
.select-btn, .interest, .start-btn { min-height: 38px; }
.status-pill { max-width: calc(100vw - 130px); }
.monitor-badge {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 96px);
  right: 12px;
  z-index: 11;
  padding: 8px 12px;
  border-radius: 999px;
  color: #ffe9a6;
  background: rgba(139,86,0,.58);
  border: 1px solid rgba(255,214,96,.45);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 800;
}
.tv-shell { --controls-h: 62px; }
.tv-controls {
  gap: 4px;
  justify-content: space-evenly;
  padding: 5px 5px calc(7px + env(safe-area-inset-bottom, 0px));
}
.control {
  flex: 0 0 clamp(33px, 10vw, 42px);
  width: clamp(33px, 10vw, 42px);
  height: clamp(33px, 10vw, 42px);
  font-size: clamp(14px, 4.2vw, 18px);
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
}
.control small {
  display: block;
  font-size: 8px;
  line-height: 1;
  margin-top: -1px;
  opacity: .88;
  font-weight: 800;
}
.chat-preview {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(var(--controls-h) + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 30;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 18px;
  color: #fff;
  text-align: left;
  background: rgba(12,13,16,.82);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 35px rgba(0,0,0,.38);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat-box { bottom: calc(var(--controls-h) + env(safe-area-inset-bottom, 0px) + 10px); }
.monitor-page { min-height: 100vh; background: #06070a; color: #fff; overflow: hidden; }
.monitor-wrap { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.monitor-head, .monitor-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: rgba(17,19,28,.9); border-bottom: 1px solid rgba(255,255,255,.12);
}
.monitor-head h1 { font-size: 18px; margin: 0; }
.monitor-head p { margin: 2px 0 0; color: rgba(255,255,255,.68); font-size: 12px; }
.monitor-grid { display: grid; grid-template-rows: 1fr 1fr; gap: 8px; padding: 8px; min-height: 0; }
.monitor-card { position: relative; overflow: hidden; border-radius: 18px; background: #000; border: 1px solid rgba(255,255,255,.14); display: grid; place-items: center; }
.monitor-card img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.monitor-card span { position: absolute; left: 10px; top: 10px; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.55); backdrop-filter: blur(10px); font-size: 12px; font-weight: 800; }
.monitor-empty { color: rgba(255,255,255,.55); text-align: center; padding: 20px; }
.monitor-foot { border-top: 1px solid rgba(255,255,255,.12); border-bottom: 0; justify-content: center; flex-wrap: wrap; }
@media (max-height: 720px) {
  .tv-shell { --controls-h: 56px; }
  .local-pane .start-panel { gap: 6px; }
  .control { flex-basis: clamp(31px, 9.5vw, 38px); width: clamp(31px, 9.5vw, 38px); height: clamp(31px, 9.5vw, 38px); font-size: 14px; }
  .control small { font-size: 7px; }
}
@media (max-width: 370px) {
  .tv-controls { gap: 3px; }
  .control { flex-basis: 31px; width: 31px; height: 31px; font-size: 13px; }
  .control small { font-size: 6.5px; }
}
