﻿:root {
  color-scheme: light;
  --bg: #f7f2ea;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(15, 24, 36, 0.08);
  --text: #172033;
  --muted: #5d687d;
  --ink: #0e1827;
  --teal: #0f8b8d;
  --coral: #df6d57;
  --gold: #c08a3c;
  --shadow: 0 24px 60px rgba(16, 30, 44, 0.12);
  --shadow-soft: 0 12px 30px rgba(16, 30, 44, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-sans: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1724;
  --surface: rgba(24, 34, 50, 0.82);
  --surface-strong: rgba(28, 39, 58, 0.92);
  --line: rgba(196, 210, 230, 0.12);
  --text: #e9eef8;
  --muted: #a5b1c7;
  --ink: #f7fbff;
  --teal: #5ed3d0;
  --coral: #ff9b88;
  --gold: #f2c97d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(223, 109, 87, 0.18), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(15, 139, 141, 0.18), transparent 24%),
    linear-gradient(140deg, #fff6ea 0%, #f2f7f8 48%, #f8fbf6 100%);
  overflow-x: hidden;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 155, 136, 0.16), transparent 28%),
    radial-gradient(circle at 86% 14%, rgba(94, 211, 208, 0.16), transparent 24%),
    linear-gradient(145deg, #0d1420 0%, #101a2a 48%, #121d25 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 88%);
  pointer-events: none;
}

.page-shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0.7;
}

.ambient-one {
  top: 80px;
  left: -60px;
  width: 240px;
  height: 240px;
  background: rgba(223, 109, 87, 0.15);
  animation: floatBlob 11s ease-in-out infinite;
}

.ambient-two {
  right: 2%;
  top: 220px;
  width: 300px;
  height: 300px;
  background: rgba(15, 139, 141, 0.16);
  animation: floatBlob 13s ease-in-out infinite reverse;
}

.ambient-three {
  right: 16%;
  bottom: 64px;
  width: 180px;
  height: 180px;
  background: rgba(192, 138, 60, 0.15);
  animation: floatBlob 9s ease-in-out infinite;
}



.main-grid {
  display: grid;
  gap: 22px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--surface-strong), rgba(255, 255, 255, 0.7));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

.reveal {
  animation: revealUp 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.intro-panel,
.calculator-panel,
.result-panel {
  padding: 30px;
}

.result-panel {
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.result-panel.is-ready {
  transform: translateY(-2px);
  box-shadow: 0 28px 70px rgba(16, 30, 44, 0.16);
  border-color: rgba(15, 139, 141, 0.22);
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intro-panel h1 {
  margin: 0;
  max-width: 12em;
  font-size: clamp(1.4rem, 2.8vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.intro-copy {
  max-width: 52rem;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.72;
  font-size: 1.02rem;
}

.intro-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.intro-highlights article,
.field-card,
.metric-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.56));
  box-shadow: var(--shadow-soft);
}

.intro-highlights article,
.field-card,
.metric-card {
  padding: 18px;
}

.highlight-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 139, 141, 0.1);
  color: var(--teal);
  font-size: 0.84rem;
  font-weight: 700;
}

.intro-highlights strong {
  display: block;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.intro-highlights p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.68;
  font-size: 0.95rem;
}

