/* ============================================
   HAN XU · AI CHAT
   Minimal + News Ticker
   ============================================ */

:root {
  --bg: #ffffff;
  --bg-hover: #f5f5f5;

  --text-dark: #1a1a1a;
  --text-body: #333333;
  --text-soft: rgba(26, 26, 26, 0.7);
  --text-muted: rgba(26, 26, 26, 0.5);
  --text-light: rgba(26, 26, 26, 0.3);
  --text-inverse: #ffffff;

  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.1);

  --border: #e5e5e5;

  --glass: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-dark: rgba(0, 0, 0, 0.05);

  --user-bubble: #1a1a1a;
  --user-text: #ffffff;

  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);

  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, sans-serif;
  --font-display: 'Inter', 'Noto Sans SC', sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--text-body);
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  position: relative;
  line-height: 1.6;
  padding-top: 100px;
  transition: padding-top 0.4s ease;
}

/* ============================================
   SLIDESHOW (HIDDEN FOR NOW)
   ============================================ */
.slideshow {
  display: none;
}

/* ============================================
   MOBILE SWIPE LAYOUT
   ============================================ */
.mobile-swipe-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
  overflow: visible;
}

.mobile-panel {
  width: 100%;
  display: block;
}

.panel-right {
  display: none;
}

.news-ticker-vertical {
  display: none;
}

.mobile-swipe-indicator {
  display: none;
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 1000;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.3s;
}

.mobile-swipe-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   NEWS TICKER
   ============================================ */
.news-ticker {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 36px;
  background: #111111;
  color: #ffffff;
  z-index: 100;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ticker-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: scrollTicker 40s linear infinite;
  font-size: 12px;
  letter-spacing: 0.5px;
  width: max-content;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  flex-shrink: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.news-ticker-vertical .ticker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.ticker-label {
  background: #22c55e;
  color: #111111;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 1px;
}

.ticker-label.creative {
  background: #3b82f6;
  color: #ffffff;
}

.ticker-label.ai {
  background: #a855f7;
  color: #ffffff;
}

.ticker-label.tech {
  background: #f97316;
  color: #ffffff;
}

.ticker-text {
  color: rgba(255, 255, 255, 0.9);
}

.ticker-divider {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 300;
}

@keyframes scrollTicker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============================================
   CONTAINER
   ============================================ */
.container {
  position: relative;
  z-index: 2;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 60px 32px 32px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 32px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  padding: 24px;
  overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-radius: var(--r-lg);
  box-shadow: none;
  animation: slideUp 0.5s var(--ease) both;
}

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

.avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

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

.user-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.2;
  margin-bottom: 3px;
}

.tagline-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}

.tagline-cn {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.tagline-item {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.cn-text {
  padding: 0 4px;
}

.tagline-dot {
  color: var(--text-light);
  font-weight: 300;
}

.tagline-en {
  display: flex;
  align-items: center;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.en-item {
  padding: 0 4px;
  position: relative;
  cursor: default;
  transition: transform 0.2s ease, color 0.2s ease;
}

.en-item:hover {
  transform: translateY(-2px);
  color: var(--accent);
}

.en-sep {
  color: var(--text-light);
  font-weight: 300;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================
   CHAT AREA
   ============================================ */
.chat {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 20px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat::-webkit-scrollbar {
  width: 4px;
}

.chat::-webkit-scrollbar-track {
  background: transparent;
}

.chat::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

/* ============================================
   MESSAGES
   ============================================ */
.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
  animation: msgIn 0.35s var(--ease) both;
}

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

.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }

.bubble-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.message.bot .bubble-avatar {
  color: #ffffff;
}

.message.user .bubble-avatar {
  color: var(--accent);
}

.msg-bubble {
  max-width: calc(100% - 54px);
  padding: 12px 16px;
  font-size: 15px;
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
  border-radius: var(--r-lg);
}

.message.bot .msg-bubble {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--text-dark);
  border-bottom-left-radius: 8px;
}

.message.user .msg-bubble {
  background: var(--user-bubble);
  color: var(--user-text);
  border-bottom-right-radius: 8px;
  max-width: none;
  width: auto;
  white-space: normal;
}

.typing {
  display: flex;
  gap: 5px;
  padding: 2px 0;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Streaming cursor */
.streaming-cursor {
  display: inline-block;
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
  color: var(--text-muted);
  font-weight: 300;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Knowledge save card */
.kb-save-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: kbSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kb-save-card .kb-save-icon {
  font-size: 24px;
  line-height: 1;
}

.kb-save-card .kb-save-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.kb-save-card .kb-save-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  word-break: break-word;
}

.kb-save-card .kb-save-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kb-kw-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.kb-save-card .kb-save-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.kb-save-card.success {
  border-color: rgba(76, 175, 80, 0.3);
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.12), var(--bg-secondary));
}

.kb-save-card.success .kb-save-icon {
  animation: kbPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kb-save-card.saving {
  border-color: rgba(255, 193, 7, 0.2);
}

.kb-save-card.error {
  border-color: rgba(244, 67, 54, 0.3);
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.12), var(--bg-secondary));
}

