* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #090a08;
  color: #f6f0df;
  font: 500 16px/1.4 Manrope, Arial, sans-serif;
}
body { overflow: hidden; }
[hidden] { display: none !important; }
button { cursor: pointer; font: 700 13px Manrope, sans-serif; }
button:focus-visible { outline: 3px solid #f5a45d; outline-offset: 3px; }
#tv-display {
  width: 100%;
  height: 100%;
  margin-inline: auto;
  position: relative;
  isolation: isolate;
  container-type: size;
  background: #13140f;
}
@media (min-aspect-ratio: 1/1) {
  #tv-display { width: 56.25vh; }
}
#air {
  height: 100%;
  padding: 2.4cqh 4cqw;
  display: flex;
  flex-direction: column;
  gap: 1.4cqh;
}
.wall-head {
  display: flex;
  align-items: center;
  gap: 2.5cqw;
}
.wall-head img { width: 21cqw; }
.wall-head span, .wall-head b {
  font: 800 2.1cqw/1.15 Manrope, sans-serif;
  letter-spacing: .11em;
}
.wall-head span { padding-left: 2.5cqw; border-left: 1px solid #6b6959; }
.wall-head b {
  display: flex;
  align-items: center;
  gap: .65em;
  margin-left: auto;
  max-width: 43%;
  color: #f1bd8d;
  text-align: right;
}
.wall-head b::before {
  content: "";
  width: .6em;
  height: .6em;
  border-radius: 50%;
  background: #ff8a4c;
  flex: none;
}
.wall-side {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1.4cqh;
}
.wall-side:has(.wall-members[hidden]) { grid-template-rows: minmax(0, 1fr); }
.wall-side h2 { margin: 0; font: 700 5.6cqw/1 Barlow, sans-serif; letter-spacing: -.015em; }
.wall-chat {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #424337;
  border-radius: 1.4cqw;
  background: #1b1c17;
}
.wall-chat h2 {
  padding: 1.2cqh 3.5cqw;
  border-bottom: 1px solid #38392e;
}
.chat-window {
  position: relative;
  isolation: isolate;
  container-type: size;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  background: #161712;
}
#chat-video { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
#chat-idle {
  display: grid;
  gap: .45em;
  margin: 0;
  padding: 5cqw;
  color: #cac7b8;
  font-size: 3.7cqw;
}
#chat-idle > strong { color: #fff6e4; font: 700 6cqw Barlow, sans-serif; }
#chat-idle.sample-chat { height: 100%; gap: 0; align-content: space-evenly; }
.sample-chat b {
  font: 750 2.4cqw/1.2 Manrope,sans-serif;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #c1af90;
}
.sample-chat p { padding: 2.7cqw 0; margin: 0; border-bottom: 1px solid #303127; line-height: 1.3; }
.sample-chat p:last-child { border: 0; }
.sample-chat p strong { display: block; color: #f1bb8b; }
.wall-members { min-width: 0; }
.wall-members h2 { font-size: 4.3cqw; }
.wall-members ol {
  list-style: none;
  margin: 1cqh 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 2cqw;
  counter-reset: buyer;
}
.wall-members ol:empty { display: none; }
.wall-members li {
  counter-increment: buyer;
  min-width: 0;
  padding-top: .75cqh;
  border-top: 1px solid #49483c;
  font: 700 3.3cqw/1.08 Barlow, sans-serif;
  overflow-wrap: anywhere;
}
.wall-members li::before {
  content: "0" counter(buyer);
  display: block;
  margin-bottom: .3em;
  color: #f1ad74;
  font: 750 2cqw/1 Manrope, sans-serif;
}
.empty-buyers { color: #b9b6a5; font-size: 3cqw; margin: .55em 0 0; }
.wall-members ol:not(:empty) + p { display: none; }

#sale-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  background: radial-gradient(ellipse at 65% 55%, #593322, #171610 75%);
  pointer-events: none;
}
#sale-stage #output { width: 97%; aspect-ratio: 1.38; }
.chat-window #sale-stage {
  background: linear-gradient(transparent 0%, #0b0b0970 25% 75%, transparent 100%);
}
.chat-window #sale-stage #output { width: 96%; height: min(80%, 95cqw); aspect-ratio: auto; }
.chat-window .scene-stage, .chat-window .alarm-stage {
  inset: 1%;
  box-shadow: 0 1cqw 3cqw #0008;
}
.chat-window .scene-stage {
  border-top: .65cqw solid var(--hit);
  border-bottom: .25cqw solid var(--hit);
  background: radial-gradient(ellipse at 62% 15%, color-mix(in srgb, var(--hit) 23%, #201a15), transparent 62%), #211d17;
}
.chat-window .scene .stage-copy, .chat-window .scene .alarm-main {
  inset: 38% 5% 5%;
  width: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  transform: none;
}
.chat-window .scene.running .stage-copy { animation-name: tv-type; }
@keyframes tv-type { from { opacity: 0; translate: 0 6%; } to { opacity: 1; translate: 0; } }
.chat-window .scene .product-cut, .chat-window .scene .alarm-product {
  inset: 3% 8% auto auto;
  height: 38%;
  width: 47%;
}
.chat-window .scene .alarm-product { top: 11%; height: 30%; }
.chat-window .sale-star { left: 12%; top: 14%; width: 10%; height: 15%; }
.chat-window .alarm-band { height: 9%; font-size: 2.4cqw; }
.chat-window .scene .ticket { font-size: min(2.5cqw,3.3cqh); }
.chat-window .scene .member-title, .chat-window .scene .burst-title { font-size: min(7.8cqw,11cqh); }
.chat-window .scene .member-handle {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: min(var(--tv-name-size), 19cqh);
  line-height: .98;
  letter-spacing: -.018em;
}
.chat-window .scene .receipt, .chat-window .scene .alarm-main small {
  font-size: min(3.1cqw,4.4cqh);
  transform: none;
}
.chat-window .alarm-meter { bottom: 2.5%; }

.tv-tools {
  position: fixed;
  bottom: 0.6vh;
  right: 3vw;
  display: flex;
  gap: 0.35rem;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 6;
}
.tv-tools.show,
.tv-tools:hover,
.tv-tools:focus-within {
  opacity: 1;
}
.tv-tools button,
#enable-audio,
dialog button {
  border: 1px solid #4b4d41;
  border-radius: 5px;
  background: #25261f;
  color: #f6f0df;
  padding: 7px 10px;
}
.tv-tools button {
  font-size: 11px;
}
#enable-audio {
  position: fixed;
  bottom: 30px;
  left: 12px;
  z-index: 7;
}
.rehearsal .tv-tools { opacity: 1; }
.rehearsal #air { padding-bottom: max(2.4cqh, 46px); }
@media (max-width: 400px) {
  .rehearsal #air { padding-bottom: 68px; }
}
.tv-tools { max-width: 98vw; flex-wrap: wrap; justify-content: flex-end; }
.tv dialog {
  box-sizing: border-box;
  width: min(670px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: #191a16;
  color: #f7f0df;
  border: 1px solid #6c6552;
  border-radius: 10px;
  padding: 20px;
}
.tv dialog::backdrop {
  background: #000b;
}
dialog h2 {
  font:
    700 31px Barlow,
    sans-serif;
  margin: 0;
}
dialog p {
  font-size: 13px;
  color: #ceccbc;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
#tv-link-form label { display: grid; gap: 5px; font-size: 14px; }
#tv-link { width: 100%; padding: 9px; background: #22231c; border: 1px solid #77796a; border-radius: 4px; color: #fff; font: inherit; }
dialog button:disabled {
  opacity: 0.4;
  cursor: default;
}
#crop-box {
  position: relative;
  display: table;
  max-width: 100%;
  margin: 12px auto;
  cursor: crosshair;
  line-height: 0;
  touch-action: none;
}
#capture-preview {
  display: block;
  max-width: 100%;
  max-height: 45vh;
}
#crop-rect {
  position: absolute;
  border: 2px solid #ff813e;
  background: #ff893525;
  pointer-events: none;
}
.tv-tools button:hover,
dialog button:hover {
  border-color: #d18c5d;
}
@media (prefers-reduced-motion: reduce) {
  .tv-tools { transition: none; }
}
