.play-body {
  height: 100dvh;
  overflow: hidden;
  background: #000;
}
.play-app {
  --handle-h: 56px;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: calc(var(--handle-h) + var(--safe-b));
  background: var(--bg);
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: calc(var(--safe-t) + 6px) 12px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .brand {
  flex: 0 1 auto;
  font-size: 16px;
}
.topbar-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
  overflow: hidden;
}
#chipWatch {
  display: none;
}

/* ---------------------------------------------------------------- stage */
.stage {
  position: relative;
  min-height: 0;
  background: #000;
  overflow: hidden;
}
.video {
  position: absolute;
  inset: 0;
  background: #000;
}
.video video {
  object-fit: contain;
  background: #000;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 7, 10, 0.66);
}
.ocard {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 380px;
  padding: 24px;
  text-align: center;
  background: rgba(20, 25, 34, 0.94);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.bigplay {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 30px;
  border: 0;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 20px var(--font);
  cursor: pointer;
}

.playerbar {
  position: absolute;
  z-index: 6;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 20px);
  padding: 4px 4px 4px 16px;
  border-radius: 24px;
  background: rgba(15, 19, 27, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
  font-weight: 650;
  white-space: nowrap;
}
.playerbar .btn {
  border-radius: 20px;
}

.banner {
  position: absolute;
  z-index: 6;
  left: 12px;
  right: 12px;
  bottom: 68px;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 19, 27, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 14px;
  text-align: center;
}
.banner-warn {
  border-color: rgba(251, 191, 36, 0.5);
  color: #ffe9a8;
}

.statsbox {
  position: absolute;
  z-index: 6;
  left: 10px;
  top: 10px;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.62);
  color: #cfe3ff;
  font: 12px/1.45 var(--mono);
  pointer-events: none;
}
.is-player .statsbox {
  top: 62px;
}

.controls {
  position: absolute;
  z-index: 7;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
}
.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 19, 27, 0.8);
  backdrop-filter: blur(6px);
  color: #fff;
  font: 600 14px var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.ctl:hover {
  background: rgba(40, 50, 70, 0.92);
}
.ctl-label {
  display: none;
}
.ctl-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.ctl-attn {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.ctl-attn:hover {
  background: #ffc363;
}
.ctl-attn .ctl-label {
  display: inline;
}

/* ---------------------------------------------------------------- panel (bottom sheet on phones) */
.panel {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  padding-bottom: var(--safe-b);
}
.panel-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: var(--handle-h);
  padding: 0 18px;
  background: none;
  border: 0;
  color: var(--text);
  font: 650 16px var(--font);
  text-align: left;
  cursor: pointer;
}
.panel-handle-chev {
  color: var(--muted);
}
.panel-body {
  display: none;
  max-height: min(68dvh, 560px);
  overflow-y: auto;
  padding: 4px 12px 14px;
  overscroll-behavior: contain;
}
.panel.open .panel-body {
  display: grid;
  gap: 10px;
}
.panel-body .card {
  background: var(--surface-2);
  padding: 14px;
}
.panel-body h3 {
  margin-bottom: 8px;
}
.panel-body .card > * + * {
  margin-top: 8px;
}
.h-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.big-line {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.big-line .muted {
  font-size: 15px;
  font-weight: 500;
}
.row-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.announce {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 180, 58, 0.4);
  color: #ffe2ae;
}
.announce .icon {
  margin-top: 2px;
  color: var(--accent);
}
.announce p {
  overflow-wrap: anywhere;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.queue li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
}
.queue li.you {
  background: var(--accent-soft);
  outline: 1px solid rgba(255, 180, 58, 0.5);
}
.pos {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 13px;
  font-weight: 700;
}
.qname {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.watchers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.name-form {
  display: grid;
  gap: 8px;
}
.name-edit {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}
.name-edit .input {
  min-width: 0;
}
.name-form .field-error {
  margin: 0;
}
.panel-foot {
  text-align: center;
  font-size: 14px;
  padding: 4px 0 10px;
}

/* ---------------------------------------------------------------- offer modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 7, 10, 0.8);
}
.modal {
  width: min(380px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 22px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(255, 180, 58, 0.5);
  border-radius: 22px;
  box-shadow: 0 0 0 6px rgba(255, 180, 58, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-badge {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: url(/icon.svg) center / cover no-repeat;
}
.countdown-big {
  font-size: 48px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.modal-actions {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

/* ---------------------------------------------------------------- fullscreen */
.is-fs .topbar,
.is-fs .panel {
  display: none;
}
.is-fs .play-app {
  padding-bottom: 0;
  grid-template-rows: minmax(0, 1fr);
}

/* ---------------------------------------------------------------- wider screens: side panel */
@media (min-width: 820px) {
  .play-app {
    padding-bottom: 0;
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }
  #chipWatch {
    display: inline-flex;
  }
  .panel {
    position: static;
    grid-column: 2;
    grid-row: 2;
    border: 0;
    border-left: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    padding: 0;
  }
  .panel-handle {
    display: none;
  }
  .panel-body {
    display: grid;
    gap: 10px;
    max-height: none;
    overflow: visible;
    padding: 12px;
  }
  .stage {
    grid-column: 1;
  }
  .ctl-label {
    display: inline;
  }
  .banner {
    bottom: 64px;
  }
  .is-fs .play-app {
    grid-template-columns: minmax(0, 1fr);
  }
  .is-fs .stage {
    grid-column: 1;
  }
}

/* phones in landscape: keep the sheet short */
@media (max-height: 460px) and (max-width: 819px) {
  .panel-body {
    max-height: 62dvh;
  }
  .topbar {
    min-height: 40px;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .play-app {
    --handle-h: 46px;
  }
}

.is-replaced .panel-body {
  opacity: 0.45;
  pointer-events: none;
}
.is-replaced .controls,
.is-replaced .playerbar {
  display: none;
}
