:root {
  color-scheme: dark;
  --bg: #03050a;
  --surface: rgba(19, 23, 34, .68);
  --surface-strong: rgba(25, 30, 44, .88);
  --surface-soft: rgba(255, 255, 255, .055);
  --line: rgba(255, 255, 255, .105);
  --line-bright: rgba(255, 255, 255, .18);
  --text: #f7f8fc;
  --muted: #9ba5b7;
  --blue: #0a84ff;
  --indigo: #6e5cff;
  --cyan: #56d8ff;
  --green: #30d899;
  --red: #ff5263;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -5%, rgba(52, 106, 255, .24), transparent 30%),
    radial-gradient(circle at 90% 12%, rgba(129, 72, 255, .18), transparent 28%),
    radial-gradient(circle at 55% 100%, rgba(0, 180, 216, .1), transparent 34%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0 72px; position: relative; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 15, 23, .62);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  box-shadow: 0 20px 70px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.06);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.025em; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #36a1ff, #6156ff 55%, #9d54ff);
  box-shadow: 0 10px 30px rgba(62, 108, 255, .38), inset 0 1px rgba(255,255,255,.42);
}
.eyebrow { color: #8adfff; text-transform: uppercase; letter-spacing: .16em; font-size: 11px; font-weight: 800; }
h1 { font-size: clamp(42px, 7vw, 82px); line-height: .94; letter-spacing: -.065em; margin: 14px 0 24px; text-wrap: balance; }
h2 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.045em; }
p { color: var(--muted); line-height: 1.72; }

