:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #151a22;
  --panel: #1d242e;
  --panel-strong: #252d39;
  --line: #364150;
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #f4f7fb;
  --muted: #9aa7b8;
  --accent: #32d0a4;
  --accent-2: #ffb84d;
  --danger: #ff6868;
  --blue: #6fb7ff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #070b10;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  min-height: 100vh;
}

.login-page {
  --scene-x: 0;
  --scene-y: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(120deg, rgba(7, 37, 32, 0.72) 0%, rgba(7, 11, 16, 0.96) 46%, rgba(17, 13, 11, 0.9) 100%),
    linear-gradient(180deg, #08100f 0%, #070b10 100%);
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, transparent 0%, black 38%, black 68%, transparent 100%);
  transform: perspective(1000px) rotateX(66deg) translateY(34vh) scale(1.12);
  transform-origin: center;
  opacity: 0.42;
}

.login-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 14%),
    radial-gradient(ellipse at 50% 44%, rgba(50, 208, 164, 0.12) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 50%, transparent 0%, transparent 46%, rgba(0, 0, 0, 0.58) 86%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 34%, transparent 66%, rgba(0, 0, 0, 0.34));
}

.login-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  position: relative;
  z-index: 2;
}

.login-corner-btn {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 5;
  min-height: 42px;
  padding: 0 18px;
  color: var(--text);
  background: rgba(29, 36, 46, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.login-corner-btn:hover {
  border-color: rgba(50, 208, 164, 0.58);
  color: #dffdf5;
}

.brand-stage {
  min-height: min(680px, calc(100vh - 64px));
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  perspective: 980px;
}

.cosmos-scene {
  position: fixed;
  inset: -8vh -8vw;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translate3d(calc(var(--scene-x) * -14px), calc(var(--scene-y) * -10px), 0);
  transition: transform 160ms ease-out;
}

.starfield {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 18% 35%, rgba(50, 208, 164, 0.2), transparent 28%),
    radial-gradient(ellipse at 72% 24%, rgba(111, 183, 255, 0.15), transparent 30%),
    radial-gradient(ellipse at 54% 58%, rgba(50, 208, 164, 0.1), transparent 34%);
  filter: blur(10px);
  opacity: 0.8;
  mask-image: radial-gradient(ellipse at center, black 0%, black 74%, transparent 96%);
}

.starfield::before {
  content: "";
  position: absolute;
  inset: 9% 12%;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(111, 183, 255, 0.16), transparent 0 34%),
    radial-gradient(ellipse at 48% 48%, transparent 0 44%, rgba(50, 208, 164, 0.12) 45%, transparent 50%);
  opacity: 0.55;
}

.orbit {
  position: absolute;
  left: 50%;
  top: 46%;
  border: 1px solid rgba(111, 183, 255, 0.18);
  border-radius: 50%;
  box-shadow:
    0 0 32px rgba(50, 208, 164, 0.06),
    inset 0 0 32px rgba(111, 183, 255, 0.04);
}

.orbit::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(50, 208, 164, 0.13);
  filter: blur(1px);
}

.orbit-wide {
  width: min(920px, 82vw);
  height: min(230px, 24vw);
  transform: translate(-50%, -50%) rotate(-5deg);
  animation: orbitPulse 8s ease-in-out infinite;
}

.orbit-mid {
  width: min(680px, 68vw);
  height: min(170px, 20vw);
  transform: translate(-50%, -50%) rotate(9deg);
  animation: orbitPulse 10s ease-in-out infinite 1.4s;
}

.orbit-tight {
  width: min(440px, 50vw);
  height: min(118px, 16vw);
  transform: translate(-50%, -50%) rotate(-18deg);
  animation: orbitPulse 7s ease-in-out infinite 0.7s;
}

