/* ==========================================================================
   ChatGPT (chatgpt.com) 1:1 Pixel-Accurate Production Stylesheet
   Zero-Emoji, Pure Vector SVG & Official Design Tokens (Dark & Light Themes)
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg-primary: #212121;
  --bg-sidebar: #171717;
  --bg-elevated: #2f2f2f;
  --bg-elevated-hover: #383838;
  --bg-modal: #2f2f2f;
  --bg-modal-card: #212121;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --bg-code-header: #2f2f2f;
  --bg-code-body: #0d0d0d;

  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #7d7d7d;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);

  --accent-green: #10a37f;
  --accent-blue: #3b82f6;
  --accent-blue-bg: rgba(59, 130, 246, 0.14);
  --accent-blue-border: rgba(59, 130, 246, 0.38);

  --btn-send-bg: #ffffff;
  --btn-send-fg: #0d0d0d;

  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.48), 0 2px 6px rgba(0, 0, 0, 0.32);
  --shadow-composer: 0 4px 20px rgba(0, 0, 0, 0.22);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.62);

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-sidebar: #f9f9f9;
  --bg-elevated: #f4f4f4;
  --bg-elevated-hover: #eaeaea;
  --bg-modal: #ffffff;
  --bg-modal-card: #f9f9f9;
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-active: rgba(0, 0, 0, 0.08);
  --bg-code-header: #e5e5e5;
  --bg-code-body: #171717;

  --text-primary: #0d0d0d;
  --text-secondary: #5d5d5d;
  --text-muted: #8e8e8e;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.13);
  --border-strong: rgba(0, 0, 0, 0.22);

  --btn-send-bg: #0d0d0d;
  --btn-send-fg: #ffffff;

  --shadow-popover: 0 10px 28px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-composer: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.18);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

/* Custom Subtle Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(155, 155, 155, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(155, 155, 155, 0.38);
}

/* ==================== App Layout ==================== */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ==================== Left Sidebar (260px 1:1 Official) ==================== */
.sidebar {
  width: 260px;
  min-width: 260px;
  height: 100%;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.16s ease;
  z-index: 30;
  user-select: none;
  position: relative;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
}

.sidebar-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Sidebar Search Input Drawer */
.sidebar-search-wrap {
  padding: 0 10px 8px;
  display: none;
}

.sidebar-search-wrap.open {
  display: block;
}

.sidebar-search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.sidebar-search-input:focus {
  border-color: var(--border-medium);
}

/* Sidebar Top Nav Items (ChatGPT + Explore Nodes) */
.sidebar-nav-section {
  padding: 0 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-brand-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.12s ease;
}

.sidebar-brand-item:hover {
  background-color: var(--bg-hover);
}

.brand-logo-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-logo-circle svg {
  width: 16px;
  height: 16px;
}

.sidebar-brand-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-sub-badge {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-hover);
  padding: 1px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Sidebar Conversation History */
.sidebar-history {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 12px;
}

.history-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 14px 10px 6px;
}

.history-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.12s ease;
  margin-bottom: 1px;
}

.history-item:hover {
  background-color: var(--bg-hover);
}

.history-item.active {
  background-color: var(--bg-active);
}

.history-item-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
  font-weight: 400;
}

.history-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
}

.history-item:hover .history-item-actions,
.history-item.active .history-item-actions {
  display: flex;
}

.history-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.history-action-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.history-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Sidebar Footer (Upgrade Plan + User Profile) */
.sidebar-footer {
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.upgrade-banner-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease;
}

.upgrade-banner-btn:hover {
  background-color: var(--bg-hover);
}

.upgrade-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

.upgrade-icon-wrap svg {
  width: 15px;
  height: 15px;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease;
}

