/* ============================================================
   Mobile — 大屏手机全面放大（≤760px）
   ============================================================ */
@media (max-width: 760px) {

  /* ── 全局 ── */
  html, body, #app { height: 100dvh; }
  body { overflow: hidden; font-size: 22px; }

  /* ── 顶栏 ── */
  .topbar { height: 72px; padding: 0 20px; gap: 20px; justify-content: space-between; }
  .brand-lockup { min-width: 0; gap: 14px; }
  .brand-mark { width: 48px; height: 48px; font-size: 24px; }
  .brand-name { font-size: 22px; font-weight: 700; }
  .brand-subtitle, .github-link, .topbar-stat, .topbar-context { display: none; }
  .system-pill { font-size: 15px; padding: 8px 16px; }
  .system-pill .dot { width: 12px; height: 12px; }
  .topbar-stat { display: none; }
  .more-btn { font-size: 13px; padding: 10px 16px; }
  .more-dropdown { min-width: 200px; }
  .more-item { font-size: 15px; padding: 16px 20px; }

  /* ── 主体区域 ── */
  .console-shell { height: calc(100dvh - 72px); display: grid; grid-template-columns: 1fr; grid-template-rows: 64px minmax(0, 1fr); }
  .console-rail { grid-column: 1; grid-row: 1; flex-direction: row; border-right: 0; border-bottom: 1px solid #343b36; }
  .rail-tab { flex: 1; min-width: 0; height: 64px; border-right: 1px solid #343b36; border-bottom: 0; gap: 4px; }
  .rail-tab b { font-size: 17px; font-weight: 700; }
  .rail-tab span { font-size: 13px; }
  .rail-tab.active::before { top: auto; bottom: 0; left: 24px; right: 24px; width: auto; height: 4px; }
  .rail-spacer, .rail-version { display: none; }
  .content { grid-column: 1; grid-row: 2; }

  /* ── 聊天 ── */
  .chat-layout { grid-template-columns: 1fr; min-height: 0; }
  .chat-sidebar { display: none; }
  .chat-messages { padding: 28px 20px 300px; gap: 28px; }
  .chat-empty { padding-bottom: 4vh; }
  .chat-empty h1 { font-size: 44px; line-height: 1.06; }
  .chat-empty .hero-index { font-size: 15px; margin-bottom: 18px; letter-spacing: .14em; }
  .chat-empty p { font-size: 20px; margin-top: 22px; line-height: 1.7; }
  .hero-capabilities { gap: 12px; margin-top: 24px; }
  .hero-capabilities span { font-size: 13px; padding: 10px 13px; letter-spacing: .06em; }
  .msg { max-width: 100%; }
  .msg.user { max-width: 84%; }
  .msg.user .bubble { padding: 18px 22px; font-size: 20px; border-radius: 8px; }
  .msg.assistant .bubble { padding: 26px 22px; font-size: 20px; line-height: 1.85; border-left-width: 5px; }
  .msg.assistant .bubble h1, .msg.assistant .bubble h2, .msg.assistant .bubble h3 { font-size: 24px; margin: 16px 0 10px; }
  .msg.assistant .bubble p { margin: 12px 0; }
  .msg.assistant .bubble ul, .msg.assistant .bubble ol { padding-left: 28px; }
  .msg.assistant .bubble code { font-size: 17px; padding: 3px 6px; }
  .msg.assistant .bubble pre { font-size: 16px; padding: 18px; margin: 16px 0; }
  .msg.assistant .bubble table { font-size: 16px; }
  .msg.assistant .bubble th, .msg.assistant .bubble td { padding: 12px 10px; }
  .msg.thinking .bubble { padding: 20px 24px; font-size: 19px; }
  .thinking-dots { gap: 5px; }
  .thinking-dots i { width: 6px; height: 6px; }
  .typing-cursor { width: 3px; height: 22px; }

  .sources-section { margin-top: 14px; }
  .sources-label { font-size: 14px; margin-bottom: 14px; letter-spacing: .08em; }
  .sources-grid { gap: 12px; }
  .src-card { flex: 1 1 100%; max-width: 100%; padding: 20px; font-size: 16px; }
  .src-name { font-size: 17px; }
  .src-meta { font-size: 13px; margin-top: 6px; }
  .src-excerpt { font-size: 15px; line-height: 1.55; margin-top: 10px; }
  .src-download { font-size: 15px; padding: 12px 0; margin-top: 10px; }
  .score-bar { margin-top: 10px; height: 3px; }

  /* ── 输入区：固定在底部 ── */
  .chat-input-area { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 18px 16px max(20px, env(safe-area-inset-bottom)); background: rgba(244,240,231,.98); backdrop-filter: blur(16px); border: 0; border-top: 1px solid #d6d0c3; box-shadow: 0 -12px 48px rgba(34,30,25,.14); }
  .composer-row { gap: 14px; align-items: flex-end; }
  .composer-row textarea { min-height: 56px; max-height: 160px; padding: 16px 18px; font-size: 20px; border-radius: 10px; border: 1.5px solid #c4beb1; background: #fffdf8; }
  .btn-send { min-width: 64px; height: 56px; padding: 0 18px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
  .btn-send span { display: none; }
  .btn-send b { font-size: 28px; }
  .composer-meta { font-size: 13px; margin-bottom: 8px; }
  .composer-meta span:last-child { display: none; }

  /* ── 管线 trace ── */
  .compact-trace { grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px 0 8px; margin-bottom: 8px; }
  .compact-trace li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
  .compact-trace li b { width: 24px; height: 24px; font-size: 10px; }
  .compact-trace li span { font-size: 12px; }
  .compact-trace li::after, .compact-trace .trace-status { display: none; }

  /* ── 文档页 ── */
  .page-layout { height: 100%; overflow-y: auto; padding: 28px 18px; }
  .page-header { display: grid; gap: 22px; align-items: start; padding-bottom: 26px; }
  .page-header h1 { font-size: 34px; line-height: 1.15; }
  .page-header .eyebrow { font-size: 13px; }
  .doc-actions { flex-wrap: wrap; gap: 14px; }
  .doc-actions .btn { padding: 16px 22px; font-size: 17px; border-radius: 8px; font-weight: 600; }
  .btn { padding: 16px 22px; font-size: 17px; border-radius: 8px; font-weight: 500; }
  .btn.primary { font-weight: 700; }
  .doc-stats { grid-template-columns: 1fr 1fr; }
  .doc-stat-card { padding: 24px 20px; }
  .doc-stat-card span { font-size: 13px; letter-spacing: .08em; }
  .doc-stat-card strong { font-size: 40px; margin-top: 12px; }
  .doc-table-wrap { margin: 0 -18px; padding: 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .doc-table { font-size: 16px; min-width: 600px; }
  .doc-table th { font-size: 13px; letter-spacing: .06em; }
  .doc-table th, .doc-table td { padding: 16px 12px; }
  .doc-name-cell { max-width: 160px; }
  .badge { padding: 5px 10px; font-size: 13px; border-radius: 4px; }

  /* ── 关于页 ── */
  .about-grid { grid-template-columns: 1fr; gap: 16px; padding-top: 24px; }
  .about-card { padding: 28px; border-radius: 8px; }
  .about-card-wide { grid-column: auto; }
  .about-card .eyebrow { font-size: 13px; margin-bottom: 14px; }
  .about-card dl { font-size: 17px; gap: 16px; grid-template-columns: 1fr 1.4fr; }
  .about-card dt { font-size: 15px; }
  .about-card dd { font-size: 17px; }
  .system-orbit { min-height: auto; padding: 40px 22px 56px; border-radius: 8px; }
  .orbit-map { width: 340px; height: 340px; margin: 0 auto; }
  .orbit-core { width: 110px; height: 110px; }
  .orbit-core strong { font-size: 42px; }
  .orbit-core span { font-size: 14px; }
  .orbit-stage { width: 90px; padding: 10px; }
  .orbit-stage b { font-size: 13px; width: 24px; height: 24px; }
  .orbit-stage span { font-size: 11px; }
  .orbit-copy h2 { font-size: 30px; margin-bottom: 14px; }
  .orbit-copy p { font-size: 18px; line-height: 1.7; }

  /* ── 弹窗 ── */
  .modal { width: calc(100vw - 16px); padding: 32px 24px; border-radius: 10px; }
  .modal h3 { font-size: 30px; }
  .modal .eyebrow { font-size: 13px; }
  .form-group label, .form-check label { font-size: 16px; margin-bottom: 10px; }
  .form-group input, .form-group select { padding: 16px 14px; font-size: 18px; border-radius: 8px; }
  .form-hint { font-size: 14px; }
  .form-check { gap: 12px; }
  .form-check input[type=checkbox] { width: 24px; height: 24px; }

  /* ── 鉴权门禁 ── */
  .auth-card { width: calc(100vw - 32px); padding: 40px 24px; }
  .auth-card h2 { font-size: 40px; }
  .auth-card > p { font-size: 17px; margin-bottom: 32px; }
  .auth-input-row { flex-direction: column; gap: 14px; }
  .auth-input-row input { padding: 18px 20px; font-size: 20px; border-radius: 8px; }
  .auth-input-row .btn { padding: 18px 24px; font-size: 18px; border-radius: 8px; }
  .auth-error { font-size: 15px; margin-top: 16px; }
  .auth-close { top: 18px; right: 18px; width: 44px; height: 44px; font-size: 20px; }
}

/* ============================================================
   小屏手机 — ≤400px：略降
   ============================================================ */
@media (max-width: 400px) {
  body { font-size: 18px; }
  .topbar { height: 64px; padding: 0 14px; }
  .brand-mark { width: 40px; height: 40px; font-size: 20px; }
  .brand-name { font-size: 18px; }
  .console-shell { height: calc(100dvh - 64px); grid-template-rows: 56px minmax(0, 1fr); }
  .rail-tab { height: 56px; }
  .rail-tab b { font-size: 15px; }
  .chat-messages { padding: 20px 14px 270px; gap: 22px; }
  .chat-empty h1 { font-size: 36px; }
  .chat-empty p { font-size: 17px; }
  .msg.user .bubble { font-size: 18px; padding: 15px 18px; }
  .msg.assistant .bubble { font-size: 18px; padding: 20px 18px; }
  .chat-input-area { padding: 14px 12px max(14px, env(safe-area-inset-bottom)); }
  .composer-row textarea { font-size: 18px; min-height: 50px; padding: 14px 16px; }
  .btn-send { min-width: 56px; height: 50px; }
  .page-layout { padding: 22px 14px; }
  .page-header h1 { font-size: 28px; }
  .btn { font-size: 15px; padding: 14px 18px; }
  .about-card { padding: 22px; }
  .orbit-map { width: 290px; height: 290px; }
}

/* 2026-06 compact mobile correction */
@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .topbar {
    height: 60px;
    padding: 0 12px;
    gap: 10px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .brand-name {
    max-width: 128px;
    font-size: 16px;
    line-height: 1.05;
  }

  .topbar-right {
    gap: 9px;
  }

  .system-pill {
    max-width: 72px;
    gap: 6px;
    padding: 0;
    font-size: 10px;
    line-height: 1.25;
  }

  .system-pill .dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
  }

  .more-btn {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 10px;
  }

  .more-dropdown {
    min-width: 170px;
  }

  .console-shell {
    height: calc(100dvh - 60px);
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .rail-tab {
    height: 52px;
  }

  .rail-tab b {
    font-size: 13px;
  }

  .rail-tab span {
    font-size: 9px;
  }

  .chat-messages {
    padding: 20px 14px 152px;
    gap: 20px;
  }

  .chat-empty {
    margin: 0;
    padding: 18px 0 32px;
  }

  .chat-empty h1 {
    font-size: clamp(30px, 9.2vw, 36px);
    line-height: 1.03;
  }

  .chat-empty p {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.65;
  }

  .hero-capabilities {
    gap: 7px;
    margin-top: 18px;
  }

  .hero-capabilities span {
    padding: 7px 9px;
    font-size: 9px;
  }

  .chat-input-area {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(34, 30, 25, .1);
  }

  .compact-trace {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
    gap: 4px;
    margin: 0 0 5px;
    padding: 0 0 7px;
    overflow-x: auto;
  }

  .compact-trace li {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 42px;
    padding: 0;
  }

  .compact-trace li b {
    width: auto;
    height: auto;
    font-size: 8px;
  }

  .compact-trace li span {
    font-size: 8px;
  }

  .composer-meta {
    margin: 0 2px 6px;
    font-size: 9px;
  }

  .composer-row {
    gap: 8px;
  }

  .composer-row textarea {
    min-height: 48px;
    max-height: 112px;
    padding: 12px 13px;
    font-size: 16px;
  }

  .btn-send {
    min-width: 52px;
    height: 48px;
    padding: 0 14px;
  }

  .btn-send b {
    font-size: 22px;
  }
}

@media (max-width: 400px) {
  body {
    font-size: 16px;
  }

  .topbar {
    height: 56px;
    padding: 0 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    max-width: 112px;
    font-size: 15px;
  }

  .system-pill {
    max-width: 62px;
    font-size: 9px;
  }

  .more-btn {
    min-height: 36px;
    padding: 7px 8px;
  }

  .console-shell {
    height: calc(100dvh - 56px);
    grid-template-rows: 50px minmax(0, 1fr);
  }

  .rail-tab {
    height: 50px;
  }

  .chat-messages {
    padding: 16px 12px 148px;
  }
}
