:root {
  --bg: #000000;
  --text: #e2e8f0;
  --text-soft: rgba(226, 232, 240, 0.68);
  --text-faint: rgba(226, 232, 240, 0.36);
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.07);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6);
  --primary: #d4a574;
  --accent-red: rgba(239, 68, 68, 0.6);
  --accent-rose: rgba(251, 113, 133, 0.5);
  --accent-slate: rgba(255, 255, 255, 0.05);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --sidebar-width: 286px;
  --live2d-widget-width: 292px;
  --live2d-widget-height: 500px;
  --live2d-widget-width-mobile: 244px;
  --live2d-widget-height-mobile: 404px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  background: #000000;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#starfieldBg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#starfieldBg canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(48px) saturate(1.3);
  -webkit-backdrop-filter: blur(48px) saturate(1.3);
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: width 0.3s ease, padding 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.sidebar.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  transform: translateX(-100%);
  opacity: 0;
  border-right: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.brand-mark img {
  width: 26px;
  height: 26px;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.new-chat-btn,
.primary-btn,
.secondary-btn,
.upload-btn {
  font: inherit;
}

.new-chat-btn,
.primary-btn {
  border: 1px solid rgba(212, 165, 116, 0.3);
  color: #d4a574;
  background: rgba(212, 165, 116, 0.12);
  box-shadow: 0 0 24px rgba(212, 165, 116, 0.08);
}

.new-chat-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  margin-bottom: 16px;
  cursor: pointer;
}

.new-chat-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.upload-btn:hover {
  transform: translateY(-1px);
}

.sidebar-section {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.section-title {
  padding-left: 4px;
  margin-bottom: 10px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.session-list {
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.session-row {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.2s ease;
}

.session-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.session-row.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.empty-tip {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
}

.session-item {
  flex: 1;
  min-width: 0;
  padding: 11px 10px 11px 12px;
  text-align: left;
  font-size: 14px;
  color: var(--text);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.session-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.session-menu-trigger {
  width: 34px;
  height: 34px;
  margin-right: 6px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.2s ease;
}

.session-menu-trigger span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.session-menu-trigger:hover,
.session-menu-trigger.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.session-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 110px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(18, 18, 22, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 20;
}

.session-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.session-menu-item {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.session-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.session-menu-item.danger {
  color: rgba(248, 113, 113, 0.95);
}

.session-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: rgba(252, 165, 165, 1);
}

.sidebar-footer {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-weight: 700;
}

.auth-meta {
  flex: 1;
  min-width: 0;
}

.auth-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-kind {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
}

.ghost-btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
}

.ghost-btn:hover {
  color: var(--text);
}

.primary-btn {
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-actions .primary-btn {
  padding: 8px 20px;
  font-size: 13px;
  min-height: 36px;
}

.workspace {
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

.sidebar-toggle-fixed {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  cursor: pointer;
}

.sidebar-toggle-fixed:hover {
  background: rgba(255, 255, 255, 0.1);
}

.stage-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 24px 20px;
  border-radius: 32px;
  background: transparent;
}

.chat-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 360px;
  z-index: 19;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(48px) saturate(1.3);
  -webkit-backdrop-filter: blur(48px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s;
}

.chat-panel.chat-collapsed {
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
}

/* Floating chat ball */
.chat-fab {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(212, 165, 116, 0.2);
  background: radial-gradient(circle at 40% 35%, rgba(212, 165, 116, 0.18) 0%, rgba(212, 165, 116, 0.06) 50%, transparent 80%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 0 24px rgba(212, 165, 116, 0.12), 0 0 48px rgba(212, 165, 116, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: rgba(212, 165, 116, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s;
  animation: fab-breathe 4s ease-in-out infinite;
}

.chat-fab:hover {
  box-shadow: 0 0 32px rgba(212, 165, 116, 0.25), 0 0 64px rgba(212, 165, 116, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: rgba(212, 165, 116, 0.95);
  transform: scale(1.08);
}

.chat-fab.fab-hidden {
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}

.chat-fab-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(212, 165, 116, 0.08);
  animation: fab-ring-pulse 4s ease-in-out infinite 0.5s;
  pointer-events: none;
}

.chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d4a574;
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.6);
}

.chat-fab-badge.hidden {
  display: none;
}

.live2d-widget {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 18;
  pointer-events: none;
  font-family: "STKaiti", serif;
}

.live2d-widget__panel {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--live2d-widget-width);
  height: var(--live2d-widget-height);
  pointer-events: none;
  overflow: visible;
  transform-origin: bottom center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.live2d-widget__header {
  display: none;
}

.live2d-widget__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9, 7, 15, 0.58);
  border: 1px solid rgba(212, 165, 116, 0.18);
  color: rgba(255, 245, 232, 0.88);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.live2d-widget__status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 196, 128, 0.45);
  box-shadow: 0 0 0 6px rgba(255, 165, 88, 0.08);
}

.live2d-widget[data-bridge="connected"] .live2d-widget__status::before {
  background: #7bd88f;
  box-shadow: 0 0 0 6px rgba(123, 216, 143, 0.12);
}

.live2d-widget__collapse {
  min-width: 44px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 7, 15, 0.58);
  color: rgba(255, 245, 232, 0.85);
  cursor: pointer;
  pointer-events: auto;
}

.live2d-widget__canvas-wrap {
  position: relative;
  width: var(--live2d-widget-width);
  height: var(--live2d-widget-height);
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  overflow: visible;
}

.live2d-widget canvas {
  width: 100%;
  height: 100%;
  pointer-events: none;
  object-fit: contain;
}

.live2d-widget__ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    none;
  cursor: pointer;
  pointer-events: auto;
  display: grid;
  place-items: center;
  color: rgba(212, 165, 116, 0.8);
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.live2d-widget__ball::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(255, 158, 62, 0.1),
    0 0 12px 4px rgba(255, 138, 41, 0.14),
    0 0 24px 8px rgba(255, 113, 28, 0.08);
  z-index: -1;
}

