/* ==========================================================================
   时间计算器 — 样式
   设计规范对齐博客主题 Butterfly：
   主色 #49b1f5 / 悬停 #ff7242 / 选中 #00c4b6 / 正文 #4c4948
   卡片 8px 圆角 + 0 3px 8px 6px rgba(7,17,27,.05) 阴影
   ========================================================================== */

:root {
  /* 取自主题 :root 的变量 */
  --global-bg: #fff;
  --font-color: #4c4948;
  --text-highlight-color: #1f2d3d;
  --card-bg: #fff;
  --card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .05);
  --card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .09);
  --btn-bg: #49b1f5;
  --btn-hover-color: #ff7242;
  --light-grey: #eee;
  --dark-grey: #cacaca;
  --search-bg: #f6f8fa;
  --hr-border: #a4d8fa;
  --headline-presudo: #a0a0a0;
  --card-meta: #858585;
  --toc-link-color: #666261;
  --teal: #00c4b6;

  /* 常用尺寸 */
  --radius: 8px;
  --radius-sm: 6px;
  --nav-height: 60px;
  --layout-max: 1100px;

  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Lato, Roboto,
          'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: consolas, Menlo, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--global-bg);
  color: var(--font-color);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

::selection {
  background: var(--teal);
  color: #f7f7f7;
}

*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-thumb { background: var(--btn-bg); border-radius: 5px; }
*::-webkit-scrollbar-track { background-color: transparent; }

.wrap {
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 0 15px;
}

/* ---------- 顶部导航（对齐 #nav） ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 91;
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
  box-shadow: 0 5px 6px -5px rgba(133, 133, 133, .6);
  transition: background .3s ease-in-out;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--nav-height);
}

.blog-info {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--font-color);
  transition: color .3s ease-in-out;
}

.blog-info:hover { color: var(--btn-bg); }

.nav-logo {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--btn-bg);
}

.nav-logo svg { width: 24px; height: 24px; }

.site-name {
  margin: 0;
  font-size: 1.3em;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.5;
}

.menus {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.menus::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--font-color);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: color .3s ease-in-out, background .3s ease-in-out;
}

.tab svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.tab:hover { color: var(--btn-bg); background: var(--search-bg); }

.tab.active {
  color: var(--btn-bg);
  font-weight: 600;
  background: rgba(73, 177, 245, .1);
}

.tab:focus-visible {
  outline: 2px solid var(--btn-bg);
  outline-offset: 1px;
}

.clock {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--card-meta);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--search-bg);
  white-space: nowrap;
}

/* ---------- 主体容器（对齐 .layout） ---------- */

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 30px 15px;
}

.panel[hidden] { display: none !important; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- 卡片（对齐 .card-widget / .recent-post-item） ---------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-box-shadow);
  padding: 20px 24px;
  transition: box-shadow .3s;
}

.card:hover { box-shadow: var(--card-hover-box-shadow); }

.card.inset {
  margin-top: 18px;
  padding: 16px 18px;
  box-shadow: none;
  background: var(--search-bg);
}

.card.inset:hover { box-shadow: none; }

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-bottom: 6px;
  font-size: 1.2em;
  font-weight: 600;
  color: var(--text-highlight-color);
}

/* 标题前的强调竖条，呼应主题里 --hr-before-color 的用法 */
.card-title::before {
  content: '';
  flex: 0 0 auto;
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--btn-bg), var(--hr-border));
}

.card-desc {
  margin: 0 0 4px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--card-meta);
}

/* ---------- 表单 ---------- */

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }

.field-label {
  font-size: 13px;
  line-height: 1.6;
  color: var(--toc-link-color);
}

input,
select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--font-color);
  background: var(--card-bg);
  border: 1px solid var(--light-grey);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 40px;
  transition: border-color .3s, box-shadow .3s;
}

input[type="number"],
input[type="text"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] { font-variant-numeric: tabular-nums; }

input:hover,
select:hover { border-color: var(--hr-border); }

