/* Galaxy Realtime Voice — fullscreen sci-fi visualizer */

.xh-galaxy-voice {
  position: fixed;
  inset: 0;
  z-index: 50000;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  background: #000000;
  color: #e8ecff;
  overflow: hidden;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.xh-galaxy-root {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 50% at 50% 42%, rgba(48, 20, 90, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(10, 40, 70, 0.25) 0%, transparent 50%),
    #050508;
}

.xh-galaxy-top {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 8px;
  pointer-events: none;
}

.xh-galaxy-top > * {
  pointer-events: auto;
}

.xh-galaxy-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.xh-galaxy-back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(180, 200, 255, 0.22);
  background: rgba(12, 14, 28, 0.55);
  color: rgba(220, 230, 255, 0.9);
  font-size: 16px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, background 0.2s;
}

.xh-galaxy-back:hover {
  border-color: rgba(140, 200, 255, 0.55);
  background: rgba(30, 40, 70, 0.7);
}

.xh-galaxy-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.xh-galaxy-logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: #f0f4ff;
  text-shadow:
    0 0 12px rgba(140, 100, 255, 0.55),
    0 0 28px rgba(80, 140, 255, 0.35);
}

.xh-galaxy-sub {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(160, 180, 220, 0.55);
}

.xh-galaxy-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.xh-galaxy-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(120, 140, 200, 0.28);
  background: rgba(10, 12, 24, 0.65);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(180, 200, 240, 0.75);
  backdrop-filter: blur(12px);
}

.xh-galaxy-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(140, 150, 180, 0.7);
  box-shadow: 0 0 0 0 rgba(120, 140, 200, 0.4);
}

.xh-galaxy-live.is-live {
  border-color: rgba(80, 220, 200, 0.45);
  color: rgba(180, 255, 240, 0.95);
}

.xh-galaxy-live.is-live i {
  background: #4ff0d0;
  box-shadow: 0 0 8px #4ff0d0;
  animation: xh-galaxy-pulse 1.4s ease-in-out infinite;
}

.xh-galaxy-live.is-error {
  border-color: rgba(255, 100, 120, 0.5);
  color: rgba(255, 180, 190, 0.95);
}

.xh-galaxy-live.is-error i {
  background: #ff6b7a;
  box-shadow: 0 0 8px #ff6b7a;
}

@keyframes xh-galaxy-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

.xh-galaxy-voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(120, 140, 200, 0.25);
  background: rgba(10, 12, 24, 0.65);
  backdrop-filter: blur(12px);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: rgba(160, 180, 220, 0.65);
}

.xh-galaxy-voice-pill select {
  max-width: 180px;
  border: none;
  background: transparent;
  color: #e8ecff;
  font-size: 12px;
  letter-spacing: 0;
  outline: none;
  cursor: pointer;
}

.xh-galaxy-voice-pill select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.xh-galaxy-voice-pill select option {
  background: #0a0c18;
  color: #e8ecff;
}

.xh-galaxy-main {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 20px 100px;
}

.xh-galaxy-orb-host {
  position: relative;
  width: min(52vh, 420px);
  height: min(52vh, 420px);
  max-width: 90vw;
  flex: 0 0 auto;
  pointer-events: none;
}

.xh-galaxy-orb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.xh-galaxy-orb-fallback {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, rgba(220, 200, 255, 0.55), transparent 35%),
    radial-gradient(circle at 60% 60%, rgba(80, 40, 160, 0.9), rgba(20, 10, 50, 0.95) 70%);
  box-shadow:
    0 0 40px rgba(120, 80, 255, 0.45),
    0 0 90px rgba(60, 40, 180, 0.35),
    inset 0 0 40px rgba(180, 140, 255, 0.25);
  animation: xh-galaxy-orb-breathe 4s ease-in-out infinite;
}

.xh-galaxy-orb-fallback::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  border: 1px solid rgba(140, 200, 255, 0.15);
  box-shadow: 0 0 30px rgba(100, 180, 255, 0.12);
  pointer-events: none;
}

.xh-galaxy-orb[data-phase="listening"] .xh-galaxy-orb-fallback {
  box-shadow:
    0 0 50px rgba(80, 220, 255, 0.5),
    0 0 100px rgba(40, 120, 200, 0.35),
    inset 0 0 40px rgba(160, 240, 255, 0.3);
  animation-duration: 1.6s;
}

.xh-galaxy-orb[data-phase="speaking"] .xh-galaxy-orb-fallback {
  box-shadow:
    0 0 60px rgba(200, 120, 255, 0.65),
    0 0 120px rgba(140, 60, 255, 0.45),
    inset 0 0 50px rgba(255, 255, 255, 0.35);
  animation-duration: 0.9s;
}

@keyframes xh-galaxy-orb-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

.xh-galaxy-hint {
  margin: 18px 0 0;
  max-width: 420px;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(180, 195, 230, 0.55);
  letter-spacing: 0.04em;
}

.xh-galaxy-subs {
  margin-top: 22px;
  width: min(560px, 92vw);
  min-height: 72px;
  max-height: 140px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.xh-galaxy-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  opacity: 1;
  transition: opacity 0.45s ease, transform 0.45s ease;
  transform: translateY(0);
}

.xh-galaxy-line[data-age="1"] {
  opacity: 0.62;
}

.xh-galaxy-line[data-age="2"] {
  opacity: 0.38;
}