.panel-heading,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-heading h2,
.result-head h2 {
  margin: 2px 0 0;
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  letter-spacing: -0.03em;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
  border-color: rgba(15, 139, 141, 0.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.theme-toggle-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.theme-toggle-caret {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 2px;
}

.theme-toggle-text {
  font-size: 0.82rem;
  font-weight: 600;
}

.theme-menu {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 10;
}

.theme-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.theme-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.theme-option-icon {
  font-size: 0.92rem;
  line-height: 1;
  flex-shrink: 0;
}

.theme-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

.theme-option.is-active {
  background: rgba(0, 0, 0, 0.06);
  font-weight: 700;
}

.section-note,
.result-range,
.form-message,
.timeline-label,
.metric-card p {
  color: var(--muted);
}

.calculator-form {
  display: grid;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.accent-card {
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.08), rgba(255, 255, 255, 0.78)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
}

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

.field-header label {
  font-size: 0.94rem;
  font-weight: 700;
}

.text-button,
.chip-button,
.ghost-button,
.primary-button {
  border: none;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--coral);
  font-size: 0.92rem;
  font-weight: 700;
}

.chip-button {
  padding: 10px 14px;
  border: 1px solid rgba(15, 24, 36, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.ghost-button {
  padding: 13px 18px;
  border: 1px solid rgba(15, 24, 36, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.primary-button {
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ink), #22314a);
  color: #fff;
  box-shadow: 0 16px 26px rgba(23, 32, 51, 0.22);
  font-weight: 700;
}

.text-button:hover,
.chip-button:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.chip-button:hover,
.ghost-button:hover {
  box-shadow: 0 14px 28px rgba(16, 30, 44, 0.1);
}

.primary-button:hover {
  box-shadow: 0 20px 32px rgba(23, 32, 51, 0.28);
}

input[type="datetime-local"] {
  width: 100%;
  min-height: 56px;
  padding: 0 44px 0 16px;
  border: 1px solid rgba(15, 24, 36, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  display: none;
}

input[type="datetime-local"]:focus {
  outline: 2px solid rgba(15, 139, 141, 0.2);
  border-color: rgba(15, 139, 141, 0.48);
}

/* ── datetime wrapper & trigger ── */
.datetime-wrap { position: relative; }

.cal-trigger {
  position: absolute;
  right: 1px; top: 1px; bottom: 1px;
  width: 42px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.cal-trigger:hover { color: var(--teal); background: rgba(15,139,141,.06); }

/* ── 日历弹窗 ── */
.cal-backdrop { position: fixed; inset: 0; z-index: 9998; display: none; }
.cal-backdrop.is-open { display: block; }

.cal-popup {
  position: fixed;
  z-index: 9999;
  width: 310px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
  display: none;
}
.cal-popup.is-open { display: block; }

.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  font-size: .88rem; font-weight: 700; color: var(--text);
}
.cal-nav button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem;
  transition: background .12s;
}
.cal-nav button:hover { background: rgba(0,0,0,.06); }

.cal-weekdays {
  display: grid; grid-template-columns: repeat(7,1fr);
  padding: 0 8px; text-align: center;
  font-size: .72rem; font-weight: 600; color: var(--muted);
}

.cal-days {
  display: grid; grid-template-columns: repeat(7,1fr);
  padding: 4px 8px 8px; gap: 2px; text-align: center;
}
.cal-days button {
  width: 100%; aspect-ratio: 1;
  border: none; border-radius: 50%;
  background: transparent; color: var(--text);
  font-size: .82rem; cursor: pointer;
  transition: background .1s, color .1s;
}
.cal-days button:hover { background: rgba(15,139,141,.1); }
.cal-days button.other-month { color: var(--muted); opacity: .45; }
.cal-days button.today { font-weight: 800; color: var(--teal); }
.cal-days button.selected {
  background: var(--teal); color: #fff; font-weight: 700;
}

.cal-time-row {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 6px 12px;
  font-size: .82rem; color: var(--muted);
}
.cal-time-row input {
  width: 46px; padding: 5px 2px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font-size: .85rem; text-align: center; font-family: inherit;
}
.cal-time-row span { font-weight: 700; }

.cal-footer {
  display: flex; border-top: 1px solid var(--line);
}
.cal-footer button {
  flex: 1; padding: 10px 0;
  border: none; background: transparent;
  font-size: .86rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .12s;
}
.cal-footer .cal-cancel { color: var(--muted); }
.cal-footer .cal-cancel:hover { background: rgba(0,0,0,.04); }
.cal-footer .cal-ok { color: var(--teal); font-weight: 700; }
.cal-footer .cal-ok:hover { background: rgba(15,139,141,.08); }

.preset-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}



.preset-row {
  margin-top: 14px;
}

.action-row {
  justify-content: flex-end;
  padding-top: 4px;
}

.form-message {
  margin: 0;
  min-height: 1.75em;
  line-height: 1.65;
}

.form-message.error {
  color: #b24a37;
}



.result-range {
  margin: 0 0 22px;
  max-width: 62rem;
  line-height: 1.72;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.major-card {
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.08), rgba(255, 255, 255, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.7));
}

.accent-metric {
  background:
    linear-gradient(180deg, rgba(223, 109, 87, 0.08), rgba(255, 255, 255, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.7));
}

.metric-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-card strong {
  display: block;
  font-size: clamp(1.12rem, 1.5vw, 1.42rem);
  line-height: 1.24;
  letter-spacing: -0.05em;
  color: var(--ink);
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.timeline-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 18px 20px;
}

.timeline-card strong {
  display: block;
  margin-top: 8px;
  font-size: 0.96rem;
  line-height: 1.5;
}

@keyframes floatBlob {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -16px, 0) scale(1.04);
  }
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
    padding-bottom: 28px;
  }

  .theme-menu {
    top: 20px;
    right: 16px;
  }

  .panel-heading,
  .result-head,
  .panel-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .theme-menu-panel {
    left: auto;
    right: 0;
  }

  .calculator-panel,
  .result-panel {
    padding: 22px 18px;
  }

  .form-grid,
  .intro-highlights,
  .metric-grid,
  .timeline-card {
    grid-template-columns: 1fr;
  }

  .action-row {
    justify-content: stretch;
  }

  .action-row > button {
    width: 100%;
  }

  .theme-toggle {
    padding: 5px 10px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .theme-toggle-icon { font-size: 0.78rem; }
  .theme-toggle-caret { font-size: 0.55rem; }

  .cal-popup {
    width: calc(100vw - 40px);
    max-width: 310px;
  }
}


/* ── Dark mode overrides ── */
:root[data-theme="dark"] .panel {
  border-color: rgba(196, 210, 230, 0.08);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
}

:root[data-theme="dark"] .panel::after {
  border-color: rgba(196, 210, 230, 0.06);
}

:root[data-theme="dark"] .intro-highlights article,
:root[data-theme="dark"] .field-card,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .timeline-card {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border-color: var(--line);
}

:root[data-theme="dark"] .accent-card {
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.12), var(--surface)),
    var(--surface-strong);
}

:root[data-theme="dark"] .chip-button {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .ghost-button {
  background: var(--surface);
  border-color: var(--line);
}

:root[data-theme="dark"] .primary-button {
  background: linear-gradient(135deg, var(--teal), #1a6b6a);
  color: #fff;
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] .primary-button:hover {
  box-shadow: 0 20px 32px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] input[type="datetime-local"] {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

:root[data-theme="dark"] .cal-popup {
  background: var(--surface-strong);
  border-color: var(--line);
}

:root[data-theme="dark"] .cal-nav button:hover { background: rgba(255,255,255,.08); }
:root[data-theme="dark"] .cal-days button:hover { background: rgba(15,139,141,.18); }
:root[data-theme="dark"] .cal-cancel:hover { background: rgba(255,255,255,.06); }

:root[data-theme="dark"] .major-card {
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.12), var(--surface)),
    var(--surface-strong);
}

:root[data-theme="dark"] .accent-metric {
  background:
    linear-gradient(180deg, rgba(223, 109, 87, 0.12), var(--surface)),
    var(--surface-strong);
}

:root[data-theme="dark"] .theme-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .theme-option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .chip-button:hover,
:root[data-theme="dark"] .ghost-button:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
}