/* ==================== 灰黑暗色系配色方案 ==================== */
:root {
  /* 主色调 - 灰黑暗色系 */
  --primary-bg: #1a1a1a;
  --secondary-bg: #242424;
  --tertiary-bg: #0f0f0f;
  --accent-color: #6b6b6b;
  --accent-hover: #8a8a8a;
  
  /* 文字颜色 */
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --text-muted: #707070;
  
  /* 边框和分隔线 */
  --border-color: #2a2a2a;
  --divider-color: #3a3a3a;
  
  /* 状态颜色 */
  --success-color: #4a4a4a;
  --warning-color: #5a5a5a;
  --error-color: #6a6a6a;
  --info-color: #5a5a5a;
  
  /* 阴影 */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.7);
  
  /* 字体 */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ==================== 全局样式 ==================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--primary-bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* ==================== 顶部导航栏 ==================== */
.topnav {
  background: var(--tertiary-bg);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  position: relative;
  z-index: 1000;
  border-bottom: 1px solid var(--divider-color);
}

.nav-left, .nav-center, .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-left {
  flex: 0 0 auto;
}

.nav-center {
  flex: 1;
  justify-content: center;
}

.nav-right {
  flex: 0 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.logo:hover {
  background-color: var(--secondary-bg);
  color: var(--text-primary);
}

.logo svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logo:hover svg {
  transform: rotateY(180deg);
}

/* 菜单切换按钮（移动端） */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.menu-toggle span {
  width: 24px;
  height: 3px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* 导航菜单 */
.nav-menu {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* 下拉菜单容器 */
.menu-dropdown {
  position: relative;
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: var(--font-main);
}

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

.menu-btn svg {
  flex-shrink: 0;
}

.dropdown-arrow {
  margin-left: 2px;
  transition: transform 0.3s ease;
}

.menu-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

/* 下拉菜单内容 */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--secondary-bg);
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  padding: 8px 0;
  z-index: 1000;
  margin-top: 4px;
  border: 1px solid var(--divider-color);
  animation: slideDown 0.2s ease;
}

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

.menu-dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a,
.dropdown-content .dropdown-item-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 16px;
  font-size: 13px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.dropdown-content a:hover,
.dropdown-content .dropdown-item-label:hover {
  background-color: var(--tertiary-bg);
  color: var(--text-primary);
  padding-left: 20px;
}

.dropdown-content a svg,
.dropdown-content .dropdown-item-label svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.dropdown-divider {
  height: 1px;
  background-color: var(--divider-color);
  margin: 8px 0;
}

.shortcut {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background-color: var(--tertiary-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.format-desc {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* 用户信息区域 */
#userInfo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-credits {
  background: var(--secondary-bg);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--divider-color);
}

.btn-auth, .btn-user-center, .btn-signout {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-auth {
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
}

.btn-auth:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-user-center {
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
}

.btn-user-center:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-signout {
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

.btn-signout:hover {
  background-color: var(--accent-color);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

/* ==================== AI 输入面板（顶部，已隐藏） ==================== */
.ai-input-panel {
  display: none;
}

/* ==================== AI 模块（左侧栏） ==================== */
.ai-module-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--tertiary-bg);
  padding: 16px;
  overflow: hidden;
}

.ai-module-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.ai-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.ai-section-title {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-section-title svg {
  color: var(--accent-color);
}

.ai-prompt-textarea {
  width: 100%;
  height: 120px;
  background-color: var(--primary-bg);
  border: 2px solid var(--divider-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 12px;
  font-family: var(--font-main);
  resize: none;
  transition: all 0.3s ease;
  line-height: 1.6;
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.ai-prompt-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.3);
}

.ai-prompt-textarea::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.ai-generate-btn-module {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.ai-generate-btn-module:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.ai-generate-btn-module:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-generate-btn-module.generating svg {
  animation: spin 2s linear infinite;
}

.ai-tips {
  background-color: var(--primary-bg);
  border-left: 3px solid var(--accent-color);
  padding: 12px;
  border-radius: 4px;
  margin-top: 8px;
  display: none;
}

.ai-tips-title {
  color: var(--accent-color);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-tips-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ai-tips-list li {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.6;
  padding: 4px 0;
  padding-left: 16px;
  position: relative;
}

.ai-tips-list li:before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-color);
}

.ai-examples {
  margin-top: 12px;
  display: none;
}

.ai-examples-title {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ai-example-btn {
  display: block;
  width: 100%;
  background-color: var(--primary-bg);
  border: 1px solid var(--divider-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  line-height: 1.4;
}

.ai-example-btn:hover {
  background-color: var(--secondary-bg);
  border-color: var(--accent-color);
  color: var(--text-primary);
  transform: translateX(4px);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==================== 控制台输出（集成在AI模块中） ==================== */
.console-output {
  background-color: var(--primary-bg);
  border-radius: 8px;
  border: 1px solid var(--divider-color);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.console-header {
  display: none;
}

.console-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  background-color: var(--tertiary-bg);
  box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.3);
  min-height: 0;
}

.console-content::-webkit-scrollbar {
  width: 8px;
}

.console-content::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb {
  background: var(--divider-color);
  border-radius: 4px;
}

.console-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.console-content > div {
  margin-bottom: 4px;
  padding: 4px 0;
}

/* ==================== 模态框 ==================== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--secondary-bg);
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 450px;
  position: relative;
  animation: slideUp 0.3s ease;
  border: 1px solid var(--divider-color);
}

.modal-large {
  max-width: 800px;
}

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

.close {
  position: absolute;
  right: 16px;
  top: 16px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  color: var(--text-primary);
  background-color: var(--accent-color);
  transform: rotate(90deg);
}

.modal-content h2 {
  margin: 0 0 24px 0;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 600;
}

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

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

.form-group input {
  width: 100%;
  padding: 12px;
  background-color: var(--tertiary-bg);
  border: 2px solid var(--divider-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ==================== 认证Tab（登录/注册） ==================== */
.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--divider-color);
  padding-bottom: 0;
}

.auth-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -2px;
  flex: 1;
  justify-content: center;
}

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

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

.auth-tab-btn svg {
  flex-shrink: 0;
}

.auth-form-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.auth-form-content.active {
  display: block;
}

.auth-form-content h2 {
  margin: 0 0 24px 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

/* ==================== 用户中心 ==================== */
/* Tab导航 */
.user-center-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--divider-color);
  padding-bottom: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

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

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

.tab-btn svg {
  flex-shrink: 0;
}

/* Tab内容 */
.user-center-content {
  min-height: 400px;
  max-height: 500px;
  overflow-y: auto;
  padding: 0 4px;
}

.user-center-content::-webkit-scrollbar {
  width: 8px;
}

.user-center-content::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 4px;
}

.user-center-content::-webkit-scrollbar-thumb {
  background: var(--divider-color);
  border-radius: 4px;
}

.user-center-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* 响应式优化 */
@media (max-width: 768px) {
  .user-center-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tab-btn {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .user-avatar {
    width: 80px;
    height: 80px;
  }
  
  .user-avatar svg {
    width: 48px;
    height: 48px;
  }
  
  .credits-amount {
    font-size: 42px;
  }
  
  .user-center-footer {
    padding-top: 16px;
  }
  
  .btn-logout {
    min-width: 150px;
    padding: 10px 24px;
  }
}

/* 用户信息卡片 */
.user-info-card {
  background: var(--tertiary-bg);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--divider-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  background: var(--accent-color);
  border-radius: 50%;
  border: 2px solid var(--divider-color);
}

.user-avatar svg {
  color: var(--text-primary);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.user-detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background-color: var(--primary-bg);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.user-detail-item:hover {
  background-color: var(--secondary-bg);
  transform: translateX(4px);
}

.user-detail-item svg {
  color: var(--accent-color);
  flex-shrink: 0;
}

.detail-label {
  color: var(--text-muted);
  font-size: 13px;
  min-width: 80px;
}

.detail-value {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  word-break: break-all;
}

/* 用户中心底部 */
.user-center-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--divider-color);
  display: flex;
  justify-content: center;
}

.btn-logout {
  padding: 12px 32px;
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 200px;
}

.btn-logout:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* 积分信息卡片 */
.credits-info {
  background: var(--tertiary-bg);
  padding: 32px;
  border-radius: 12px;
  border: 1px solid var(--divider-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.credits-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.credits-header svg {
  color: var(--accent-color);
}

.credits-info h3 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
}

.credits-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  background: var(--primary-bg);
  border-radius: 16px;
  border: 2px solid var(--divider-color);
  width: 100%;
  max-width: 300px;
}

.credits-amount {
  font-size: 56px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.credits-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.btn-recharge {
  width: 100%;
  max-width: 300px;
  padding: 14px;
  background: var(--accent-color);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-recharge:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* 生成记录 */
.transaction-history {
  background: var(--tertiary-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--divider-color);
}

.history-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--divider-color);
}

.history-header svg {
  color: var(--accent-color);
}

.transaction-history h3 {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--divider-color);
  border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* 生成记录项 */
.generation-item {
  background-color: var(--primary-bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
}

.generation-item:hover {
  background-color: var(--secondary-bg);
  transform: translateX(4px);
  border-left-color: var(--accent-color);
}

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

.gen-date {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.gen-credits {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  background-color: var(--tertiary-bg);
  padding: 4px 10px;
  border-radius: 12px;
}

.gen-description {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider-color);
}

.gen-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gen-tokens {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.gen-tokens svg {
  color: var(--accent-color);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--divider-color);
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin: 0 0 8px 0;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 500;
}

.empty-state span {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 300px;
}

/* ==================== TweakPane 主题 ==================== */
:root {
  --tp-font-family: var(--font-main);
  --tp-base-background-color: var(--tertiary-bg);
  --tp-button-background-color: var(--secondary-bg);
  --tp-button-background-color-active: var(--accent-color);
  --tp-button-background-color-focus: var(--accent-hover);
  --tp-button-background-color-hover: var(--accent-color);
  --tp-button-foreground-color: var(--text-primary);
  --tp-label-foreground-color: var(--text-secondary);
}

.gui-panel {
  position: absolute;
  right: 0;
  max-height: 100%;
  overflow-y: auto;
  z-index: 100;
}

.gui-panel::-webkit-scrollbar {
  width: 10px;
  background: var(--tp-base-background-color);
}

.gui-panel::-webkit-scrollbar-thumb {
  background: var(--divider-color);
  border-radius: 5px;
}

.gui-panel::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.tp-rotv {
  text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
}

.tp-rotv button {
  text-shadow: inherit;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .user-center-content {
    grid-template-columns: 1fr;
  }
  
  .menu-dropdown {
    width: 100%;
  }
  
  .menu-btn {
    width: 100%;
    justify-content: space-between;
  }
  
  .dropdown-content {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--accent-color);
    border-radius: 0;
    background: var(--tertiary-bg);
  }
}

@media (max-width: 768px) {
  .topnav {
    height: 56px;
    flex-wrap: nowrap;
    padding: 8px 12px;
    justify-content: space-between;
  }
  
  .nav-left {
    order: 1;
    flex: 0 0 auto;
  }
  
  .nav-center {
    order: 2;
    flex: 0 0 auto;
    margin-top: 0;
    display: flex !important;
  }
  
  .nav-right {
    order: 3;
    flex: 0 0 auto;
    margin-left: auto;
  }
  
  .menu-toggle {
    display: flex; /* 移动端显示菜单按钮 */
  }
  
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    width: 100%;
    background-color: var(--secondary-bg);
    border-radius: 0 0 8px 8px;
    padding: 12px;
    gap: 4px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .menu-dropdown {
    width: 100%;
  }
  
  .menu-btn {
    width: 100%;
    justify-content: space-between;
    padding: 12px;
  }
  
  .dropdown-content {
    position: static;
    display: none;
    width: 100%;
    margin-top: 4px;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--accent-color);
    border-radius: 0;
    background: var(--tertiary-bg);
    padding: 4px 0;
  }
  
  .menu-dropdown.active .dropdown-content {
    display: block;
  }
  
  .dropdown-content a,
  .dropdown-content .dropdown-item-label {
    padding: 12px 16px;
  }
  
  .ai-input-panel {
    padding: 12px;
  }
  
  .ai-input-container {
    flex-wrap: wrap;
  }
  
  #aiPromptInput {
    min-width: 100%;
  }
  
  .ai-generate-btn {
    width: 100%;
    justify-content: center;
  }
  
  #userInfo {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .user-email {
    display: none;
  }
  
  .user-credits {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .btn-auth, .btn-user-center {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .btn-auth svg, .btn-user-center svg {
    width: 14px;
    height: 14px;
  }
  
  .btn-auth .btn-text, .btn-user-center .btn-text {
    display: none; /* 移动端隐藏按钮文字 */
  }
  
  .modal-content {
    width: 95%;
    padding: 24px;
  }
  
  .logo {
    font-size: 14px;
  }
  
  .logo span {
    display: none;
  }
  
  /* 移动端布局优化 - 显示tab标签栏，但样式优化 */
  .lm_header {
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    background: var(--secondary-bg) !important;
    display: flex !important;
    border-bottom: 2px solid var(--accent-color) !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
  }
  
  .lm_tabs {
    display: flex !important;
    flex: 1 !important;
    visibility: visible !important;
    width: 100% !important;
    height: 44px !important;
  }
  
  .lm_tab {
    height: 44px !important;
    min-height: 44px !important;
    line-height: 44px !important;
    padding: 0 20px !important;
    font-size: 15px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    background: var(--tertiary-bg) !important;
    color: var(--text-secondary) !important;
    border-radius: 8px 8px 0 0 !important;
    margin-right: 4px !important;
    transition: all 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    min-width: 80px !important;
    flex-shrink: 0 !important;
  }
  
  .lm_tab:hover {
    background: var(--secondary-bg) !important;
    color: var(--text-primary) !important;
  }
  
  .lm_tab.lm_active {
    background: var(--accent-color) !important;
    color: white !important;
  }
  
  .lm_title {
    font-size: 15px !important;
    pointer-events: none !important;
    display: inline-block !important;
    visibility: visible !important;
  }
  
  /* 隐藏关闭按钮等控件 */
  .lm_close_tab {
    display: none !important;
  }
  
  .lm_controls {
    display: none !important;
  }
  
  /* 移动端AI模块优化 - 将输入框和按钮放在底部 */
  .ai-module-container {
    padding: 8px;
  }
  
  .ai-module-content {
    gap: 8px;
  }
  
  /* 控制台输出在移动端隐藏 */
  .console-output {
    display: none !important;
  }
  
  /* AI输入区域固定在底部 */
  .ai-input-wrapper {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: var(--tertiary-bg) !important;
    padding: 10px 12px !important;
    z-index: 999 !important;
    border-top: 2px solid var(--divider-color) !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    /* 防止输入法弹出时被遮挡 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  
  .ai-section-title {
    display: none; /* 移动端隐藏标题 */
  }
  
  .ai-prompt-textarea {
    height: 60px;
    font-size: 14px;
    padding: 10px;
    margin: 0 !important;
    /* 防止输入法弹出时页面滚动 */
    position: relative;
    /* 修复iOS输入法问题 */
    -webkit-user-select: text;
    user-select: text;
    -webkit-appearance: none;
    resize: none;
    /* 确保可以输入 */
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  
  /* 当输入框获得焦点时，确保可见 */
  .ai-prompt-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    /* iOS修复 */
    -webkit-user-select: text;
    user-select: text;
  }
  
  .ai-generate-btn-module {
    padding: 12px 16px;
    font-size: 14px;
    margin: 0 !important;
    /* 确保按钮可点击 */
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  
  /* 移动端Golden Layout调整 */
  .lm_goldenlayout {
    padding-bottom: 0 !important;
    height: calc(100vh - 56px - 140px) !important; /* 减去顶部导航栏和底部AI输入框的高度 */
    position: relative !important;
    width: 100% !important;
  }
  
  /* 确保root容器正确 */
  .lm_root {
    width: 100% !important;
    height: 100% !important;
  }
  
  /* 移动端隐藏AI模块的tab - 只隐藏第3个tab */
  .lm_stack .lm_tabs .lm_tab:nth-child(3) {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
  }
  
  /* 确保前两个tab显示 */
  .lm_stack .lm_tabs .lm_tab:nth-child(1),
  .lm_stack .lm_tabs .lm_tab:nth-child(2) {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* 确保stack占满空间 */
  .lm_stack {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* 确保items容器正确显示 */
  .lm_items {
    flex: 1 !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* 确保每个item占满空间 */
  .lm_item {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: none !important;
  }
  
  /* 只显示激活的item */
  .lm_item.lm_active {
    display: block !important;
  }
  
  /* 确保stack内的items容器正确显示 */
  .lm_items {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    flex: 1 !important;
  }
  
  /* 确保每个item正确显示 */
  .lm_item {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
  }
  
  /* 激活的tab内容显示，非激活的隐藏 */
  .lm_items > .lm_item {
    display: none !important;
  }
  
  .lm_items > .lm_item.lm_active {
    display: block !important;
  }
  
  /* 确保内容容器正确显示 */
  .lm_content {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
  }
  
  /* 确保3D视图canvas占满屏幕 */
  .lm_item_container {
    width: 100% !important;
  }
  
  /* 移动端隐藏GUI面板 */
  .gui-panel {
    display: none !important;
  }
  
  /* 确保canvas能正确显示 */
  canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    touch-action: none !important; /* 允许触摸交互 */
  }
  
  /* 移动端Monaco编辑器优化 */
  .monaco-editor .overflow-guard {
    width: 100% !important;
    height: 100% !important;
  }
}

/* 移动端专用样式 - 更精确的选择器 */
@media (max-width: 768px) {
  /* 移动端时，防止输入法弹出导致页面滚动 */
  body {
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 100vh;
    /* 允许触摸滚动 */
    -webkit-overflow-scrolling: touch;
  }
  
  #appbody {
    height: calc(100vh - 56px) !important;
    overflow: hidden;
    position: relative;
  }
  
  /* 移动端AI输入框样式优化 */
  .ai-input-wrapper {
    gap: 10px;
  }
  
  .ai-prompt-textarea::placeholder {
    font-size: 11px;
  }
  
  /* 确保Golden Layout内容区域正确显示 */
  .lm_content {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
  }
  
  /* 确保canvas和编辑器容器正确显示 */
  .lm_item_container {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
  }
  
  /* Monaco编辑器容器 */
  .monaco-editor {
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
  }
  
  /* 确保Three.js canvas正确显示 */
  canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    position: relative !important;
  }
}

/* 针对更小屏幕的优化 */
@media (max-width: 480px) {
  #appbody {
    height: calc(100vh - 48px) !important;
  }
  
  .topnav {
    height: 48px;
  }
  
  .lm_goldenlayout {
    height: calc(100vh - 48px - 140px) !important; /* 减去顶部导航栏和底部AI输入框的高度 */
  }
  
  .lm_header {
    height: 28px !important;
  }
  
  .lm_tab {
    height: 28px !important;
    line-height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
  }
  
  .ai-input-wrapper {
    padding: 10px 8px !important;
  }
  
  .ai-prompt-textarea {
    height: 60px !important;
    font-size: 12px !important;
    padding: 8px !important;
  }
  
  .ai-generate-btn-module {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  
  .ai-generate-btn-module svg {
    width: 16px;
    height: 16px;
  }
  
  /* 更小屏幕时进一步优化按钮文字 */
  .ai-generate-btn-module {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .topnav {
    padding: 6px 8px;
  }
  
  .logo {
    font-size: 0;
    padding: 6px;
  }
  
  .logo svg {
    width: 20px;
    height: 20px;
  }
  
  .user-credits {
    font-size: 10px;
    padding: 3px 6px;
  }
  
  .btn-auth, .btn-user-center, .btn-signout {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .btn-auth .btn-text, .btn-user-center .btn-text {
    display: none;
  }
  
  .ai-input-panel {
    padding: 8px;
  }
  
  .ai-prompt-textarea {
    height: 70px;
    font-size: 12px;
  }
  
  .ai-generate-btn-module {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .modal-content {
    padding: 20px;
  }
  
  .modal-content h2 {
    font-size: 18px;
  }
  
  .auth-tab-btn {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .form-group input {
    padding: 10px;
    font-size: 13px;
  }
  
  .credits-amount {
    font-size: 32px;
  }
  
  .console-content {
    font-size: 11px;
  }
  
  /* 移动端AI输入区域进一步优化 */
  .ai-input-wrapper {
    padding: 10px;
  }
  
  .ai-prompt-textarea {
    margin-bottom: 8px;
  }
}

/* ==================== Golden Layout 自定义样式 ==================== */
.lm_goldenlayout {
  background: var(--primary-bg);
}

.lm_header {
  background: var(--secondary-bg) !important;
  border-bottom: 2px solid var(--accent-color) !important;
}

.lm_tab {
  background: var(--tertiary-bg) !important;
  color: var(--text-secondary) !important;
  border-radius: 8px 8px 0 0 !important;
  margin-right: 4px !important;
  transition: all 0.3s ease !important;
}

.lm_tab:hover {
  background: var(--secondary-bg) !important;
  color: var(--text-primary) !important;
}

.lm_tab.lm_active {
  background: var(--accent-color) !important;
  color: white !important;
}

.lm_content {
  background: var(--primary-bg) !important;
}

.lm_splitter {
  background: var(--divider-color) !important;
  opacity: 1 !important;
}

.lm_splitter:hover {
  background: var(--accent-color) !important;
}

/* ==================== 控制台样式 ==================== */
.lm_item_container {
  background: var(--tertiary-bg) !important;
}

/* ==================== 动画效果 ==================== */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.slide-in-left {
  animation: slideInFromLeft 0.5s ease;
}

.slide-in-right {
  animation: slideInFromRight 0.5s ease;
}
