/* 工具簇统一视觉皮肤：在各自 assets/app.css 之后加载，只做外观增强，不改布局结构。
   配合 body[data-site-cluster] 给每个工具簇一套配色。CSP 为 style-src 'self'，无内联样式。 */

:root {
  --c1: #6366f1;
  --c2: #2563eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --line: #e3e9f3;
  --muted: #54657a;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 40, 80, 0.05), 0 10px 26px rgba(20, 40, 80, 0.07);
  --shadow-lg: 0 18px 44px rgba(20, 40, 80, 0.13);
}

body[data-site-cluster="gpa"]       { --c1: #6366f1; --c2: #2563eb; --brand: #2563eb; --brand-dark: #1d4ed8; }
body[data-site-cluster="fonts"]     { --c1: #a855f7; --c2: #db2777; --brand: #9333ea; --brand-dark: #7e22ce; }
body[data-site-cluster="words"]     { --c1: #14b8a6; --c2: #059669; --brand: #0d9488; --brand-dark: #0f766e; }
body[data-site-cluster="calories"]  { --c1: #f97316; --c2: #dc2626; --brand: #ea580c; --brand-dark: #c2410c; }
body[data-site-cluster="sleep"]     { --c1: #7c3aed; --c2: #4338ca; --brand: #6d28d9; --brand-dark: #5b21b6; }
body[data-site-cluster="wordcount"] { --c1: #06b6d4; --c2: #0284c7; --brand: #0891b2; --brand-dark: #0e7490; }
body[data-site-cluster="decibel"]   { --c1: #f59e0b; --c2: #d97706; --brand: #d97706; --brand-dark: #b45309; }
body[data-site-cluster="schedule"]  { --c1: #22c55e; --c2: #15803d; --brand: #16a34a; --brand-dark: #15803d; }
body[data-site-cluster="water"]     { --c1: #0ea5e9; --c2: #0369a1; --brand: #0284c7; --brand-dark: #075985; }
body[data-site-cluster="ip"]         { --c1: #3b82f6; --c2: #1e3a8a; --brand: #2563eb; --brand-dark: #1e40af; }
body[data-site-cluster="floor-area"] { --c1: #d97706; --c2: #78350f; --brand: #b45309; --brand-dark: #78350f; }
body[data-site-cluster="currency"]   { --c1: #10b981; --c2: #065f46; --brand: #047857; --brand-dark: #064e3b; }
body[data-site-cluster="population"] { --c1: #f43f5e; --c2: #881337; --brand: #be123c; --brand-dark: #881337; }
body[data-site-cluster="steps"]      { --c1: #a855f7; --c2: #581c87; --brand: #7e22ce; --brand-dark: #581c87; }

body {
  background: #f5f8fd;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 460px at 8% -6%, var(--c1), transparent 62%),
    radial-gradient(760px 420px at 96% 4%, var(--c2), transparent 60%);
  opacity: 0.13;
}

/* ---------- 页眉：每簇一条渐变，站内工具入口条嵌在下方 ---------- */
.site-header {
  background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
  border-bottom: 0;
  color: #fff;
  box-shadow: 0 12px 30px rgba(20, 40, 90, 0.18);
}
.site-header .wrap {
  min-height: 0;
  padding-top: 10px;
  padding-bottom: 6px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-size: 18px;
}
.brand span { color: rgba(255, 255, 255, 0.86); }
.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}
.site-nav { gap: 4px; font-size: 13.5px; }
.site-nav a {
  color: rgba(255, 255, 255, 0.84);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  text-decoration: none;
}
.site-nav a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.42);
}

/* 工具入口条在深色页眉里的配色 */
.site-header .toolnav-item {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.site-header .toolnav-item:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.site-header .toolnav-icon { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }

/* ---------- 标题 ---------- */
main { padding: 26px 0 44px; }
h1 {
  position: relative;
  font-size: 32px;
  font-weight: 800;
  padding-bottom: 12px;
}
h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 58px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
}
.lede { font-size: 17px; color: var(--muted); }
h2 { font-size: 21px; }
h2 + p, h2 + ul, h2 + table { margin-top: 0; }

/* ---------- 工具卡片与结果 ---------- */
.tool {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.tool:focus-within {
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.35);
}
.result {
  position: relative;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(37, 99, 235, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.08);
}
.result-value { color: var(--c2); font-size: 32px; }
.result.is-ok .result-value { color: #0f7b5f; }
.result.is-warn {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(220, 38, 38, 0.06));
  border-color: rgba(234, 88, 12, 0.28);
}

.btn {
  border-radius: 9px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border: 1px solid transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.24);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--c2), var(--c1));
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.3);
}

/* 输入控件：更清晰的聚焦态 */
.row input:focus, .row select:focus, .field input:focus, .field select:focus {
  outline: 2px solid rgba(99, 102, 241, 0.28);
  border-color: var(--c1);
}

/* ---------- 表格 / 提示块 / 相关工具 ---------- */
table { border-radius: 12px; box-shadow: var(--shadow-sm); border-color: var(--line); }
th { background: #f1f5fc; color: #46566b; font-size: 12.5px; }
tbody tr:hover td { background: #f8fbff; }

.callout {
  border-left-width: 4px;
  border-left-color: var(--c1);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(99, 102, 241, 0.03));
  border-radius: 0 12px 12px 0;
}

.related {
  background: linear-gradient(135deg, #ffffff 0%, #f6faff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.related h2 { font-size: 16px; }
.related ul { list-style: none; padding-left: 0; }
.related li { margin: 4px 0; }
.related a { display: inline-block; padding: 1px 0; }

.index-group { border-top: 1px solid var(--line); }
.index-group h3 { color: var(--muted); }

/* ---------- 页脚 ---------- */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .brand { font-size: 16px; }
  .site-nav {
    flex-wrap: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    font-size: 12.5px;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; }
  .result-value { font-size: 26px; }
}

/* ==================================================================
   视觉增强（覆盖层）：标题带、索引卡片、相关工具胶囊、统计与结果块
   全部是纯样式覆盖，不改动任何页面的结构与计算逻辑。
   ================================================================== */

/* 每个簇的标题水印图标 */
body { --hero-icon: none; }
body[data-site-cluster="gpa"]       { --hero-icon: url("/static/img/tool-gpa.svg"); }
body[data-site-cluster="fonts"]     { --hero-icon: url("/static/img/tool-fonts.svg"); }
body[data-site-cluster="words"]     { --hero-icon: url("/static/img/tool-words.svg"); }
body[data-site-cluster="calories"]  { --hero-icon: url("/static/img/tool-calories.svg"); }
body[data-site-cluster="sleep"]     { --hero-icon: url("/static/img/tool-sleep.svg"); }
body[data-site-cluster="wordcount"] { --hero-icon: url("/static/img/tool-wordcount.svg"); }
body[data-site-cluster="decibel"]   { --hero-icon: url("/static/img/tool-decibel.svg"); }
body[data-site-cluster="schedule"]  { --hero-icon: url("/static/img/tool-schedule.svg"); }
body[data-site-cluster="water"]     { --hero-icon: url("/static/img/tool-water.svg"); }
body[data-site-cluster="ip"]         { --hero-icon: url("/static/img/tool-ip.svg"); }
body[data-site-cluster="floor-area"] { --hero-icon: url("/static/img/tool-floorarea.svg"); }
body[data-site-cluster="currency"]   { --hero-icon: url("/static/img/tool-currency.svg"); }
body[data-site-cluster="population"] { --hero-icon: url("/static/img/tool-population.svg"); }
body[data-site-cluster="steps"]      { --hero-icon: url("/static/img/tool-steps.svg"); }

/* 标题带：浅色渐变卡片 + 右侧簇图标 */
h1 {
  padding: 20px 96px 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background-color: #fff;
  background-image: var(--hero-icon), linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.94));
  background-repeat: no-repeat, no-repeat;
  background-position: right 20px center, left top;
  background-size: 54px 54px, cover;
  box-shadow: 0 10px 26px rgba(20, 40, 80, 0.06);
}
h1::after { display: none; }

/* 簇内“全部页面”索引：卡片网格 */
.index-group ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 12px;
  padding: 0;
  margin: 0;
  list-style: none;
  columns: auto;
  column-gap: normal;
}
.index-group li { margin: 0; }
.index-group li a {
  position: relative;
  display: block;
  padding: 9px 12px 9px 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #26405c;
  font-size: 14.5px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.index-group li a::before {
  content: "\203A";
  position: absolute;
  left: 12px;
  top: 8px;
  color: var(--c1);
  font-weight: 700;
}
.index-group li a:hover {
  text-decoration: none;
  border-color: rgba(99, 102, 241, 0.42);
  background: #f7faff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 60, 120, 0.08);
}

/* 相关工具：胶囊链接 */
.related ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  columns: auto;
}
.related li { margin: 0; }
.related li a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #dce8fb;
  border-radius: 999px;
  background: #f5f9ff;
  color: #1f3f66;
  font-size: 14px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.related li a:hover {
  text-decoration: none;
  background: #eaf2ff;
  border-color: #bcd4f6;
}

/* 字数统计的指标卡 */
.stats { gap: 10px; }
.stat {
  border: 1px solid #dbe7f8;
  border-top: 3px solid var(--c1);
  border-radius: 12px;
  background: linear-gradient(160deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: 0 6px 16px rgba(20, 40, 80, 0.05);
}
.stat-value { color: var(--c2); }
.top-words li { background: #f7fbff; border-color: #dbe7f8; }

/* 分贝读数：渐变字 + 更宽的呼吸空间 */
.meter { padding: 18px 0 6px; }
.db-value { color: var(--c2); }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .db-value {
    background: linear-gradient(135deg, var(--c1), var(--c2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--c2);
  }
}

/* 饮水结果块 */
.water-result {
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(3, 105, 161, 0.05));
  box-shadow: 0 10px 26px rgba(14, 165, 233, 0.1);
}
.water-value { color: var(--c2); }

/* 明细行、表格斑马纹 */
.metric:hover { background: #f8fbff; }
tbody tr:nth-child(even) td { background: #fbfcff; }

@media (max-width: 640px) {
  h1 {
    padding: 15px 68px 15px 16px;
    font-size: 22px;
    background-position: right 14px center, left top;
    background-size: 40px 40px, cover;
  }
  .index-group ul { grid-template-columns: 1fr; }
}

/* ==================================================================
   页眉修正
   - 容器左右各加 50px（880 → 980），工具条整行平铺、不再滚动
   - 页眉底部加渐变细线 + 气泡装饰，避免整块纯色
   ================================================================== */
.site-header {
  position: relative;
  overflow: hidden;
}
.site-header .wrap {
  max-width: 980px;
  padding-top: 12px;
  padding-bottom: 10px;
}
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 16px 7px, rgba(255, 255, 255, 0.5) 0 2.6px, transparent 3.1px),
    radial-gradient(circle at 44px 4px, rgba(255, 255, 255, 0.34) 0 2px, transparent 2.5px),
    radial-gradient(circle at 66px 9px, rgba(255, 255, 255, 0.24) 0 1.5px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.14));
  background-size: 86px 12px, 86px 12px, 86px 12px, 100% 2px;
  background-position: 0 0, 0 0, 0 0, 0 bottom;
  background-repeat: repeat-x, repeat-x, repeat-x, no-repeat;
  opacity: 0.9;
}
