.live-test-page {
  min-height: 100vh;
}

.live-shell {
  width: calc(100vw - 24px);
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 54px;
}

.live-watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 17vw, 320px);
  gap: 12px;
  align-items: stretch;
}

.live-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.live-main,
.danmu-panel,
.studio-panel,
.live-log {
  border: 1px solid rgba(151, 173, 208, .16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 25, 41, .9), rgba(7, 12, 20, .95));
  box-shadow: 0 24px 64px rgba(0, 0, 0, .32);
}

.live-watch-head,
.studio-head,
.live-log header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(151, 173, 208, .12);
}

.live-watch-head h1,
.studio-head h2,
.studio-head h1,
.danmu-panel h2,
.live-log h2 {
  margin: 0;
}

.live-watch-head h1,
.studio-head h1 {
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
}

.live-actions,
.studio-buttons,
.studio-copy,
.commentary-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.live-video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(91, 220, 255, .10), transparent 34%),
    #03060a;
}

.live-video,
.studio-preview {
  display: block;
  width: 100%;
  height: 100%;
  background: #02050a;
  object-fit: contain;
}

.live-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
}

.live-empty-state[hidden] {
  display: none;
}

.live-empty-state span {
  justify-self: center;
  padding: 3px 12px;
  border: 1px solid rgba(242, 220, 155, .62);
  border-radius: 999px;
  color: #f2dc9b;
  font-weight: 800;
}

.live-empty-state strong {
  font-size: clamp(28px, 4vw, 46px);
}

.live-empty-state p {
  max-width: 480px;
  margin: 0;
  color: rgba(232, 242, 252, .74);
}

.live-sound-button {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  min-height: 40px;
  border: 1px solid rgba(242, 220, 155, .58);
  border-radius: 6px;
  color: #07101b;
  background: linear-gradient(180deg, #f4df9c, #d8b66d);
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.mobile-live-controls {
  display: none;
}

.mobile-room-strip {
  display: none;
}

.phone-call-actions {
  align-items: center;
}

.phone-call-button {
  display: inline-grid;
  min-width: 76px;
  min-height: 58px;
  place-items: center;
  gap: 2px;
  border: 1px solid rgba(151, 173, 208, .28);
  border-radius: 16px;
  color: #f4f7fb;
  background: rgba(12, 20, 32, .92);
  font-weight: 800;
  cursor: pointer;
}

.phone-call-button span {
  font-size: 22px;
  line-height: 1;
}

.phone-call-button.call-start { background: linear-gradient(180deg, #3fcf77, #208c50); }
.phone-call-button.call-stop { background: linear-gradient(180deg, #ed5d5d, #a52f38); }
.phone-call-button:disabled { opacity: .42; cursor: not-allowed; }

.phone-isolation-note {
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid rgba(91, 220, 255, .14);
  color: #8ee9b4;
  background: rgba(8, 31, 24, .54);
  font-size: 13px;
}

.live-meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  min-height: 58px;
  border-top: 1px solid rgba(151, 173, 208, .12);
  background: rgba(5, 10, 18, .72);
}

.live-meta-strip div {
  min-width: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 8px 12px;
  border-right: 1px solid rgba(151, 173, 208, .12);
}

.live-meta-strip div:last-child {
  border-right: 0;
}

.live-meta-strip span,
.danmu-panel span,
.broadcast-status-grid span,
.studio-tools span,
.commentary-tools span {
  display: block;
  color: rgba(176, 192, 214, .76);
  font-size: 13px;
}

.live-meta-strip strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danmu-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 16px;
}

.danmu-panel h2 {
  font-size: 22px;
}

.danmu-list {
  display: flex;
  min-height: 0;
  flex: 1 1 0;
  flex-direction: column;
  gap: 8px;
  height: auto;
  margin-top: 12px;
  overflow: auto;
  padding-right: 4px;
}

.danmu-row {
  display: block;
  padding: 5px 4px;
  border: 0;
  border-bottom: 1px solid rgba(151, 173, 208, .08);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.danmu-row b {
  display: inline;
  margin-right: 6px;
  color: #f2dc9b;
  font-size: 12px;
}

.danmu-row span {
  display: inline;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
}

.danmu-form {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 12px;
}

.danmu-form input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(151, 173, 208, .22);
  border-radius: 6px;
  color: #f4f7fb;
  background: rgba(5, 10, 18, .78);
  padding: 0 12px;
}

.danmu-layer {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 25%;
  overflow: hidden;
  pointer-events: none;
}

.danmu-fly {
  position: absolute;
  right: -40%;
  max-width: 70%;
  overflow: hidden;
  color: rgba(232, 232, 232, .9);
  font-family: "Microsoft YaHei", "SimHei", "Noto Sans SC", "PingFang SC", sans-serif;
  font-size: clamp(20px, 2.2vw, 30px);
  font-weight: 900;
  line-height: 1.1;
  text-shadow:
    1px 0 1px rgba(0, 0, 0, .86),
    -1px 0 1px rgba(0, 0, 0, .86),
    0 1px 1px rgba(0, 0, 0, .86),
    0 -1px 1px rgba(0, 0, 0, .86),
    0 2px 5px rgba(0, 0, 0, .92);
  white-space: nowrap;
  animation: danmu-fly linear forwards;
}

@keyframes danmu-fly {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-170vw);
  }
}

.commentary-audio-stage {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.mic-test-panel {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid rgba(151, 173, 208, .12);
}

.mic-test-panel span {
  color: rgba(232, 242, 252, .82);
  font-size: 14px;
}

.mic-test-meter {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(151, 173, 208, .22);
  border-radius: 999px;
  background: rgba(5, 10, 18, .76);
}

.mic-test-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5bdcff, #f4df9c);
  transition: width .08s linear;
}

.studio-panel,
.autostart-panel,
.browser-guard,
.live-log {
  margin-top: 18px;
}

.autostart-panel,
.browser-guard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(242, 220, 155, .28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(41, 31, 12, .88), rgba(10, 16, 26, .94));
  box-shadow: 0 24px 64px rgba(0, 0, 0, .32);
}

.browser-guard {
  margin-top: 0;
  border-color: rgba(91, 220, 255, .34);
  background: linear-gradient(180deg, rgba(13, 42, 58, .9), rgba(8, 14, 24, .95));
}

.autostart-panel h2,
.browser-guard h2 {
  margin: 0 0 6px;
}

.autostart-panel p,
.browser-guard p {
  margin: 0;
  color: rgba(232, 242, 252, .76);
}

.browser-guard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}