@keyframes kbSlideIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes kbPop {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================
   WELCOME
   ============================================ */
.welcome {
  text-align: center;
  padding: 40px 20px 28px;
}

.welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.welcome-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.welcome-sub {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 24px;
  line-height: 1.6;
}

.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.chip {
  padding: 9px 16px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--ease);
}

.chip:hover {
  background: #f4f4f5;
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.chip:active {
  transform: scale(0.97);
}

/* ============================================
   SITE CARDS (inside chat bubble)
   ============================================ */
.sites-section {
  margin-top: 12px;
}

.sites-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.site-card {
  display: block;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  text-decoration: none;
  transition: var(--ease);
  cursor: pointer;
  margin: 6px 0;
}

.site-card-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
}

.site-card:hover {
  background: #f4f4f5;
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.site-card:active {
  transform: scale(0.99);
}

.site-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.site-card-wide .site-card-name {
  margin-bottom: 0;
}

.site-card-desc {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

/* ============================================
   INPUT
   ============================================ */
.input-area {
  padding: 12px 0 20px;
}

.input-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--r-pill);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: var(--ease);
}

.input-pill:focus-within {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.15);
}

.input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-dark);
  padding: 10px 0;
  font-weight: 400;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #1a1a1a;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ease);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--accent);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.94);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.send-btn svg {
  width: 16px;
  height: 16px;
}

.hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  min-height: 14px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    padding-top: 0;
  }

  .news-ticker {
    background: #111111;
    color: #ffffff;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .ticker-text {
    color: rgba(255, 255, 255, 0.9);
  }

  /* 移动端滑动容器 - 横向滚动 */
  .mobile-swipe-wrap {
    position: fixed;
    top: 100px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .mobile-swipe-wrap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  /* 移动端的panel设置为100vw宽度 */
  .mobile-panel {
    width: 100vw;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  /* 第一个panel（Chat卡片） */
  .panel-left {
    width: 100vw;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  /* .container 在panel-left内部，需要移除padding */
  .panel-left.container {
    padding: 0;
  }

  /* 第二个panel（右侧空白页面） */
  .panel-right {
    width: 100vw;
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    padding: 0;
    box-sizing: border-box;
  }

  .right-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: hidden;
    height: 100%;
  }

  .empty-space {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #ffffff;
  }

  .card {
    flex: 1;
    padding: 12px;
    border-radius: 20px;
    min-height: 0;
    background: rgba(255, 255, 255, 0.85);
  }

  .chat {
    flex: 1;
    min-height: 0;
    padding: 10px 2px 8px;
    gap: 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .input-area {
    touch-action: manipulation;
  }

  .right-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
    overflow: hidden;
  }

  .right-panel-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
  }

  .news-ticker-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    padding-right: 8px;
  }

  .news-ticker-vertical::-webkit-scrollbar {
    width: 4px;
  }

  .news-ticker-vertical::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
  }

  .news-ticker-vertical .ticker-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
  }

  .news-ticker-vertical .ticker-item .ticker-label {
    flex-shrink: 0;
  }

  .news-ticker-vertical .ticker-item .ticker-text {
    color: var(--text-dark);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
  }

  .swipe-hint-left {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 10px;
  }

  .mobile-swipe-indicator {
    display: block;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 200;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    animation: indicatorPulse 2s ease-in-out infinite;
  }

  .mobile-swipe-indicator.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  @keyframes indicatorPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
  }

  /* 普通容器样式 - 排除panel-left */
  .container:not(.panel-left) {
    margin: 0;
    padding: 12px;
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  .card {
    padding: 12px;
    border-radius: 20px;
    flex: 1;
    min-height: 0;
  }

  .header {
    padding: 12px 14px;
    gap: 10px;
  }

  .avatar {
    width: 36px;
    height: 36px;
    font-size: 12px;
  }

  .user-name {
    font-size: 14px;
  }

  .tagline-cn,
  .tagline-en {
    font-size: 9px;
  }

  .chat {
    flex: 1;
    min-height: 0;
    padding: 10px 2px 8px;
    gap: 10px;
    overflow-y: auto;
  }

  .msg-bubble {
    font-size: 14px;
    padding: 10px 13px;
    line-height: 1.55;
  }

  .welcome {
    padding: 18px 10px;
  }

  .welcome-title {
    font-size: 18px;
  }

  .sites-section {
    margin-top: 18px;
  }

  .sites-grid {
    gap: 10px;
  }

  .site-card {
    padding: 12px 14px;
  }

  .site-card-name {
    font-size: 14px;
  }

  .site-card-desc {
    font-size: 11px;
  }

  .input-area {
    padding-top: 8px;
  }

  .input-pill {
    padding: 4px 4px 4px 12px;
  }

  .input-field {
    font-size: 14px;
    padding: 6px 0;
  }

  .send-btn {
    width: 34px;
    height: 34px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 680px;
  }

  .chat {
    padding: 28px 12px 16px;
  }

  .msg-bubble {
    font-size: 16px;
    padding: 14px 20px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

::selection {
  background: var(--accent);
  color: white;
}

/* ============================================
   DEV MODE
   ============================================ */
.dev-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.dev-modal-content {
  background: var(--bg);
  border-radius: 16px;
  padding: 32px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.dev-modal-content h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text-dark);
}

.dev-desc {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.dev-modal-content input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.dev-btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  transition: opacity 0.2s;
}

.dev-btn-primary:hover {
  opacity: 0.9;
}

.dev-btn-secondary {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
}

.dev-hint {
  text-align: center;
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--text-light);
}

/* Dev Panel */
.dev-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 420px;
  max-height: calc(100vh - 40px);
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dev-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dev-panel-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-dark);
}

.dev-icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
}

.dev-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-dark);
}

.dev-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.dev-tab {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.dev-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.dev-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.dev-tab-content.hidden {
  display: none;
}

/* Knowledge Tab */
.dev-add-item {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.dev-add-item input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.dev-add-item textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  box-sizing: border-box;
  resize: vertical;
}

.dev-knowledge-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dev-knowledge-item {
  background: var(--bg-hover);
  border-radius: 10px;
  padding: 12px;
  border-left: 3px solid var(--accent);
}

.dev-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dev-item-idx {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.dev-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
}

.dev-delete-btn:hover {
  color: #ef4444;
}

.dev-keywords-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 6px;
  box-sizing: border-box;
}

.dev-response-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  box-sizing: border-box;
  resize: vertical;
}

.dev-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  padding: 20px;
}

.dev-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dev-footer .dev-btn-primary {
  width: auto;
  padding: 10px 20px;
  margin-bottom: 0;
}

.dev-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Prompt Tab */
.dev-tab-content textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  font-family: 'SF Mono', Monaco, monospace;
  line-height: 1.6;
  box-sizing: border-box;
  resize: vertical;
  margin-bottom: 12px;
}

/* Test Tab */
.dev-tab-content input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.dev-test-result {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-hover);
  border-radius: 10px;
}

.dev-test-question {
  font-size: 13px;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.dev-test-answer {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}

.dev-loading,
.dev-error {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.dev-error {
  color: #ef4444;
}

/* Mobile Dev Panel */
@media (max-width: 768px) {
  .dev-panel {
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ============================================
   TRAINING MODE INDICATOR
   ============================================ */
.training-indicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  z-index: 9997;
  animation: trainingPulse 2s ease-in-out infinite;
}

.training-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: dotPulse 1.5s ease-in-out infinite;
}

.training-exit {
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.training-exit:hover {
  background: rgba(255, 255, 255, 0.5);
}

@keyframes trainingPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(102, 126, 234, 0.7); }
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}

@media (max-width: 768px) {
  .training-indicator {
    top: 10px;
    font-size: 12px;
    padding: 8px 14px;
  }
}

/* ============================================
   PET PLAYER
   ============================================ */
.pet-section {
  background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

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

.pet-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.pet-status {
  font-size: 11px;
  color: #22c55e;
  font-weight: 600;
  padding: 3px 10px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 10px;
}

.pet-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
  border-radius: 16px;
}

.pet-bubble {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: white;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  color: #333;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  white-space: nowrap;
  z-index: 10;
}

.pet-bubble.show {
  transform: translateX(-50%) scale(1);
}

.pet-bubble::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid white;
}