input:focus,
select:focus {
  outline: none;
  border-color: var(--btn-bg);
  box-shadow: 0 0 0 3px rgba(73, 177, 245, .18);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23858585' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
  padding-right: 34px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--font-color);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 16px;
  height: 16px;
  min-height: 0;
  flex: 0 0 16px;
  accent-color: var(--btn-bg);
  cursor: pointer;
}

/* ---------- 按钮（对齐 .btn-effects） ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  appearance: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: #fff;
  cursor: pointer;
  transition: all .3s ease-in-out;
}

.btn:hover {
  background: var(--btn-hover-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  transform: translateY(-1px) scale(1.02);
}

.btn:active { transform: translateY(0) scale(1); }

.btn:focus-visible { outline: 2px solid var(--btn-bg); outline-offset: 2px; }

.btn.ghost {
  background: transparent;
  color: var(--toc-link-color);
  border: 1px solid var(--light-grey);
}

.btn.ghost:hover {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: #fff;
}

/* ---------- 结果区 ---------- */

.cd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.cd-card { display: flex; flex-direction: column; }

.cd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.cd-name {
  margin: 0;
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-highlight-color);
}

.cd-sub {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--card-meta);
}

.cd-days {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
}

.cd-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--btn-bg);
}

.cd-unit {
  font-size: 14px;
  color: var(--card-meta);
}

.cd-clock {
  margin-top: 2px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 1.7;
  color: var(--font-color);
}

.cd-target {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--light-grey);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--card-meta);
}

.cd-card.is-today .cd-num { color: var(--btn-hover-color); }
.cd-card.is-today .cd-clock { color: var(--btn-hover-color); }

.results { display: flex; flex-direction: column; }

.result-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--light-grey);
  transition: all .3s;
}

.result-row:last-child { border-bottom: none; }

.r-label {
  flex: 0 0 auto;
  width: 42%;
  max-width: 320px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--card-meta);
}

.r-value {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: 14.5px;
  line-height: 1.6;
  font-weight: 600;
  color: var(--text-highlight-color);
  word-break: break-word;
}

.r-value.mono,
.r-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.r-unit {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 400;
  color: var(--card-meta);
}

.result-row.hero {
  align-items: center;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--light-grey);
}

.result-row.hero .r-label {
  font-size: 13.5px;
  color: var(--toc-link-color);
}

.result-row.hero .r-value {
  font-size: 32px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--btn-bg);
}

.result-row.hero .r-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--btn-bg);
  opacity: .8;
}

.copy-btn {
  flex: 0 0 auto;
  appearance: none;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--card-meta);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  cursor: pointer;
  transition: all .3s;
}

.copy-btn:hover {
  color: #fff;
  background: var(--btn-bg);
  border-color: var(--btn-bg);
}

.note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--card-meta);
}

.note.warn { color: var(--btn-hover-color); }

.empty {
  margin: 0;
  padding: 4px 0;
  font-size: 13.5px;
  color: var(--card-meta);
}

/* ---------- 页脚（对齐 #footer） ---------- */

.app-footer {
  background: var(--btn-bg);
  color: var(--light-grey);
  padding: 20px 0;
  font-size: 13px;
  line-height: 1.8;
}

.app-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.app-footer .dot { color: rgba(255, 255, 255, .6); }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--btn-bg);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 9px 20px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 96;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */

@media (max-width: 768px) {
  .nav-inner { gap: 10px; min-height: 52px; }
  .site-name { font-size: 1.2em; }
  .nav-logo { width: 22px; height: 22px; }
  .nav-logo svg { width: 20px; height: 20px; }
  .tab { padding: 5px 9px; font-size: 13.5px; }
}

@media (max-width: 1100px) {
  .clock { display: none; }
}

@media (max-width: 480px) {
  .site-name { display: none; }
}

@media (max-width: 640px) {
  .main { padding: 20px 12px; gap: 16px; }
  .panel { gap: 16px; }
  .card { padding: 16px 16px; }
  .result-row { flex-wrap: wrap; gap: 4px 12px; }
  .r-label { width: 100%; max-width: none; }
  .r-value { text-align: left; }
  .result-row.hero .r-value { font-size: 27px; }
  .copy-btn { margin-left: auto; }
  .card.inset { padding: 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
