/* 智墨 Zhimo - 水墨风格全局样式 */
:root {
  --paper: #f5f0e8;
  --paper-dark: #ece6d8;
  --ink: #1a1a1a;
  --ink-light: #2d2d2d;
  --ink-muted: #6b6b6b;
  --cinnabar: #c43228;
  --cinnabar-dim: #a02820;
  --user-bubble: #d8d0c0;
  --ai-bubble: #f5f0e8;
  --sidebar-bg: #ede6d6;
  --border-ink: #b0a890;
  --stone-blue: #2a6f7b;
  --amber: #d4a017;
}

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

body {
  font-family: 'Noto Serif SC', 'WenQuanYi Micro Hei', serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(180,160,130,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(160,140,110,0.06) 0%, transparent 50%);
}

/* 导航栏 */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(245,240,232,0.97);
  border-bottom: 1px solid var(--border-ink);
  position: sticky; top: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-seal {
  width: 32px; height: 32px; background: var(--cinnabar); border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: bold;
  box-shadow: 2px 2px 0 rgba(196,50,40,0.3);
}
.logo-text { font-size: 20px; letter-spacing: 3px; font-weight: bold; }
.nav-links { display: flex; gap: 14px; align-items: center; }
.nav-links a, .nav-links button {
  text-decoration: none; color: var(--ink-muted);
  font-size: 14px; cursor: pointer; background: none; border: none;
  font-family: inherit;
}
.nav-links a:hover, .nav-links button:hover { color: var(--cinnabar); }

/* 按钮 */
.btn-primary {
  background: var(--cinnabar); color: #fff;
  border: none; padding: 9px 24px; border-radius: 3px;
  font-size: 15px; cursor: pointer; font-family: inherit;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--cinnabar-dim); }
.btn-secondary {
  background: transparent; color: var(--ink);
  border: 1px solid var(--border-ink); padding: 7px 18px; border-radius: 3px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { border-color: var(--cinnabar); color: var(--cinnabar); }

/* Hero 区 */
.hero {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 65vh; text-align: center;
  padding: 40px 20px; position: relative; overflow: hidden;
}
.hero h1 {
  font-size: 80px; letter-spacing: 18px; color: var(--ink);
  margin-bottom: 12px; position: relative;
}
.hero h1::after {
  content: ''; position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 140px; height: 3px; background: var(--cinnabar); border-radius: 2px;
}
.hero p {
  font-size: 18px; color: var(--ink-muted);
  letter-spacing: 5px; margin-top: 22px; margin-bottom: 36px;
}

/* 特性卡片 */
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; padding: 36px 28px; max-width: 960px; margin: 0 auto;
}
.feature-card {
  background: var(--paper-dark); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 24px; text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(26,26,26,0.1); }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; color: var(--ink); }
.feature-card p { font-size: 13px; color: var(--ink-muted); line-height: 1.6; }
.feature-icon { font-size: 32px; margin-bottom: 10px; }

/* Footer */
.footer {
  text-align: center; padding: 28px;
  color: var(--ink-muted); font-size: 12px;
  border-top: 1px solid var(--border-ink); margin-top: 36px;
}

/* 登录/注册 */
.auth-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 80vh; padding: 20px;
}
.auth-box {
  background: var(--paper-dark); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 36px; width: 100%; max-width: 380px;
  box-shadow: 0 4px 16px rgba(26,26,26,0.08);
}
.auth-box h2 {
  text-align: center; font-size: 26px; margin-bottom: 6px; letter-spacing: 4px;
}
.auth-box .subtitle {
  text-align: center; color: var(--ink-muted); font-size: 12px; margin-bottom: 24px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 13px; color: var(--ink-muted); margin-bottom: 5px;
}
.form-group input {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--border-ink); border-radius: 3px;
  background: var(--paper); color: var(--ink);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--cinnabar); }