#petCanvas {
  cursor: pointer;
  max-width: 100%;
  height: auto;
  image-rendering: auto;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

#petCanvas:focus {
  outline: none;
}

.pet-controls {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.pet-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.pet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pet-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
}

@media (max-width: 768px) {
  .pet-section {
    padding: 12px;
  }

  .pet-container {
    padding: 8px;
  }

  .pet-controls {
    gap: 4px;
  }

  .pet-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* Desktop Floating Pet */
.desktop-pet {
  position: fixed;
  z-index: 9999;
  display: none;
  pointer-events: auto;
}

.desktop-pet.show {
  display: block;
}

.desktop-pet #desktopPetCanvas {
  cursor: pointer;
  image-rendering: auto;
  display: block;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.desktop-pet #desktopPetCanvas:focus {
  outline: none;
}

.desktop-pet-bubble {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: rgba(30, 30, 30, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.desktop-pet-bubble.show {
  transform: translateX(-50%) scale(1);
}

.desktop-pet-bubble::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: rgba(30, 30, 30, 0.9);
}

@media (max-width: 480px) {
  .desktop-pet {
    display: block;
    pointer-events: auto;
  }
  
  .desktop-pet #desktopPetCanvas {
    pointer-events: auto;
  }

  /* 移动端直播横幅展开样式 */
  .live-banner.expanded {
    max-height: none;
  }

  .live-expanded-content {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .live-expanded-image {
    width: 100%;
    min-height: 160px;
  }

  .live-expanded-info {
    gap: 2px;
  }

  .live-event-title {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .live-expanded-side {
    width: 100%;
  }
}

/* ============================================
   LIVE BANNER
   ============================================ */
.live-banner {
  position: fixed;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 150;
  background: #1a1a1a;
  color: #fff;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.live-banner.collapsed {
  max-height: 44px;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.live-banner.expanded {
  max-height: none;
  height: auto;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

/* Collapsed State */
.live-banner-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 40px;
  background: #1a1a1a;
  border-radius: 14px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
}

.live-label {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-title {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-brand {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 4px;
}

.headstream-logo {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  font-size: 8px;
  line-height: 11px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}

.live-expand-btn,
.live-collapse-btn {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.live-expand-btn:hover,
.live-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: scale(1.1);
}

/* Expanded State */
.live-banner-expanded {
  display: none;
  background: #1a1a1a;
}

.live-banner.expanded .live-banner-collapsed {
  display: none;
}

.live-banner.expanded .live-banner-expanded {
  display: block;
}

.live-expanded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-expanded-content {
  display: flex;
  gap: 16px;
  padding: 16px;
}

.live-expanded-image {
  position: relative;
  width: 40%;
  min-height: 180px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.live-expanded-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.live-play-btn {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #1a1a1a;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.live-play-btn:hover {
  transform: scale(1.1);
  background: #fff;
}

.live-expanded-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.live-now-text {
  font-size: 12px;
  font-weight: 600;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-time {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'SF Mono', monospace;
}

.live-event-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.live-upnext {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.upnext-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 2px;
}

.upnext-time {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'SF Mono', monospace;
}

.upnext-title {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.live-expanded-side {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.headstream-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.headstream-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
}

.headstream-logo-large {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

.headstream-slogan {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

.headstream-cta {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.headstream-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}

@media (max-width: 768px) {
  .live-expanded-content {
    flex-direction: column;
  }

  .live-expanded-image {
    width: 100%;
    min-height: 150px;
  }

  .live-expanded-side {
    width: 100%;
  }

  .headstream-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 12px;
  }

  .headstream-cta {
    width: auto;
    padding: 8px 16px;
    font-size: 12px;
  }
}
