/* ==========================================================================
   响应式样式 - mobile-first 适配
   ========================================================================== */

/* 平板 */
@media (max-width: 900px) {
  .gauge-row,
  .ip-grid-main,
  .quality-main {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .about-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav {
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .nav a {
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .tool-grid { grid-template-columns: 1fr; }
}

/* 手机 */
@media (max-width: 768px) {
  :root {
    --topbar-h: 56px;
  }

  .topbar-inner {
    padding: 0 12px;
    gap: 8px;
  }

  .brand-name {
    font-size: 16px;
  }

  .brand img {
    width: 30px;
    height: 30px;
  }

  .nav {
    display: none; /* 移动端用页面内导航 */
  }

  .lang-switcher select {
    height: 36px;
    padding: 0 28px 0 10px;
    font-size: 12px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .container {
    padding: 16px 12px 32px;
  }

  .hero {
    padding: 16px 8px 24px;
  }

  .panel {
    padding: 20px 16px;
    margin-bottom: 16px;
  }

  .results {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .result-card {
    padding: 14px 10px;
  }

  .r-value {
    font-size: 22px;
  }

  .btn {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
  }

  .controls {
    gap: 8px;
  }

  .gauge-wrap {
    max-width: 220px;
  }

  .gauge-ring {
    max-width: 190px;
  }

  .gauge-num {
    font-size: 36px;
  }

  .gd-item-value {
    font-size: 13px;
  }
  .gd-item {
    padding: 5px 6px;
  }

  .quality-score-wrap {
    max-width: 200px;
  }

  .quality-num {
    font-size: 44px;
  }

  .ip-meta {
    grid-template-columns: 1fr;
  }

  .map-wrapper {
    height: 280px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .history-list li {
    padding: 8px 12px;
    font-size: 12px;
    gap: 8px;
  }

  .history-list .h-metrics {
    gap: 8px;
    font-size: 11px;
  }

  .chart-card {
    padding: 14px;
  }

  #speedChart {
    height: 140px;
  }

  .global-table {
    font-size: 12px;
    min-width: 480px;
  }

  .global-table th,
  .global-table td {
    padding: 8px 10px;
  }

  .progress-mini-bar {
    width: 80px;
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .input {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .output-box {
    font-size: 12px;
    padding: 12px;
  }
}

/* 小屏手机 */
@media (max-width: 400px) {
  .container {
    padding: 12px 10px 24px;
  }

  .panel {
    padding: 16px 12px;
  }

  .results {
    grid-template-columns: repeat(2, 1fr);
  }

  .ip-quick {
    font-size: 12px;
    padding: 8px 14px;
  }

  .btn {
    font-size: 13px;
    padding: 0 14px;
    height: 40px;
  }
}

/* 横屏手机 */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 8px 8px 16px;
  }

  .map-wrapper {
    height: 240px;
  }
}

/* 减少动效（无障碍） */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 打印 */
@media print {
  .topbar,
  .controls,
  .footer,
  .toast,
  .map,
  .map-wrapper {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .glass,
  .glass-soft {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(148, 163, 184, 0.4);
  }

  .btn,
  .icon-btn {
    border: 2px solid currentColor;
  }
}
