/* 移动端样式（仅在 max-width:760px 生效；桌面不产生任何视觉变化） */

.cw-mnav-anchor,
.cw-mnav-btn,
.cw-mnav-panel {
  display: none;
}

@media (max-width: 760px) {
  /* ---------- 1. 头部：只留 logo 与菜单按钮 ---------- */
  body .site-header {
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 10px !important;
    padding-bottom: 12px;
  }

  body .site-header .head-right {
    display: flex !important;
    order: 1;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  body .site-header .head-right .nav,
  body .site-header .head-right .head-acct {
    display: none !important;
  }

  body .site-header .lang-btn {
    width: auto !important;
    height: 40px !important;
    padding: 0 12px !important;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink);
    font-size: 13px;
  }

  body .site-header .lang-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  body .site-header .lang-menu {
    z-index: 90;
    min-width: 150px;
  }

  body .site-header .lang-menu a {
    padding: 10px 12px;
    font-size: 14px;
  }

  body .site-header .wordmark {
    order: 0 !important;
    margin-right: auto;
  }

  body .site-header .wordmark img {
    height: 20px;
  }

  .cw-mnav-btn {
    display: inline-flex;
    order: 9;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
  }

  .cw-mnav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
  }

  /* ---------- 2. 下拉面板：5 项导航 + 语言文字按钮 ---------- */
  .cw-mnav-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 80;
    display: none;
    width: min(320px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .cw-mnav-panel:target,
  #cw-mnav-open:target ~ .cw-mnav-panel {
    display: block;
  }

  .cw-mnav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 8px;
    border-bottom: 1px solid var(--line);
  }

  .cw-mnav-title {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .cw-mnav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
  }

  .cw-mnav-close:hover {
    background: #f4f2ed;
    color: var(--ink);
    text-decoration: none;
  }

  .cw-mnav-links {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
  }

  .cw-mnav-links a {
    display: block;
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--ink);
    font-size: 15px;
    line-height: 1.4;
  }

  .cw-mnav-links a:hover {
    background: #f4f2ed;
    text-decoration: none;
  }

  .cw-mnav-links a.on {
    color: var(--accent);
    font-weight: 600;
  }

  /* ---------- 3. 首页首屏：隐藏最新消息，动画全宽 ---------- */
  body.page-home .newsline {
    display: none !important;
  }

  body.page-home .hero-screen {
    margin: 0 -16px !important;
    width: auto !important;
    border-radius: 0;
    box-shadow: none;
  }

  body.page-home .film-frame {
    display: block;
    width: 100% !important;
    height: auto;
    aspect-ratio: 1040 / 600;
  }

  /* ---------- 4. 手机版首页重排：以文字阅读为主 ---------- */

  /* 4.1 首屏：动画自动播放，右上角按钮全屏 */
  body.page-home .hero-screen {
    position: relative;
    height: auto !important;
    display: block;
    overflow: hidden;
    aspect-ratio: 1040 / 600;
    background: #f4f2ed;
  }

  body.page-home .hero-screen > .hero-fs {
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
  }

  body.page-home .hero-mobile {
    display: none !important;
  }

  /* 4.2 模型列表：单列纯文字行，仅极细分隔线 */
  body.page-home .model-cards {
    grid-template-columns: 1fr;
    gap: 0;
  }

  body.page-home .mcard {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px 2px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0;
    background: transparent;
    position: relative;
    min-height: 48px;
    transform: none;
  }

  body.page-home .mcard:hover {
    border-color: rgba(0, 0, 0, 0.06);
    transform: none;
  }

  body.page-home .mcard-top {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  body.page-home .mcard-text {
    min-width: 0;
    padding-right: 20px;
  }

  body.page-home .mcard-mark {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
  }

  body.page-home .mcard-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
  }

  body.page-home .mcard-ver,
  body.page-home .mcard-date {
    color: var(--muted, #8a8a8a);
    font-size: 11.5px;
    line-height: 1.5;
  }

  body.page-home .mcard::after {
    content: "\2228";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #b0b0b0;
    pointer-events: none;
  }

  body.page-home .mcard-btn {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    opacity: 0;
    font-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* 4.3 计算卡：三张并排小图 */
  body.page-home .card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-items: start;
  }

  body.page-home .calc-card,
  body.page-home .calc-card:nth-child(1),
  body.page-home .calc-card:nth-child(2),
  body.page-home .calc-card:nth-child(3) {
    grid-column: auto;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  body.page-home .calc-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
  }

  /* 4.4 免费接入：四列小图标 */
  body.page-home .agent-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 6px;
  }

  body.page-home .agent-item {
    padding: 4px 0;
    gap: 6px;
  }

  body.page-home .agent-mark {
    width: 24px;
    height: 24px;
  }

  body.page-home .agent-mark img {
    width: 24px;
    height: 24px;
  }

  body.page-home .agent-name {
    font-size: 10px;
    line-height: 1.3;
    white-space: normal;
  }

  /* Dify 图标：SVG 本身可正常渲染，但它是列表最后一项的 loading="lazy" 图，
     未滚动即截图时不会加载；用 CSS 背景保证 24×24 确定性出现，并套用同样的灰度/透明度 */
  body.page-home .agent-item:last-child .agent-mark {
    background: url("/assets/logos/dify.svg") center / 24px 24px no-repeat;
    filter: grayscale(1);
    opacity: 0.5;
  }

  body.page-home .agent-item:last-child .agent-mark img {
    visibility: hidden;
  }

  /* 4.5 首屏图已含全部文案，不再叠加遮罩 */
  body.page-home .hero-screen::after {
    display: none !important;
  }

  /* 4.6 首页模型列表只留 5 条 */
  body.page-home .model-cards .mcard:nth-child(n+6) {
    display: none !important;
  }
}