.xh-galaxy-line[data-age="3"],
.xh-galaxy-line[data-age="4"],
.xh-galaxy-line[data-age="5"] {
  opacity: 0.18;
}

.xh-galaxy-line-role {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(140, 180, 255, 0.55);
}

.xh-galaxy-line.is-user .xh-galaxy-line-role {
  color: rgba(120, 230, 220, 0.65);
}

.xh-galaxy-line-text {
  font-size: 15px;
  line-height: 1.45;
  color: rgba(240, 245, 255, 0.92);
  text-shadow: 0 0 14px rgba(180, 200, 255, 0.35);
  word-break: break-word;
}

.xh-galaxy-dock {
  position: absolute;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.xh-galaxy-dock.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.xh-galaxy-dock-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(160, 180, 255, 0.18);
  background: rgba(12, 14, 28, 0.55);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Mid-call text + image composer (Phase 1–2). */
.xh-galaxy-composer {
  width: min(560px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.xh-galaxy-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 22px;
  border: 1px solid rgba(160, 180, 255, 0.18);
  background: rgba(12, 14, 28, 0.72);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.xh-galaxy-attach-btn,
.xh-galaxy-send {
  flex: 0 0 auto;
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(160, 180, 255, 0.22);
  background: rgba(36, 44, 80, 0.7);
  color: rgba(230, 235, 255, 0.92);
  font-size: 13px;
  cursor: pointer;
}

.xh-galaxy-attach-btn {
  width: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.xh-galaxy-attach-btn.is-disabled,
.xh-galaxy-attach-btn:disabled,
.xh-galaxy-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.xh-galaxy-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  max-height: 120px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: rgba(240, 245, 255, 0.95);
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 4px;
  font-family: inherit;
}

.xh-galaxy-input::placeholder {
  color: rgba(170, 185, 220, 0.45);
}

.xh-galaxy-input:disabled {
  opacity: 0.55;
}

.xh-galaxy-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}

.xh-galaxy-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border-radius: 14px;
  border: 1px solid rgba(160, 180, 255, 0.2);
  background: rgba(18, 22, 42, 0.78);
  color: rgba(230, 235, 255, 0.9);
}

.xh-galaxy-chip.is-failed {
  border-color: rgba(255, 120, 140, 0.45);
}

.xh-galaxy-chip.is-done {
  border-color: rgba(120, 220, 170, 0.35);
}

.xh-galaxy-chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  flex: 0 0 auto;
}

.xh-galaxy-chip-thumb.is-empty {
  display: inline-block;
}

.xh-galaxy-chip-thumb.is-doc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(210, 220, 255, 0.85);
  background: rgba(90, 120, 220, 0.22);
}

.xh-galaxy-chip.is-document .xh-galaxy-chip-name {
  max-width: 180px;
}

.xh-galaxy-chip-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.xh-galaxy-chip-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.xh-galaxy-chip-status {
  font-size: 11px;
  color: rgba(170, 185, 220, 0.7);
}

.xh-galaxy-chip-remove {
  border: 0;
  background: transparent;
  color: rgba(200, 210, 240, 0.7);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}

.xh-galaxy-ctrl {
  min-width: 72px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(160, 180, 255, 0.2);
  background: rgba(30, 36, 64, 0.55);
  color: rgba(230, 235, 255, 0.92);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.xh-galaxy-ctrl:hover {
  border-color: rgba(140, 200, 255, 0.45);
  background: rgba(50, 60, 110, 0.7);
  box-shadow: 0 0 16px rgba(100, 140, 255, 0.2);
}

.xh-galaxy-ctrl.is-active {
  border-color: rgba(255, 180, 100, 0.55);
  color: #ffe8c8;
}

.xh-galaxy-ctrl.is-danger {
  border-color: rgba(255, 100, 120, 0.4);
  background: rgba(80, 20, 36, 0.55);
}

.xh-galaxy-ctrl.is-danger:hover {
  border-color: rgba(255, 120, 140, 0.7);
  background: rgba(120, 30, 48, 0.7);
  box-shadow: 0 0 16px rgba(255, 80, 100, 0.25);
}

.xh-galaxy-model {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(140, 160, 200, 0.4);
}

/* Hide legacy panel chrome when galaxy mode is active */
.xh-galaxy-voice .xh-rt-panel,
.xh-galaxy-voice .xh-rt-header,
.xh-galaxy-voice .xh-rt-body {
  display: none !important;
}

body.xh-galaxy-voice-active {
  overflow: hidden;
}

body.xh-galaxy-voice-active #composerBottomSlot,
body.xh-galaxy-voice-active .chat-workspace-composer,
body.xh-galaxy-voice-active #sidebar {
  pointer-events: none !important;
}

@media (max-width: 640px) {
  .xh-galaxy-top {
    padding: 14px 14px 6px;
  }

  .xh-galaxy-sub {
    display: none;
  }

  .xh-galaxy-voice-pill span {
    display: none;
  }

  .xh-galaxy-orb-host {
    width: min(58vw, 300px);
    height: min(58vw, 300px);
  }

  .xh-galaxy-line-text {
    font-size: 14px;
  }

  .xh-galaxy-dock {
    bottom: 18px;
    width: calc(100% - 24px);
  }

  .xh-galaxy-dock-inner {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .xh-galaxy-composer {
    width: 100%;
  }
}
