/* ============================================================
   时间网 TimeSite — shared stylesheet
   ============================================================ */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #22262b;
  --muted: #71767f;
  --line: #e6e1d6;
  --accent: #bf3a2b;
  --accent-ink: #fff;
  --accent-soft: #faece9;
  --gold: #c9922a;
  --ok: #2e8b57;
  --warn: #b7791f;
  --danger: #c53030;
  --shadow: 0 1px 2px rgba(31, 35, 43, .05), 0 8px 24px -12px rgba(31, 35, 43, .18);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191d;
    --card: #1f2329;
    --ink: #e8e6e0;
    --muted: #9aa0aa;
    --line: #32363e;
    --accent: #e05d4d;
    --accent-ink: #17100e;
    --accent-soft: #33241f;
    --gold: #d8ab52;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -12px rgba(0, 0, 0, .55);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
}
img, svg { vertical-align: middle; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: .4em 0 .9em; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 58px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--ink); white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { width: 26px; height: 26px; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav > a, .nav-drop > a {
  display: inline-block; padding: 7px 11px; border-radius: 8px;
  color: var(--ink); font-size: 14.5px; font-weight: 500;
}
.main-nav > a:hover, .nav-drop > a:hover { background: var(--accent-soft); text-decoration: none; }
.main-nav > a.active { color: var(--accent); background: var(--accent-soft); }
.nav-drop { position: relative; }
.nav-drop > a::after { content: " ▾"; font-size: 11px; opacity: .7; }
.nav-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 200px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.nav-drop:hover .nav-menu, .nav-drop:focus-within .nav-menu { display: grid; grid-template-columns: 1fr; }
.nav-menu a { padding: 7px 10px; border-radius: 8px; color: var(--ink); font-size: 13.5px; white-space: nowrap; }
.nav-menu a:hover { background: var(--accent-soft); text-decoration: none; }
.lang-switch {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }
.menu-btn { display: none; margin-left: auto; border: 1px solid var(--line); background: none; border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--ink); }

/* ---------------- hero clock ---------------- */
.hero {
  padding: 34px 0 26px;
  text-align: center;
}
.clock-hero {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(56px, 13vw, 118px); font-weight: 700; letter-spacing: .02em;
  line-height: 1.05;
}
.clock-hero .sec { font-size: .45em; color: var(--muted); font-weight: 600; }
.hero-date { font-size: clamp(17px, 2.6vw, 22px); margin-top: 6px; font-weight: 600; }
.hero-sub { color: var(--muted); margin-top: 4px; font-size: 14.5px; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  margin: 0 3px;
}
.badge.gold { background: transparent; color: var(--gold); border-color: var(--gold); }
.clock-md {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: clamp(40px, 8vw, 64px); font-weight: 700;
}
.clock-sm { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 700; }

/* ---------------- layout blocks ---------------- */
main { padding-bottom: 48px; }
section.block { margin-top: 34px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tool-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 10px 14px; text-align: center; color: var(--ink); transition: transform .15s ease, box-shadow .15s ease;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.tool-card svg { width: 34px; height: 34px; stroke: var(--accent); }
.tool-card b { font-size: 14px; font-weight: 600; }
.tool-card span { font-size: 11.5px; color: var(--muted); }

.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13.5px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 14.5px; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; }

/* ---------------- forms & buttons ---------------- */
label.field { display: block; margin: 0 0 12px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="number"], input[type="text"], select {
  width: 100%; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.btn {
  display: inline-block; border: none; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 10px; padding: 9px 20px; font-size: 14.5px;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.big { padding: 12px 30px; font-size: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.result {
  background: var(--accent-soft); border-radius: 12px; padding: 14px 18px;
  font-size: 17px; font-weight: 600; margin-top: 6px;
}
.result small { display: block; color: var(--muted); font-weight: 400; margin-top: 4px; }
.notice {
  border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--card));
  border-radius: 8px; padding: 10px 14px; font-size: 13.5px; color: var(--muted);
}
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600;
}
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------------- tables ---------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.tbl-wrap { overflow-x: auto; }

