:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #050507;
  color: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #050507;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

.live-shell {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100dvh;
  min-height: 560px;
  margin: 0 auto;
  overflow: hidden;
  background: #101013;
  isolation: isolate;
}

.camera-video,
.camera-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-video {
  z-index: 0;
  background: #111;
}

.camera-fallback {
  z-index: -1;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 28% 24%, rgba(235, 64, 72, 0.28), transparent 32%),
    radial-gradient(circle at 74% 30%, rgba(0, 215, 255, 0.18), transparent 28%),
    linear-gradient(150deg, #171719 0%, #070708 52%, #1d1515 100%);
}

.camera-video.is-empty + .camera-fallback {
  z-index: 0;
}

.fallback-scene {
  position: relative;
  width: 62%;
  aspect-ratio: 9 / 16;
  max-height: 64vh;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
  overflow: hidden;
}

.fallback-light {
  position: absolute;
  inset: 18% 14% auto;
  height: 24%;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  filter: blur(24px);
}

.fallback-phone {
  position: absolute;
  left: 23%;
  top: 24%;
  width: 54%;
  height: 48%;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.22);
}

.fallback-reflection {
  position: absolute;
  inset: auto 0 0;
  height: 36%;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.1), transparent);
}

.shade {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}

.top-shade {
  top: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.68), transparent);
}

.bottom-shade {
  bottom: 0;
  height: 42%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), transparent);
}

.top-bar {
  position: absolute;
  z-index: 3;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.host-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: calc(100% - 56px);
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.avatar,
.rail-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff315c, #ff9b2f);
  font-weight: 800;
}

.host-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.host-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.host-row strong,
.host-copy span {
  max-width: 154px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-row strong {
  font-size: 13px;
  letter-spacing: 0;
}

.host-copy span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.76);
}

.live-pill {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: #ff174f;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.round-btn,
.rail-btn,
.mic-button {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.round-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px);
  font-size: 22px;
}

.stats-strip {
  position: absolute;
  z-index: 3;
  top: calc(max(12px, env(safe-area-inset-top)) + 54px);
  left: 12px;
  display: flex;
  gap: 6px;
  max-width: calc(100% - 24px);
  overflow: hidden;
}

.stats-strip span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  backdrop-filter: blur(14px);
}

.comments-feed {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 86px;
  bottom: calc(130px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  height: min(35vh, 260px);
  pointer-events: none;
}

.comment {
  align-self: flex-start;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: commentIn 360ms ease both;
}

.comment b {
  color: #ffd35a;
  font-size: 12px;
  font-weight: 800;
}

.comment span {
  margin-left: 6px;
  font-size: 13px;
  line-height: 1.35;
  color: #fff;
  word-break: break-word;
}

.right-rail {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: calc(140px + env(safe-area-inset-bottom));
  display: grid;
  gap: 15px;
}

.rail-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
  font-size: 24px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rail-btn:active,
.mic-button:active,
.round-btn:active {
  transform: scale(0.96);
}

.followed {
  background: transparent;
  box-shadow: none;
}

.plus-mark {
  position: absolute;
  left: 50%;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #ff174f;
  font-size: 16px;
  font-weight: 900;
}

.bottom-panel {
  position: absolute;
  z-index: 4;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 78px 1fr;
  align-items: center;
  gap: 10px;
}

.voice-status,
.bottom-meta {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.36);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  line-height: 1.2;
  backdrop-filter: blur(18px);
}

.voice-status {
  text-align: left;
}

.bottom-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.bottom-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mic-button {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, #fff 0 9%, transparent 10%),
    linear-gradient(160deg, #ff174f, #ff6a2b 78%);
  box-shadow: 0 12px 34px rgba(255, 23, 79, 0.45);
}

.mic-core {
  width: 18px;
  height: 28px;
  border: 3px solid #fff;
  border-top-width: 7px;
  border-radius: 999px;
}

.mic-core::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 19px;
  width: 24px;
  height: 14px;
  transform: translateX(-50%);
  border-bottom: 3px solid #fff;
  border-left: 3px solid #fff;
  border-right: 3px solid #fff;
  border-radius: 0 0 16px 16px;
}

.mic-button.is-recording {
  animation: micPulse 1.1s ease-in-out infinite;
  background:
    radial-gradient(circle at 50% 42%, #fff 0 9%, transparent 10%),
    linear-gradient(160deg, #00d7ff, #20d66b 78%);
  box-shadow: 0 12px 34px rgba(0, 215, 255, 0.42);
}

.like-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.floating-like {
  position: absolute;
  right: 26px;
  bottom: 154px;
  font-size: 22px;
  color: #ff376c;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  animation: likeFloat 1.8s ease-out forwards;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  width: min(320px, calc(100vw - 32px));
  padding: 11px 14px;
  transform: translateX(-50%) translateY(24px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  text-align: center;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mic-button:disabled,
.access-submit:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.access-gate {
  position: absolute;
  inset: 0;
  z-index: 16;
  display: grid;
  align-items: end;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.82)),
    radial-gradient(circle at 22% 18%, rgba(255, 23, 79, 0.24), transparent 30%),
    radial-gradient(circle at 78% 28%, rgba(32, 214, 107, 0.16), transparent 28%);
  backdrop-filter: blur(12px);
}

.access-gate[hidden] {
  display: none;
}

.access-panel {
  display: grid;
  gap: 11px;
  padding: 18px;
  border-radius: 24px 24px 18px 18px;
  background: rgba(16, 16, 19, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 24px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(22px);
}

.access-kicker,
.access-copy,
.access-error {
  margin: 0;
}

.access-kicker {
  color: #28f0a0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.access-panel h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: 0;
}

.access-copy {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.access-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.access-input,
.access-submit {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  font: inherit;
}

.access-input {
  border: 1px solid rgba(255, 255, 255, 0.18);
  outline: 0;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.access-input:focus {
  border-color: rgba(40, 240, 160, 0.82);
  box-shadow: 0 0 0 3px rgba(40, 240, 160, 0.16);
}

.access-submit {
  background: linear-gradient(135deg, #20d66b, #00d7ff);
  color: #04110b;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(32, 214, 107, 0.28);
}

.access-submit:active {
  transform: scale(0.98);
}

.access-error {
  min-height: 18px;
  color: #ffd35a;
  font-size: 12px;
  line-height: 1.4;
}

.scene-picker {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  align-items: end;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.76)),
    radial-gradient(circle at 20% 18%, rgba(255, 23, 79, 0.26), transparent 30%),
    radial-gradient(circle at 86% 26%, rgba(0, 215, 255, 0.18), transparent 28%);
  backdrop-filter: blur(10px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
}

.scene-picker.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px);
  pointer-events: none;
}

.scene-panel {
  display: grid;
  gap: 12px;
}

.scene-kicker {
  margin: 0;
  color: #ff4e78;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.scene-panel h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.scene-card {
  min-height: 86px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  text-align: left;
  backdrop-filter: blur(18px);
}

.scene-card:active {
  transform: scale(0.98);
}

.scene-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.15;
}

.scene-card span {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  line-height: 1.35;
}

@keyframes commentIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes likeFloat {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.72);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-22px, -168px) scale(1.45);
  }
}

@keyframes micPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (min-width: 720px) {
  .live-shell {
    margin-top: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 80px rgba(0, 0, 0, 0.54);
  }
}

@media (max-width: 380px) {
  .bottom-panel {
    grid-template-columns: 1fr 68px 1fr;
    gap: 7px;
  }

  .mic-button {
    width: 66px;
    height: 66px;
  }

  .comments-feed {
    right: 76px;
  }
}
