/* Thubi-Telas — arcade/HUD theme */
:root {
  color-scheme: dark;
  --bg: #07060d;
  --bg2: #0e0b1a;
  --panel: #110e1f;
  --panel2: #181429;
  --line: #2c2545;
  --line-hot: #4a3a78;
  --text: #f3f0ff;
  --muted: #9a93b8;
  --dim: #6c6589;
  --pink: #ff2e88;
  --pink-soft: #ff2e8833;
  --cyan: #19e3ff;
  --cyan-soft: #19e3ff26;
  --yellow: #ffd23f;
  --red: #ff4d5e;
  --cut: 14px;
  --display: "Chakra Petch", "Barlow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--body);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}
main { flex: 1; position: relative; z-index: 1; }
.hidden { display: none !important; }
button, input, select { font-family: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* Background: perspective grid floor, glow and scanlines */
.bg-grid {
  position: fixed; inset: auto -50% -10% -50%; height: 60vh; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--pink-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--pink-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  animation: grid-run 6s linear infinite;
}
@keyframes grid-run { to { background-position: 0 56px, 0 0; } }
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 380px at 15% -5%, #7b2cff40, transparent 70%),
    radial-gradient(520px 360px at 95% 10%, #19e3ff22, transparent 70%),
    radial-gradient(700px 300px at 50% 110%, #ff2e8830, transparent 70%);
}
/* Background-only CRT texture: kept under the page content (z-index 0) so it never streaks the live video. */
.scanlines {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #00000026 2px 3px);
}
@media (prefers-reduced-motion: reduce) { .bg-grid { animation: none; } }

/* Shared HUD panel with cut corners */
.panel {
  position: relative;
  background:
    linear-gradient(160deg, var(--panel2), var(--panel)) padding-box,
    linear-gradient(160deg, var(--line-hot), var(--line) 40%, var(--line) 70%, #ff2e8866) border-box;
  border: 1px solid transparent;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.panel-tag, .mini-label {
  font: 600 11px var(--display);
  letter-spacing: 2px;
  color: var(--cyan);
}

/* Top bar */
.topbar {
  position: relative; z-index: 2;
  height: 72px; padding: 0 clamp(16px, 5vw, 80px);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #ffffff10;
  background: linear-gradient(#07060dcc, #07060d66);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; fill: var(--pink); filter: drop-shadow(0 0 10px #ff2e8899); }
.brand-mark .brand-play, .screen-icon .brand-play { fill: var(--bg); }
.brand-name { font: 700 21px var(--display); letter-spacing: 1.5px; }
.brand-name span { color: var(--cyan); text-shadow: 0 0 14px #19e3ff88; }
.top-note { display: flex; align-items: center; gap: 9px; font: 600 11px var(--display); letter-spacing: 1.6px; color: var(--muted); }
.live-dot, .status-pill i, .stage-badge i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #3dff9a; box-shadow: 0 0 10px #3dff9a;
  animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .35; } }

/* Home */
.home-layout {
  max-width: 1160px; margin: auto;
  padding: clamp(40px, 9vh, 96px) clamp(16px, 4vw, 32px) 60px;
  display: grid; grid-template-columns: 1fr 420px; align-items: center; gap: 72px;
}
.eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; font: 600 11px var(--display); letter-spacing: 1.8px; color: var(--muted); }
.chip { padding: 3px 8px; background: var(--pink); color: #fff; font-weight: 700; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
h1 { margin: 0; font: 700 clamp(40px, 6vw, 70px)/1.02 var(--display); letter-spacing: -1px; text-transform: uppercase; }
.neon-text {
  background: linear-gradient(95deg, var(--pink), #b84dff 50%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px #ff2e8855);
}
.intro > p { max-width: 460px; margin: 22px 0 34px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 22px;
  background: #07060daa; border: 1px solid var(--line);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.stat-strip div { padding: 12px 10px; text-align: center; }
.stat-strip div + div { border-left: 1px solid var(--line); }
.stat-strip b { display: block; font: 700 24px/1.1 var(--display); color: var(--cyan); text-shadow: 0 0 14px #19e3ff66; }
.stat-strip div:nth-child(even) b { color: var(--pink); text-shadow: 0 0 14px #ff2e8866; }
.stat-strip small { display: block; margin-top: 3px; font: 600 9.5px var(--display); letter-spacing: 1.4px; color: var(--muted); }
.feature-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feature-grid li {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px;
  background: #110e1fb3; border: 1px solid var(--line);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.feature-grid li:hover { border-color: var(--line-hot); transform: translateY(-2px); box-shadow: 0 6px 22px #7b2cff22; }
.feature-grid li:hover .feature-icon { border-color: var(--pink); box-shadow: 0 0 14px #ff2e8855; }
.feature-icon {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-size: 18px;
  background: var(--panel2); border: 1px solid var(--line-hot);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.feature-icon { width: 38px; height: 38px; font-size: 17px; transition: border-color .15s, box-shadow .15s; }
.feature-grid b, .feature-grid small { display: block; }
.feature-grid b { font: 700 14px var(--display); letter-spacing: .4px; }
.feature-grid small { margin-top: 2px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }

.entry-card { padding: 30px; box-shadow: 0 30px 80px #0008; }
.entry-card::after {
  content: ""; position: absolute; top: 0; left: var(--cut); right: 30%; height: 2px;
  background: linear-gradient(90deg, var(--pink), transparent);
}
.panel-tag { margin-bottom: 10px; }
.card-heading { margin-bottom: 24px; }
.card-heading h2 { margin: 0 0 4px; font: 700 26px var(--display); text-transform: uppercase; }
.card-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.field-label { display: block; margin-bottom: 8px; font: 600 11px var(--display); letter-spacing: 2px; color: var(--muted); }
.text-input {
  width: 100%; height: 48px; padding: 0 14px;
  background: #07060d; border: 1px solid var(--line); color: var(--text);
  font: 500 15px var(--body); outline: none; transition: border-color .15s, box-shadow .15s;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.text-input:focus { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 18px var(--cyan-soft); }
.text-input::placeholder { color: var(--dim); }
.room-input { font: 700 18px var(--display); letter-spacing: 6px; text-align: center; }

.button {
  height: 48px; padding: 0 18px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  font: 700 14px var(--display); letter-spacing: 1.2px; text-transform: uppercase;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: transform .12s, filter .12s, box-shadow .12s;
}
.button:hover { filter: brightness(1.12); transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button-primary { background: linear-gradient(95deg, var(--pink), #c53bff); color: #fff; box-shadow: 0 0 24px #ff2e8855; }
.button-primary b, .button-secondary b { font-size: 16px; }
.entry-card > .button-primary { width: 100%; margin-top: 14px; }
.button-secondary { background: #0b1d26; color: var(--cyan); box-shadow: inset 0 0 0 1px #19e3ff66; }
.button-secondary:hover { box-shadow: inset 0 0 0 1px var(--cyan), 0 0 16px var(--cyan-soft); }
.button-stop { background: #2a0d14; color: #ff8a97; box-shadow: inset 0 0 0 1px #ff4d5e88; }
.button-quiet { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hot); }
.sound-cta { background: var(--yellow); color: #1a1300; box-shadow: 0 0 22px #ffd23f66; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 6px #ffd23f33; } }

.divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 16px; }
.divider span { flex: 1; height: 1px; background: var(--line); }
.divider small { font: 600 10px var(--display); letter-spacing: 1.6px; color: var(--dim); }
.join-row { display: flex; gap: 10px; }
.join-row .button-secondary { min-width: 118px; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--dim); font-size: 13px; }
.privacy-note span { color: var(--pink); }
.error-text { min-height: 18px; margin: 10px 0 -8px; color: var(--red); font-size: 13px; font-weight: 600; }

.page-foot { position: relative; z-index: 1; padding: 18px; text-align: center; font: 600 10px var(--display); letter-spacing: 2px; color: var(--dim); }

/* Room */
.room-layout { max-width: 1260px; margin: auto; padding: 26px clamp(12px, 3.5vw, 48px) 50px; }
.room-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.back-button { background: none; border: 0; padding: 8px 0; cursor: pointer; color: var(--muted); font: 600 13px var(--display); letter-spacing: 1px; text-transform: uppercase; }
.back-button:hover { color: var(--pink); }
.status-pill {
  display: flex; align-items: center; gap: 9px; padding: 8px 14px;
  background: var(--panel); border: 1px solid var(--line);
  font: 600 12px var(--display); letter-spacing: 1px; color: var(--text);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.status-pill.is-waiting i { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }

.screen-panel { padding: 18px; }
.screen-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 2px 14px; }
.screen-head h2 { margin: 4px 0 0; font: 700 22px var(--display); text-transform: uppercase; }
.watcher-count { padding: 7px 12px; background: #0b1d26; color: var(--cyan); font: 600 12px var(--display); letter-spacing: .8px; white-space: nowrap; box-shadow: inset 0 0 0 1px #19e3ff55; clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }

.screen-stage { position: relative; aspect-ratio: 16/9; background: #030207; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.screen-stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, #7b2cff1f, transparent 65%);
}
/* Pin the video to the 16:9 frame so any monitor shape (4:3, 16:10, ultrawide) letterboxes instead of being cropped. */
.screen-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.hud-corner { position: absolute; width: 22px; height: 22px; border: 2px solid var(--cyan); pointer-events: none; opacity: .8; z-index: 1; }
.hud-corner.tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.hud-corner.tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.hud-corner.bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.hud-corner.br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.stage-empty { position: relative; text-align: center; padding: 16px; }
.screen-icon svg { width: 54px; height: 54px; fill: var(--line-hot); margin-bottom: 12px; animation: blink 2.4s ease-in-out infinite; }
.stage-empty h3 { margin: 0 0 6px; font: 700 16px var(--display); letter-spacing: 3px; color: var(--muted); }
.stage-empty p { margin: 0; color: var(--dim); font-size: 14px; }
.stage-badge {
  position: absolute; top: 16px; left: 18px; z-index: 2; padding: 5px 10px;
  background: var(--red); color: #fff; font: 700 11px var(--display); letter-spacing: 1.5px;
  box-shadow: 0 0 18px #ff4d5e88; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.stage-badge i { width: 7px; height: 7px; margin-right: 5px; background: #fff; box-shadow: none; }
.stage-controls { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; gap: 8px; }
.stage-button { width: 40px; height: 36px; display: grid; place-items: center; border: 1px solid #19e3ff66; background: #030207cc; color: var(--cyan); font-size: 20px; cursor: pointer; }
.stage-button:hover { background: #0b1d26; box-shadow: 0 0 14px var(--cyan-soft); }
.stage-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.stage-button[aria-pressed="true"] { background: var(--cyan); color: #04121a; box-shadow: 0 0 14px #19e3ff88; }
.screen-stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; }
.screen-stage:fullscreen .hud-corner, .screen-stage:fullscreen #theaterBtn { display: none; }

/* Theater mode: wide video across the page, room info moves below it (like YouTube). */
.room-layout.is-theater { max-width: 1680px; }
.is-theater .room-grid { grid-template-columns: 1fr; }
/* Explicit height instead of aspect-ratio + max-height, which would shrink the width and leave a gap. */
.is-theater .screen-stage { aspect-ratio: auto; width: 100%; height: calc(100vh - 230px); max-height: 56vw; min-height: 240px; }
.is-theater .side-panel { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start; }
.is-theater .room-tip { grid-column: auto; }

.screen-actions { display: flex; gap: 10px; margin-top: 14px; }
.screen-actions .button-primary { flex: 1; }
.button-stop, .button-quiet { flex: 1; justify-content: center; }
.quality-select {
  height: 48px; max-width: 170px; padding: 0 10px;
  background: var(--panel2); border: 1px solid var(--line-hot); color: var(--text);
  font: 600 12px var(--display); letter-spacing: .5px; outline: none; cursor: pointer;
}
.quality-select:focus { border-color: var(--cyan); }
.audio-hint { margin: 12px 0 0; font: 600 13px var(--body); color: #3dff9a; }
.audio-hint:empty { display: none; }
.audio-hint.is-off { color: var(--yellow); }
.browser-hint { margin: 10px 0 0; text-align: center; color: var(--dim); font-size: 12.5px; }
.browser-hint b { color: var(--muted); }

.side-panel { display: flex; flex-direction: column; gap: 14px; }
.invite-card, .people-card { padding: 18px; }
.invite-card h3, .people-head h3 { margin: 4px 0 4px; font: 700 17px var(--display); letter-spacing: .6px; text-transform: uppercase; }
.invite-card > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.code-box {
  height: 54px; margin-bottom: 10px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: #07060d; border: 1px dashed #ff2e8888;
}
.code-box span { font: 700 26px var(--display); letter-spacing: 6px; color: var(--pink); text-shadow: 0 0 14px #ff2e8888; }
.code-box button { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.code-box button:hover { color: var(--pink); }
.full-width { width: 100%; height: 44px; font-size: 12px; }
.copy-feedback { min-height: 16px; margin-top: 6px; text-align: center; color: #3dff9a; font-size: 12px; font-weight: 600; }

.people-head { display: flex; justify-content: space-between; align-items: center; }
.people-head h3 { margin: 0; }
.people-head > span { min-width: 26px; padding: 2px 8px; text-align: center; background: var(--pink); color: #fff; font: 700 12px var(--display); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.people-list { margin-top: 10px; }
.person { display: flex; align-items: center; gap: 10px; padding: 10px 0 4px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.person > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #3a1d6e, #1d1240); color: var(--cyan);
  font: 700 14px var(--display); border: 1px solid var(--line-hot);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.person small { margin-left: auto; color: var(--dim); font: 600 11px var(--display); letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.person:has(.kick-button) small { display: none; }
.kick-button {
  margin-left: auto; padding: 5px 9px; cursor: pointer;
  background: #2a0d14; border: 1px solid #ff4d5e66; color: #ff8a97;
  font: 700 10px var(--display); letter-spacing: 1px; text-transform: uppercase;
}
.kick-button:hover { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 12px #ff4d5e88; }
.room-tip { display: flex; gap: 10px; padding: 13px 14px; background: #ffd23f0d; border-left: 2px solid var(--yellow); color: var(--muted); }
.room-tip p { margin: 0; font-size: 13px; line-height: 1.55; }
.room-tip b { color: var(--yellow); font-family: var(--display); letter-spacing: 1px; text-transform: uppercase; font-size: 12px; }

/* Responsive */
@media (max-width: 900px) {
  .home-layout { grid-template-columns: 1fr 380px; gap: 40px; }
  .room-grid { grid-template-columns: minmax(0, 1fr) 270px; }
}
@media (max-width: 760px) {
  .topbar { height: 60px; }
  .brand-name { font-size: 18px; }
  .top-note { font-size: 10px; letter-spacing: 1px; }
  /* On phones, show the join form right after the headline, before the feature list. */
  .home-layout { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-top: 36px; }
  .intro { display: contents; }
  .entry-card { order: 1; margin-bottom: 28px; }
  .stat-strip, .feature-grid { order: 2; }
  .intro > p { font-size: 15px; margin: 16px 0 24px; }
  .stat-strip b { font-size: 19px; }
  .stat-strip small { font-size: 8.5px; letter-spacing: .8px; }
  .entry-card { padding: 22px; }
  .room-grid { grid-template-columns: 1fr; }
  .side-panel, .is-theater .side-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .room-tip, .is-theater .room-tip { grid-column: 1 / -1; }
  .is-theater .screen-stage { aspect-ratio: 16/9; height: auto; max-height: none; min-height: 0; }
  .screen-panel { padding: 12px; }
  .screen-head h2 { font-size: 17px; }
  .screen-actions { flex-wrap: wrap; }
  .quality-select { flex: 1 1 120px; max-width: none; }
  .screen-actions .button-primary { flex: 1 1 calc(100% - 130px); }
  .stage-empty p { font-size: 12px; }
}
@media (max-width: 480px) {
  .top-note { display: none; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip div:nth-child(3) { border-left: 0; }
  .stat-strip div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .feature-grid { grid-template-columns: 1fr; }
  .side-panel, .is-theater .side-panel { grid-template-columns: 1fr; }
  .room-tip { grid-column: auto; }
  .join-row .button-secondary { min-width: 100px; }
  .screen-actions .button-primary { flex-basis: 100%; }
}