/* ---------------- calendar ---------------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-size: 21px; font-weight: 700; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; font: inherit; }
.cal-nav button:hover { border-color: var(--accent); color: var(--accent); }
.cal-table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 5px; }
.cal-table th { font-size: 12.5px; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal-table td {
  text-align: center; vertical-align: middle; aspect-ratio: 1 / 0.86;
  border-radius: 10px; cursor: pointer; border: 1px solid transparent;
}
.cal-table td:hover { background: var(--accent-soft); }
.cal-table .d-num { font-size: 16.5px; font-weight: 650; line-height: 1.15; }
.cal-table .d-lunar { font-size: 11px; color: var(--muted); line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-table .we .d-num { color: var(--accent); }
.cal-table .today { background: var(--accent); border-color: var(--accent); }
.cal-table .today .d-num, .cal-table .today .d-lunar { color: var(--accent-ink); }
.cal-table .fest .d-lunar { color: var(--accent); font-weight: 600; }
.cal-table .term .d-lunar { color: var(--gold); font-weight: 600; }
.cal-table .today.fest .d-lunar, .cal-table .today.term .d-lunar { color: var(--accent-ink); }
.cal-table td.other { opacity: .38; }
@media (max-width: 560px) {
  .cal-table { border-spacing: 2px; }
  .cal-table .d-num { font-size: 13.5px; }
  .cal-table .d-lunar { font-size: 9.5px; }
}

/* ---------------- world clock cards ---------------- */
.wc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wc-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.wc-card .wc-city { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.wc-card .wc-time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 700; margin-top: 2px; }
.wc-card .wc-date { font-size: 12px; color: var(--muted); }
.wc-card .wc-off { font-size: 11.5px; margin-top: 4px; }
.star-btn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px; line-height: 0; }
.star-btn.on { color: var(--gold); }
.search-input { max-width: 420px; }

/* ---------------- alarm list ---------------- */
.alarm-item { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.alarm-item:last-child { border-bottom: none; }
.alarm-time { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* countdown digits */
.cd-digits { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.cd-cell { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 96px; padding: 14px 8px; text-align: center; }
.cd-cell b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(34px, 7vw, 54px); font-weight: 700; display: block; line-height: 1.1; }
.cd-cell span { font-size: 12.5px; color: var(--muted); }

/* progress bar */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s linear; }

/* five elements bars */
.wx-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 13.5px; }
.wx-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.wx-bar i { display: block; height: 100%; border-radius: 999px; }
.pillar { text-align: center; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.pillar .p-label { font-size: 12px; color: var(--muted); }
.pillar .p-gz { font-size: 24px; font-weight: 700; letter-spacing: .08em; margin: 4px 0; }
.pillar .p-na { font-size: 12px; color: var(--muted); }

/* shichen highlight */
tr.now-row td { background: var(--accent-soft) !important; color: var(--accent); font-weight: 600; }

/* ringing modal */
.modal-mask { position: fixed; inset: 0; background: rgba(10, 10, 12, .62); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal-box { background: var(--card); border-radius: 18px; padding: 30px 34px; text-align: center; max-width: 340px; width: calc(100% - 40px); box-shadow: var(--shadow); }
.ring-icon { width: 54px; height: 54px; margin: 0 auto 10px; animation: shake 1s infinite; }
@keyframes shake { 0%, 100% { transform: rotate(-14deg); } 50% { transform: rotate(14deg); } }

/* ---------------- footer ---------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 40px; padding: 30px 0 24px; font-size: 13.5px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 26px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { font-size: 13.5px; margin-bottom: 8px; color: var(--muted); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 4px 0; }
.footer-bottom { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }

.breadcrumb { font-size: 13px; color: var(--muted); margin: 14px 0 4px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .main-nav {
    display: none; position: absolute; top: 58px; left: 0; right: 0;
    background: var(--card); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; padding: 10px 14px 14px; gap: 2px;
  }
  .main-nav.open { display: flex; }
  .nav-menu { position: static; display: grid; box-shadow: none; border: none; padding: 0 0 0 12px; }
  .header-inner { position: relative; }
  .lang-switch { order: 3; }
}