.hero { min-height: 84vh; display: grid; align-items: center; grid-template-columns: 1.08fr .92fr; gap: clamp(34px, 7vw, 90px); }
.hero::after {
  content: "LIVE";
  position: absolute;
  right: 2%;
  top: 8%;
  font-size: clamp(130px, 24vw, 320px);
  font-weight: 900;
  letter-spacing: -.09em;
  color: rgba(255,255,255,.018);
  z-index: -1;
}
.hero p { max-width: 620px; font-size: 17px; }
.hero-card, .panel, .room-card, .auth-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, rgba(36, 43, 62, .78), rgba(11, 14, 22, .68));
  border: 1px solid var(--line);
  box-shadow: 0 32px 100px rgba(0,0,0,.48), inset 0 1px rgba(255,255,255,.09);
  backdrop-filter: blur(30px) saturate(155%);
  -webkit-backdrop-filter: blur(30px) saturate(155%);
}
.hero-card::before, .panel::before, .auth-card::before {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  right: -100px;
  top: -140px;
  background: rgba(85, 102, 255, .26);
  filter: blur(45px);
  pointer-events: none;
}
.hero-card { padding: 30px; border-radius: 34px; transform: perspective(900px) rotateY(-3deg) rotateX(1deg); }
.hero-card p { margin-bottom: 0; }
.signal { display: grid; grid-template-columns: repeat(18, 1fr); align-items: end; gap: 5px; height: 190px; padding: 24px 0 5px; }
.signal span { display: block; background: linear-gradient(to top, var(--blue), var(--cyan), #fff); border-radius: 999px; opacity: .8; box-shadow: 0 0 18px rgba(74, 190, 255, .22); }

.button {
  min-height: 44px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  color: white;
  padding: 11px 18px;
  font-weight: 740;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: linear-gradient(145deg, #168cff, #6256ff);
  box-shadow: 0 12px 30px rgba(37, 106, 255, .28), inset 0 1px rgba(255,255,255,.25);
  transition: transform .2s ease, filter .2s ease, border-color .2s ease;
}
.button:hover { filter: brightness(1.12); transform: translateY(-1px); border-color: rgba(255,255,255,.28); }
.button:active { transform: scale(.98); }
.button.secondary { background: rgba(255,255,255,.065); border-color: var(--line); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.button.danger { background: rgba(255, 57, 76, .12); color: #ff8390; border-color: rgba(255, 82, 99, .28); box-shadow: none; }
.button.small { min-height: 38px; padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }

.panel { padding: clamp(22px, 4vw, 34px); border-radius: 30px; margin-bottom: 26px; }
.workflow { margin-bottom: 26px; padding: clamp(20px, 3vw, 28px); border: 1px solid var(--line); border-radius: 28px; background: rgba(10,15,27,.62); box-shadow: inset 0 1px rgba(255,255,255,.06); }
.workflow-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.workflow-head h2 { margin-top: 7px; }
.workflow-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.workflow-step { display: flex; gap: 11px; min-height: 112px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); }
.workflow-step > strong { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; color: white; background: linear-gradient(145deg, #168cff, #6256ff); box-shadow: 0 8px 18px rgba(37,106,255,.25); }
.workflow-step span { display: grid; align-content: start; gap: 6px; }
.workflow-step b { font-size: 13px; }
.workflow-step small { color: var(--muted); line-height: 1.5; }
.reality-note { margin-top: 12px; padding: 12px 14px; border-radius: 14px; color: #b8c7da; background: rgba(10,132,255,.08); border: 1px solid rgba(10,132,255,.18); font-size: 12px; line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { color: #d7dce7; font-size: 13px; font-weight: 660; }
input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(2, 4, 9, .52);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.28);
}
input::placeholder { color: #647087; }
select { font-family: inherit; font-size: 13px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8b97ab 50%), linear-gradient(135deg, #8b97ab 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 38px; }
select option { background: #0b0e16; color: var(--text); }
input:focus, select:focus { border-color: rgba(67, 148, 255, .8); box-shadow: 0 0 0 4px rgba(10,132,255,.13), inset 0 1px 4px rgba(0,0,0,.2); }
.check { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 3px; }
.check input { width: 18px; min-height: 18px; accent-color: var(--blue); }
.rooms { display: grid; gap: 16px; }
.room-card { padding: 22px; border-radius: 26px; transition: border-color .2s ease, transform .2s ease; }
.room-card:hover { border-color: var(--line-bright); transform: translateY(-2px); }
.room-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.room-title { font-size: 20px; font-weight: 780; letter-spacing: -.03em; }
.meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid rgba(48,216,153,.2);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(48,216,153,.1);
  color: #70ecc0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
.badge.closed { background: rgba(255,82,99,.1); color: #ff8995; border-color: rgba(255,82,99,.2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.stats { display: flex; gap: 44px; margin: 20px 0; padding: 18px 2px; border-block: 1px solid var(--line); }
.stat strong { display: block; font-size: 26px; letter-spacing: -.045em; }
.stat span { color: var(--muted); font-size: 11px; }
.secret-box { background: rgba(0,0,0,.26); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 12px 0; overflow-wrap: anywhere; box-shadow: inset 0 1px 8px rgba(0,0,0,.18); }
.secret-box code { color: #cbd7e9; font-size: 11px; }
.check-ok, .check-bad, .check-warn { border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.check-ok { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.4); color: #d1fae5; }
.check-bad { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.4); color: #fecaca; }
.check-warn { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.4); color: #fde68a; }
.check-order { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; font-size: 12.5px; line-height: 1.5; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(450px, 100%); padding: clamp(26px, 5vw, 38px); border-radius: 32px; }
.auth-card .button { width: 100%; margin-top: 16px; }
.viewer-auth-wrap { position: relative; overflow: hidden; padding-top: max(24px, env(safe-area-inset-top)); padding-right: max(20px, env(safe-area-inset-right)); padding-bottom: max(24px, env(safe-area-inset-bottom)); padding-left: max(20px, env(safe-area-inset-left)); background: radial-gradient(circle at 50% 0%, rgba(44,102,255,.2), transparent 36%), radial-gradient(circle at 100% 90%, rgba(126,71,255,.13), transparent 32%), #020307; }
.viewer-auth-wrap::before { content: ""; position: absolute; width: min(70vw, 700px); aspect-ratio: 1; border: 1px solid rgba(255,255,255,.035); border-radius: 50%; box-shadow: 0 0 0 90px rgba(255,255,255,.012), 0 0 0 180px rgba(255,255,255,.008); pointer-events: none; }
.viewer-auth-card { width: min(480px, 100%); text-align: center; border-color: rgba(255,255,255,.13); background: linear-gradient(155deg, rgba(30,37,56,.84), rgba(8,11,18,.78)); box-shadow: 0 38px 120px rgba(0,0,0,.58), inset 0 1px rgba(255,255,255,.1); }
.viewer-auth-card h2 { margin-top: 10px; }
.viewer-auth-card .field { text-align: left; margin-top: 20px; }
.viewer-auth-card input { min-height: 54px; border-radius: 17px; text-align: center; font-size: 18px; letter-spacing: .12em; }
.viewer-auth-icon { width: 62px; height: 62px; margin: 0 auto 22px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 21px; background: linear-gradient(145deg, #269cff, #6557ff 58%, #a352ff); box-shadow: 0 17px 48px rgba(52,92,255,.38), inset 0 1px rgba(255,255,255,.48); }
.viewer-auth-icon span { width: 20px; height: 20px; border: 4px solid white; border-radius: 50%; box-shadow: 0 0 0 6px rgba(255,255,255,.13); }
.viewer-auth-icon.quiet { filter: saturate(.35); opacity: .8; }
.viewer-enter { min-height: 54px; border-radius: 17px; font-size: 15px; }
.viewer-enter > span { margin-left: auto; font-size: 20px; font-weight: 400; }
.viewer-auth-meta { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 22px; }
.viewer-auth-meta span { padding: 6px 8px; color: #8290a5; border: 1px solid rgba(255,255,255,.075); border-radius: 999px; background: rgba(255,255,255,.03); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.error, .notice { border-radius: 14px; padding: 11px 13px; font-size: 13px; }
.error { color: #ff9ca6; background: rgba(255,82,99,.1); border: 1px solid rgba(255,82,99,.24); }
.notice { color: #91efd1; background: rgba(48,216,153,.09); border: 1px solid rgba(48,216,153,.2); }

.viewer {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 480px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 25% 0%, rgba(25, 95, 255, .17), transparent 35%),
    radial-gradient(circle at 85% 100%, rgba(120, 72, 255, .12), transparent 38%),
    #000;
}
.viewer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 54px 54px;
}
.viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13,16,24,.9), rgba(5,7,11,.76));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 14px 50px rgba(0,0,0,.3), inset 0 1px rgba(255,255,255,.07);
  z-index: 4;
}
.viewer-title { min-width: 0; display: flex; align-items: center; gap: 11px; }
.viewer-title > span:last-child { min-width: 0; display: grid; gap: 2px; }
.viewer-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; letter-spacing: -.015em; }
.viewer-title small { color: #7e899c; font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.viewer-orb { flex: 0 0 auto; width: 38px; height: 38px; padding: 1px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(145deg, #31a7ff, #6657ff 58%, #ad55ff); box-shadow: 0 9px 28px rgba(50,104,255,.35), inset 0 1px rgba(255,255,255,.5); }
.viewer-orb i { width: 12px; height: 12px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.13); }
.viewer-controls { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.quality-pill { height: 38px; min-width: 58px; display: grid; place-content: center; justify-items: center; border: 1px solid rgba(117,174,255,.18); border-radius: 12px; color: #eaf5ff; background: rgba(22,105,255,.09); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.quality-pill strong { font-size: 12px; line-height: 1; letter-spacing: -.02em; }
.quality-pill small { margin-top: 3px; color: #73b9ff; font-size: 7px; font-weight: 850; letter-spacing: .09em; }
.viewer-control { height: 40px; min-width: 40px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: #e9edf5; border: 1px solid rgba(255,255,255,.11); border-radius: 12px; background: rgba(255,255,255,.055); box-shadow: inset 0 1px rgba(255,255,255,.05); transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.viewer-control:hover, .viewer-control.active { background: rgba(32,125,255,.18); border-color: rgba(75,151,255,.35); }
.viewer-control:active { transform: scale(.96); }
.viewer-control:focus-visible { outline: 3px solid rgba(10,132,255,.55); outline-offset: 2px; }
.viewer-control svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.viewer-control span { font-size: 11px; font-weight: 720; }
.viewer-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; overflow: hidden; background: #000; }
.viewer-stage::before { content: ""; position: absolute; inset: -20%; pointer-events: none; opacity: .22; background: radial-gradient(circle, rgba(34,79,145,.35), transparent 58%); }
.viewer-stage iframe, .viewer-stage video { position: relative; z-index: 1; display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; border: 0; background: #000; }
/* WebRTC playback is a real <video>, so letterbox it instead of letting the
   1080p intrinsic size overflow the stage and crop the edges. */
.viewer-stage video { object-fit: contain; }
.viewer-stage:fullscreen, .viewer-stage:-webkit-full-screen { width: 100%; height: 100%; background: #000; }
.viewer-stage:fullscreen iframe, .viewer-stage:-webkit-full-screen iframe,
.viewer-stage:fullscreen video, .viewer-stage:-webkit-full-screen video { width: 100%; height: 100%; }
.viewer-gate { position: absolute; z-index: 6; inset: 0; width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; color: #f7f9ff; font-family: inherit; text-align: center; border: 0; background: rgba(3,4,7,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); cursor: pointer; }
.viewer-gate b { font-size: 16px; font-weight: 750; }
.viewer-gate small { color: #a9b4c6; font-size: 11px; }
.viewer-gate-icon { width: 62px; height: 62px; margin-bottom: 8px; display: grid; place-items: center; font-size: 24px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(255,255,255,.09); }
.viewer-gate.sound-only { inset: auto auto 18% 50%; width: auto; height: auto; padding: 12px 20px; grid-auto-flow: column; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(10,12,18,.86); transform: translateX(-50%); }
.viewer-gate.sound-only .viewer-gate-icon { width: 26px; height: 26px; margin: 0; font-size: 14px; border: 0; background: none; }
.viewer-gate.sound-only small { display: none; }
.viewer-gate.sound-only b { font-size: 13px; }
.viewer-gate[hidden] { display: none; }
/* ปุ่มแตะเดียว "ดูเต็มจอ" (มือถือ) */
.viewer-fullgate { position: absolute; z-index: 7; inset: 0; width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; color: #f7f9ff; font-family: inherit; text-align: center; border: 0; background: rgba(3,4,7,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); cursor: pointer; }
.viewer-fullgate b { font-size: 16px; font-weight: 750; }
.viewer-fullgate small { color: #a9b4c6; font-size: 11px; }
.viewer-fullgate-ic { width: 60px; height: 60px; margin-bottom: 6px; display: grid; place-items: center; font-size: 28px; border: 1px solid rgba(255,255,255,.24); border-radius: 18px; background: rgba(255,255,255,.1); }
.viewer-fullgate[hidden] { display: none; }
/* โหมด immersive: ซ่อนหัว/ท้าย ให้เครื่องเล่นเต็มพื้นที่ (fallback เมื่อ native fullscreen ไม่ได้ เช่น iframe บน iOS) */
.viewer.immersive { position: fixed; inset: 0; z-index: 999; height: 100vh; height: 100dvh; grid-template-rows: minmax(0, 1fr); }
.viewer.immersive .viewer-head, .viewer.immersive .viewer-foot { display: none; }
.viewer-exitfull { position: fixed; z-index: 1000; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.5); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.viewer-exitfull[hidden] { display: none; }
.viewer-notice { position: relative; z-index: 8; display: flex; align-items: center; gap: 10px; padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); color: #ffe9c2; font-size: 12px; font-weight: 650; line-height: 1.45; background: rgba(122,74,12,.94); border-bottom: 1px solid rgba(255,255,255,.12); }
.viewer-notice span { flex: 1; }
.viewer-notice-close { flex: 0 0 auto; width: 26px; height: 26px; color: inherit; font-size: 13px; border: 0; border-radius: 8px; background: rgba(0,0,0,.22); cursor: pointer; }
.rotate-hint { display: none; }
.viewer-foot { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 9px max(18px, env(safe-area-inset-right)) max(9px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); color: #687386; font-size: 10px; font-weight: 650; letter-spacing: .025em; border-top: 1px solid rgba(255,255,255,.06); background: rgba(4,5,8,.94); }
.viewer-foot > span:first-child { color: #9fcfff; }
.privacy-copy { margin-left: auto; }
.viewer-toast { position: fixed; z-index: 20; left: 50%; bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); max-width: min(420px, calc(100% - 28px)); padding: 11px 15px; color: #f7f9ff; text-align: center; font-size: 12px; font-weight: 650; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(24,27,36,.88); box-shadow: 0 18px 55px rgba(0,0,0,.48); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }
.viewer-toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.empty { padding: 44px; text-align: center; color: var(--muted); border: 1px dashed var(--line-bright); border-radius: 24px; background: rgba(255,255,255,.025); }

@media (max-width: 780px) {
  .shell { width: min(100% - 24px, 1180px); padding-top: 12px; }
  .hero { min-height: auto; grid-template-columns: 1fr; gap: 32px; padding: 70px 0; }
  .hero-card { transform: none; border-radius: 28px; }
  .grid { grid-template-columns: 1fr; }
  .workflow-head { align-items: flex-start; flex-direction: column; }
  .workflow-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .topbar, .room-head { align-items: flex-start; }
  .topbar { border-radius: 18px; }
  .room-head { flex-direction: column; }
  .viewer-head { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .viewer-control { padding-inline: 10px; }
  .viewer-control span { display: none; }
  .quality-pill { min-width: 50px; }
  .viewer-foot { justify-content: center; }
  .privacy-copy { display: none; }
}

@media (max-width: 560px) and (orientation: portrait) {
  .viewer { min-height: 100dvh; grid-template-rows: auto minmax(0, 1fr) auto; }
  .viewer-title > span:last-child, .quality-pill { display: none; }
  .viewer-title { flex: 0 0 auto; }
  .viewer-head { position: relative; min-height: 60px; }
  .viewer-controls { position: absolute; right: max(12px, env(safe-area-inset-right)); }
  .viewer-controls { gap: 6px; }
  .viewer-control { height: 38px; min-width: 38px; padding: 0; }
  .viewer-stage iframe, .viewer-stage video { width: 100%; height: auto; max-height: 100%; aspect-ratio: 16 / 9; }
  .rotate-hint { position: absolute; z-index: 2; top: calc(50% + min(34vw, 150px)); left: 50%; width: max-content; max-width: calc(100% - 32px); display: grid; justify-items: center; gap: 2px; color: #dce8f8; pointer-events: none; transform: translate(-50%, -50%); }
  .rotate-hint span { width: 34px; height: 34px; margin-bottom: 5px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; background: rgba(255,255,255,.05); font-size: 20px; }
  .rotate-hint b { font-size: 12px; }
  .rotate-hint small { color: #788499; font-size: 10px; }
}

@media (orientation: landscape) and (max-height: 600px) {
  .viewer { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; min-height: 0; display: block; background: #000; }
  .viewer-stage { position: absolute; inset: 0; width: 100%; height: 100%; }
  .viewer-head { position: absolute; z-index: 5; inset: 0 0 auto; min-height: 54px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; border: 0; background: linear-gradient(to bottom, rgba(0,0,0,.78), transparent); box-shadow: none; }
  .viewer-title small, .quality-pill { display: none; }
  .viewer-control { width: 38px; min-width: 38px; height: 38px; padding: 0; background: rgba(0,0,0,.3); }
  .viewer-control span { display: none; }
  .viewer-foot, .rotate-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* รายการเลือกงานขายบัตร (ผูกได้หลายงาน ข้ามร้าน) */
.event-pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto;
  padding: 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.03); }
.event-pick-shop { font-size: 12px; font-weight: 800; color: #a9b4d0; margin: 8px 2px 2px; }
.event-pick { display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 9px; cursor: pointer; }
.event-pick:hover { background: rgba(255,255,255,.05); }
.event-pick input { width: 18px; height: 18px; flex: none; }
.event-pick small { color: #8b93ad; }

/* =====================================================================
   QENTRO CI — ธีมหน้า viewer ให้เหมือนร้าน Q (ดำ #000 · มิ้น #00FFBF · แดง #FF023F)
   ===================================================================== */
:root{ --bg:#000000; --blue:#00FFBF; --indigo:#FF023F; --cyan:#7dffe6; --red:#FF023F; }
html{ background:#000; }
body{
  background:
    radial-gradient(circle at 22% -5%, rgba(0,255,191,.16), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(255,2,63,.14), transparent 30%),
    radial-gradient(circle at 55% 100%, rgba(0,255,191,.07), transparent 36%),
    #000;
}
/* ปุ่มหลัก = ไล่เฉดมิ้น→แดง (เหมือนร้าน Q) */
.button{
  background: linear-gradient(120deg,#00FFBF 0%,#00e6c8 42%,#FF023F 125%);
  color:#00231c; border:none;
  box-shadow: 0 12px 30px rgba(0,255,191,.26), inset 0 1px rgba(255,255,255,.25);
}
.button:hover{ border:none; filter:brightness(1.08); }
.button.danger{ background: rgba(255,2,63,.14); color:#ff6b8a; border:1px solid rgba(255,2,63,.3); box-shadow:none; }
/* หน้าล็อกอิน viewer */
.viewer-auth-wrap{
  background: radial-gradient(circle at 50% 0%, rgba(0,255,191,.18), transparent 38%),
             radial-gradient(circle at 100% 90%, rgba(255,2,63,.14), transparent 32%), #000;
}
.viewer-auth-card{
  border-color: rgba(0,255,191,.22);
  background: linear-gradient(155deg, rgba(12,16,15,.92), rgba(0,0,0,.88));
  box-shadow: 0 38px 120px rgba(0,0,0,.6), 0 0 0 1px rgba(0,255,191,.08), inset 0 1px rgba(255,255,255,.06);
}
.viewer-auth-icon{
  background: linear-gradient(140deg,#00FFBF,#00e6c8 55%,#FF023F);
  box-shadow: 0 17px 48px rgba(0,255,191,.3), inset 0 1px rgba(255,255,255,.4);
}
.eyebrow{ color:#00FFBF !important; }
/* เครื่องเล่น: orb + ป้าย + ปุ่มควบคุม */
.viewer-orb{
  background: linear-gradient(140deg,#00FFBF,#00e6c8 55%,#FF023F);
  box-shadow: 0 9px 28px rgba(0,255,191,.35), inset 0 1px rgba(255,255,255,.5);
}
.badge{ border-color: rgba(0,255,191,.28); background: rgba(0,255,191,.12); color:#00FFBF; }
.quality-pill{ border-color: rgba(0,255,191,.2); color:#eafff8; background: rgba(0,255,191,.08); }
.quality-pill small{ color:#00FFBF; }
.viewer-control:hover, .viewer-control.active{ background: rgba(0,255,191,.16); border-color: rgba(0,255,191,.42); }
.viewer-control:focus-visible{ outline: 3px solid rgba(0,255,191,.5); }
.viewer-gate-icon{ border-color: rgba(0,255,191,.3); background: rgba(0,255,191,.12); }
input:focus{ outline:none; border-color: rgba(0,255,191,.55) !important; box-shadow: 0 0 0 3px rgba(0,255,191,.18) !important; }
/* ปุ่มรอง (คัดลอก Stream Key / ปิดห้อง / ย้ายบัญชี Mux) — ตัวอักษรขาว อ่านออกบนพื้นมืด */
.button.secondary{ background: rgba(255,255,255,.08); color:#f2f5f4; border:1px solid rgba(255,255,255,.18); box-shadow:none; }
.button.secondary:hover{ border:1px solid rgba(0,255,191,.45); }
.button[data-remux]{ color:#00FFBF; border-color: rgba(0,255,191,.45); background: rgba(0,255,191,.08); }