.form-group input::placeholder { color: #bbb; }
.password-hint { font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.password-hint.strong { color: #4a8; }
.password-hint.warning { color: var(--amber); }
.password-hint.weak { color: var(--cinnabar); }
.auth-footer {
  text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-muted);
}
.auth-footer a { color: var(--cinnabar); text-decoration: none; }
.error-msg {
  background: rgba(196,50,40,0.1); color: var(--cinnabar);
  padding: 9px 12px; border-radius: 3px; font-size: 13px;
  margin-bottom: 14px; border: 1px solid rgba(196,50,40,0.2);
}

/* 聊天布局 */
.chat-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 240px; min-width: 180px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-ink);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-header {
  padding: 14px; border-bottom: 1px solid var(--border-ink);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-header h3 { font-size: 15px; letter-spacing: 2px; }
.new-chat-btn {
  background: var(--cinnabar); color: #fff; border: none;
  padding: 5px 12px; border-radius: 3px; font-size: 12px;
  cursor: pointer; font-family: inherit;
}
.convo-list { flex: 1; overflow-y: auto; padding: 6px; }
.convo-item {
  padding: 10px 12px; border-radius: 5px; cursor: pointer;
  margin-bottom: 3px; font-size: 13px; color: var(--ink-light);
  transition: background 0.15s; display: flex;
  align-items: center; justify-content: space-between;
}
.convo-item:hover { background: rgba(196,50,40,0.08); }
.convo-item.active { background: rgba(196,50,40,0.15); color: var(--cinnabar); }
.convo-item .delete-btn {
  opacity: 0; background: none; border: none; color: var(--cinnabar);
  cursor: pointer; font-size: 15px; padding: 0 3px;
}
.convo-item:hover .delete-btn { opacity: 1; }
.sidebar-footer {
  padding: 10px 12px; border-top: 1px solid var(--border-ink);
}
.sidebar-footer button {
  width: 100%; text-align: left; background: none; border: none;
  color: var(--ink-muted); font-size: 13px; cursor: pointer;
  font-family: inherit; padding: 6px 0;
}
.sidebar-footer button:hover { color: var(--cinnabar); }

.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-bottom: 1px solid var(--border-ink);
  background: rgba(245,240,232,0.95);
}
.chat-topbar .conv-title { font-size: 15px; letter-spacing: 2px; }
.model-selector {
  padding: 5px 10px; border: 1px solid var(--border-ink);
  border-radius: 3px; background: var(--paper); color: var(--ink);
  font-size: 12px; font-family: inherit; cursor: pointer; outline: none;
}
.model-selector:focus { border-color: var(--cinnabar); }

.messages-area {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.message {
  max-width: 76%; padding: 12px 16px; border-radius: 6px;
  font-size: 14px; line-height: 1.65; word-break: break-word;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.user {
  align-self: flex-end; background: var(--user-bubble);
  border: 1px solid var(--border-ink); color: var(--ink);
}
.message.ai {
  align-self: flex-start; background: var(--ai-bubble);
  border: 1px solid var(--border-ink); color: var(--ink-light);
  box-shadow: 0 2px 6px rgba(26,26,26,0.05);
}
.message pre {
  background: var(--ink); color: #eee; padding: 10px; border-radius: 4px;
  overflow-x: auto; margin: 6px 0; font-size: 12px;
}
.message code {
  background: rgba(0,0,0,0.06); padding: 1px 4px; border-radius: 2px; font-size: 12px;
}
.message .copy-btn {
  float: right; background: none; border: none; cursor: pointer;
  color: var(--ink-muted); font-size: 12px; opacity: 0; transition: opacity 0.2s;
}
.message:hover .copy-btn { opacity: 1; }
.message:hover .copy-btn:hover { color: var(--cinnabar); }

.input-area {
  padding: 14px 20px; border-top: 1px solid var(--border-ink);
  background: rgba(245,240,232,0.95);
}
.input-row { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; padding: 12px 14px;
  border: none; border-bottom: 2px solid var(--border-ink);
  background: transparent; color: var(--ink);
  font-size: 14px; font-family: inherit; resize: none; outline: none;
  min-height: 46px; max-height: 130px; transition: border-color 0.2s;
}
.chat-input:focus { border-bottom-color: var(--cinnabar); }
.chat-input::placeholder { color: #bbb; }
.send-btn {
  background: var(--cinnabar); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.send-btn:hover { background: var(--cinnabar-dim); }
.send-btn:disabled { background: var(--border-ink); cursor: not-allowed; }
.stop-btn {
  background: var(--ink); color: #fff; border: none;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 14px; cursor: pointer;
}

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,26,26,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--paper); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 28px; width: 90%; max-width: 480px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 6px 24px rgba(26,26,26,0.12);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}
.modal h2 { font-size: 20px; letter-spacing: 2px; margin-bottom: 18px; }
.modal-close {
  float: right; background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--ink-muted);
}
.modal-close:hover { color: var(--cinnabar); }
.key-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; background: var(--paper-dark); border-radius: 4px;
  margin-bottom: 10px;
}
.key-item .provider-label { font-size: 13px; font-weight: bold; min-width: 70px; }
.key-item .masked-key { flex: 1; font-size: 12px; color: var(--ink-muted); }
.key-item button {
  background: none; border: none; cursor: pointer;
  color: var(--cinnabar); font-size: 12px;
}
.key-form {
  display: flex; gap: 8px; margin-top: 14px;
}
.key-form select, .key-form input {
  flex: 1; padding: 9px 10px; border: 1px solid var(--border-ink);
  border-radius: 3px; background: var(--paper); color: var(--ink);
  font-size: 13px; font-family: inherit; outline: none;
}
.key-form select:focus, .key-form input:focus { border-color: var(--cinnabar); }

/* 通知 */
.notif-panel {
  position: fixed; top: 56px; right: 20px; width: 340px;
  max-height: 480px; background: var(--paper);
  border: 1px solid var(--border-ink); border-radius: 6px;
  box-shadow: 0 4px 20px rgba(26,26,26,0.12); z-index: 150;
  overflow: hidden; display: none; animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.notif-panel.show { display: block; }
.notif-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border-ink);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-header h3 { font-size: 15px; letter-spacing: 1px; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  padding: 10px 16px; border-bottom: 1px solid rgba(176,168,144,0.3);
  cursor: pointer; transition: background 0.15s;
}
.notif-item:hover { background: rgba(196,50,40,0.05); }
.notif-item.unread { background: rgba(196,50,40,0.08); }
.notif-item .notif-title { font-size: 13px; font-weight: bold; color: var(--ink); }
.notif-item .notif-content { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.notif-item .notif-time { font-size: 11px; color: #aaa; margin-top: 4px; }
.notif-empty { padding: 24px; text-align: center; color: var(--ink-muted); font-size: 13px; }

/* 用户下拉菜单 */
.user-dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: 100%; right: 0;
  min-width: 160px; background: var(--paper);
  border: 1px solid var(--border-ink); border-radius: 4px;
  box-shadow: 0 4px 16px rgba(26,26,26,0.1); z-index: 160;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-menu button {
  width: 100%; text-align: left; padding: 9px 14px;
  background: none; border: none; font-size: 13px;
  color: var(--ink-light); cursor: pointer; font-family: inherit;
}
.dropdown-menu button:hover { background: rgba(196,50,40,0.08); color: var(--cinnabar); }

/* 模型卡片 */
.models-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; padding: 24px; max-width: 1100px; margin: 0 auto;
}
.model-card {
  background: var(--paper-dark); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
}
.model-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(26,26,26,0.08); }
.model-card .mc-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.model-card .mc-logo {
  width: 36px; height: 36px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: bold; color: #fff;
}
.model-card .mc-logo.openai { background: #10a37f; }
.model-card .mc-logo.anthropic { background: #a855f7; }
.model-card .mc-logo.google { background: #4285f4; }
.model-card .mc-logo.mistral { background: var(--stone-blue); }
.model-card .mc-name { font-size: 15px; font-weight: bold; color: var(--ink); }
.model-card .mc-provider { font-size: 11px; color: var(--ink-muted); }
.model-card .mc-desc { font-size: 12px; color: var(--ink-muted); line-height: 1.5; margin-bottom: 10px; }
.model-card .mc-tags {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.model-card .tag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: rgba(176,168,144,0.3); color: var(--ink-muted);
}
.model-card .mc-status { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.model-card .status-dot { width: 8px; height: 8px; border-radius: 50%; }
.model-card .status-dot.available { background: #4a8; }
.model-card .status-dot.unconfigured { background: var(--amber); }

/* 用量 */
.usage-container { max-width: 900px; margin: 0 auto; padding: 24px; }
.usage-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--paper-dark); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 18px; text-align: center;
}
.stat-card .stat-value { font-size: 26px; font-weight: bold; color: var(--ink); }
.stat-card .stat-label { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }
.chart-container {
  background: var(--paper-dark); border: 1px solid var(--border-ink);
  border-radius: 6px; padding: 20px; margin-bottom: 20px;
}
.chart-container h3 { font-size: 15px; margin-bottom: 14px; letter-spacing: 1px; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 160px; padding-top: 10px;
}
.bar-wrapper {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.bar {
  background: var(--cinnabar); border-radius: 2px 2px 0 0;
  width: 100%; min-height: 2px; transition: height 0.3s;
}
.bar-label { font-size: 10px; color: var(--ink-muted); }
.bar-value { font-size: 10px; color: var(--ink); }
.model-rank { display: flex; flex-direction: column; gap: 8px; }
.rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--paper); border-radius: 4px;
}
.rank-num { font-size: 16px; font-weight: bold; color: var(--cinnabar); min-width: 24px; }
.rank-info { flex: 1; }
.rank-info .rank-name { font-size: 13px; font-weight: bold; }
.rank-info .rank-detail { font-size: 11px; color: var(--ink-muted); }
.rank-stat { font-size: 13px; color: var(--ink); }

/* 响应式 */
@media (max-width: 768px) {
  .sidebar { width: 52px; min-width: 52px; }
  .sidebar-header h3, .convo-item span, .sidebar-footer button span { display: none; }
  .convo-item { justify-content: center; padding: 10px 0; }
  .new-chat-btn { padding: 5px 8px; font-size: 16px; }
  .hero h1 { font-size: 44px; letter-spacing: 8px; }
  .features { padding: 16px; }
  .usage-stats { grid-template-columns: repeat(2, 1fr); }
  .notif-panel { right: 10px; width: calc(100vw - 20px); }
}

/* ========================================
   移动端适配样式
   ======================================== */

/* 手机尺寸 (max-width: 480px) */
@media (max-width: 480px) {
  /* 导航栏适配 */
  .navbar {
    padding: 12px 16px;
  }
  .logo-text {
    font-size: 18px;
  }
  .nav-links {
    gap: 10px;
  }
  .nav-links a {
    font-size: 13px;
  }
  .btn-primary {
    padding: 6px 14px;
    font-size: 13px;
  }
  
  /* Hero 区域适配 */
  .hero {
    min-height: 50vh;
    padding: 30px 16px;
  }
  .hero h1 {
    font-size: 48px;
    letter-spacing: 8px;
  }
  .hero p {
    font-size: 14px;
    letter-spacing: 2px;
  }
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  .btn-large {
    width: 100%;
    max-width: 280px;
  }
  
  /* 统计数字适配 */
  .hero-stats {
    gap: 20px;
  }
  .hero-stat .number {
    font-size: 28px;
  }
  .hero-stat .label {
    font-size: 11px;
  }
  
  /* 特性卡片适配 */
  .features {
    padding: 40px 16px;
  }
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .feature-card {
    padding: 20px;
  }
  .feature-icon {
    width: 40px;
    height: 40px;
  }
  .feature-card h3 {
    font-size: 15px;
  }
  .feature-card p {
    font-size: 12px;
  }
  
  /* 登录/注册表单适配 */
  .auth-box {
    padding: 24px 20px;
  }
  .auth-box h2 {
    font-size: 22px;
  }
  .form-group input {
    padding: 10px 12px;
    font-size: 14px;
  }
  .btn-primary {
    padding: 10px 20px;
  }
  
  /* 聊天页面适配 */
  .sidebar {
    width: 52px;
    min-width: 52px;
  }
  .sidebar-header h3,
  .convo-item span,
  .sidebar-footer button span {
    display: none;
  }
  .convo-item {
    justify-content: center;
    padding: 10px 0;
  }
  .new-chat-btn {
    padding: 5px 8px;
    font-size: 18px;
  }
  .chat-topbar {
    padding: 8px 12px;
  }
  .conv-title {
    font-size: 14px;
  }
  .model-selector {
    font-size: 11px;
    padding: 4px 8px;
  }
  .messages-area {
    padding: 16px;
  }
  .message {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 14px;
  }
  .input-area {
    padding: 10px 12px;
  }
  .chat-input {
    padding: 10px 12px;
    font-size: 14px;
  }
  .send-btn, .stop-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  /* 表格适配 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  
  /* 弹窗适配 */
  .modal {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
  }
  .modal h2 {
    font-size: 18px;
  }
  .key-form {
    flex-direction: column;
  }
  .key-form select,
  .key-form input {
    width: 100%;
  }
  
  /* 通知面板适配 */
  .notif-panel {
    right: 10px;
    width: calc(100vw - 20px);
    max-height: 70vh;
  }
  
  /* 统计卡片适配 */
  .usage-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card .value {
    font-size: 22px;
  }
  .stat-card .label {
    font-size: 11px;
  }
  
  /* 图表适配 */
  .chart-container {
    padding: 14px;
  }
  .chart-container h3 {
    font-size: 14px;
  }
  .bar-chart {
    height: 120px;
  }
  .bar-label {
    font-size: 9px;
  }
  .bar-value {
    font-size: 9px;
  }
  
  /* 页脚适配 */
  .footer {
    padding: 20px 16px;
  }
  .footer a {
    display: block;
    margin: 6px 0;
  }
}

/* 平板尺寸 (max-width: 768px) */
@media (max-width: 768px) {
  /* 导航栏适配 */
  .navbar {
    padding: 14px 20px;
  }
  
  /* Hero 区域适配 */
  .hero h1 {
    font-size: 56px;
    letter-spacing: 10px;
  }
  .hero p {
    font-size: 16px;
  }
  .hero-stats {
    gap: 30px;
  }
  .hero-stat .number {
    font-size: 32px;
  }
  
  /* 特性卡片适配 */
  .features {
    padding: 50px 20px;
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 聊天页面适配 */
  .sidebar {
    width: 60px;
    min-width: 60px;
  }
  .sidebar-header h3,
  .convo-item span,
  .sidebar-footer button span {
    display: none;
  }
  
  /* 统计卡片适配 */
  .usage-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* 模型卡片适配 */
  .models-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 16px;
  }
}

/* 大屏幕优化 (min-width: 1200px) */
@media (min-width: 1200px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .usage-stats {
    grid-template-columns: repeat(4, 1fr);
  }
  .models-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 20px;
  }
  .hero h1 {
    font-size: 36px;
  }
  .hero-stats {
    display: none;
  }
}

/* 打印样式 */
@media print {
  .navbar, .sidebar, .input-area, .btn-primary, .btn-secondary {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
  .message {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ========================================
   移动端优化 (max-width: 768px)
   ======================================== */
@media (max-width: 768px) {
  /* 通用适配 */
  body {
    font-size: 14px;
  }
  
  /* 导航栏优化 */
  .navbar {
    padding: 12px 16px;
  }
  .logo-text {
    font-size: 18px;
  }
  .nav-links {
    gap: 10px;
  }
  .nav-links a, .nav-links button {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  /* Hero 区域 */
  .hero {
    min-height: 50vh;
    padding: 30px 20px;
  }
  .hero h1 {
    font-size: 48px;
    letter-spacing: 8px;
  }
  .hero p {
    font-size: 14px;
    letter-spacing: 3px;
  }
  .btn-large {
    padding: 12px 28px;
    font-size: 14px;
  }
  .hero-stats {
    gap: 20px;
  }
  .hero-stat .number {
    font-size: 28px;
  }
  
  /* 特性卡片 */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .feature-card {
    padding: 20px;
  }
  
  /* 统计卡片 */
  .usage-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card .value {
    font-size: 22px;
  }
  
  /* 聊天布局 */
  .chat-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: 60px;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border-ink);
    overflow-x: auto;
  }
  .sidebar-header {
    display: none;
  }
  .convo-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 8px;
  }
  .convo-item {
    white-space: nowrap;
    min-width: max-content;
    padding: 8px 14px;
  }
  .sidebar-footer {
    display: none;
  }
  
  /* 消息区域 */
  .messages-area {
    padding: 16px;
  }
  .message {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 14px;
  }
  
  /* 输入区域 */
  .input-area {
    padding: 12px 16px;
  }
  .chat-input {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* 认证页面 */
  .auth-box {
    padding: 24px 20px;
    margin: 10px;
  }
  .auth-box h2 {
    font-size: 22px;
  }
  .form-group input {
    padding: 10px 12px;
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  /* 管理面板侧边栏 */
  .admin-sidebar {
    width: 100%;
    height: 56px;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border-ink);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-sidebar .logo {
    display: none;
  }
  .admin-nav {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    flex: 1;
    padding: 8px;
    gap: 4px;
  }
  .admin-nav-item {
    padding: 8px 14px;
    white-space: nowrap;
    font-size: 13px;
  }
  
  /* 表格适配 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  th, td {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  /* 弹窗适配 */
  .modal {
    width: 95%;
    max-width: none;
    margin: 20px;
    max-height: calc(100vh - 40px);
  }
  
  /* 按钮优化（触摸友好） */
  button, .btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 通知面板 */
  .notif-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* 小屏手机适配 (max-width: 480px) */
@media (max-width: 480px) {
  .navbar {
    padding: 10px 12px;
  }
  .logo-seal {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .logo-text {
    font-size: 16px;
    letter-spacing: 2px;
  }
  .nav-links a, .nav-links button {
    font-size: 12px;
    padding: 5px 8px;
  }
  
  /* Hero */
  .hero {
    min-height: 40vh;
    padding: 20px 16px;
  }
  .hero h1 {
    font-size: 36px;
    letter-spacing: 6px;
  }
  .hero p {
    font-size: 13px;
  }
  .cta-buttons {
    flex-direction: column;
    width: 100%;
  }
  .cta-buttons a {
    width: 100%;
    text-align: center;
  }
  
  /* 统计卡片 */
  .usage-stats {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-card .value {
    font-size: 20px;
  }
  .stat-card .label {
    font-size: 11px;
  }
  
  /* 输入框 */
  .chat-input {
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  /* 消息气泡 */
  .message {
    max-width: 90%;
    padding: 8px 12px;
    font-size: 13px;
  }
}

/* 横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 20px;
  }
  .hero h1 {
    font-size: 32px;
  }
  .hero-stats {
    display: none;
  }
  .navbar {
    position: relative;
  }
}

/* ========================================
   管理面板移动端适配
   ======================================== */
@media (max-width: 768px) {
  /* 侧边栏折叠 */
  .sidebar {
    width: 60px !important;
    min-width: 60px !important;
  }
  .sidebar .logo h2,
  .sidebar .logo span,
  .sidebar .nav-item span {
    display: none;
  }
  .sidebar .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .sidebar .nav-item .icon {
    margin-right: 0;
  }
  .sidebar .nav-bottom {
    display: none;
  }
  
  /* 主内容区调整 */
  .main {
    padding: 20px 16px;
  }
  .page-title {
    font-size: 18px;
    margin-bottom: 16px;
  }
  
  /* 统计卡片 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 14px;
  }
  .stat-card .value {
    font-size: 22px;
  }
  .stat-card .label {
    font-size: 11px;
  }
  
  /* 图表区域 */
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* 表格优化 */
  table {
    font-size: 12px;
  }
  th, td {
    padding: 8px 10px;
  }
  
  /* 按钮优化 */
  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }
  
  /* 过滤器栏 */
  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }
  .filter-bar input,
  .filter-bar select {
    width: 100%;
  }
}

/* 小屏手机 */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-card .value {
    font-size: 20px;
  }
  
  /* 搜索栏 */
  .toolbar {
    flex-direction: column;
  }
  .search-box {
    width: 100%;
  }
  
  /* 分页 */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
}