.user-profile-btn:hover {
  background-color: var(--bg-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #10a37f;
  color: #ffffff;
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Tier Badges (Subtle, Clean, Non-Neon) */
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tier-badge.free {
  background: rgba(155, 155, 155, 0.14);
  color: var(--text-secondary);
}

.tier-badge.plus {
  background: rgba(16, 163, 127, 0.16);
  color: #34d399;
}

.tier-badge.pro {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

/* ==================== Main Workspace & Chat Column ==================== */
.main-workspace {
  flex: 1;
  height: 100%;
  display: flex;
  overflow: hidden;
  background-color: var(--bg-primary);
  position: relative;
}

.chat-column {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Topbar (height: 56px, 1:1 Official) */
.topbar {
  height: 56px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: var(--bg-primary);
  position: relative;
  z-index: 20;
}

.chat-column.is-empty .topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.model-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.model-selector-btn:hover {
  background-color: var(--bg-hover);
}

.model-selector-btn .model-sub {
  color: var(--text-secondary);
  font-weight: 600;
}

.model-selector-btn svg {
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Model Picker Dropdown (1:1 Official Popover) */
.model-dropdown {
  position: absolute;
  top: 48px;
  left: 0;
  width: 320px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-popover);
  padding: 6px;
  display: none;
  z-index: 100;
  animation: popFadeIn 0.12s ease-out;
}

.model-dropdown.open {
  display: block;
}

@keyframes popFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.model-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.model-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.model-option:hover {
  background-color: var(--bg-hover);
}

.model-option-icon {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.model-option-icon svg {
  width: 18px;
  height: 18px;
}

.model-option-info {
  flex: 1;
  min-width: 0;
}

.model-option-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-option-check {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.topbar-pill-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.topbar-pill-btn svg {
  width: 15px;
  height: 15px;
}

/* Status Dots */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.idle {
  background-color: #10b981;
}

.status-dot.busy {
  background-color: #f59e0b;
}

.status-dot.cooling,
.status-dot.crowded {
  background-color: #ef4444;
}

/* ==================== 1:1 Official Empty-State (Centered) vs Active-Chat (Docked) ==================== */
.chat-scroll-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

/* When conversation is empty: center greeting + composer in the middle of the screen! */
.chat-column.is-empty .chat-scroll-area {
  flex: 0 0 auto;
  overflow: visible;
}

.chat-column.is-empty {
  justify-content: center;
}

.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 20px 28px;
  text-align: center;
}

.welcome-Hero-hidden,
.welcome-hero.hidden {
  display: none !important;
}

.welcome-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text-primary);
}

/* Suggestion Pills below Composer in Empty State */
.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 768px;
  justify-content: center;
  margin-top: 16px;
}

.chat-column:not(.is-empty) .welcome-chips {
  display: none !important;
}

.suggestion-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.suggestion-pill:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.suggestion-pill svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ==================== Conversation Messages Stream (768px Centered) ==================== */
.messages-container {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 16px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.chat-column.is-empty .messages-container {
  display: none;
}

.message-row {
  display: flex;
  width: 100%;
  animation: fadeIn 0.16s ease-out;
}

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

/* User Right Bubble */
.message-row.user {
  justify-content: flex-end;
}

.user-bubble-wrap {
  max-width: 70%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.user-bubble {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.user-attachments-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.user-attachment-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px 10px;
  max-width: 240px;
}

.user-attachment-card img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
}

/* Assistant Left Response */
.message-row.assistant {
  justify-content: flex-start;
  gap: 16px;
  align-items: flex-start;
}

.assistant-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}

.assistant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.assistant-avatar svg {
  width: 17px;
  height: 17px;
}

.assistant-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 1:1 Official Reasoning ("已思考 X 秒") Minimalist Collapsible */
.thinking-box {
  margin-bottom: 4px;
}

.thinking-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease;
}

.thinking-header:hover {
  color: var(--text-primary);
}

.thinking-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

.thinking-box.expanded .thinking-chevron,
.thinking-box.open .thinking-chevron {
  transform: rotate(90deg);
}

.shimmer-text {
  background: linear-gradient(90deg, var(--text-secondary) 0%, var(--text-primary) 50%, var(--text-secondary) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 1.8s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.thinking-content {
  display: none;
  margin-top: 6px;
  padding: 2px 0 4px 14px;
  border-left: 2px solid var(--border-medium);
  font-size: 13.5px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.65;
}

.thinking-box.expanded .thinking-content,
.thinking-box.open .thinking-content {
  display: block;
}

/* DALL-E 3 / Imagen 3 Generated Image Card */
.dalle-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0;
}

.dalle-card {
  position: relative;
  width: 360px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #141414;
  cursor: zoom-in;
}

.dalle-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.dalle-card:hover img {
  transform: scale(1.015);
}

.dalle-card-overlay {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.dalle-card:hover .dalle-card-overlay {
  opacity: 1;
}

.dalle-overlay-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(13, 13, 13, 0.78);
  backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.dalle-overlay-btn svg {
  width: 14px;
  height: 14px;
}

/* Web Search Citations Bar */
.citations-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.14s ease;
}

.citation-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.citation-pill svg {
  width: 12px;
  height: 12px;
}

/* ==================== 1:1 Official Markdown Prose, Tables & Syntax Highlighting ==================== */
.markdown-prose {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-primary);
  word-break: break-word;
}

.markdown-prose h1,
.markdown-prose h2,
.markdown-prose h3,
.markdown-prose h4 {
  margin: 20px 0 8px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.markdown-prose h1:first-child,
.markdown-prose h2:first-child,
.markdown-prose h3:first-child {
  margin-top: 2px;
}

.markdown-prose h1 { font-size: 22px; }
.markdown-prose h2 { font-size: 19px; }
.markdown-prose h3 { font-size: 16.5px; }

.markdown-prose p {
  margin-bottom: 12px;
}

.markdown-prose p:last-child {
  margin-bottom: 0;
}

.markdown-prose ul,
.markdown-prose ol {
  margin: 8px 0 14px 24px;
}

.markdown-prose li {
  margin-bottom: 5px;
}

.markdown-prose blockquote {
  border-left: 3px solid var(--border-medium);
  padding-left: 14px;
  color: var(--text-secondary);
  margin: 12px 0;
}

.markdown-prose hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 18px 0;
}

.markdown-prose a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-prose code.inline-code {
  background-color: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

/* Official ChatGPT Markdown Table Styling */
.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.md-table th,
.md-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.md-table th {
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
}

.md-table tr:last-child td {
  border-bottom: none;
}

/* Official Code Block & Syntax Highlighting */
.code-block-wrap {
  margin: 14px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-code-body);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background-color: var(--bg-code-header);
  color: #b4b4b4;
  font-size: 12px;
  font-family: var(--font-sans);
}

[data-theme="light"] .code-block-header {
  color: #4b5563;
}

.code-block-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.code-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.12s ease;
}