.live2d-widget__ball::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.26), transparent 30%),
    radial-gradient(circle at 50% 50%, rgba(255, 159, 67, 0.12), rgba(255, 96, 0, 0.06) 58%, rgba(10, 10, 18, 0.82) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 190, 120, 0.22),
    0 8px 18px rgba(255, 110, 28, 0.12);
}

.live2d-widget__ball img {
  width: 62%;
  height: 62%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 8px rgba(255, 173, 58, 0.62))
    drop-shadow(0 0 18px rgba(255, 86, 13, 0.42));
}

.live2d-widget__loading {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 999px;
  color: rgba(255, 245, 232, 0.82);
  font-size: 12px;
  letter-spacing: 0.08em;
  background: rgba(9, 7, 15, 0.68);
  border: 1px solid rgba(212, 165, 116, 0.16);
  white-space: nowrap;
}

.live2d-widget__loading.is-error {
  color: rgba(255, 222, 208, 0.92);
  border-color: rgba(255, 125, 88, 0.28);
}

.live2d-widget.is-collapsed .live2d-widget__panel {
  opacity: 0;
  transform: translate(10px, 14px) scale(0.88);
  pointer-events: none;
}

.live2d-widget.is-collapsed .live2d-widget__ball {
  pointer-events: auto;
  opacity: 1;
  transform: scale(1);
}

.live2d-widget:not(.is-collapsed) .live2d-widget__ball {
  opacity: 0;
  transform: scale(0.84);
  pointer-events: none;
}

.live2d-widget.is-speaking .live2d-widget__canvas-wrap {
  filter: drop-shadow(0 0 20px rgba(212, 165, 116, 0.16));
}

@media (max-width: 768px) {
  .live2d-widget {
    z-index: 17;
  }

  .live2d-widget__panel {
    width: var(--live2d-widget-width-mobile);
    height: var(--live2d-widget-height-mobile);
  }

  .live2d-widget__canvas-wrap {
    width: var(--live2d-widget-width-mobile);
    height: var(--live2d-widget-height-mobile);
  }

  .live2d-widget__ball {
    width: 44px;
    height: 44px;
  }
}

.chat-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.chat-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.chat-status-row .status-pill {
  padding: 5px 10px;
  font-size: 11px;
}

.chat-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.top-strip {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 12px;
  font-weight: 600;
}

.stage-center {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatani-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.chatani-grid {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  mask-image: radial-gradient(ellipse at center, transparent 30%, black);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 30%, black);
  animation: chatani-grid-move 40s linear infinite;
}

.chatani-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(100deg, rgba(212, 165, 116, 0.15) 0%, rgba(212, 165, 116, 0.15) 1px, transparent 1px, transparent 4%);
}

