:root {
  --bg: #0c0a07;
  --gold: #e0b34a;
  --gold-soft: #c9a056;
  --parchment: #f4ead8;
  --parchment-dim: rgba(244, 234, 216, 0.74);
  --live: #e23d3d;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--parchment);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

@media (min-width: 900px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .stage {
    height: min(100dvh, 100vw * 16 / 9);
    width: calc(min(100dvh, 100vw * 16 / 9) * 9 / 16);
    max-width: 100vw;
    border-radius: 18px;
    box-shadow:
      0 0 0 1px rgba(224, 179, 74, 0.16),
      0 28px 80px rgba(0, 0, 0, 0.65);
  }
}

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.shade {
  position: absolute;
  inset: auto 0 0 0;
  height: 48%;
  background: linear-gradient(
    to top,
    rgba(12, 10, 7, 0.94) 0%,
    rgba(12, 10, 7, 0.55) 48%,
    rgba(12, 10, 7, 0) 100%
  );
  pointer-events: none;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(224, 179, 74, 0.35);
  background: var(--bg);
}

.live-badge {
  background: var(--live);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1.4;
}

.viewers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.48);
  color: var(--parchment);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.offline {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(196, 146, 42, 0.22), transparent 55%),
    var(--bg);
}

.offline[hidden] { display: none; }

.offline-mark {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  margin-bottom: 22px;
  border: 1px solid rgba(224, 179, 74, 0.35);
}

.offline-kicker {
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.offline-title {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.offline-next {
  color: var(--parchment-dim);
  font-size: 15px;
  max-width: 260px;
  line-height: 1.45;
}

.chat {
  position: absolute;
  left: 12px;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(78%, 330px);
  max-height: 38%;
  overflow: hidden;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, #000 18%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%);
}

.msg {
  color: var(--parchment);
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  animation: msg-in 0.28s ease-out;
}

.msg .name {
  font-weight: 700;
  color: var(--gold);
  margin-right: 6px;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.reactions-layer {
  position: absolute;
  right: 8px;
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  width: 72px;
  height: 48%;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}

.floater {
  position: absolute;
  bottom: 0;
  left: 50%;
  font-size: 22px;
  animation: rise 2.2s ease-out forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

@keyframes rise {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift, 10px)), -260px) scale(1.15); }
}

.unmute {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(12, 10, 7, 0.78);
  color: var(--parchment);
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 1px rgba(224, 179, 74, 0.4);
  cursor: pointer;
}

.unmute[hidden] { display: none; }

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px));
}

.composer {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 0;
}

.composer input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 10, 7, 0.62);
  color: var(--parchment);
  padding: 0 16px;
  font: 400 14px/1.2 var(--sans);
  box-shadow: inset 0 0 0 1px rgba(244, 234, 216, 0.16);
  outline: none;
}

.composer input::placeholder { color: rgba(244, 234, 216, 0.48); }
.composer input:focus { box-shadow: inset 0 0 0 1px var(--gold-soft); }

.composer button,
.admin button {
  height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  background: var(--gold);
  color: #1a1408;
  font: 700 13px/1 var(--sans);
  cursor: pointer;
}

.react-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.react-bar button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 10, 7, 0.55);
  font-size: 20px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(244, 234, 216, 0.12);
}

.admin {
  position: absolute;
  top: calc(52px + env(safe-area-inset-top, 0px));
  right: 10px;
  z-index: 9;
  background: rgba(12, 10, 7, 0.86);
  border: 1px solid rgba(224, 179, 74, 0.28);
  border-radius: 12px;
  padding: 10px;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin[hidden] { display: none; }

.admin p {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin form { display: flex; flex-direction: column; gap: 6px; }

.admin input {
  height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 0 8px;
  background: rgba(244, 234, 216, 0.08);
  color: var(--parchment);
  font: 400 12px/1 var(--sans);
}

.admin button { height: 32px; font-size: 12px; width: 100%; }

.zoom-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(224, 179, 74, 0.45);
  color: var(--gold);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(12, 10, 7, 0.45);
  white-space: nowrap;
}
.zoom-pill[hidden],
.zoom-cta[hidden] { display: none !important; }

.zoom-cta {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1408;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

@media (max-width: 400px) {
  .zoom-pill { font-size: 10px; padding: 0 8px; }
}

/* Landscape sources (e.g. a 16:9 camera): show the whole frame instead of cropping. */
.stage.landscape #player {
  object-fit: contain;
}

@media (min-width: 900px) {
  .stage.landscape {
    width: min(100vw - 48px, (100dvh - 48px) * 16 / 9);
    height: calc(min(100vw - 48px, (100dvh - 48px) * 16 / 9) * 9 / 16);
  }
}
