/* style.css — TermCalc 设计系统 v2.0（Apple-inspired）
 * 约束：无第三方资源；375px 视口完整可用；保留 v1 全部类名不破坏存量页面。
 * 设计语言：#f5f5f7 底、#1d1d1f 墨、#0071e3 强调、大圆角、柔和投影、毛玻璃页头。
 */
:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --bg: #f5f5f7;
  --card: #ffffff;
  --danger: #d70015;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-rest: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 15% -80px, rgba(0, 113, 227, 0.10), transparent 60%),
    radial-gradient(1000px 460px at 85% -60px, rgba(177, 84, 255, 0.09), transparent 60%),
    radial-gradient(900px 400px at 50% -40px, rgba(255, 149, 0, 0.06), transparent 55%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(0, 113, 227, 0.18); }

/* ---------- 页头：毛玻璃悬浮导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.site-header nav { display: flex; gap: 4px 18px; flex-wrap: wrap; align-items: center; }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  padding: 4px 2px;
  border-radius: 6px;
  transition: color 0.2s ease;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

main { max-width: 880px; margin: 0 auto; padding: 40px 22px 64px; }

/* ---------- Hero：大标题居中，呼吸感 ---------- */
.hero { text-align: center; padding: 12px 0 0; }
.hero h1 {
  font-size: 44px;
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 12px;
}
.hero .lede { max-width: 560px; margin: 0 auto 28px; }

