:root {
  --bg: #efe7da;
  --panel: rgba(255, 253, 248, 0.96);
  --panel-soft: rgba(249, 244, 236, 0.92);
  --panel-muted: rgba(246, 240, 229, 0.85);
  --line: rgba(126, 98, 67, 0.14);
  --line-strong: rgba(126, 98, 67, 0.24);
  --ink: #2f2923;
  --muted: #756b5e;
  --muted-soft: #988d7f;
  --brand: #9b3922;
  --brand-deep: #7f2816;
  --accent: #2f6355;
  --accent-soft: rgba(47, 99, 85, 0.08);
  --brand-soft: rgba(155, 57, 34, 0.08);
  --warn-soft: rgba(240, 181, 74, 0.18);
  --warn-ink: #7b5613;
  --shadow: 0 20px 50px rgba(81, 57, 32, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(155, 57, 34, 0.09), transparent 24%),
    radial-gradient(circle at 100% 0, rgba(47, 99, 85, 0.1), transparent 26%),
    linear-gradient(180deg, #f6f1e7 0%, #efe7da 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(180, 139, 84, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 139, 84, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.16), transparent 76%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.site-shell {
  width: min(1380px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 28px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 247, 239, 0.96));
  box-shadow: var(--shadow);
}

.site-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  padding: 16px 18px 14px;
  backdrop-filter: blur(18px);
}

.topbar,
.topbar-right,
.info-strip,
.calendar-toolbar,
.today-head,
.detail-head,
.pane-head,
.compatibility-head,
.holiday-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-seal {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff9f3;
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 24px rgba(155, 57, 34, 0.22);
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 1.04rem;
  letter-spacing: 0.04em;
}

.brand-copy span,
.section-link,
.calendar-title p,
.workspace-head p,
.field span,
.mini-card p,
.result-subtitle,
.holiday-target,
.holiday-state {
  color: var(--muted);
}

.section-link {
  font-size: 0.94rem;
  padding: 0 2px;
}

