/* 铁板神数在线教学工具样式 · 与站点宋版册页风格一致 */

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 22px 0 30px;
  padding: 14px 16px;
  background: #f8f2e6;
  border: 1px solid #ddd0b8;
  border-radius: 4px;
  font-size: 14.5px;
}
.tool-nav a {
  color: #855c1e;
  text-decoration: none;
  white-space: nowrap;
  /* 触控目标：WCAG 2.2 建议 >=24px，Apple HIG 建议 >=44px */
  display: inline-block;
  padding: 9px 4px;
  min-height: 44px;
  line-height: 26px;
}
.tool-nav a:hover { text-decoration: underline; }

.tool {
  margin: 0 0 34px;
  padding: 20px 22px 24px;
  background: #fffdf8;
  border: 1px solid #e3d7c0;
  border-left: 4px solid #855c1e;
  border-radius: 4px;
}
.tool h2 { margin-top: 0 !important; border-left: none !important; padding-left: 0 !important; font-size: 19px; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
  margin: 12px 0;
}
.row label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  color: #6b5a45;
  flex: 1 1 200px;
  min-width: 160px;
}
.row label.wide { flex: 1 1 100%; }

input[type="text"],
input[type="number"],
select,
textarea {
  font: inherit;
  /* 必须 >= 16px：iOS Safari 对小于 16px 的输入控件会自动放大页面。
     select 也必须包含，否则下拉框在 iOS 上会触发缩放。 */
  font-size: 16px;
  padding: 8px 11px;
  border: 1px solid #cfc0a4;
  border-radius: 3px;
  background: #fff;
  color: #2b2118;
  width: 100%;
}
textarea { resize: vertical; font-family: inherit; min-height: 70px; }
input:focus, textarea:focus {
  outline: 2px solid #b98a3e;
  outline-offset: 1px;
  border-color: #855c1e;
}

button {
  font: inherit;
  font-size: 15px;
  padding: 9px 20px;
  border: none;
  border-radius: 3px;
  background: #855c1e;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  flex: 0 0 auto;
}
button:hover { background: #6d4a16; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid #d4a94e; outline-offset: 2px; }
button.ghost {
  background: transparent;
  color: #855c1e;
  border: 1px solid #c9b48d;
}
button.ghost:hover { background: #f3ebda; }

.out {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8f2e6;
  border-radius: 3px;
  font-size: 15px;
  min-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
}
.out:empty::before {
  content: "（结果会显示在这里）";
  color: #a89b86;
  font-style: italic;
  font-size: 14px;
}
.out .err { color: #9d2933; font-weight: 600; }
.out .ok { color: #2f6b3a; font-weight: 600; }
.out .badge {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 6px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  vertical-align: middle;
}
.badge.classical { background: #dbead5; color: #2f6b3a; }
.badge.traditional { background: #fbe6c8; color: #8a5a12; }
.badge.scholarly { background: #d7e6f5; color: #1e4f7a; }
.badge.editorial { background: #e8e2d4; color: #5f5648; }

.hint { font-size: 14px; color: #6b5a45; margin: 6px 0; }
.warn {
  font-size: 13.5px;
  color: #8a5a12;
  background: #fdf6e6;
  border-left: 3px solid #d4a94e;
  padding: 10px 14px;
  margin: 14px 0 0;
  border-radius: 2px;
}
.warn strong { color: #7a4a0a; }

.grid60 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
  margin-top: 14px;
}
.grid60 .cell {
  padding: 7px 4px;
  text-align: center;
  background: #f8f2e6;
  border: 1px solid #e3d7c0;
  border-radius: 3px;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s;
}
.grid60 .cell:hover { background: #f0e4cc; }
.grid60 .cell .n { display: block; color: #a89b86; font-size: 11.5px; }

details { margin-top: 14px; }
summary {
  cursor: pointer;
  color: #855c1e;
  font-size: 14.5px;
  padding: 6px 0;
}
summary:hover { text-decoration: underline; }

/* 手机优化 */
@media (max-width: 640px) {
  .tool { padding: 16px 14px 18px; }
  .row { gap: 10px 12px; }
  .row label { flex: 1 1 100%; min-width: 0; }
  button { flex: 1 1 45%; min-height: 44px; }
  .tool-nav { font-size: 14px; gap: 0 10px; padding: 8px 12px; }
  .tool-nav a { padding: 9px 2px; }
  .grid60 { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}
/* 站间导航（与 Starlight 主站衔接） */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 26px;
  padding: 10px 0 14px;
  border-bottom: 1px solid #ddd0b8;
  font-size: 15px;
}
.site-nav a {
  color: #855c1e;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 2px;
}
.site-nav a:hover { text-decoration: underline; }
.site-nav a:first-child { font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .site-nav { border-bottom-color: #4a4239; }
  .site-nav a { color: #c9a227; }
}

/* 长 URL / 命令 / 编号不得撑破移动端容器 */
code, kbd, samp, pre, .cite, a {
  overflow-wrap: anywhere;
  word-break: break-word;
}
pre { overflow-x: auto; max-width: 100%; }
table { max-width: 100%; display: block; overflow-x: auto; }
img, svg, video { max-width: 100%; height: auto; }

/* 排盘：标准时 / 真太阳时对照表 */
.pp-compare {
  margin: 22px 0 6px;
  padding: 16px 18px;
  background: #fdfaf3;
  border: 1px solid #e3d7c0;
  border-radius: 4px;
}
.pp-compare h4 { margin: 0 0 12px; font-size: 15.5px; color: #5c4420; font-weight: 600; }
.pp-compare table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pp-compare th, .pp-compare td { padding: 9px 10px; border-bottom: 1px solid #ece2cf; text-align: center; }
.pp-compare th:first-child, .pp-compare td:first-child { text-align: left; }
.pp-compare th { font-weight: 600; color: #6b5230; background: #f7f0e2; }
.pp-compare td { font-variant-numeric: tabular-nums; }
.pp-compare tr.pp-hl td { background: #fdf5e3; font-weight: 600; }
.pp-compare small { color: #8a7a62; font-size: 12.5px; font-weight: 400; }
.pp-compare .pp-note { margin: 12px 0 0; font-size: 14px; line-height: 1.75; color: #4a4238; }
@media (max-width: 520px) {
  .pp-compare { padding: 12px 10px; overflow-x: auto; }
  .pp-compare table { font-size: 13.5px; min-width: 340px; }
  .pp-compare th, .pp-compare td { padding: 7px 6px; }
}
@media (prefers-color-scheme: dark) {
  .pp-compare { background: #232019; border-color: #4a4239; }
  .pp-compare h4 { color: #d8c9a8; }
  .pp-compare th, .pp-compare td { border-bottom-color: #3a342c; }
  .pp-compare th { background: #2c2820; color: #c9b894; }
  .pp-compare tr.pp-hl td { background: #322c22; }
  .pp-compare small { color: #9a8c76; }
  .pp-compare .pp-note { color: #cfc4b2; }
}