.planet {
  --planet-x: 0px;
  --planet-y: 0px;
  --planet-scale: 1;
  position: absolute;
  left: 50%;
  top: 46%;
  border-radius: 999px;
  transform:
    translate(-50%, -50%)
    translate(var(--planet-x), var(--planet-y))
    scale(var(--planet-scale));
  transition: filter 160ms ease;
  box-shadow:
    inset -12px -14px 24px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(255, 255, 255, 0.12);
}

.planet::after {
  content: "";
  position: absolute;
  inset: -38%;
  border-radius: inherit;
  background: inherit;
  filter: blur(18px);
  opacity: 0.42;
  z-index: -1;
}

.planet-aurora {
  --planet-x: -338px;
  --planet-y: 44px;
  width: 74px;
  height: 74px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.95), transparent 0 12%),
    radial-gradient(circle at 62% 70%, rgba(8, 42, 52, 0.52), transparent 0 30%),
    linear-gradient(145deg, #8fffe1 0%, #32d0a4 42%, #176f8a 100%);
}

.planet-coral {
  --planet-x: -220px;
  --planet-y: 56px;
  width: 46px;
  height: 46px;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.85), transparent 0 14%),
    radial-gradient(circle at 62% 70%, rgba(75, 26, 38, 0.52), transparent 0 30%),
    linear-gradient(145deg, #ffd58b 0%, #ff8a64 45%, #823865 100%);
}

.planet-ice {
  --planet-x: 70px;
  --planet-y: -44px;
  width: 32px;
  height: 32px;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.96), transparent 0 16%),
    radial-gradient(circle at 62% 70%, rgba(25, 45, 102, 0.52), transparent 0 30%),
    linear-gradient(145deg, #e8f7ff 0%, #75c7ff 48%, #3e5dd4 100%);
}

.brand-stage:hover .orbit {
  border-color: rgba(50, 208, 164, 0.3);
}

@keyframes orbitPulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 0.82;
  }
}

.booth-visual {
  display: none;
}

.brand-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  display: grid;
  gap: 20px;
  justify-items: center;
  padding: 32px 0 72px;
}

@media (max-width: 760px) {
  .cosmos-scene {
    inset: -8% -36% 2%;
  }

  .planet-aurora {
    width: 54px;
    height: 54px;
  }

  .planet-coral {
    width: 36px;
    height: 36px;
  }

  .brand-copy { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .orbit,
  .planet {
    animation: none;
  }

  .cosmos-scene {
    transition: none;
  }
}

.brand-title {
  margin: 0;
  font-size: clamp(46px, 4.8vw, 84px);
  line-height: 0.98;
  max-width: none;
  white-space: nowrap;
  letter-spacing: 0;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16),
    0 24px 70px rgba(0, 0, 0, 0.62),
    0 0 46px rgba(111, 183, 255, 0.08);
}

.brand-subtitle {
  margin: 0 auto;
  max-width: 760px;
  color: #aeb9c8;
  font-size: 18px;
  line-height: 1.65;
}