.lede { color: var(--muted); font-size: 17px; margin: 0 0 24px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-rest);
}
.card.calculator { max-width: 560px; margin-left: auto; margin-right: auto; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field label, .field legend {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 7px;
  letter-spacing: -0.01em;
}
.field input[type="date"],
.field input[type="number"],
.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236e6e73' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}
.field textarea { font-family: ui-monospace, Consolas, monospace; font-size: 14px; resize: vertical; }

fieldset.mode {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px 10px;
  margin: 0 0 18px;
}
.radio, .checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 400 !important;
  margin-bottom: 7px;
  font-size: 15px;
  cursor: pointer;
}
.radio input, .checkbox input { margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.hint-inline { color: var(--muted); font-weight: 400; font-size: 13px; }

/* ---------- 结果区 ---------- */
.result {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  animation: rise 0.35s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.result-date { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0; }
.result-overdue { color: var(--danger); font-weight: 600; margin: 0 0 8px; }

.placeholder { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
.hidden { display: none !important; }

/* ---------- 按钮：胶囊 ---------- */
.btn {
  display: inline-block;
  background: linear-gradient(180deg, #2b8dff, #0068e5);
  color: var(--accent-ink);
  border: none;
  border-radius: 980px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(0, 113, 227, 0.45);
}
.btn.ghost:hover { background: rgba(0, 113, 227, 0.07); }

.row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.error-row td { color: var(--danger); background: #fdf1f0; }
.overdue-row td:last-child { color: var(--danger); font-weight: 600; }

/* ---------- 正文区块 ---------- */
.content h2 {
  font-size: 27px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 40px 0 12px;
  color: var(--ink);
}
.content h3 { font-size: 16.5px; font-weight: 600; margin: 22px 0 6px; color: var(--ink); }
.content p, .content li { color: var(--muted); font-size: 15.5px; }
.content a { color: var(--accent); text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content ul { padding-left: 20px; }
.content li { margin-bottom: 8px; }
code { background: rgba(0, 0, 0, 0.05); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; }

/* ---------- 工具卡片网格（首页目录） ---------- */
.tools-section {
  margin-top: 40px;
  margin-bottom: 48px;
  background:
    linear-gradient(135deg, rgba(0, 113, 227, 0.07), rgba(177, 84, 255, 0.07) 45%, rgba(52, 199, 89, 0.08) 85%),
    linear-gradient(180deg, #ffffff, #f2f4f9);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 44px 30px 40px;
  box-shadow: var(--shadow-rest);
}
.tools-section > h2 {
  text-align: center;
  font-size: 32px;
  letter-spacing: -0.025em;
  font-weight: 800;
  margin: 0 0 6px;
  background: linear-gradient(90deg, #0a6cff, #8e44ff 52%, #ff9500);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tools-section > .tools-lede {
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  margin: 0 auto 32px;
  max-width: 520px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px 20px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-rest);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--tint, linear-gradient(90deg, #0a6cff, #8e44ff));
  opacity: 0.9;
}
.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--tint-border, rgba(0, 113, 227, 0.4));
}
.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.06);
}
.tool-card h3 {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}
.tool-card .tool-tag {
  margin-top: auto;
  padding-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
/* 图标底色：苹果系马卡龙色板 */
.t-blue { background: #e8f1ff; }
.t-purple { background: #f1e9ff; }
.t-teal { background: #dcf6f0; }
.t-orange { background: #ffefdc; }
.t-pink { background: #ffe9ee; }
.t-green { background: #e5f7e5; }
.t-yellow { background: #fff6d9; }
.t-indigo { background: #e9ebff; }
.t-slate { background: #e9edf2; }
.t-red { background: #ffe7e3; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 26px 20px;
  background: rgba(255, 255, 255, 0.6);
}
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- 375px 视口：单列无溢出 ---------- */
@media (max-width: 860px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tools-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 31px; }
  .result-date { font-size: 23px; }
  main { padding: 26px 16px 48px; }
  .card { padding: 18px; }
  .card.calculator { padding: 20px; }
  .tools-section > h2 { font-size: 25px; }
  th, td { padding: 7px 8px; }
  .site-header { padding: 10px 16px; }
}

/* 每工具专属渐变（顶条 + 图标块） */
.t-blue    { background: linear-gradient(135deg, #e6f1ff, #dbe7ff); --tint: linear-gradient(90deg,#0a6cff,#00c3ff); --tint-border: rgba(10,108,255,.45); }
.t-indigo  { background: linear-gradient(135deg, #ecebff, #dfe3ff); --tint: linear-gradient(90deg,#5e5ce6,#0a6cff); --tint-border: rgba(94,92,230,.45); }
.t-teal    { background: linear-gradient(135deg, #e2f7f1, #d3f2ea); --tint: linear-gradient(90deg,#00c7be,#34c759); --tint-border: rgba(0,199,190,.45); }
.t-orange  { background: linear-gradient(135deg, #fff0de, #ffe7cb); --tint: linear-gradient(90deg,#ff9500,#ff6a00); --tint-border: rgba(255,149,0,.45); }
.t-purple  { background: linear-gradient(135deg, #f4eaff, #ecdfff); --tint: linear-gradient(90deg,#a944ff,#d44aff); --tint-border: rgba(169,68,255,.45); }
.t-red     { background: linear-gradient(135deg, #ffe9e6, #ffddd8); --tint: linear-gradient(90deg,#ff453a,#ff7a5c); --tint-border: rgba(255,69,58,.45); }
.t-green   { background: linear-gradient(135deg, #e6f8e6, #d8f4d8); --tint: linear-gradient(90deg,#30d158,#7fe0a0); --tint-border: rgba(48,209,88,.45); }
.t-yellow  { background: linear-gradient(135deg, #fff7d6, #fff1bd); --tint: linear-gradient(90deg,#ffb300,#ffd60a); --tint-border: rgba(255,179,0,.5); }
.t-pink    { background: linear-gradient(135deg, #ffe9f0, #ffdce8); --tint: linear-gradient(90deg,#ff2d78,#ff6ab0); --tint-border: rgba(255,45,120,.45); }
.t-slate   { background: linear-gradient(135deg, #eef1f6, #e4e9f0); --tint: linear-gradient(90deg,#57708c,#8399b3); --tint-border: rgba(87,112,140,.45); }

/* ---------- 反馈区（全站底部） ---------- */
.feedback-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-top: 48px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-rest);
}
.feedback-section h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 4px;
}
.feedback-section > p { color: var(--muted); font-size: 14.5px; margin: 0 0 14px; }
.feedback-section textarea {
  width: 100%;
  min-height: 88px;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.feedback-section textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}
.fb-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.fb-row input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 980px;
}
.fb-row input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}
.fb-status { font-size: 14px; margin: 10px 0 0; font-weight: 500; }
