* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f3ede4;
  color: #333;
  line-height: 1.5;
}

header {
  background: linear-gradient(135deg, #8b4513, #a05a1f);
  color: #fff;
}
.header-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px;
}
.brand .title { font-size: 20px; font-weight: bold; }
.brand .sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

nav {
  background: #fff;
  border-bottom: 1px solid #e3d6c6;
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
}
nav button {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 0;
  font-size: 15px;
  cursor: pointer;
  color: #8b6f52;
  border-bottom: 3px solid transparent;
  font-family: inherit;
}
nav button.active {
  color: #8b4513;
  font-weight: bold;
  border-bottom-color: #d9822b;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}
section { display: none; }
section.active { display: block; }

footer {
  border-top: 1px solid #e3d6c6;
  background: #fff;
}
.footer-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 20px;
  font-size: 12px;
  color: #a08a70;
  text-align: center;
}

.footer-inner a { color: #8b4513; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: #8b6f52; margin-bottom: 4px; }
.field select, .field input {
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
  border: 1px solid #d9c7b3;
  border-radius: 8px;
  background-color: #fdf9f3;
  color: #333;
  font-family: inherit;
}
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }
.row .field.wide { flex: 2; }

.btn {
  width: 100%;
  padding: 12px;
  background-color: #d9822b;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  font-family: inherit;
}
.btn:hover { background-color: #b86b1f; }
.btn.secondary {
  background-color: #f0e6da;
  color: #8b4513;
  font-weight: normal;
  font-size: 14px;
  margin-top: 10px;
}
.btn.secondary:hover { background-color: #e6d6c2; }

.pan { border-radius: 10px; padding: 12px; background: #fdf6ec; border: 1px solid #e8d5bb; margin-bottom: 10px; }
.pan-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.pan-label { color: #8b6f52; font-size: 13px; }
.pan-star { font-weight: bold; color: #8b4513; font-size: 16px; }
.pan-dao { font-size: 12px; color: #a05a1f; margin-top: 3px; }
.pan-hint { font-size: 12px; color: #a08a70; margin-top: 8px; border-top: 1px dashed #e0cdb2; padding-top: 8px; white-space: pre-wrap; }

.star-block { margin-bottom: 14px; }
.star-title { font-size: 16px; font-weight: bold; color: #8b4513; margin-bottom: 6px; }
.star-dao { font-size: 12px; color: #a05a1f; margin-bottom: 6px; }

.verse {
  background: #fdf6ec;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.guben, .modern { font-size: 14px; line-height: 1.8; color: #444; }
.label { font-size: 13px; font-weight: bold; color: #8b6f52; margin: 8px 0 4px; }
.modern ul { margin: 0; padding-left: 20px; }
.modern li { margin-bottom: 4px; }

.toc-item {
  padding: 12px;
  border: 1px solid #e3d6c6;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
  font-size: 14px;
  color: #333;
}
.toc-item:hover { border-color: #d9822b; background: #fdf6ec; }
.toc-item .sub { font-size: 12px; color: #a08a70; margin-top: 3px; }

.back-btn {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 14px;
  color: #8b4513;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font-family: inherit;
}
.hint { font-size: 12px; color: #a08a70; line-height: 1.6; margin-top: 8px; }
.intro { font-size: 14px; line-height: 1.8; color: #444; }
.info-card p { margin: 6px 0; font-size: 14px; line-height: 1.8; }
.mono-verse { white-space: pre-wrap; font-size: 14px; line-height: 1.8; color: #444; }

.dayun-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed #eee0cd;
  font-size: 13px;
}
.dayun-row:last-child { border-bottom: none; }
.dayun-seg { width: 58px; color: #a08a70; font-size: 12px; flex-shrink: 0; }
.dayun-main { width: 84px; color: #8b4513; font-weight: bold; flex-shrink: 0; }
.dayun-years { display: flex; gap: 3px; flex-wrap: wrap; }
.dayun-y {
  background: #fdf6ec;
  border: 1px solid #e8d5bb;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 11px;
  color: #666;
}

.xiaoyun-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}
.xy-cell {
  background: #fdf6ec;
  border: 1px solid #e8d5bb;
  border-radius: 5px;
  padding: 3px 5px;
  font-size: 11px;
  text-align: center;
  color: #666;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .header-inner { padding: 14px 16px; }
  main { padding: 14px 12px 32px; }
  .row { flex-direction: column; gap: 0; }
  .xiaoyun-grid { grid-template-columns: repeat(4, 1fr); }
}