.broadcast-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid rgba(151, 173, 208, .12);
}

.broadcast-status-grid div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid rgba(151, 173, 208, .12);
}

.broadcast-status-grid div:last-child {
  border-right: 0;
}

.broadcast-status-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #fff;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-preview {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}

.studio-tools,
.commentary-tools {
  align-content: start;
  display: grid;
  gap: 14px;
}

.studio-tools label,
.commentary-tools label {
  min-width: 0;
}

.studio-tools input,
.studio-tools select,
.commentary-tools input,
.studio-copy input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(151, 173, 208, .22);
  border-radius: 6px;
  color: #f4f7fb;
  background: rgba(5, 10, 18, .78);
  padding: 0 12px;
}

.studio-copy input {
  flex: 1 1 220px;
}

.studio-note {
  margin: 0;
  color: rgba(232, 242, 252, .7);
  font-size: 13px;
}

.commentary-panel {
  padding-bottom: 18px;
}

.commentary-tools {
  grid-template-columns: minmax(220px, 1fr) auto auto;
  padding: 18px;
}

.live-log [data-live-log] {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding: 18px;
}

.live-log p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(151, 173, 208, .12);
  border-radius: 6px;
  color: rgba(232, 242, 252, .84);
  background: rgba(5, 10, 18, .52);
}

