/* ===== 全站多端适配补丁 2026-11-12 =====
   在 </head> 前最后加载，覆盖各页内联/外部样式。
   原则：桌面观感不变；手机不缩放、不横向溢出；平板排版更舒展；触屏设备降低重绘。 */

/* 通用：禁止 iOS 自动放大文本；长串换行；媒体不溢出；键盘焦点可见 */
html { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body, .app { overflow-wrap:break-word; }
img, video, canvas { max-width:100%; height:auto; }
svg { max-width:100%; }
[hidden] { display:none!important; }
:focus-visible { outline:2px solid #B34A32; outline-offset:2px; }

/* 左右留白统一出口：桌面沿用 28px，平板 20px，手机 26px。
   所有页面（含管理后台）都从这里取，避免各处各写一套导致忽紧忽松。 */
:root { --pad-x:28px; }
@media (max-width:1024px){ :root { --pad-x:20px; } }
@media (max-width:600px){ :root { --pad-x:26px; } }

/* 输入框 ≥16px：iOS Safari 对 <16px 的输入框聚焦时会自动放大整个页面 */
@media (max-width:1024px){
  input[type=text],input[type=search],input[type=password],input[type=email],
  input[type=number],input[type=tel],textarea,select{ font-size:16px!important; }
}

/* 刘海屏 / 横屏安全区（大屏不动，避免改变桌面边距） */
@supports (padding:env(safe-area-inset-left)){
  @media (max-width:1024px){
    .app{
      padding-left:calc(var(--pad-x) + env(safe-area-inset-left,0px));
      padding-right:calc(var(--pad-x) + env(safe-area-inset-right,0px));
    }
    footer.foot{ padding-bottom:calc(24px + env(safe-area-inset-bottom,0px)); }
  }
}

/* 手机：单列、按钮整行、表格可横向滚动、取消列宽下限 */
@media (max-width:600px){
  .topbar{ gap:10px; }
  /* 顶栏第一行吃满：logo + 两个查询入口平分剩余宽度，右侧不再留空 */
  .brand{ width:100%; gap:10px; }
  .seg{ flex:1 1 auto; min-width:0; display:flex; }
  .seg a{ flex:1 1 0; justify-content:center; white-space:nowrap; padding-left:8px; padding-right:8px; }
  .topright{ width:100%; justify-content:flex-start; }
  .result-head{ flex-wrap:wrap; gap:6px; }
  .pager{ flex-wrap:wrap; gap:8px; }
  .bar input{ width:100%; min-width:0; }
  table{ table-layout:auto; }
  .zh-cell,.kz-cell,.src-cell{ min-width:0; max-width:none; }
  .modal{ width:100%; max-height:92dvh; }
}

/* 平板：适中留白，表格列宽收敛，词典结果两列利用横向空间 */
@media (min-width:601px) and (max-width:1024px){
  .zh-cell,.kz-cell{ min-width:160px; max-width:320px; }
}
@media (min-width:900px) and (max-width:1180px){
  #sdResults{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:28px; }
}

/* 触屏设备：点击目标 ≥44px，降低误触；清空按钮单独收敛尺寸 */
@media (pointer:coarse){
  button,.btn,.nav a,.seg a,input[type=submit],input[type=button],select{ min-height:44px; }
  .btn.mini,.btn.link{ padding-left:14px; padding-right:14px; }
  .nav a,.seg a{ display:inline-flex; align-items:center; }
  .clear-btn{ width:40px; height:40px; min-height:40px; right:2px; }
  input[type=checkbox],input[type=radio]{ width:20px; height:20px; }
}

/* 触屏设备（含平板/触屏本）：去掉毛玻璃与逐卡动画，滚动时不再持续合成 */
@media (hover:none){
  .panel,.topbar,.backdrop,.modal{
    -webkit-backdrop-filter:none!important; backdrop-filter:none!important;
  }
  .card,#results .card,#sdResults .card{ animation:none!important; transform:none!important; }
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms!important; animation-iteration-count:1!important;
    transition-duration:.001ms!important; scroll-behavior:auto!important;
  }
}