.chatani-glow {
  position: absolute;
  inset: 0;
  mask-image: radial-gradient(90% 60% at 50% 50%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(90% 60% at 50% 50%, #000 40%, transparent 100%);
}

.chatani-glow-a::before,
.chatani-glow-b::before {
  content: "";
  position: absolute;
  inset: 0;
}

.chatani-glow-a::before {
  background: radial-gradient(ellipse at center, rgba(212, 165, 116, 0.06), transparent 70%);
  filter: blur(120px);
  animation: chatani-glow-a 12s ease-in-out infinite;
}

.chatani-glow-b::before {
  background: radial-gradient(ellipse at center, rgba(212, 165, 116, 0.04), transparent 70%);
  filter: blur(80px);
  animation: chatani-glow-b 15s ease-in-out infinite;
}

.orb-container {
  position: relative;
  z-index: 2;
  width: min(24vw, 320px);
  height: min(24vw, 320px);
  min-width: 200px;
  min-height: 200px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chatani-orb,
.chatani-ring,
.chatani-ring-inner {
  display: none;
}

.orb-container #chaosOrbMount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}

.orb-container #chaosOrbMount canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  border-radius: 50%;
}

.orb-overlay {
  display: none;
}

.orb-title {
  display: none;
}

.orb-state {
  margin-top: 12px;
  color: rgba(212, 180, 140, 0.85);
  font-size: 14px;
  line-height: 1.55;
  text-shadow: 0 0 12px rgba(212, 165, 116, 0.25);
}

.orb-hint {
  margin-top: 8px;
  color: rgba(212, 180, 140, 0.45);
  font-size: 12px;
}

.stage-actions {
  position: relative;
  z-index: 4;
  margin: 8px 0 14px;
  transform: translateX(var(--chat-offset, 0px));
}

.image-config {
  position: relative;
  z-index: 4;
  width: min(100%, 560px);
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow);
  transform: translateX(var(--chat-offset, 0px));
}

.image-head {
  display: none;
}

.image-title {
  font-size: 16px;
  font-weight: 700;
}

.image-subtitle {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 12px;
}

.image-actions {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-evenly;
}

.tts-config {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tts-config-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 12px;
}

.tts-config-title {
  font-size: 14px;
  font-weight: 700;
}

.tts-config-subtitle {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

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

.tts-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tts-field span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
}

.tts-field input,
.tts-field select,
.tts-field textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

.tts-field input,
.tts-field select {
  min-height: 40px;
  padding: 10px 12px;
}

.tts-field textarea {
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.tts-field input:focus,
.tts-field select:focus,
.tts-field textarea:focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.45);
  background: rgba(255, 255, 255, 0.07);
}

.tts-field-textarea {
  margin-top: 12px;
}

.tts-config-foot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tts-config-status {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

.tts-reset-btn {
  flex-shrink: 0;
  padding: 0;
}

.tts-modal-card {
  width: min(520px, calc(100vw - 28px));
}

.tts-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.image-actions .upload-btn,
.image-actions .secondary-btn {
  flex: none;
}

.image-actions .upload-btn {
  justify-content: center;
}

.image-actions .secondary-btn {
  justify-content: center;
}

.upload-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.secondary-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-tip {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 12px;
}

.oracle-image-card {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  max-height: min(52vh, 420px);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.oracle-image-preview {
  width: 92px;
  height: 92px;
  border-radius: 14px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.oracle-image-meta {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  overscroll-behavior: contain;
}

.oracle-image-char {
  font-size: 28px;
  font-weight: 700;
}

.oracle-image-char--pending {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.35);
}

.oracle-image-word {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
}

.oracle-image-warning {
  margin-top: 6px;
  color: #dc2626;
  font-size: 12px;
}

.oracle-image-baihua {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.oracle-image-topk {
  margin-top: 8px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.5;
  white-space: normal;
}

.oracle-image-meta::-webkit-scrollbar {
  width: 6px;
}

.oracle-image-meta::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.oracle-image-meta::-webkit-scrollbar-track {
  background: transparent;
}

.stage-footnote {
  position: relative;
  z-index: 4;
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 12px;
  transform: translateX(var(--chat-offset, 0px));
}

.chat-header {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-title {
  font-size: 18px;
  font-weight: 700;
}

.chat-subtitle {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 12px;
}

.chat-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-faint);
}

.chat-empty-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-soft);
}

.chat-empty-text {
  margin-top: 8px;
  line-height: 1.6;
}

.chat-composer {
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(17, 14, 24, 0.16), rgba(17, 14, 24, 0.3));
}

.chat-composer__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chat-composer__input {
  flex: 1;
  min-height: 44px;
  max-height: 132px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  resize: none;
  outline: none;
  font: inherit;
  line-height: 1.55;
  overflow-y: hidden;
  scrollbar-width: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-composer__input::-webkit-scrollbar {
  display: none;
}

.chat-composer__input::placeholder {
  color: rgba(246, 240, 229, 0.4);
}

.chat-composer__input:focus {
  border-color: rgba(212, 165, 116, 0.36);
  box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.08);
}

.chat-composer__input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.chat-composer__send {
  flex-shrink: 0;
  min-width: 72px;
  height: 44px;
  padding: 0 16px;
}