.hero-start-btn {
  position: relative;
  min-width: min(340px, 74vw);
  min-height: 68px;
  margin-top: 18px;
  padding: 0 46px;
  overflow: hidden;
  color: #03130f;
  background: linear-gradient(135deg, #36ecc0 0%, #32d0a4 52%, #64bdf1 100%);
  border: 1px solid rgba(217, 255, 244, 0.58);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(50, 208, 164, 0.14),
    0 18px 48px rgba(50, 208, 164, 0.28),
    0 0 28px rgba(105, 200, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-start-btn::before {
  content: "";
  position: absolute;
  inset: -120% -35%;
  background: linear-gradient(115deg, transparent 34%, rgba(255, 255, 255, 0.58) 48%, transparent 62%);
  transform: translateX(-45%) rotate(8deg);
  transition: transform 520ms ease;
}

.hero-start-btn::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(4, 20, 16, 0.18);
  border-radius: 6px;
}

.hero-start-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(111, 183, 255, 0.2),
    0 24px 76px rgba(50, 208, 164, 0.42),
    0 0 34px rgba(111, 183, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hero-start-btn:hover::before {
  transform: translateX(42%) rotate(8deg);
}

.hero-start-btn span {
  position: relative;
  z-index: 1;
}

.auth-card,
.admin-form {
  background: rgba(29, 36, 46, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 22px;
}

.auth-card h2,
.admin-form h2 {
  margin: 0 0 18px;
  font-size: 22px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  color: var(--text);
  background: #111720;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(50, 208, 164, 0.18);
}

.primary-btn,
.secondary-btn,
.icon-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text);
  background: var(--panel-strong);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn {
  width: 100%;
  background: var(--accent);
  color: #05241b;
  font-weight: 750;
}

.secondary-btn {
  border-color: var(--line);
}

.auth-switch-btn {
  width: 100%;
  margin-top: 10px;
}

.danger-btn {
  background: rgba(255, 104, 104, 0.16);
  border-color: rgba(255, 104, 104, 0.38);
}

.icon-btn {
  width: 54px;
  padding: 0;
  font-size: 12px;
  font-weight: 750;
}

.icon-btn.is-off {
  background: rgba(255, 104, 104, 0.16);
  border-color: rgba(255, 104, 104, 0.45);
}

.stop-btn {
  color: #ffdfe3;
  background: rgba(255, 104, 104, 0.16);
  border-color: rgba(255, 104, 104, 0.42);
}

.stop-btn:hover {
  background: rgba(255, 104, 104, 0.24);
  border-color: rgba(255, 104, 104, 0.62);
}

.action-btn {
  color: #05241b;
  background: rgba(50, 208, 164, 0.9);
  border-color: rgba(50, 208, 164, 0.72);
}

.action-btn:hover {
  background: var(--accent);
  border-color: rgba(217, 255, 244, 0.72);
}

.error {
  min-height: 22px;
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 17, 23, 0.84);
  backdrop-filter: blur(14px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.room {
  height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  min-width: 0;
  min-height: 0;
}

.video-pane,
.avatar-sidebar,
.admin-panel {
  background: rgba(21, 26, 34, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  min-width: 0;
}

.video-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  min-height: 0;
}

.pane-head {
  min-height: 48px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.pane-title {
  display: grid;
  gap: 3px;
}

.pane-title strong {
  font-size: 15px;
}

.pane-title span {
  color: var(--muted);
  font-size: 12px;
}

.video-frame {
  position: relative;
  min-height: 0;
  background: #070b10;
  overflow: hidden;
  display: grid;
}

.video-pane > .video-frame:first-child {
  grid-row: 1 / -1;
}

.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05070a;
  display: block;
}

.video-name-label {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  max-width: min(48%, 360px);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.62);
  color: var(--text);
  font-weight: 800;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.camera-placeholder,
.avatar-stage {
  position: absolute;
  inset: 0;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 26px;
  text-align: center;
}

.avatar-stage {
  --avatar-control-safe: 98px;
  background:
    linear-gradient(180deg, rgba(111, 183, 255, 0.13), transparent 38%),
    linear-gradient(135deg, #121922, #0a0d12);
}

.avatar-stage::before,
.avatar-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.avatar-stage::before {
  z-index: 0;
  opacity: 0.96;
}

.avatar-stage::after {
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(4, 7, 10, 0.02), rgba(4, 7, 10, 0.18)),
    radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, 0.3), transparent 58%);
}

.avatar-bg-study::before {
  background:
    linear-gradient(90deg, transparent 0 10%, rgba(64, 41, 26, 0.7) 10% 12%, transparent 12% 30%, rgba(64, 41, 26, 0.72) 30% 32%, transparent 32% 50%, rgba(64, 41, 26, 0.72) 50% 52%, transparent 52% 70%, rgba(64, 41, 26, 0.72) 70% 72%, transparent 72% 100%),
    linear-gradient(180deg, transparent 0 26%, rgba(108, 72, 38, 0.88) 26% 28%, transparent 28% 46%, rgba(108, 72, 38, 0.86) 46% 48%, transparent 48% 66%, rgba(108, 72, 38, 0.82) 66% 68%, transparent 68% 100%),
    radial-gradient(circle at 50% 18%, rgba(255, 202, 112, 0.22), transparent 22%),
    linear-gradient(180deg, #2b211b 0%, #171311 66%, #0b0d10 100%);
}

.avatar-bg-bedroom::before {
  background:
    radial-gradient(ellipse at 26% 28%, rgba(255, 214, 172, 0.22), transparent 24%),
    linear-gradient(90deg, transparent 0 58%, rgba(255, 255, 255, 0.22) 58% 59%, rgba(104, 136, 174, 0.24) 59% 80%, transparent 80%),
    linear-gradient(180deg, transparent 0 55%, rgba(51, 57, 74, 0.96) 55% 74%, rgba(32, 35, 45, 0.98) 74% 100%),
    linear-gradient(135deg, #232a37 0%, #151a25 58%, #0c0f16 100%);
}

.avatar-bg-sofa::before {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 195, 124, 0.18), transparent 28%),
    linear-gradient(180deg, transparent 0 48%, rgba(77, 89, 80, 0.88) 48% 50%, rgba(34, 48, 43, 0.96) 50% 78%, rgba(12, 16, 18, 1) 78% 100%),
    radial-gradient(ellipse at 30% 58%, rgba(75, 113, 95, 0.88), transparent 28%),
    radial-gradient(ellipse at 70% 58%, rgba(75, 113, 95, 0.82), transparent 28%),
    linear-gradient(135deg, #1d2522, #101416 68%);
}

.avatar-stage.has-custom-bg::before {
  background:
    linear-gradient(180deg, rgba(4, 7, 10, 0.04), rgba(4, 7, 10, 0.22)),
    var(--custom-avatar-background) center / cover no-repeat;
}

.video-frame video.avatar-video {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  object-fit: contain;
  object-position: center center;
  background: transparent;
  mix-blend-mode: normal;
  z-index: 1;
}

.video-frame video.avatar-video.is-canvas-source {
  opacity: 0;
}

.avatar-video-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}

.avatar-view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.42);
}

