/* ============================================================
   xugtek 工具站共享样式
   视觉风格与 xugtek.com 主站保持一致，零第三方依赖
   ============================================================ */

/* ---------- 主题变量(亮 / 暗) ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --card: #ffffff;
  --text: #16161a;
  --text-muted: #5c5c66;
  --text-faint: #8a8a94;
  --border: #e6e6eb;
  --accent: #2c72da;
  --accent-soft: rgba(44, 114, 218, 0.10);
  --shadow: 0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.06);
  --shadow-lg: 0 2px 4px rgba(16, 16, 24, 0.05), 0 16px 40px rgba(16, 16, 24, 0.10);
  --nav-bg: rgba(255, 255, 255, 0.78);
}

/* 默认跟随系统;JS 里手动切换时写入 html[data-theme] 覆盖 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0f;
    --bg-soft: #121218;
    --card: #15151c;
    --text: #f2f2f5;
    --text-muted: #a4a4b0;
    --text-faint: #6f6f7a;
    --border: #26262e;
    --accent: #2c72da;
    --accent-soft: rgba(44, 114, 218, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.45);
    --nav-bg: rgba(11, 11, 15, 0.78);
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0f;
  --bg-soft: #121218;
  --card: #15151c;
  --text: #f2f2f5;
  --text-muted: #a4a4b0;
  --text-faint: #6f6f7a;
  --border: #26262e;
  --accent: #2c72da;
  --accent-soft: rgba(44, 114, 218, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(11, 11, 15, 0.78);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  display: block;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  scroll-margin-top: 72px;
}

/* ---------- 顶部导航(与主站一致) ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  flex: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--bg-soft) url("../icons/brand.svg") center/contain no-repeat;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links > a {
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
}

.nav-links > a:hover {
  color: var(--text);
  text-decoration: none;
}

.lang-switch {
  position: relative;
}

.lang-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.lang-switch-btn:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.lang-switch-btn svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.lang-switch-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  list-style: none;
  display: none;
  z-index: 60;
}

.lang-switch:focus-within .lang-switch-list,
.lang-switch.open .lang-switch-list {
  display: block;
}

.lang-switch-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.lang-switch-list a:hover {
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}

.lang-switch-list a.current {
  color: var(--accent);
  font-weight: 700;
}

.lang-switch-list a.current::after {
  content: "✓";
  font-weight: 700;
}

.theme-toggle {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
}

.icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-sun {
  display: block;
}

/* ---------- Hero / 页面头 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 40px;
  text-align: center;
}

.hero h1 {
  position: relative;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero p {
  position: relative;
  color: var(--text-muted);
  font-size: 16px;
  margin: 0;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.card h1,
.card h2,
.card h3 {
  margin-top: 0;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--text);
}

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  grid-column: 1 / -1;
}

#price-section .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.form-group-month {
  grid-column: 1 / -1;
  grid-row: 1;
  max-width: 314px;
}

#estimate-section .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

select.form-control {
  cursor: pointer;
}

.hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}

.note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 12px;
}

/* ---------- 滑动条 ---------- */
.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
}

.range-value {
  width: 90px;
  flex: 0 0 auto;
}

.range-row > span {
  color: var(--text-muted);
  font-size: 13px;
  flex: 0 0 auto;
}

/* ---------- 结果卡片 ---------- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.result-item {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 14px;
  padding: 16px 18px;
}

.result-item .label {
  font-size: 13px;
  color: var(--text-muted);
}

.result-item .value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  word-break: break-word;
}

.result-item .value-sep {
  color: var(--text-muted);
  font-weight: 600;
}

.breakdown-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  margin: 8px 0 0;
  font-size: 14px;
}

.breakdown-table td {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.breakdown-table tr:last-child td {
  border-bottom: 0;
}

.breakdown-table td:first-child {
  color: var(--text-strong);
  padding-right: 16px;
  width: 100%;
}

.breakdown-table .usage {
  color: var(--text-muted);
  text-align: right;
  padding-left: 8px;
}

.breakdown-table .cost {
  font-weight: 600;
  text-align: right;
  padding-left: 8px;
}

.breakdown-table .cost-sep {
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 2px;
}

/* ---------- 对比固定 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn-ghost {
  border-color: var(--border);
  color: var(--text-muted);
  padding: 7px 12px;
  font-size: 13px;
}

.btn-ghost:hover {
  border-color: var(--text-faint);
  color: var(--text);
  background: var(--bg-soft);
}

.result-actions {
  margin-top: 16px;
}

.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.compare-header .section-title {
  margin: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.compare-card {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
}

.compare-card .compare-name {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  padding-right: 20px;
  word-break: break-word;
}

.compare-card .compare-value {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compare-card .compare-usage {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.compare-card .compare-value strong {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.compare-card .compare-value .value-sep {
  color: var(--text-faint);
  font-weight: 600;
}

.compare-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.compare-remove:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 工具导航页 ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 24px;
}

.tool-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 24px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  text-decoration: none;
}

.tool-card h3 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tool-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.tool-card .hint {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 600;
}

.coming-soon {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  text-align: center;
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-faint);
}

.footer-inner .links {
  display: flex;
  gap: 20px;
}

.footer-inner a {
  color: var(--text-muted);
}

.footer-inner a:hover {
  color: var(--text);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .nav-inner {
    padding: 0 16px;
  }

  .card {
    padding: 20px;
  }

  .hero {
    padding: 52px 0 28px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .result-item .value {
    font-size: 18px;
  }

  .range-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .range-slider {
    flex: 1 0 100%;
  }

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

  #estimate-section .form-grid {
    grid-template-columns: 1fr;
  }

  #estimate-section .form-group-month {
    max-width: none;
  }

  .nav-links {
    gap: 10px;
  }
}