@media (max-width: 1120px) {
  .live-watch,
  .studio-grid {
    grid-template-columns: 1fr;
  }

  .danmu-panel {
    display: block;
    order: 2;
  }

  .danmu-list {
    height: 390px;
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .live-shell {
    width: min(100% - 18px, 1500px);
    padding-top: 14px;
  }

  .live-watch-head,
  .studio-head,
  .autostart-panel,
  .browser-guard,
  .live-log header,
  .commentary-tools {
    align-items: start;
    flex-direction: column;
  }

  .browser-guard-actions {
    width: 100%;
  }

  .live-video-wrap {
    min-height: 240px;
  }

  .live-meta-strip,
  .broadcast-status-grid {
    grid-template-columns: 1fr;
  }

  body[data-live-page="watch"] .live-meta-strip {
    display: none;
  }

  .live-meta-strip div,
  .broadcast-status-grid div {
    border-right: 0;
    border-bottom: 1px solid rgba(151, 173, 208, .12);
  }

  .danmu-list {
    height: 260px;
    min-height: 0;
  }

  .danmu-fly {
    max-width: 78%;
    font-size: 14px;
  }

  .danmu-form {
    grid-template-columns: 1fr;
  }

  .mic-test-panel {
    grid-template-columns: 1fr;
  }

  .commentary-tools {
    display: flex;
  }
}

@media (pointer: coarse) and (hover: none), (max-width: 720px) {
  body[data-live-page="watch"] .site-header {
    display: none;
  }

  body[data-live-page="watch"] {
    background: #000;
  }

  body[data-live-page="watch"] .live-shell {
    width: 100%;
    padding: 0 0 18px;
  }

  body[data-live-page="watch"] .live-watch {
    gap: 0;
  }

  body[data-live-page="watch"] .live-main {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body[data-live-page="watch"] .live-watch-head {
    min-height: 58px;
    padding: 10px 14px;
    background: #05070a;
  }

  body[data-live-page="watch"] .live-watch-head .kicker {
    display: none;
  }

  body[data-live-page="watch"] .live-watch-head h1 {
    font-size: 22px;
  }

  body[data-live-page="watch"] .live-video-wrap {
    width: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
    border-radius: 0;
  }

  body[data-live-page="watch"] .danmu-panel {
    min-height: 0;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    background: #05070a;
    box-shadow: none;
    padding: 12px 14px 18px;
  }

  body[data-live-page="watch"] .live-meta-strip {
    display: none;
  }

  .danmu-fly {
    max-width: 78%;
    font-size: 14px;
  }

  body[data-live-page="watch"] .danmu-list {
    height: 42dvh;
    min-height: 320px;
    max-height: 560px;
    margin-top: 10px;
  }

  .mobile-room-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px;
    background: #05070a;
    scrollbar-width: none;
  }

  .mobile-room-strip::-webkit-scrollbar {
    display: none;
  }

  .mobile-room-strip .live-actions {
    display: contents;
  }

  .mobile-room-strip .arena-action {
    min-width: 44vw;
    min-height: 68px;
    flex: 0 0 44vw;
    border-color: rgba(151, 173, 208, .22);
    color: #f4f7fb;
    background: linear-gradient(180deg, rgba(35, 39, 48, .96), rgba(19, 23, 31, .98));
    font-size: 15px;
  }

  .mobile-live-controls {
    position: absolute;
    right: 8px;
    bottom: 8px;
    left: 8px;
    z-index: 8;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
  }

  .mobile-live-controls.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mobile-live-controls > button,
  .mobile-live-controls .danmu-form button {
    min-height: 38px;
    border: 1px solid rgba(242, 220, 155, .48);
    border-radius: 6px;
    color: #07101b;
    background: linear-gradient(180deg, #f4df9c, #d8b66d);
    padding: 0 10px;
    font-weight: 800;
  }

  .mobile-live-controls .danmu-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    margin: 0;
  }

  .mobile-live-controls .danmu-form [data-danmu-name] {
    display: none;
  }

  .mobile-live-controls .danmu-form input {
    min-height: 38px;
    background: rgba(3, 7, 13, .88);
  }

  .mobile-danmu-slot {
    min-width: 0;
  }
}

@media (orientation: portrait) {
  html.force-landscape-live .live-video-wrap:fullscreen {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vh;
    height: 100vw;
    max-width: none;
    aspect-ratio: auto;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
    background: #000;
  }

  html.force-landscape-live .live-video-wrap:fullscreen .live-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}