.avatar-view-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.avatar-view-tabs button.active {
  color: #05241b;
  background: var(--accent);
  font-weight: 750;
}

.avatar-render-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
}

.avatar-render-stage,
.avatar-render-stage canvas,
.avatar-render-stage img {
  width: 100%;
  height: 100%;
}

.avatar-render-stage {
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.avatar-render-stage:active {
  cursor: grabbing;
}

.avatar-render-stage canvas,
.avatar-render-stage img {
  position: absolute;
  inset: 0;
  display: block;
}

.avatar-render-stage img {
  object-fit: contain;
  background: transparent;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.avatar-render-stage img.is-swapping {
  opacity: 0.72;
}

.avatar-render-notice,
.avatar-render-loading,
.avatar-render-status {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.82);
  color: #eef7f4;
  pointer-events: none;
}

.avatar-render-notice {
  left: 18px;
  right: 18px;
  bottom: 102px;
  padding: 10px 12px;
  font-size: 13px;
}

.avatar-render-loading {
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.avatar-render-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(238, 247, 244, 0.35);
  border-top-color: #eef7f4;
  border-radius: 50%;
  animation: avatar-render-spin 800ms linear infinite;
}

@keyframes avatar-render-spin {
  to {
    transform: rotate(360deg);
  }
}

.avatar-render-status {
  left: 18px;
  bottom: 70px;
  max-width: min(520px, calc(100% - 36px));
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.avatar-render-controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(680px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 76px 54px minmax(120px, 1fr) minmax(124px, auto) 76px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.84);
  backdrop-filter: blur(12px);
  cursor: default;
  pointer-events: auto;
  touch-action: auto;
}

.avatar-render-controls input {
  width: 100%;
}

.avatar-render-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.avatar-person {
  width: min(360px, 64%);
  aspect-ratio: 1 / 1.12;
  display: grid;
  place-items: end center;
  position: relative;
  z-index: 1;
}

.avatar-person.has-still {
  place-items: center;
  width: min(760px, 86%);
  height: min(900px, calc(100% - 12px));
  aspect-ratio: auto;
  align-self: center;
  margin-bottom: 0;
  transform: translateY(64px);
}

.avatar-still {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  opacity: 1;
  filter:
    drop-shadow(0 22px 38px rgba(0, 0, 0, 0.28))
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.08));
}