.chat-composer__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-composer__hint {
  margin-top: 8px;
  min-height: 18px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.5;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  gap: 6px;
  animation: message-in 0.24s ease;
}

.message.user {
  align-self: flex-end;
  align-items: flex-end;
}

.message.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.message .bubble,
.message-bubble {
  padding: 14px 16px;
  border-radius: 22px;
  line-height: 1.65;
  font-size: 14px;
  word-break: break-word;
}

.message.user .bubble,
.message.user .message-bubble {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-right-radius: 8px;
}

.message.assistant .bubble,
.message.assistant .message-bubble {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-left-radius: 8px;
}

.message .content {
  white-space: normal;
}

.message .content > :first-child {
  margin-top: 0;
}

.message .content > :last-child {
  margin-bottom: 0;
}

.message .content p,
.message .content ul,
.message .content ol,
.message .content pre,
.message .content blockquote {
  margin: 0 0 10px;
}

.message .content ul,
.message .content ol {
  padding-left: 1.2em;
}

.message .content li + li {
  margin-top: 4px;
}

.message .content code {
  padding: 0.15em 0.42em;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.message .content pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.24);
}

.message .content pre code {
  padding: 0;
  background: transparent;
}

.message .content a {
  color: #f6d19f;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message .content strong {
  font-weight: 700;
}

.message .content blockquote {
  padding-left: 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.22);
  color: var(--text-soft);
}

.message-meta {
  padding: 0 4px;
  color: var(--text-faint);
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: min(420px, calc(100vw - 28px));
  padding: 26px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(48px) saturate(1.2);
  -webkit-backdrop-filter: blur(48px) saturate(1.2);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.2s ease;
}

.modal-backdrop.hidden .modal-card {
  transform: scale(0.96);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-subtitle {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 12px;
}

.tab-row {
  display: flex;
  gap: 8px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-soft);
  padding: 9px 10px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.auth-form.hidden {
  display: none;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: rgba(212, 165, 116, 0.5);
  background: rgba(255, 255, 255, 0.07);
}

.full-btn {
  width: 100%;
}

.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.toast {
  min-width: 220px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow);
  animation: toast-in 0.22s ease;
}

.toast.warning {
  border-color: rgba(251, 191, 36, 0.48);
}

.toast.error {
  border-color: rgba(248, 113, 113, 0.5);
}

.session-list::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
  width: 8px;
}

.session-list::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

@keyframes chatani-grid-move {
  from {
    background-position: 0% 0%;
  }
  to {
    background-position: 100% 100%;
  }
}

@keyframes chatani-glow-a {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

@keyframes chatani-glow-b {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

@keyframes chatani-ring-1 {
  0% {
    transform: rotate(0deg) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: rotate(180deg) scale(1.02);
    opacity: 0.82;
  }
  100% {
    transform: rotate(360deg) scale(1);
    opacity: 0.7;
  }
}

@keyframes chatani-ring-2 {
  0% {
    transform: rotate(0deg) scale(1.05);
    opacity: 0.8;
  }
  50% {
    transform: rotate(180deg) scale(1.071);
    opacity: 0.92;
  }
  100% {
    transform: rotate(360deg) scale(1.05);
    opacity: 0.8;
  }
}

@keyframes chatani-ring-3 {
  0% {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.9;
  }
  50% {
    transform: rotate(180deg) scale(1.122);
    opacity: 1;
  }
  100% {
    transform: rotate(360deg) scale(1.1);
    opacity: 0.9;
  }
}

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

@keyframes fab-breathe {
  0%, 100% { box-shadow: 0 0 24px rgba(212, 165, 116, 0.12), 0 0 48px rgba(212, 165, 116, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
  50% { box-shadow: 0 0 32px rgba(212, 165, 116, 0.22), 0 0 64px rgba(212, 165, 116, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
}

@keyframes fab-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.4; }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .chat-panel {
    width: 320px;
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    width: 100%;
    padding: 14px;
  }

  .chat-panel {
    width: calc(100vw - 32px);
    left: 16px;
  }

  .stage-center {
    min-height: 320px;
  }

  .top-strip {
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .orb-container {
    width: min(60vw, 280px);
    height: min(60vw, 280px);
    min-width: 180px;
    min-height: 180px;
  }

  .image-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .tts-config-grid {
    grid-template-columns: 1fr;
  }

  .image-tip {
    width: 100%;
    margin-left: 0;
  }

  .oracle-image-card {
    flex-direction: column;
  }

  .oracle-image-preview {
    width: 100%;
    height: auto;
    max-height: 220px;
  }
}