.code-action-btn:hover {
  color: #ffffff;
}

[data-theme="light"] .code-action-btn:hover {
  color: #0d0d0d;
}

.code-action-btn svg {
  width: 14px;
  height: 14px;
}

.code-block-wrap pre {
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: #e5e7eb;
}

/* Syntax Token Colors */
.tok-kw { color: #c084fc; }
.tok-str { color: #86efac; }
.tok-com { color: #6b7280; font-style: italic; }
.tok-num { color: #fca5a5; }
.tok-fn { color: #60a5fa; }

/* ==================== 1:1 Official Assistant Message Bottom Action Bar ==================== */
.message-actions-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  color: var(--text-muted);
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.msg-action-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.msg-action-btn.active {
  color: var(--text-primary);
}

.msg-action-btn svg {
  width: 15px;
  height: 15px;
}

.msg-meta-tag {
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.message-row.assistant:hover .msg-meta-tag {
  opacity: 0.75;
}

/* ==================== 1:1 Official Composer Input Pill ==================== */
.composer-section {
  width: 100%;
  max-width: 768px;
  margin: 0 auto;
  padding: 0 20px 16px;
  flex-shrink: 0;
}

.composer-box {
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 12px 14px 10px 18px;
  box-shadow: var(--shadow-composer);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer-box:focus-within {
  border-color: var(--border-medium);
}

/* Pending Attachment Thumbnails */
.pending-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-attachments:empty {
  display: none;
}

.pending-att-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px 28px 6px 8px;
  font-size: 12.5px;
}

.pending-att-item img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
}

.pending-att-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-textarea {
  width: 100%;
  max-height: 200px;
  min-height: 26px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

.composer-textarea::placeholder {
  color: var(--text-muted);
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.tool-pill-btn.circle {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.tool-pill-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.tool-pill-btn.active {
  background-color: var(--accent-blue-bg);
  border-color: var(--accent-blue-border);
  color: #60a5fa;
}

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

.composer-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.send-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--btn-send-bg);
  color: var(--btn-send-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

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

.voice-mode-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.voice-mode-btn:hover {
  opacity: 0.9;
}

.composer-disclaimer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.chat-column.is-empty .composer-disclaimer {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
}

/* ==================== Right Split-Screen Canvas Panel ==================== */
.canvas-panel {
  width: 0;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 25;
}

.canvas-panel.open {
  width: 48%;
  min-width: 420px;
}

.canvas-header {
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.canvas-tabs {
  display: inline-flex;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}

.canvas-tab-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.canvas-tab-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.canvas-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.canvas-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.canvas-code-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: #0d0d0d;
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 16px;
  line-height: 1.6;
}

/* ==================== Bottom-Left Profile Popover Menu ==================== */
.profile-popover {
  position: absolute;
  bottom: 64px;
  left: 8px;
  width: 244px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-popover);
  padding: 6px;
  display: none;
  z-index: 120;
  animation: popFadeIn 0.12s ease-out;
}

.profile-popover.open {
  display: block;
}

.popover-user-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}

.popover-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: background-color 0.12s ease;
}

.popover-menu-item:hover {
  background-color: var(--bg-hover);
}

.popover-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

/* ==================== Modals (Auth, Official 3-Col Upgrade Plan/CDK, Node Switcher, Quota) ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  box-shadow: var(--shadow-modal);
  padding: 28px;
  animation: popFadeIn 0.16s ease-out;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.modal-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-medium);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.14s ease;
}

.form-input:focus {
  border-color: var(--text-primary);
}

.primary-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  border: none;
  background-color: var(--text-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.14s ease;
}

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

/* Official ChatGPT "Upgrade Your Plan" 3-Column Pricing Grid inside CDK Modal */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 780px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-col {
  background: var(--bg-modal-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pricing-col.featured {
  border-color: rgba(16, 163, 127, 0.55);
}

.pricing-plan-name {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pricing-price {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.pricing-price span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
}

.pricing-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  min-height: 38px;
}

.pricing-cta-btn {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.14s ease, transform 0.12s ease;
  margin: 2px 0 4px;
}

.pricing-cta-btn.muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: default;
}

[data-theme="light"] .pricing-cta-btn.muted {
  background: rgba(0, 0, 0, 0.06);
}

.pricing-cta-btn.plus {
  background: #10a37f;
  color: #ffffff;
}

.pricing-cta-btn.plus:hover {
  opacity: 0.92;
}

.pricing-cta-btn.pro {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.pricing-cta-btn.pro:hover {
  opacity: 0.92;
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.pricing-features li svg {
  width: 15px;
  height: 15px;
  color: var(--text-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==================== Node Pool & Routing Switcher Modal ==================== */
.carpool-filter-tabs {
  display: inline-flex;
  background: var(--bg-modal-card);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.carpool-tab-btn {
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.carpool-tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.carpool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
}

.carpool-card {
  background: var(--bg-modal-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.carpool-card:hover {
  border-color: var(--border-medium);
}

.carpool-card.selected {
  border-color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.carpool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.carpool-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.pow-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 500;
}

.pow-badge.full {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.pow-badge.degraded {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

.provider-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.provider-pill.chatgpt {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.provider-pill.gemini {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.carpool-load-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.carpool-load-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ==================== 1:1 Advanced Realtime Voice Mode (Blue Fluid Orb) ==================== */
.voice-overlay {
  position: fixed;
  inset: 0;
  background: #090b10;
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 36px 24px 48px;
  color: #ffffff;
}

.voice-overlay.open {
  display: flex;
  animation: fadeIn 0.22s ease;
}

.voice-orb-container {
  position: relative;
  width: 230px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-orb {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #e0f2fe 0%, #38bdf8 30%, #2563eb 68%, #1e3a8a 100%);
  box-shadow: 0 0 60px rgba(56, 189, 248, 0.5), inset 0 0 40px rgba(255, 255, 255, 0.42);
  animation: orbFluidMorph 5s ease-in-out infinite;
}

.voice-orb.speaking {
  animation: orbSpeakingPulse 1.1s ease-in-out infinite;
}

@keyframes orbFluidMorph {
  0%, 100% {
    border-radius: 50% 50% 48% 52% / 52% 48% 52% 48%;
    transform: scale(1);
  }
  50% {
    border-radius: 47% 53% 52% 48% / 48% 52% 47% 53%;
    transform: scale(1.06);
  }
}

@keyframes orbSpeakingPulse {
  0%, 100% {
    transform: scale(0.96);
    box-shadow: 0 0 45px rgba(56, 189, 248, 0.5);
  }
  50% {
    transform: scale(1.16);
    box-shadow: 0 0 95px rgba(56, 189, 248, 0.9);
  }
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 24px;
}

.voice-ctrl-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, background 0.14s ease;
}

.voice-ctrl-btn.hangup {
  background: #ef4444;
}

.voice-ctrl-btn:hover {
  transform: scale(1.05);
}