.avatar-head {
  width: 36%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, #f1c3a1, #9b6b55);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.04);
  position: absolute;
  top: 8%;
}

.avatar-body {
  width: 76%;
  height: 62%;
  border-radius: 44% 44% 8px 8px;
  background: linear-gradient(155deg, var(--avatar-color, #32d0a4), #253140 68%);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.room-control-cluster {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 4;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 10, 15, 0.68);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
}

.background-select {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  color: var(--muted);
  background: rgba(13, 17, 23, 0.42);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  font-size: 12px;
}

.background-select select {
  min-height: 30px;
  color: var(--text);
  background: rgba(17, 23, 32, 0.96);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
}

.avatar-caption {
  display: block;
  color: var(--muted);
  pointer-events: none;
}

.avatar-status-badge {
  white-space: nowrap;
}

.generation-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.listening-panel {
  min-height: 42px;
  min-width: 190px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(50, 208, 164, 0.18);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.42);
}

.listening-copy {
  display: grid;
  gap: 4px;
}

.listening-copy strong {
  color: var(--text);
  font-size: 14px;
}

.listening-copy span {
  color: var(--muted);
  font-size: 12px;
}

.voice-wave {
  height: 30px;
  min-width: 108px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.voice-wave span {
  width: 6px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6fb7ff, var(--accent));
  box-shadow: 0 0 18px rgba(50, 208, 164, 0.3);
  animation: voice-wave-pulse 920ms ease-in-out infinite;
  opacity: 0.86;
}

.voice-wave span:nth-child(2) {
  animation-delay: 90ms;
}

.voice-wave span:nth-child(3) {
  animation-delay: 180ms;
}

.voice-wave span:nth-child(4) {
  animation-delay: 270ms;
}

.voice-wave span:nth-child(5) {
  animation-delay: 360ms;
}

@keyframes voice-wave-pulse {
  0%,
  100% {
    height: 10px;
    opacity: 0.48;
  }
  45% {
    height: 28px;
    opacity: 1;
  }
}

.generation-track {
  height: 4px;
  overflow: hidden;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.08);
}

.generation-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6fb7ff);
  transition: width 0.35s ease;
}

.reply-box {
  width: 100%;
  max-height: 72px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  line-height: 1.42;
  text-align: left;
  font-size: clamp(13px, 0.95vw, 16px);
}

.room-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  gap: 8px;
  background: rgba(13, 17, 23, 0.42);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 0 0 auto;
}

.room-control-row .avatar-view-tabs,
.room-control-row .listening-panel,
.room-control-row .avatar-status-badge,
.room-control-row .toolbar {
  flex: 0 0 auto;
}

.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  color: var(--danger);
  background: rgba(255, 104, 104, 0.12);
  border: 1px solid rgba(255, 104, 104, 0.32);
  border-radius: 999px;
  font-size: 12px;
}

.recording-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.avatar-sidebar {
  display: grid;
  grid-template-rows: auto minmax(150px, 0.55fr) minmax(260px, 1fr) auto;
  overflow: hidden;
}