.topbar-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.lang-button {
  min-width: 48px;
  min-height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.lang-button.active {
  color: #fff9f2;
  background: linear-gradient(135deg, var(--accent), #244d45);
}

.info-strip {
  flex-wrap: wrap;
  margin-top: 14px;
}

.info-pill,
.tool-chip,
.ribbon-chip,
.holiday-chip,
.mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  background: var(--panel-soft);
}

.tool-navbar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

.tool-chip {
  flex: 0 0 auto;
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tool-chip.active {
  color: #fff9f2;
  border-color: rgba(155, 57, 34, 0.22);
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.main-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.site-footer {
  margin-top: 18px;
  padding: 16px 18px;
}

.footer-visitor,
.footer-copy,
.footer-total {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-visitor {
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-copy {
  min-width: 0;
}

.footer-copy strong,
.footer-total strong {
  font-family: "Outfit", sans-serif;
}

.footer-copy strong {
  font-size: 0.98rem;
  color: var(--ink);
}

.footer-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.footer-source {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--panel-soft);
}

.footer-source.cloudflare {
  color: var(--accent);
  border-color: rgba(47, 99, 85, 0.16);
  background: var(--accent-soft);
}

.footer-source.unavailable {
  color: var(--brand);
  border-color: rgba(155, 57, 34, 0.14);
  background: var(--brand-soft);
}

.footer-total {
  gap: 12px;
  color: var(--muted);
}

.footer-total strong {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.dashboard {
  display: grid;
  grid-template-columns: 305px minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
}

.workspace {
  padding: 16px;
}

.today-card,
.calendar-card,
.detail-card,
.tool-display {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 241, 230, 0.8));
}

.today-card,
.detail-card,
.calendar-card,
.tool-display {
  padding: 16px;
}

.calendar-title {
  display: grid;
  gap: 4px;
}

.calendar-title h1,
.workspace-head h2 {
  margin: 0;
  font-family: "ZCOOL XiaoWei", serif;
  font-weight: 400;
  font-size: 1.62rem;
}

.calendar-title p,
.workspace-head p,
.pane-head p {
  margin: 0;
  line-height: 1.6;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
  font-size: 0.9rem;
}

.compact-field {
  min-width: 170px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  border-color: rgba(155, 57, 34, 0.42);
  box-shadow: 0 0 0 4px rgba(155, 57, 34, 0.08);
}

.primary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  border: none;
  color: #fff8ef;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 24px rgba(155, 57, 34, 0.18);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.primary-button:hover,
.ghost-button:hover,
.lang-button:hover,
.tool-chip:hover,
.calendar-cell:hover {
  transform: translateY(-1px);
}

.week-header,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.week-header {
  margin-top: 14px;
  padding: 0 6px 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.week-header span {
  text-align: center;
}

.calendar-grid {
  gap: 8px;
}

.calendar-cell {
  min-height: 94px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
}

.calendar-cell.outside {
  opacity: 0.48;
  background: var(--panel-muted);
}

.calendar-cell.today {
  border-color: rgba(155, 57, 34, 0.36);
  background: linear-gradient(180deg, rgba(255, 244, 237, 0.98), rgba(255, 251, 245, 0.94));
}

.calendar-cell.selected {
  border-color: rgba(47, 99, 85, 0.34);
  box-shadow: inset 0 0 0 1px rgba(47, 99, 85, 0.12);
}

.calendar-cell-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.solar-day,
.result-highlight .value,
.score-ring,
.footer-total strong,
.holiday-date {
  font-family: "Outfit", sans-serif;
}

.solar-day {
  font-size: 1.1rem;
  font-weight: 700;
}

.calendar-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.festival-note,
.holiday-chip {
  color: var(--brand);
}

.term-note,
.ribbon-chip,
.mini-badge {
  color: var(--accent);
}

.ribbon-chip,
.mini-badge {
  background: var(--accent-soft);
  border-color: rgba(47, 99, 85, 0.14);
}

.holiday-chip {
  background: var(--brand-soft);
  border-color: rgba(155, 57, 34, 0.14);
}

.today-head,
.detail-head {
  align-items: center;
}

.today-title,
.detail-title,
.summary-ribbon,
.today-summary,
.detail-summary,
.result-stack,
.yi-ji {
  display: grid;
  gap: 12px;
}

.today-title h3,
.detail-title h3,
.pane-head h3 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.35;
}

.today-title p,
.detail-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.roundel {
  min-width: 78px;
  min-height: 78px;
  padding: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 50%;
  color: #fff9f3;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 234, 198, 0.26), transparent 34%),
    linear-gradient(145deg, var(--accent), #234e46);
}

.roundel strong {
  display: block;
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 1.12rem;
  font-weight: 400;
}

.roundel span {
  display: block;
  margin-top: 4px;
  font-size: 0.76rem;
}

.summary-ribbon {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.data-grid,
.result-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.today-card .data-grid,
.detail-card .data-grid {
  grid-template-columns: 1fr;
}

.data-block,
.mini-card,
.yi-ji-row,
.holiday-item {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.data-block dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.data-block dd {
  margin: 7px 0 0;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.58;
}

.yi-ji-row h4,
.mini-card strong {
  display: block;
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips-wrap span {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--warn-ink);
  background: var(--warn-soft);
}

.chips-wrap.negative span {
  color: var(--brand-deep);
  background: rgba(155, 57, 34, 0.1);
}

.workspace-head {
  margin-bottom: 14px;
}

.tool-pane {
  display: none;
}

.tool-pane.active {
  display: block;
}

.pane-head {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.pane-head > div {
  display: grid;
  gap: 4px;
}

.tool-form {
  display: grid;
  gap: 12px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

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

.form-span {
  justify-self: start;
}

.result-box {
  margin-top: 14px;
  min-height: 188px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 243, 234, 0.9));
}

.result-box.empty,
.card-loading {
  display: grid;
  place-items: center;
  color: var(--muted-soft);
}

.result-title {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.45;
}

.result-subtitle {
  margin: 0;
}

.result-highlight {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.result-highlight .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.label {
  color: var(--muted);
}

.holiday-list {
  display: grid;
  gap: 10px;
}

.holiday-date {
  font-weight: 700;
}

.score-ring {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.48rem;
  font-weight: 700;
  color: var(--accent);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92) 44%, transparent 45%),
    conic-gradient(var(--accent) 0 var(--score), rgba(47, 99, 85, 0.12) var(--score) 360deg);
}

.sign-pair {
  display: grid;
  gap: 5px;
}

.sign-pair strong {
  font-size: 1.12rem;
}

@media (max-width: 1240px) {
  .dashboard {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .detail-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .today-card,
  .calendar-card,
  .detail-card {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 14px, 1380px);
    padding-top: 8px;
  }

  .site-header,
  .dashboard,
  .workspace {
    padding: 14px;
  }

  .site-header {
    top: 8px;
  }

  .topbar,
  .topbar-right,
  .calendar-toolbar,
  .toolbar-actions,
  .today-head,
  .detail-head,
  .compatibility-head,
  .footer-visitor,
  .footer-copy,
  .footer-total {
    flex-direction: column;
    align-items: stretch;
  }

  .tool-navbar {
    padding-bottom: 2px;
  }

  .tool-chip {
    white-space: nowrap;
  }

  .compact-form,
  .two-col-form,
  .data-grid,
  .result-split {
    grid-template-columns: 1fr;
  }

  .form-span,
  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .compact-field {
    min-width: 0;
  }

  .calendar-cell {
    min-height: 84px;
    padding: 8px;
  }
}