.avatar-list {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.avatar-option {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
}

.avatar-option.is-active {
  border-color: var(--accent);
  background: rgba(50, 208, 164, 0.12);
}

.avatar-swatch {
  width: 42px;
  height: 42px;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: var(--avatar-color);
}

.avatar-swatch img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.avatar-meta {
  min-width: 0;
}

.avatar-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.history-panel {
  min-height: 0;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.history-page-stack {
  height: calc(100vh - 64px);
  padding: 14px;
  display: grid;
  min-height: 0;
}

.history-page-panel {
  overflow: hidden;
  background: rgba(21, 26, 34, 0.9);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.history-page-panel.history-panel {
  border-top: 1px solid var(--line-soft);
}

.history-page-list {
  padding: 0 14px 14px;
}

.recordings-panel {
  min-height: 0;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.history-head {
  min-height: 46px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.history-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.history-item {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.recordings-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.recording-item {
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.recording-player {
  width: 100%;
  max-height: 130px;
  border-radius: 8px;
  background: #070b10;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.history-meta span,
.history-meta time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-user,
.history-reply,
.history-empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

.history-user {
  color: var(--text);
}

.history-reply,
.history-empty {
  color: var(--muted);
}

.history-videos {
  display: grid;
  gap: 10px;
}

.history-video-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(50, 208, 164, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(15, 23, 32, 0.92), rgba(8, 12, 18, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(50, 208, 164, 0.12), transparent 42%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.history-video-block span {
  color: #b9c7d8;
  font-size: 12px;
  font-weight: 800;
}

.history-video {
  width: 100%;
  max-height: 420px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #070b10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.talk-input {
  padding: 12px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 10px;
}

.talk-input textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  color: var(--text);
  background: #111720;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 12, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(440px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  overflow: auto;
}

.modal-card.auth-card {
  padding: 22px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

.auth-tabs .secondary-btn {
  min-height: 48px;
  font-size: 14px;
}

.auth-tabs .is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-actions {
  display: grid;
  grid-template-columns: minmax(112px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.auth-actions .primary-btn {
  width: 100%;
  min-height: 48px;
}

.auth-actions .secondary-btn {
  min-height: 48px;
  padding: 0 18px;
}

.avatar-picker-modal {
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(760px, calc(100vw - 28px));
  padding: 24px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
}

.avatar-picker-modal h2 {
  margin: 0 0 18px;
  font-size: 34px;
  line-height: 1.1;
}

.nickname-modal h2 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
}

.avatar-picker-list {
  display: grid;
  gap: 14px;
}

.avatar-picker-modal .avatar-option {
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 112px;
  padding: 16px;
  cursor: pointer;
}

.avatar-picker-modal .avatar-swatch {
  width: 86px;
  height: 86px;
  border-radius: 10px;
}

.avatar-picker-modal .avatar-meta strong {
  font-size: 26px;
  line-height: 1.12;
}

.avatar-picker-modal .avatar-meta span {
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.35;
}

.avatar-preview-btn {
  min-width: 132px;
  min-height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.avatar-preview-btn:disabled {
  opacity: 0.72;
  cursor: progress;
}

.avatar-picker-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.admin-page-stack {
  min-height: calc(100vh - 64px);
  padding: 18px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.admin-account-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
}

.admin-form {
  padding: 20px;
  align-self: start;
}

.admin-panel {
  overflow: hidden;
}

.admin-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.settings-form {
  max-width: 520px;
}

.settings-status {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.42);
}

.settings-status strong {
  font-size: 14px;
}

.settings-status span,
.settings-help-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-status.is-on {
  border-color: rgba(50, 208, 164, 0.45);
  background: rgba(50, 208, 164, 0.1);
}

.settings-status.is-off {
  border-color: rgba(255, 184, 77, 0.38);
  background: rgba(255, 184, 77, 0.08);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.settings-help {
  padding: 18px;
}

.table-wrap {
  overflow: auto;
}

.digital-humans-table-wrap {
  max-height: calc(100vh - 180px);
}

.users-table-wrap {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #131821;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(111, 183, 255, 0.14);
  color: var(--blue);
  font-size: 12px;
}

.name-badge-btn {
  border: 1px solid rgba(111, 183, 255, 0.24);
  cursor: pointer;
  font-weight: 700;
}

.name-badge-btn:hover {
  border-color: rgba(111, 183, 255, 0.58);
  background: rgba(111, 183, 255, 0.22);
  color: #d9ecff;
}

.badge.is-generating {
  color: #05241b;
  background: var(--accent);
}

.badge.off {
  background: rgba(255, 104, 104, 0.12);
  color: var(--danger);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-subtext {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-input,
.table-select {
  width: min(420px, 100%);
  min-height: 36px;
  color: var(--text);
  background: #111720;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.table-file {
  width: min(260px, 100%);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.admin-avatar-preview {
  width: 48px;
  height: 48px;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: var(--avatar-color);
}

.admin-avatar-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.admin-background-preview {
  width: 72px;
  height: 44px;
  display: block;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(50, 208, 164, 0.18), rgba(111, 183, 255, 0.12)),
    #111720;
  background-size: cover;
  background-position: center;
}

.admin-background-preview.has-image,
.avatar-stage.has-custom-bg::before {
  background-size: cover;
  background-position: center;
}

.admin-background-preview.has-image {
  background:
    linear-gradient(180deg, rgba(4, 7, 10, 0.04), rgba(4, 7, 10, 0.18)),
    var(--custom-avatar-background) center / cover no-repeat;
}

.admin-background-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.background-admin-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.background-admin-row,
.background-admin-create {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(0, 260px) auto auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.background-admin-row > *,
.background-admin-create > * {
  min-width: 0;
}

.background-admin-create {
  grid-template-columns: minmax(0, 1fr) minmax(0, 260px) auto;
  padding: 0 16px 16px;
}

.empty {
  padding: 26px;
  color: var(--muted);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .login-shell,
  .admin-account-layout {
    grid-template-columns: 1fr;
  }

  .brand-stage {
    min-height: 520px;
  }

  .login-corner-btn {
    top: 16px;
    right: 16px;
  }

  .hero-start-btn {
    min-height: 62px;
    font-size: 22px;
  }

  .brand-title {
    font-size: clamp(30px, 7.2vw, 56px);
  }

  .brand-subtitle {
    font-size: 16px;
    max-width: 560px;
  }

  .booth-visual {
    width: min(620px, 92vw);
    height: 300px;
    bottom: -10%;
  }

  .room {
    height: auto;
    min-height: calc(100vh - 64px);
    grid-template-columns: 1fr;
  }

  .video-pane {
    min-height: 360px;
  }

  .avatar-sidebar {
    min-height: 680px;
  }
}

@media (max-width: 720px) {
  .pane-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .background-admin-row {
    grid-template-columns: 84px minmax(0, 1fr) auto auto;
  }

  .background-admin-row .table-file {
    grid-column: 2 / -1;
    width: 100%;
  }

  .background-admin-create {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .background-admin-create .table-file {
    grid-column: 1 / -1;
    width: 100%;
  }

  .avatar-render-controls {
    grid-template-columns: 68px 44px minmax(0, 1fr) 68px;
  }

  .avatar-render-time {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .login-page,
  .admin-page-stack {
    padding: 12px;
  }

  .topbar {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    overflow-x: auto;
  }

  .room {
    padding: 10px;
  }

  .avatar-stage {
    --avatar-control-safe: 150px;
  }

  .room-control-cluster {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px;
  }

  .room-control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .listening-panel {
    min-width: 0;
  }

  .toolbar {
    justify-content: center;
  }

  .reply-box {
    max-height: 120px;
  }
}
