:root {
  --ink: #1a1714;
  --ink-soft: #3d3832;
  --paper: #f7f3ea;
  --paper-deep: #efe8da;
  --paper-card: rgba(255, 255, 255, 0.88);
  --cinnabar: #e23b2a;
  --cinnabar-bright: #ff4d3a;
  --cinnabar-soft: rgba(226, 59, 42, 0.12);
  /* 日历模块：偏亮朱砂（避免过暗，也不刺眼） */
  --cal-red: #d45342;
  --cal-red-deep: #b84034;
  --cal-red-mid: #c94a3c;
  --cal-red-soft: rgba(196, 70, 55, 0.12);
  --cal-red-text: #c44738;
  --jade: #0f8a6b;
  --jade-soft: rgba(15, 138, 107, 0.12);
  --gold: #d4a017;
  --gold-soft: rgba(212, 160, 23, 0.18);
  /* 干支五行色：金深黄、土棕、木深绿、火深红、水蓝 */
  --wx-metal: var(--gold);
  --wx-earth: #8b5a2b;
  --wx-wood: #1f6b35;
  --wx-fire: var(--cinnabar);
  --wx-water: #2f5d8c;
  --mist: rgba(26, 23, 20, 0.52);
  --line: rgba(26, 23, 20, 0.12);
  --shadow: rgba(26, 23, 20, 0.14);
  --font-display: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", serif;
  --font-body: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --radius: 6px;
  --max: 1120px;
  --header-bg: rgba(255, 255, 255, 0.82);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(226, 59, 42, 0.16), transparent 55%),
    radial-gradient(780px 480px at 92% 4%, rgba(15, 138, 107, 0.14), transparent 50%),
    radial-gradient(640px 400px at 50% 100%, rgba(212, 160, 23, 0.1), transparent 55%),
    linear-gradient(168deg, #fffdf8 0%, var(--paper) 42%, #f0ebe0 100%);
  line-height: 1.7;
  overflow-x: hidden;
}

.ink-wash {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.28'/%3E%3C/svg%3E");
  opacity: 0.045;
  z-index: 0;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  padding-top: calc(0.85rem + env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 8px 28px -20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 1;
  min-width: 0;
}

.auth-inline {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.auth-btn-compact {
  padding: 0.25rem 0.55rem;
  min-height: 2rem;
  font-size: 0.8rem;
}

.brand-seal {
  width: 2.55rem;
  height: 2.55rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--cinnabar);
  color: #fff;
  background: linear-gradient(145deg, var(--cinnabar-bright), var(--cinnabar));
  font-family: var(--font-display);
  font-size: 1.4rem;
  transform: rotate(-6deg);
  border-radius: 4px;
  box-shadow: 0 6px 16px -8px rgba(226, 59, 42, 0.55);
  animation: seal-in 0.8s ease both;
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.16em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  flex: 1;
  justify-content: center;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  border-bottom: 2px solid transparent;
  padding-bottom: 0.15rem;
  transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--cinnabar);
  border-bottom-color: var(--cinnabar);
}

.nav-toggle {
  display: none;
  background: var(--cinnabar);
  border: 1px solid var(--cinnabar);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius);
  line-height: 1.2;
}

.auth-slot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-left: auto;
}

.auth-user {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.auth-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  min-height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-panel,
.auth-lock-panel {
  max-width: 26rem;
  margin: 0 auto;
  padding: 1.15rem 1.1rem 1.25rem;
}

.auth-lock-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  text-align: center;
}

.auth-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.auth-step {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--mist);
  letter-spacing: 0.1em;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.85rem;
}

.auth-step.active {
  color: var(--cinnabar);
  border-color: rgba(226, 59, 42, 0.4);
  background: var(--cinnabar-soft);
  font-weight: 600;
}

#register-step-phone,
#register-step-password {
  display: grid;
  gap: 0.75rem;
}

/* ID 选择器会盖掉浏览器默认的 [hidden]{display:none}，须显式隐藏 */
#register-step-phone[hidden],
#register-step-password[hidden] {
  display: none !important;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.auth-tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--mist);
  font: inherit;
  letter-spacing: 0.1em;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.auth-tab.active {
  color: var(--cinnabar);
  border-color: rgba(226, 59, 42, 0.4);
  background: var(--cinnabar-soft);
  font-weight: 600;
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--mist);
}

.auth-form input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
}

.auth-msg {
  margin: 0;
  font-size: 0.88rem;
  color: var(--cinnabar);
  letter-spacing: 0.04em;
}

.auth-msg.ok {
  color: var(--jade);
}

.auth-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--mist);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.auth-hint a {
  color: var(--jade);
}

.auth-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: stretch;
}

.auth-code-row input {
  min-width: 0;
}

.auth-code-row .btn {
  white-space: nowrap;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

/* —— 滑动拼图（固定 300×220，与 go-captcha 主图坐标系 1:1） —— */
.slide-captcha-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(28, 25, 23, 0.45);
  box-sizing: border-box;
}

.slide-captcha-dialog {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 1rem 1rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--paper);
  box-shadow: 0 12px 40px var(--shadow);
}

.slide-captcha-dialog-cancel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.slide-captcha-dialog-cancel:hover {
  border-color: rgba(15, 138, 107, 0.35);
  color: var(--jade);
}

.slide-captcha {
  display: grid;
  gap: 0.55rem;
  width: 300px;
  max-width: 100%;
}

.slide-captcha-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.slide-captcha-title {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--mist);
}

.slide-captcha-refresh {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.slide-captcha-refresh:hover:not(:disabled) {
  border-color: rgba(15, 138, 107, 0.35);
  color: var(--jade);
}

.slide-captcha-refresh:disabled {
  opacity: 0.55;
  cursor: wait;
}

.slide-captcha-stage {
  position: relative;
  width: 300px;
  height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-deep);
  user-select: none;
  touch-action: none;
  box-sizing: content-box;
}

.slide-captcha-master {
  display: block;
  width: 300px;
  height: 220px;
  vertical-align: top;
  pointer-events: none;
}

.slide-captcha-tile {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px var(--shadow));
}

.slide-captcha-track {
  position: relative;
  width: 300px;
  height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  touch-action: none;
  box-sizing: border-box;
}

.slide-captcha-track-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--mist);
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.slide-captcha-thumb {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.35rem;
  height: 100%;
  border: none;
  border-right: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(180deg, #fff 0%, var(--paper) 100%);
  box-shadow: 1px 0 4px var(--shadow);
  cursor: grab;
  touch-action: none;
}

.slide-captcha-thumb::after {
  content: "››";
  display: block;
  text-align: center;
  line-height: 2.35rem;
  font-size: 0.95rem;
  letter-spacing: -0.08em;
  color: var(--jade);
}

.slide-captcha-thumb.is-dragging,
.slide-captcha-thumb:active {
  cursor: grabbing;
  background: var(--jade-soft);
}

.slide-captcha-status {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--mist);
}

.slide-captcha-status--err {
  color: var(--cinnabar);
}

.slide-captcha-status--ok {
  color: var(--jade);
}

/* —— 意见反馈 —— */
.feedback-fab-group {
  position: fixed;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.feedback-fab {
  min-width: 3.4rem;
  min-height: 3.4rem;
  padding: 0.65rem 0.85rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(145deg, var(--cinnabar-bright), var(--cinnabar));
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  font-weight: 600;
  box-shadow: 0 10px 28px -10px rgba(226, 59, 42, 0.65);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.22s ease;
}

.feedback-fab-list {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  padding: 0.55rem 0.8rem;
  min-height: 2.6rem;
}

.feedback-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 32px -10px rgba(226, 59, 42, 0.75);
}

body.feedback-open .feedback-fab-group {
  opacity: 0;
  pointer-events: none;
}

.feedback-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: center;
}

.feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(26, 23, 20, 0.45);
  backdrop-filter: blur(4px);
}

.feedback-modal[hidden] {
  display: none;
}

.feedback-dialog {
  width: min(100%, 26rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 24px 48px -24px var(--shadow);
  padding: 1rem 1.1rem 1.15rem;
}

.feedback-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.feedback-dialog-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.feedback-close {
  border: none;
  background: transparent;
  color: var(--mist);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.feedback-desc {
  margin: 0 0 0.75rem;
  font-size: 0.86rem;
  color: var(--mist);
  letter-spacing: 0.04em;
}

.feedback-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 0.65rem 0.7rem;
  box-sizing: border-box;
}

.feedback-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.45rem 0 0.75rem;
  min-height: 1.4rem;
}

.feedback-meta #feedback-count {
  font-size: 0.8rem;
  color: var(--mist);
  letter-spacing: 0.04em;
}

.feedback-meta #feedback-count.over {
  color: var(--cinnabar);
}

body.feedback-open {
  overflow: hidden;
}

/* 我的反馈列表 */
.feedback-page {
  animation: rise 0.45s ease both;
  max-width: 42rem;
}

.feedback-page-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.feedback-page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  letter-spacing: 0.12em;
  font-weight: 400;
}

.feedback-page-sub {
  margin: 0 0 1.15rem;
  color: var(--mist);
  font-size: 0.9rem;
}

.feedback-list {
  display: grid;
  gap: 0.9rem;
}

.feedback-item {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem 1.05rem;
  box-shadow: 0 10px 28px -22px var(--shadow);
}

.feedback-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.55rem;
}

.feedback-item-time {
  font-size: 0.8rem;
  color: var(--mist);
  letter-spacing: 0.02em;
}

.feedback-status {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--mist);
  background: rgba(255, 255, 255, 0.55);
}

.feedback-status.is-pending {
  color: #8a6a2f;
  border-color: rgba(180, 140, 60, 0.35);
  background: rgba(240, 210, 140, 0.22);
}

.feedback-status.is-processing {
  color: #2f5f8a;
  border-color: rgba(70, 130, 180, 0.35);
  background: rgba(160, 200, 235, 0.22);
}

.feedback-status.is-resolved {
  color: #2a5a3c;
  border-color: rgba(60, 140, 90, 0.35);
  background: rgba(160, 210, 170, 0.25);
}

.feedback-status.is-closed {
  color: var(--mist);
  opacity: 0.9;
}

.feedback-item-content {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.feedback-conversation {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.feedback-opener {
  margin-top: 0.15rem;
}

.feedback-thread-divider {
  height: 0;
  margin: 0.35rem 0 0.15rem;
  border: 0;
  border-top: 1px dashed rgba(42, 37, 32, 0.28);
}

.feedback-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0;
}

.feedback-bubble {
  max-width: min(92%, 34rem);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  box-sizing: border-box;
  min-width: 0;
}

.feedback-bubble.is-staff {
  align-self: flex-start;
  background: linear-gradient(165deg, rgba(15, 138, 107, 0.1), rgba(15, 138, 107, 0.04));
  border: 1px solid rgba(15, 138, 107, 0.22);
  border-left: 3px solid var(--jade);
  border-radius: 4px 10px 10px 10px;
}

.feedback-bubble.is-me {
  align-self: flex-end;
  background: linear-gradient(165deg, rgba(226, 59, 42, 0.08), rgba(255, 253, 248, 0.9));
  border: 1px solid rgba(226, 59, 42, 0.18);
  border-right: 3px solid var(--cinnabar);
  border-radius: 10px 4px 10px 10px;
}

.feedback-reply-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  font-family: var(--font-display);
}

.feedback-bubble.is-staff .feedback-role {
  color: var(--jade);
}

.feedback-bubble.is-me .feedback-role {
  color: var(--cinnabar);
}

.feedback-bubble-time {
  color: var(--mist);
  letter-spacing: 0;
  font-family: var(--font-body);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.feedback-reply-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.65;
  color: var(--ink);
  font-size: 0.95rem;
}

/* 兼容旧 class，避免别处引用失效 */
.feedback-reply {
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--cinnabar);
  background: rgba(226, 59, 42, 0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.feedback-reply-empty {
  margin-top: 0.65rem;
  font-size: 0.84rem;
  color: var(--mist);
}

.feedback-followup {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.feedback-followup-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  resize: vertical;
  font: inherit;
  line-height: 1.5;
}

.feedback-followup-input:focus {
  outline: none;
  border-color: rgba(226, 59, 42, 0.45);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.feedback-followup .feedback-form-actions {
  margin-top: 0.55rem;
  justify-content: flex-end;
}

.btn.sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.feedback-empty,
.feedback-loading,
.feedback-error {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--mist);
  background: var(--paper-card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.feedback-error {
  color: var(--cinnabar);
  border-style: solid;
}

.feedback-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.feedback-pager-info {
  font-size: 0.85rem;
  color: var(--mist);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.5rem 3rem;
  min-height: calc(100vh - 10rem);
}

.boot-fallback {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--mist);
  letter-spacing: 0.08em;
}

.site-footer {
  text-align: center;
  padding: 1.75rem 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--mist);
  background: rgba(255, 255, 255, 0.45);
}

.site-footer .muted {
  margin-top: 0.25rem;
  opacity: 0.8;
}

.site-footer .beian {
  margin-top: 0.55rem;
  font-size: 0.78rem;
}

.site-footer .beian a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #666;
  text-decoration: none;
  line-height: 1;
}

.site-footer .beian a:hover {
  color: var(--ink-soft);
  text-decoration: underline;
}

.site-footer .beian-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
  object-fit: contain;
}

.site-footer .footer-company {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.site-footer .footer-links {
  margin: 0.45rem 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.site-footer .footer-links a {
  color: var(--jade);
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 138, 107, 0.3);
}

.site-footer .footer-links a:hover {
  color: var(--cinnabar);
  border-bottom-color: rgba(226, 59, 42, 0.4);
}

.site-footer .footer-contact {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
}

.site-footer .footer-contact a {
  color: var(--jade);
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 138, 107, 0.3);
}

.site-footer .footer-contact a:hover {
  color: var(--cinnabar);
  border-bottom-color: rgba(226, 59, 42, 0.4);
}

/* Landing / About */
.landing {
  max-width: 38rem;
  margin: 0 auto;
  padding: 2.25rem 0 2.5rem;
  text-align: center;
  animation: rise 0.85s ease both;
}

.landing-hero {
  display: grid;
  justify-items: center;
  gap: 0.95rem;
  padding: 1.25rem 0 1.75rem;
}

.landing-eyebrow {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  color: var(--cinnabar);
}

.landing .hero-brand {
  text-align: center;
}

.landing .hero-lead {
  max-width: 30rem;
  margin: 0 auto;
  text-align: center;
  line-height: 1.85;
}

.landing .hero-actions {
  justify-content: center;
  margin-top: 0.55rem;
}

.landing-block {
  margin-top: 2.35rem;
  padding-top: 1.85rem;
  border-top: 1px solid var(--line);
}

.landing-block .section-title {
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  text-align: center;
}

.landing-text {
  max-width: 32rem;
  margin: 0 auto 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.85;
}

.landing-list {
  margin: 0.85rem auto 0;
  padding: 0;
  max-width: 28rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.55rem;
  list-style: none;
  text-align: center;
}

.landing-list li {
  position: relative;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 23, 20, 0.06);
}

.landing-meta {
  margin: 0.85rem auto 0;
  max-width: 28rem;
  display: grid;
  gap: 0.75rem;
  text-align: center;
}

.landing-meta > div {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

.landing-meta dt {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--mist);
}

.landing-meta dd {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.landing-meta a {
  color: var(--jade);
}

.landing-note {
  margin: 1.25rem auto 0;
  max-width: 28rem;
  color: var(--mist);
  font-size: 0.92rem;
  text-align: center;
}

.landing-note a {
  color: var(--jade);
}

.privacy-page {
  width: 100%;
  max-width: none;
  margin-top: 1.25rem;
}

.privacy-page .section-desc {
  max-width: none;
}

.privacy-panel {
  padding: 1.6rem clamp(1.35rem, 3.5vw, 2.75rem) 2rem;
}

body.legal-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.legal-layout main {
  flex: 1 0 auto;
}

body.legal-layout .site-footer.legal-footer-beian-only {
  margin-top: auto;
  padding-top: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}

body.legal-layout .site-footer.legal-footer-beian-only .beian {
  margin: 0;
}

body.legal-layout .site-header,
body.legal-layout main,
body.legal-layout .site-footer {
  max-width: none;
  width: 100%;
}

body.legal-layout .site-header {
  border-radius: 0;
}

.privacy-panel h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  margin: 1.35rem 0 0.45rem;
  color: var(--ink);
}

.privacy-panel p,
.privacy-panel li {
  color: var(--ink-soft);
}

.privacy-panel a {
  color: var(--jade);
}

.privacy-panel ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.35rem;
}

/* Hero / Home */
.hero {
  min-height: calc(100vh - 7rem);
  display: grid;
  align-content: center;
  gap: 1.25rem;
  padding: 2rem 0 1rem;
  animation: rise 0.9s ease both;
}

.hero.hero-compact {
  min-height: 0;
  padding: 1.5rem 0 0.5rem;
  align-content: start;
  gap: 0.85rem;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: 0.16em;
  margin: 0;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hero-lead {
  max-width: 32rem;
  margin: 0;
  font-size: 1.12rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.15rem;
}

.hero-links a {
  color: var(--jade);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(15, 138, 107, 0.35);
  transition: color 0.2s, border-color 0.2s;
}

.hero-links a:hover {
  color: var(--cinnabar);
  border-bottom-color: rgba(226, 59, 42, 0.45);
}

.btn {
  appearance: none;
  border: 1px solid var(--cinnabar);
  background: linear-gradient(165deg, var(--cinnabar-bright), var(--cinnabar));
  color: #fffaf8;
  padding: 0.72rem 1.4rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px -12px rgba(226, 59, 42, 0.65);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 12px 24px -12px rgba(226, 59, 42, 0.7);
}

.btn.ghost {
  background: transparent;
  color: var(--cinnabar);
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
  filter: none;
}

.section {
  margin-top: 2.5rem;
  animation: rise 0.7s ease both;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  letter-spacing: 0.12em;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.section-desc {
  margin: 0 0 1.5rem;
  color: var(--mist);
  max-width: 36rem;
}

.section-calendar {
  margin-top: 1.25rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.section-head .section-desc {
  margin-bottom: 1rem;
}

/* Calendar / 黄历风格 */
.section-calendar {
  margin-top: 1.25rem;
}

.almanac {
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px -24px var(--shadow);
  overflow: hidden;
}

.almanac-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(165deg, var(--cal-red-mid) 0%, var(--cal-red-deep) 100%);
  color: #f7f0ec;
}

.almanac-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.12em;
  font-weight: 400;
  min-width: 8rem;
  text-align: center;
}

.icon-btn.light {
  border-color: rgba(247, 240, 236, 0.4);
  color: #f7f0ec;
}

.icon-btn.light:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.almanac-today {
  margin-left: 0.35rem;
  border: none;
  background: #f7f0ec;
  color: var(--cal-red-text);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  border-radius: 4px;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.28);
}

.almanac-today:hover {
  background: #fff;
}

.almanac-week {
  padding: 0.55rem 0.4rem 0.2rem;
  background: #fff;
}

.almanac-week .weekend {
  color: var(--cal-red-text);
}

.almanac-grid {
  padding: 0.35rem 0.4rem 0.75rem;
  gap: 0.15rem;
  background: #fff;
}

.day-cell {
  position: relative;
  min-height: 3.6rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 0.3rem 0.2rem;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-body);
  color: var(--ink);
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.day-cell:hover {
  background: var(--cal-red-soft);
}

.day-cell.muted {
  opacity: 0.28;
}

.day-cell.weekend .solar {
  color: var(--cal-red-text);
}

.day-cell.off-day .solar {
  color: var(--cal-red-text);
}

.day-cell.work-day .solar {
  color: var(--ink);
}

.day-badge {
  position: absolute;
  top: 0.15rem;
  right: 0.15rem;
  font-style: normal;
  font-size: 0.58rem;
  line-height: 1;
  padding: 0.12rem 0.18rem;
  border-radius: 2px;
  font-weight: 700;
}

.day-badge.off {
  color: #fff;
  background: var(--cal-red-text, #c0392b);
}

.day-badge.work {
  color: #fff;
  background: #4a5568;
}

.day-cell.today {
  border-color: rgba(154, 52, 40, 0.4);
}

.day-cell.selected {
  border-color: var(--gold);
  background: var(--cal-red-soft);
  box-shadow: 0 0 0 2px var(--gold-soft);
}

.day-cell .solar {
  display: block;
  font-size: calc(1.05rem + 4px);
  font-weight: 700;
  line-height: 1.2;
}

.day-cell .lunar {
  display: block;
  margin-top: 0.12rem;
  font-size: calc(0.68rem + 2px);
  color: var(--mist);
  line-height: 1.2;
}

.day-cell .lunar.fest {
  color: var(--cal-red-text);
}

.almanac-detail {
  padding: 1.15rem 1.25rem 1.4rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #faf6ee 100%);
  box-shadow: none;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}

.almanac-lunar-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.6rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  margin: 0 0 0.25rem;
  color: var(--ink);
}

.almanac-bullets {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.almanac-bullets li {
  position: relative;
  padding-left: 0.95rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.almanac-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--mist);
}

.almanac-bullets li.hot,
.almanac-bullets li.hot a {
  color: var(--cal-red-text);
}

.almanac-bullets li.hot::before {
  background: var(--cal-red);
}

.almanac-bullets a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.almanac-ganz {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
  background: var(--cal-red-soft);
  border: 1px solid rgba(154, 52, 40, 0.22);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.almanac-ganz strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  font-weight: 400;
}

.almanac-yiji {
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.almanac-yiji .yi,
.almanac-yiji .ji {
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: var(--radius);
}

.almanac-yiji .yi {
  background: var(--jade-soft);
}

.almanac-yiji .ji {
  background: var(--cal-red-soft);
}

.almanac-yiji .ji strong {
  color: var(--cal-red-text);
}

.almanac-yiji p {
  margin: 0;
  line-height: 1.7;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.calendar-shell {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.calendar-panel,
.day-detail,
.panel,
.book-list article,
.result-panel {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px -24px var(--shadow);
  backdrop-filter: blur(8px);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.calendar-toolbar h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  border-radius: var(--radius);
}

.icon-btn:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.weekday-row,
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.weekday-row {
  padding: 0.6rem 0.5rem 0;
  color: var(--mist);
  font-size: 0.8rem;
  text-align: center;
  letter-spacing: 0.08em;
}

.day-detail {
  padding: 1.25rem 1.35rem;
}

.day-detail h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.1em;
}

.day-sub {
  margin: 0 0 0.85rem;
  color: var(--mist);
  font-size: 0.9rem;
}

.hour-field {
  margin: 0.85rem 0 1rem;
}

.hour-field select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
}

.gz-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin: 0.25rem 0 0.35rem;
}

.gz-cell {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.55rem 0.25rem;
  text-align: center;
}

.gz-label {
  display: block;
  font-size: 0.72rem;
  color: var(--mist);
  letter-spacing: 0.1em;
}

.gz-cell strong {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  font-weight: 400;
}

.hour-note {
  margin: 0 0 0.85rem;
}

.almanac-hours {
  margin: 0 0 0.9rem;
}

.almanac-hours-title {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--mist);
  margin-bottom: 0.35rem;
}

.almanac-hours-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.3rem;
}

.almanac-hour {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.3rem 0.15rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  line-height: 1.2;
}

.almanac-hour b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.almanac-hour i {
  font-style: normal;
  font-size: 0.68rem;
}

.almanac-hour em {
  font-style: normal;
  color: var(--mist);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}

.almanac-hour.ji i {
  color: #0f8a6b;
}

.almanac-hour.xiong i {
  color: var(--cinnabar);
}

.almanac-hour.on {
  box-shadow: inset 0 0 0 1.5px var(--cinnabar);
  background: rgba(226, 59, 42, 0.07);
}

.liuyao-method-hint {
  line-height: 1.55;
  color: var(--mist);
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.4rem;
  font-size: 0.92rem;
}

.meta-list span:last-child {
  color: var(--ink-soft);
  text-align: right;
}

.yi-ji {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.1rem;
}

.yi-ji div {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}

.yi-ji strong {
  display: block;
  margin-bottom: 0.35rem;
  letter-spacing: 0.12em;
}

.yi-ji .yi strong { color: var(--jade); }
.yi-ji .ji strong { color: var(--cinnabar); }

/* Books */
.book-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 0 0 1.15rem;
}

.book-tab {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.book-tab:hover {
  border-color: var(--gold);
  color: var(--ink);
  background: #fff;
}

.book-tab.active {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  box-shadow: 0 0 0 1px var(--gold-soft);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.book-card {
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px -22px var(--shadow);
  text-align: left;
  font-family: var(--font-body);
  color: var(--ink);
  text-decoration: none;
  display: block;
}

.book-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 16px 32px -20px var(--shadow);
}

.book-card .tag,
.book-reader .tag {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--jade);
  margin-bottom: 0.5rem;
  padding: 0.12rem 0.45rem;
  background: var(--jade-soft);
  border-radius: 4px;
}

.book-reader-meta {
  min-width: 0;
}

.book-reader-meta .tag {
  margin-bottom: 0.25rem;
}

.book-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.08em;
}

.book-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--mist);
}

.book-reader {
  display: none;
  margin-top: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px -24px var(--shadow);
  animation: rise 0.45s ease both;
}

.book-reader.open {
  display: block;
}

.book-reader header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.book-reader h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.8rem;
}

/* 独立阅读页 */
.book-page {
  animation: rise 0.45s ease both;
  padding-bottom: 3rem;
}

.book-page-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 4.25rem;
  z-index: 5;
  background: rgba(247, 243, 234, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
  padding-top: 0.45rem;
}

.book-back {
  flex-shrink: 0;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}

.book-page-meta {
  min-width: 0;
  flex: 1;
}

.book-page-meta .tag {
  margin-bottom: 0.25rem;
}

.book-page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 5vw, 2.1rem);
  letter-spacing: 0.1em;
  line-height: 1.25;
}

.book-page-sub {
  margin: 0 0 1.15rem;
  color: var(--mist);
  font-size: 0.92rem;
  line-height: 1.55;
}

.book-resume-hint {
  color: var(--jade);
}

.book-page-body {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px -24px var(--shadow);
  padding: 1.15rem 1.25rem 1.75rem;
}

.book-reader-body {
  display: block;
}

.book-reader-body.has-toc {
  display: grid;
  grid-template-columns: minmax(10rem, 14rem) 1fr;
  gap: 1rem;
  align-items: start;
}

.book-toc {
  position: sticky;
  top: 5.5rem;
  max-height: min(70vh, 42rem);
  overflow: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0.65rem 0.7rem;
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.book-toc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--line);
}

.book-toc-head strong {
  font-family: var(--font-display);
  letter-spacing: 0.1em;
  color: var(--cinnabar);
  font-size: 0.95rem;
}

.book-toc-toggle {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mist);
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  font-family: var(--font-body);
  border-radius: 4px;
}

.book-toc-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.82rem;
  line-height: 1.65;
}

.book-toc-list li {
  margin: 0.15rem 0;
}

.book-toc-list a,
.book-toc-entry a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.book-toc-list a:hover,
.book-toc-entry a:hover {
  color: var(--cinnabar);
  border-bottom-color: rgba(226, 59, 42, 0.35);
}

.book-toc.collapsed .book-toc-list {
  display: none;
}

.book-reader .content,
.book-page .content {
  white-space: pre-wrap;
  font-size: 1.05rem;
  line-height: 2;
  color: var(--ink-soft);
  -webkit-overflow-scrolling: touch;
}

.book-page .content {
  max-height: none;
  overflow: visible;
}

.book-reader .content {
  max-height: min(70vh, 42rem);
  overflow: auto;
}

.book-reader .content.is-html,
.book-page .content.is-html {
  white-space: normal;
}

.book-line {
  margin: 0 0 0.35rem;
  line-height: 1.95;
}

.book-toc-label {
  font-family: var(--font-display);
  color: var(--cinnabar);
  letter-spacing: 0.12em;
  margin: 0.75rem 0 0.35rem;
}

.book-chapter {
  margin: 1.25rem 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--cinnabar);
  /* 顶栏 + 书名 sticky 条，避免跳转后标题被挡住 */
  scroll-margin-top: 8.5rem;
}

.book-chapter.chapter-flash {
  animation: chapter-flash 1.1s ease;
}

@keyframes chapter-flash {
  0%,
  100% {
    background: transparent;
  }
  30% {
    background: rgba(226, 59, 42, 0.12);
  }
}

/* Forms / Paipan */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  padding: 1.25rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.field input,
.field select {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  border-radius: var(--radius);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--mist);
}

.bazi-head {
  margin-bottom: 1rem;
}

.bazi-title {
  margin: 0;
  font-size: 1.05rem;
}

.bazi-meta {
  margin: 0.25rem 0 0;
  color: var(--mist);
  font-size: 0.9rem;
}

/* —— 八字专业盘面 —— */
.bz-sheet {
  --line: rgba(26, 23, 20, 0.055);
  font-size: 0.9rem;
}

.bazi-form-panel,
.bz-reverse-panel {
  --line: rgba(26, 23, 20, 0.055);
}

.bz-meta {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.85rem;
  color: var(--ink);
  font-weight: 700;
}

.bz-meta-row {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.bz-meta-row:last-child {
  border-bottom: 0;
}

.bz-k {
  color: var(--mist);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.bz-kong {
  color: var(--mist);
  margin-left: 0.25rem;
}

.bz-kong em {
  color: var(--cinnabar);
  font-style: normal;
  font-weight: 600;
}

.bz-chart {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  grid-template-rows: repeat(6, auto);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.bz-side,
.bz-main {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 1 / span 6;
}

.bz-side-cell,
.bz-row {
  border-bottom: 1px solid var(--line);
  min-height: 2rem;
  display: grid;
  align-items: center;
}

.bz-side-cell:last-child,
.bz-row:last-child {
  border-bottom: 0;
}

.bz-side-cell {
  padding: 0.35rem 0.25rem;
  text-align: center;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(18, 16, 14, 0.04);
  border-right: 1px solid var(--line);
}

.bz-side-cell.bz-side-gender {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.bz-side-cell.tall,
.bz-row.tall {
  min-height: 3.4rem;
}

.bz-side-cell.cang,
.bz-row.cang {
  min-height: 3.2rem;
}

.bz-side-cell.cang {
  padding: 0.2rem 0.25rem;
}

.bz-row.cang .bz-cell {
  padding: 0.2rem 0.15rem;
}

.bz-side-cell.compact,
.bz-row.compact {
  min-height: 1.2rem;
}

.bz-row.compact .bz-cell {
  padding: 0.06rem 0.15rem;
}

.bz-side-cell.compact {
  padding: 0.06rem 0.25rem;
}

.bz-row.compact .bz-ss,
.bz-row.compact .bz-sub {
  font-size: 0.76rem;
  line-height: 1.2;
}

.bz-main .bz-row {
  grid-template-columns: repeat(4, 1fr);
}

.bz-cell {
  text-align: center;
  padding: 0.3rem 0.15rem;
  border-right: 1px solid var(--line);
}

.bz-cell:last-child {
  border-right: 0;
}

.bz-plabel {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.1em;
}

.bz-ss {
  color: #2f5d8c;
  font-size: 0.82rem;
}

.bz-ss.muted {
  color: var(--mist);
}

.bz-ss-master {
  color: var(--cinnabar);
  font-weight: 700;
  font-size: 0.95rem;
}

.bz-row.compact .bz-ss.bz-ss-master {
  font-size: 0.92rem;
  font-weight: 700;
}

.bz-cang .bz-ss-master {
  font-size: 0.85rem;
  font-weight: 700;
}

.bz-gz {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02em;
  line-height: 1.05;
}

.bz-gan,
.bz-zhi {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.bz-cang {
  display: grid;
  gap: 0.08rem;
  font-size: 0.74rem;
  line-height: 1.2;
}

.bz-cang b {
  margin-right: 0.15rem;
  font-weight: 600;
}

.bz-cang small {
  color: var(--mist);
}

.bz-sub {
  color: var(--jade);
  font-size: 0.8rem;
}

/* 干支/藏干五行色（特异性高于 .bz-gan/.bz-zhi，避免被默认墨色覆盖） */
.wx-wood,
.bz-gan.wx-wood,
.bz-zhi.wx-wood { color: var(--wx-wood); }
.wx-fire,
.bz-gan.wx-fire,
.bz-zhi.wx-fire { color: var(--wx-fire); }
.wx-earth,
.bz-gan.wx-earth,
.bz-zhi.wx-earth { color: var(--wx-earth); }
.wx-metal,
.bz-gan.wx-metal,
.bz-zhi.wx-metal { color: var(--wx-metal); }
.wx-water,
.bz-gan.wx-water,
.bz-zhi.wx-water { color: var(--wx-water); }

.bz-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: rgba(18, 16, 14, 0.03);
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 700;
  margin-top: 0.85rem;
  margin-bottom: 0;
}

.bz-shensha {
  border: 1px solid var(--line);
  border-top: 0;
  margin-bottom: 0.85rem;
  background: rgba(255, 255, 255, 0.75);
}

.bz-ss-row {
  display: grid;
  grid-template-columns: 5rem 1fr;
  border-bottom: 1px solid var(--line);
  min-height: 2.1rem;
}

.bz-ss-row:last-child {
  border-bottom: 0;
}

.bz-ss-label {
  display: grid;
  place-items: center;
  background: rgba(18, 16, 14, 0.06);
  border-right: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.bz-ss-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.4rem 0.55rem;
}

.bz-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.85);
}

.bz-tag.kong {
  background: rgba(42, 37, 32, 0.72);
  color: #f4efe6;
  border-color: transparent;
}

.bz-tag.muted {
  color: var(--mist);
  border-style: dashed;
}

.bz-dayun-wrap {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  overflow-x: auto;
  margin-top: 0.85rem;
}

.bz-dayun-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.28rem 0.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 16, 14, 0.04);
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.bz-dayun-head-line {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.55rem;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}

.bz-dayun-head .note {
  margin: 0;
  font-size: 0.75rem;
}

.bz-dayun-head .bz-siling {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.bz-dayun-head .bz-dayun-kong {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.bz-dayun-head .bz-dayun-xusui {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.bz-dayun-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(4.6rem, 1fr));
  min-width: 40rem;
}

.bz-dy-col {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  text-align: center;
}

.bz-dy-col:last-child {
  border-right: 0;
}

.bz-dy-col.active {
  background: rgba(226, 59, 42, 0.05);
  box-shadow: inset 0 0 0 1px rgba(226, 59, 42, 0.18);
}

/* 触摸屏勿用 :hover 充当选中，避免粘滞后两列同时高亮 */
@media (hover: hover) and (pointer: fine) {
  .bz-dy-col:hover:not(.active) {
    background: rgba(226, 59, 42, 0.03);
  }
}

.bz-dy-top {
  padding: 0.4rem 0.2rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.1rem;
}

.bz-dy-gz {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.06em;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.04em;
  margin: 0.15rem 0;
}

.bz-dy-gz .wx-wood { color: var(--wx-wood); }
.bz-dy-gz .wx-fire { color: var(--wx-fire); }
.bz-dy-gz .wx-earth { color: var(--wx-earth); }
.bz-dy-gz .wx-metal { color: var(--wx-metal); }
.bz-dy-gz .wx-water { color: var(--wx-water); }

.bz-dy-age {
  color: var(--cinnabar);
  font-size: 0.8rem;
  font-weight: 600;
}

.bz-dy-year {
  font-size: 0.75rem;
  color: var(--ink);
  font-weight: 700;
}

.bz-dy-years {
  padding: 0.25rem 0;
}

.bz-ln {
  font-size: 0.78rem;
  padding: 0.18rem 0;
  color: var(--ink);
  font-weight: 700;
  border-bottom: 1px dashed rgba(42, 37, 32, 0.045);
}

.bz-dy-foot {
  padding: 0.35rem 0.2rem 0.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--ink);
  font-weight: 700;
}

.bazi-form-panel {
  position: relative;
  padding: 1rem 1rem 1.15rem;
}

.bz-reverse-panel {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1rem 1.15rem;
}

.bz-reverse-panel .sub-title {
  margin-top: 0.15rem;
}

.bz-reverse-hint {
  margin: 0 0 0.85rem;
  color: var(--mist);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  line-height: 1.55;
}

.bz-reverse-pillars,
.bz-reverse-range {
  display: grid;
  gap: 0.55rem 0.65rem;
  margin-bottom: 0.75rem;
}

.bz-reverse-pillars {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bz-reverse-pillar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.55rem 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.bz-reverse-pillar-label {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-align: center;
  font-weight: 600;
}

.bz-reverse-gz {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.bz-reverse-gz select {
  border-color: rgba(26, 23, 20, 0.16);
  background: rgba(255, 255, 255, 0.92);
}

.bz-reverse-range {
  grid-template-columns: repeat(2, minmax(0, 10rem));
}

.bz-reverse-form label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--mist);
}

.bz-reverse-form .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bz-reverse-form select,
.bz-reverse-form input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  padding: 0.45rem 0.35rem;
  border-radius: var(--radius);
  text-align: center;
}

.bz-reverse-list-head {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.bz-reverse-list {
  display: grid;
  gap: 0.45rem;
  max-height: 16rem;
  overflow-y: auto;
}

.bz-reverse-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.bz-reverse-item strong {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.bz-reverse-item span {
  font-size: 0.78rem;
  color: var(--mist);
}

.bz-reverse-item:hover,
.bz-reverse-item.active {
  border-color: rgba(226, 59, 42, 0.45);
  background: var(--cinnabar-soft);
}

.bz-reverse-empty {
  margin-top: 0.5rem;
  padding: 0.75rem 0.5rem;
}

.wheel-hint {
  margin: 0 0 0.75rem;
  text-align: center;
  color: var(--mist);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  line-height: 1.45;
}

.cal-mode-wrap {
  position: static;
  z-index: 1;
  margin: 0 0 0.55rem;
  display: flex;
  justify-content: flex-start;
}

.cal-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.12rem;
  width: 7.2rem;
  padding: 0.12rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px -10px var(--shadow);
}

.cal-mode-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--mist);
  border-radius: 999px;
  min-height: 1.35rem;
  padding: 0.12rem 0.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

.cal-mode-btn:not(.active):hover {
  color: var(--ink-soft);
  background: rgba(226, 59, 42, 0.06);
}

.cal-mode-btn.active {
  color: #fff;
  background: var(--cinnabar);
  border-color: rgba(180, 40, 28, 0.25);
  box-shadow: 0 3px 8px -6px rgba(226, 59, 42, 0.8);
  font-weight: 600;
}

.wheel-cal-note {
  margin: 0.15rem 0 0.65rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  line-height: 1.45;
}

.wheel-cal-note b {
  color: var(--cinnabar);
  font-weight: 600;
}

.cal-tag {
  display: inline-block;
  min-width: 2.4rem;
  padding: 0.08rem 0.45rem;
  margin-right: 0.25rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  vertical-align: 0.05em;
}

.cal-tag.solar {
  color: #fff;
  background: var(--cinnabar);
}

.cal-tag.lunar {
  color: #fff;
  background: #1f7a5c;
}

#date-wheels[data-cal="lunar"] .wheel-viewport {
  border-color: rgba(31, 122, 92, 0.35);
  background: rgba(31, 122, 92, 0.05);
}

#date-wheels[data-cal="lunar"] .wheel-highlight {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#date-wheels[data-cal="lunar"] .wheel-item.selected {
  color: #1f7a5c;
}

.wheel-picker {
  display: grid;
  grid-template-columns: 0.7fr 1.1fr 0.8fr 0.8fr 1.4fr;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.wheel-picker[style*="--wheel-cols:6"],
.wheel-picker.cols-6 {
  grid-template-columns: 0.65fr 1fr 0.75fr 0.75fr 1.15fr 0.7fr;
}

.wheel-picker[style*="--wheel-cols:5"],
.wheel-picker.cols-5 {
  grid-template-columns: 1.1fr 0.85fr 0.85fr 1.2fr 0.7fr;
}

.wheel-picker.cols-5g {
  grid-template-columns: 0.7fr 1.1fr 0.8fr 0.8fr 1.4fr;
}

.wheel-picker[style*="--wheel-cols:4"],
.wheel-picker.cols-4 {
  grid-template-columns: 1.2fr 0.9fr 0.9fr 1.5fr;
}

.wheel-extra {
  margin: 0.75rem 0 0.25rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
}

.birth-place-fields .true-solar-field {
  margin-bottom: 0.55rem;
}

.true-solar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}

.true-solar-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--cinnabar, #e23b2a);
}

.true-solar-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--mist);
  line-height: 1.45;
}

.place-geo-block {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

.place-geo-block[hidden],
.place-geo-block.place-geo-block--off {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

.place-row {
  grid-column: 1 / -1;
  min-width: 0;
}

.place-trigger {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.place-trigger:hover {
  border-color: var(--cinnabar, #e23b2a);
}

/* 经度、纬度各约 2/5，时区约 1/5 */
.place-coord-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.place-coord-row .field {
  min-width: 0;
  max-width: 100%;
}

.place-coord-row .field input {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.place-tz-field input {
  text-align: center;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.region-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.region-sheet[hidden] {
  display: none !important;
}

.region-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(28, 18, 12, 0.45);
}

.region-sheet-panel {
  position: relative;
  width: 100%;
  max-width: min(100vw, 32rem);
  box-sizing: border-box;
  background: #fffdf8;
  border-radius: 0.85rem 0.85rem 0 0;
  box-shadow: 0 -8px 28px rgba(40, 20, 10, 0.18);
  padding: 0.65rem max(0.75rem, env(safe-area-inset-right)) calc(1.1rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  z-index: 1;
  overflow: hidden;
}

.region-sheet-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 0.5rem;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.region-sheet-head strong {
  grid-column: 2;
  text-align: center;
  letter-spacing: 0.08em;
  font-size: 0.92rem;
  white-space: nowrap;
  pointer-events: none;
}

.region-sheet-btn {
  border: none;
  background: transparent;
  color: var(--mist);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 0.35rem 0;
  cursor: pointer;
  width: 3.2em;
  box-sizing: border-box;
}

.region-sheet-head .region-sheet-btn:first-child {
  justify-self: start;
  text-align: left;
}

.region-sheet-btn.primary {
  grid-column: 3;
  justify-self: end;
  text-align: right;
  color: var(--cinnabar, #e23b2a);
  font-weight: 600;
}

.region-sheet-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.region-action-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
}

.region-wheels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
}

.region-wheels .wheel-col {
  min-width: 0;
}

.region-wheels .wheel-item {
  font-size: 0.82rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.region-sheet-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .place-coord-row {
    grid-template-columns: 2fr 2fr 1fr;
    gap: 0.28rem;
  }

  .place-coord-row .field label {
    font-size: 0.72rem;
  }

  .place-coord-row .field input {
    padding: 0.45rem 0.28rem;
    font-size: 0.82rem;
  }

  .region-sheet-panel {
    max-width: 100vw;
    border-radius: 0.75rem 0.75rem 0 0;
  }
}

.wheel-col {
  min-width: 0;
}

.wheel-label {
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--mist);
  margin-bottom: 0.35rem;
}

.wheel-viewport {
  position: relative;
  height: 9.6rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  border-radius: 0.35rem;
  scroll-snap-type: y proximity;
}

.wheel-viewport::-webkit-scrollbar {
  display: none;
}

.wheel-highlight {
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  top: 50%;
  height: 2.85rem;
  transform: translateY(-50%);
  /* 选中只靠文字变色，高亮框保持透明，避免空白处出现红框占位 */
  border: 1.5px solid transparent;
  border-radius: 0.35rem;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  z-index: 1;
}

.wheel-highlight[hidden] {
  display: none;
}

.wheel-item {
  height: 2.85rem;
  display: grid;
  place-items: center;
  font-size: 0.88rem;
  color: rgba(90, 78, 68, 0.45);
  cursor: pointer;
  user-select: none;
  transition:
    color 0.14s ease,
    font-size 0.14s ease,
    font-weight 0.14s ease,
    transform 0.14s ease,
    opacity 0.14s ease;
  scroll-snap-align: center;
  position: relative;
  z-index: 2;
  letter-spacing: 0.04em;
}

.wheel-item.selected {
  color: var(--cinnabar);
  font-weight: 700;
  font-size: 1.22rem;
  transform: scale(1.06);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.wheel-item.pad {
  visibility: hidden;
  pointer-events: none;
}

.wheel-actions {
  padding: 0.35rem 0.25rem 0;
}

.sub-title {
  margin: 1.35rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.1em;
  font-weight: 400;
}

.dayun-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dayun-cell {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.65rem 0.35rem;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  display: grid;
  gap: 0.15rem;
  text-align: center;
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.dayun-cell:hover,
.dayun-cell.active {
  border-color: var(--gold);
  background: var(--cinnabar-soft);
  box-shadow: 0 0 0 1px var(--gold-soft);
}

.dy-gz {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.dy-meta,
.dy-age,
.dy-year {
  font-size: 0.75rem;
  color: var(--mist);
}

.liunian-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.liunian-cell {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  padding: 0.55rem 0.3rem;
  text-align: center;
}

.ln-year {
  font-size: 0.78rem;
  color: var(--mist);
}

.ln-gz {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  margin: 0.15rem 0;
}

.ln-age,
.ln-ss {
  font-size: 0.72rem;
  color: var(--mist);
}

.result-panel {
  margin-top: 1.25rem;
  padding: 1.25rem;
  min-height: 8rem;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  text-align: center;
}

.pillar {
  border: 1px solid var(--line);
  padding: 0.85rem 0.5rem;
  background: rgba(255, 255, 255, 0.75);
}

.pillar .label {
  font-size: 0.8rem;
  color: var(--mist);
  letter-spacing: 0.12em;
}

.pillar .ganzhi {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.12em;
  margin: 0.35rem 0;
}

.pillar .wuxing {
  font-size: 0.8rem;
  color: var(--jade);
}

.palace-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.palace {
  min-height: 6.5rem;
  border: 1px solid var(--line);
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.6);
  font-size: 0.82rem;
}

.palace .name {
  color: var(--cinnabar);
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: 0.08em;
}

.palace .stars {
  color: var(--ink-soft);
  line-height: 1.45;
}

/* ========== 紫微斗数盘 ========== */
.zw-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.zw-head {
  text-align: center;
}

.zw-summary {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.zw-sub {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--mist);
}

.zw-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "a b c d"
    "e z z f"
    "g z z h"
    "i j k l";
  gap: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  aspect-ratio: 1;
  max-width: 52rem;
  margin: 0 auto;
  width: 100%;
}

.zw-pos.a { grid-area: a; }
.zw-pos.b { grid-area: b; }
.zw-pos.c { grid-area: c; }
.zw-pos.d { grid-area: d; }
.zw-pos.e { grid-area: e; }
.zw-pos.f { grid-area: f; }
.zw-pos.g { grid-area: g; }
.zw-pos.h { grid-area: h; }
.zw-pos.i { grid-area: i; }
.zw-pos.j { grid-area: j; }
.zw-pos.k { grid-area: k; }
.zw-pos.l { grid-area: l; }
.zw-pos.z { grid-area: z; }

.zw-pos {
  min-height: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.zw-pos > .zw-cell,
.zw-pos > .zw-center {
  flex: 1;
  width: 100%;
}

.zw-pos.d,
.zw-pos.f,
.zw-pos.h,
.zw-pos.l {
  border-right: none;
}

.zw-pos.i,
.zw-pos.j,
.zw-pos.k,
.zw-pos.l {
  border-bottom: none;
}

.zw-cell {
  height: 100%;
  padding: 0.35rem 0.4rem;
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  line-height: 1.35;
  background: rgba(255, 255, 255, 0.5);
}

.zw-cell.is-ming {
  background: rgba(226, 59, 42, 0.06);
}

.zw-cell-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.zw-majors,
.zw-softs,
.zw-aux,
.zw-misc {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.2rem 0.28rem;
  max-width: 100%;
  min-width: 0;
}

.zw-softs {
  justify-content: flex-start;
}

.zw-age {
  flex-shrink: 0;
  font-size: 0.65rem;
  color: var(--mist);
  letter-spacing: 0;
}

.zw-aux {
  margin-top: 0.12rem;
}

.zw-misc {
  margin-top: 0.1rem;
  flex: 1;
  align-content: flex-start;
}

.zw-cell-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.2rem;
  margin-top: auto;
  padding-top: 0.15rem;
}

.zw-cs {
  font-size: 0.62rem;
  color: var(--mist);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.zw-foot-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.02rem;
  text-align: right;
}

.zw-ganzhi {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.zw-ganzhi em {
  font-style: normal;
  font-size: 0.72rem;
  margin-right: 0.05rem;
  opacity: 0.85;
}

.zw-pname {
  color: var(--cinnabar);
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
}

.zw-pname i {
  font-style: normal;
  margin-left: 0.15rem;
  font-size: 0.65rem;
  border: 1px solid var(--cinnabar);
  padding: 0 0.15rem;
}

.zw-star {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.02rem;
  white-space: nowrap;
  line-height: 1.15;
  max-width: 1.35em;
}

.zw-star-name {
  display: inline-block;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 0.06em;
  line-height: 1.05;
}

.zw-star.major {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--cinnabar);
}

.zw-star.minor {
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.zw-star.soft {
  font-size: 0.62rem;
  color: #2a5f8f;
  font-weight: 500;
}

.zw-star.boshi,
.zw-star.jiangqian {
  font-size: 0.58rem;
  color: var(--ink-soft);
}

.zw-star.lucky {
  color: var(--jade);
}

.zw-star.sha {
  color: #8a3a28;
}

.zw-star.shensha:not(.soft):not(.sha) {
  color: var(--mist);
}

.zw-bright {
  font-style: normal;
  font-size: 0.52rem;
  color: var(--mist);
  margin-left: 0;
  line-height: 1;
  writing-mode: horizontal-tb;
}

.zw-hua {
  font-style: normal;
  font-weight: 700;
  font-size: 0.52rem;
  margin-left: 0;
  line-height: 1;
  writing-mode: horizontal-tb;
}

.zw-star.hua-lu .zw-hua,
.hua-lu i,
span.hua-lu { color: #2f6b3a; }
.zw-star.hua-quan .zw-hua,
.hua-quan i,
span.hua-quan { color: #6b3a8a; }
.zw-star.hua-ke .zw-hua,
.hua-ke i,
span.hua-ke { color: #2f5d8c; }
.zw-star.hua-ji .zw-hua,
.hua-ji i,
span.hua-ji { color: var(--cinnabar); }

.zw-empty-star {
  color: var(--mist);
}

.zw-center {
  height: 100%;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(226, 59, 42, 0.07), transparent 60%),
    rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
}

.zw-center-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  color: var(--cinnabar);
}

.zw-center-row {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.zw-center-row span {
  color: var(--mist);
}

.zw-center-row strong {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.zw-center-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.zw-pillars {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.zw-sihua-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.zw-sihua-legend i {
  font-style: normal;
  margin-left: 0.1rem;
  font-size: 0.65rem;
}

.zw-flow {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.4rem;
  align-items: stretch;
  max-width: 52rem;
  margin: 0 auto;
  width: 100%;
}

.zw-flow-label {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  color: var(--cinnabar);
  letter-spacing: 0.1em;
}

.zw-flow-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
}

.zw-flow-cell {
  border: 1px solid var(--line);
  padding: 0.3rem 0.15rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  font-size: 0.7rem;
}

.zw-flow-cell.on {
  background: rgba(15, 138, 107, 0.12);
  border-color: rgba(15, 138, 107, 0.35);
}

.zw-flow-cell strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.zw-flow-cell em {
  font-style: normal;
  color: var(--mist);
  font-size: 0.62rem;
}

.zw-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  justify-content: center;
  align-items: center;
  font-size: 0.78rem;
}

.zw-legend .note-inline {
  color: var(--mist);
  font-size: 0.75rem;
}

.zw-modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.15rem 0 0.35rem;
}

.zw-mode-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  padding: 0.45rem 1.05rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.zw-mode-btn:hover {
  border-color: var(--gold);
  color: var(--ink);
  background: #fff;
}

.zw-mode-btn.active {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  box-shadow: 0 0 0 1px var(--gold-soft);
}

.zw-fly-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.75rem;
  font-size: 0.78rem;
  margin: 0.35rem 0 0.15rem;
}

.zw-fly-info i {
  font-style: normal;
  margin: 0 0.1rem;
  font-size: 0.68rem;
}

.zw-sanhe-linear {
  margin: 0.55rem 0 0.2rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.zw-sanhe-linear-label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--mist);
  margin-bottom: 0.4rem;
}

.zw-sanhe-linear-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.35rem;
}

.zw-sanhe-card {
  flex: 1 1 5.5rem;
  min-width: 5.2rem;
  max-width: 8.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 0.4rem 0.45rem;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.zw-sanhe-card em {
  display: block;
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.zw-sanhe-card strong {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

.zw-sanhe-card span {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

.zw-sanhe-card small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--ink-soft, var(--mist));
  line-height: 1.35;
}

.zw-sanhe-card.is-focus {
  box-shadow: inset 0 0 0 2px var(--cinnabar);
  background: rgba(226, 59, 42, 0.08);
}

.zw-sanhe-card.is-sanhe:not(.is-focus) {
  box-shadow: inset 0 0 0 1px rgba(15, 138, 107, 0.45);
}

.zw-sanhe-card.is-dui {
  box-shadow: inset 0 0 0 1px rgba(47, 93, 140, 0.55);
}

.zw-sanhe-sep {
  align-self: center;
  color: var(--mist);
  font-size: 0.85rem;
  padding: 0 0.1rem;
}

.zw-cell {
  position: relative;
  cursor: default;
}

.zw-board.mode-feixing .zw-cell,
.zw-board.mode-sanhe .zw-cell {
  cursor: pointer;
}

.zw-cell.hl-from {
  box-shadow: inset 0 0 0 2px var(--cinnabar);
  background: rgba(226, 59, 42, 0.1);
}

.zw-cell.hl-sanhe {
  box-shadow: inset 0 0 0 2px rgba(15, 138, 107, 0.65);
  background: rgba(15, 138, 107, 0.08);
}

.zw-cell.hl-dui {
  box-shadow: inset 0 0 0 2px rgba(47, 93, 140, 0.7);
  background: rgba(47, 93, 140, 0.08);
}

.zw-cell.hl-lu {
  box-shadow: inset 0 0 0 2px #2f6b3a;
  background: rgba(47, 107, 58, 0.1);
}

.zw-cell.hl-quan {
  box-shadow: inset 0 0 0 2px #6b3a8a;
  background: rgba(107, 58, 138, 0.1);
}

.zw-cell.hl-ke {
  box-shadow: inset 0 0 0 2px #2f5d8c;
  background: rgba(47, 93, 140, 0.1);
}

.zw-cell.hl-ji {
  box-shadow: inset 0 0 0 2px var(--cinnabar);
  background: rgba(226, 59, 42, 0.12);
}

.zw-hl-badge {
  position: absolute;
  top: 0.2rem;
  right: 0.25rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.25rem;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.92);
  line-height: 1.2;
}

.zw-star.shensha {
  font-size: 0.64rem;
  opacity: 0.92;
}

.zw-star.em-hua {
  font-weight: 700;
  transform: scale(1.05);
}

.zw-star.dim {
  opacity: 0.45;
}

/* ========== 大六壬课式 ========== */
.lr-sheet {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 40rem;
  margin: 0 auto;
}

.lr-head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  font-size: 0.95rem;
}

.lr-head-main strong {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.lr-tag {
  font-size: 0.75rem;
  color: var(--jade);
  border: 1px solid rgba(15, 138, 107, 0.35);
  padding: 0.05rem 0.35rem;
}

.lr-head-sub {
  font-size: 0.78rem;
  color: var(--mist);
}

.lr-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  text-align: center;
}

.lr-pillar {
  border: 1px solid var(--line);
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.68);
}

.lr-pillar small {
  display: block;
  color: var(--mist);
  font-size: 0.7rem;
}

.lr-pillar strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
}

.lr-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  font-size: 0.82rem;
}

.lr-params b {
  font-family: var(--font-display);
}

.lr-shensha {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px dashed rgba(42, 37, 32, 0.28);
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
}

.lr-nianming {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(226, 59, 42, 0.22);
  background: var(--cinnabar-soft);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.lr-nianming b {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  font-weight: 400;
}

.lr-nianming.muted {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.45);
  color: var(--mist);
}

.lr-center-nian {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--cinnabar);
}

.lr-nian {
  display: inline-block;
  margin-left: 0.15rem;
  font-style: normal;
  font-size: 0.58rem;
  line-height: 1;
  padding: 0.08rem 0.18rem;
  border-radius: 2px;
  vertical-align: middle;
}

.lr-benming {
  color: #fff;
  background: var(--cinnabar);
}

.lr-xingnian {
  color: #fff;
  background: var(--jade);
}

.lr-cell.is-benming {
  box-shadow: inset 0 0 0 1.5px rgba(226, 59, 42, 0.55);
  background: rgba(226, 59, 42, 0.08);
}

.lr-cell.is-xingnian {
  box-shadow: inset 0 0 0 1.5px rgba(15, 138, 107, 0.55);
  background: rgba(15, 138, 107, 0.08);
}

.lr-cell.is-benming.is-xingnian {
  box-shadow: inset 0 0 0 1.5px rgba(212, 160, 23, 0.7);
  background: linear-gradient(135deg, rgba(226, 59, 42, 0.1), rgba(15, 138, 107, 0.1));
}

.lr-leg-note {
  color: var(--mist);
  font-size: 0.72rem;
  margin-left: 0.35rem;
}

.lr-ss b {
  font-family: var(--font-display);
}

.lr-geju {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--mist);
  letter-spacing: 0.08em;
}

.lr-pan-module {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(10.5rem, 0.85fr);
  gap: 0.65rem 0.85rem;
  align-items: stretch;
  padding: 0.65rem 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 252, 245, 0.92), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* 高度以左侧天地盘为准，右侧三传+四课填满同高 */
.lr-pan-side {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  height: 0;
  min-height: 100%;
  overflow: hidden;
}

.lr-block {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  min-height: 0;
}

.lr-block-board {
  align-items: center;
}

.lr-block-chuan {
  flex: 1.2 1 0;
  overflow: hidden;
}

.lr-block-kes {
  flex: 0.95 1 0;
  overflow: hidden;
}

.lr-block-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  color: var(--cinnabar);
  text-align: center;
  padding: 0.22rem 0.35rem;
  border-bottom: 1px solid var(--gold-soft);
  background: linear-gradient(90deg, transparent, var(--cinnabar-soft), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  flex-shrink: 0;
}

.lr-chuan {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  max-width: none;
  margin: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.lr-chuan-col {
  text-align: left;
  border: 1px solid var(--line);
  padding: 0.18rem 0.35rem;
  background: rgba(255, 255, 255, 0.78);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.15rem 0.35rem;
  font-size: 0.72rem;
  flex: 1 1 0;
  min-height: 0;
}

.lr-chuan-mark {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.62rem;
  display: grid;
  place-items: center;
  color: var(--mist);
  flex-shrink: 0;
}

.lr-chuan-col strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0;
  text-align: center;
  justify-self: center;
}

.lr-chuan-col strong i {
  font-style: normal;
  font-size: 0.62rem;
  color: var(--mist);
}

.lr-jiang {
  color: var(--ink-soft);
  font-size: 0.7rem;
  text-align: right;
  white-space: nowrap;
}

.lr-ss-tag {
  color: var(--mist);
  font-size: 0.66rem;
  white-space: nowrap;
}

.lr-kes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.22rem;
  max-width: none;
  margin: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  align-content: stretch;
}

.lr-block-kes .lr-ke-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.lr-ke-col {
  text-align: center;
  border: 1px solid var(--line);
  padding: 0.2rem 0.08rem;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
}

.lr-ke-char {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.15;
}

.lr-ke-col small {
  color: var(--mist);
  font-size: 0.65rem;
}

.lr-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "a b c d"
    "e z z f"
    "g z z h"
    "i j k l";
  gap: 0;
  border: 1px solid var(--line);
  aspect-ratio: 1;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  background: #fffef9;
}

.lr-pos.a { grid-area: a; }
.lr-pos.b { grid-area: b; }
.lr-pos.c { grid-area: c; }
.lr-pos.d { grid-area: d; }
.lr-pos.e { grid-area: e; }
.lr-pos.f { grid-area: f; }
.lr-pos.g { grid-area: g; }
.lr-pos.h { grid-area: h; }
.lr-pos.i { grid-area: i; }
.lr-pos.j { grid-area: j; }
.lr-pos.k { grid-area: k; }
.lr-pos.l { grid-area: l; }
.lr-pos.z { grid-area: z; }

.lr-pos {
  min-height: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.lr-pos > .lr-cell,
.lr-pos > .lr-center {
  flex: 1;
  width: 100%;
}

.lr-pos.d,
.lr-pos.f,
.lr-pos.h,
.lr-pos.l {
  border-right: none;
}

.lr-pos.i,
.lr-pos.j,
.lr-pos.k,
.lr-pos.l {
  border-bottom: none;
}

.lr-cell {
  height: 100%;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  font-size: 0.78rem;
}

.lr-cell-j {
  color: var(--ink-soft);
  font-size: 0.72rem;
  position: relative;
  line-height: 1.2;
}

.lr-mark {
  position: absolute;
  right: -0.85rem;
  top: 0;
  font-style: normal;
  font-size: 0.58rem;
  width: 0.95rem;
  height: 0.95rem;
  border: 1px solid var(--mist);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cinnabar);
}

.lr-cell-tian {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.15;
  opacity: 1;
}

.lr-cell-gz {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  opacity: 0.78;
  line-height: 1.2;
}

.lr-cell-gz strong {
  font-size: 0.78rem;
  font-weight: 400;
}

.lr-kong {
  font-style: normal;
  font-size: 0.65rem;
  color: var(--mist);
  margin-left: 0.05rem;
}

.lr-chuan-gz {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  font-weight: 400;
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  line-height: 1.1;
  gap: 0.02em;
}

.lr-chuan-gan,
.lr-chuan-zhi {
  display: inline;
}

.lr-center {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: rgba(248, 243, 234, 0.85);
  text-align: center;
}

.lr-center-day {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.1em;
}

.lr-center-day strong {
  font-size: 1.5rem;
}

.lr-center-ju {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.lr-center-gui {
  font-size: 0.78rem;
  color: var(--mist);
}

.lr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  justify-content: center;
  font-size: 0.78rem;
}

.lr-legend i {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
  background: currentColor;
}

.lr-question {
  font-size: 0.88rem;
  padding: 0.45rem 0;
  border-top: 1px dashed var(--line);
}

.lr-question span {
  color: var(--mist);
  margin-right: 0.45rem;
}

.hexagram-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem 1.75rem;
  margin: 1.1rem 0 0.75rem;
  width: 100%;
}

.hexagram-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hexagram-panel h4 {
  margin: 0 0 0.55rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: var(--cinnabar);
  font-weight: 600;
}

.hexagram-panel .hexagram-name {
  display: block;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: -0.2rem 0 0.55rem;
  letter-spacing: 0.04em;
  line-height: 1.35;
  min-height: 2.2em;
}

.hexagram {
  display: grid;
  gap: 0.45rem;
  max-width: 16rem;
  margin: 0 auto 1rem;
}

.hexagram-panel .hexagram {
  max-width: none;
  width: 100%;
  margin: 0;
  gap: 0.35rem;
}

.hexagram-panel .yao {
  gap: 0.3rem;
  min-width: 0;
}

.hexagram-panel .yao .meta {
  min-width: 0;
  flex: 0 1 auto;
  font-size: 0.72rem;
  color: var(--mist);
  letter-spacing: 0;
  white-space: nowrap;
}

.hexagram-panel .yao .meta em {
  font-style: normal;
  margin-right: 0.15rem;
  color: var(--ink-soft);
}

.hexagram-panel .yao .meta b {
  font-weight: 600;
  color: var(--ink-soft);
}

.hexagram-panel .yao .mark {
  width: auto;
  min-width: 1.1rem;
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02rem;
  font-size: 0.62rem;
  line-height: 1.05;
}

.hexagram-panel .yao .mark i {
  font-style: normal;
  color: var(--cinnabar);
  font-weight: 600;
}

.hexagram-panel .yao.ying .mark i {
  color: var(--ink-soft);
  font-weight: 500;
}

.hexagram-panel .yao .bars {
  flex: 1 1 2.5rem;
  min-width: 1.6rem;
  max-width: 5.5rem;
  height: 0.95rem;
}

.yao {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.yao .bars {
  flex: 1;
  display: flex;
  gap: 0.35rem;
  height: 0.95rem;
}

.yao .bar {
  flex: 1;
  background: var(--ink);
}

.yao.yin .bars {
  justify-content: space-between;
}

.yao.yin .bar {
  flex: 0 0 42%;
}

.yao.moving .bar {
  background: var(--cinnabar-bright);
}

.yao .mark {
  width: 1.5rem;
  text-align: center;
  color: var(--cinnabar);
  font-size: 0.85rem;
}

.liuren-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 28rem;
}

.liuren-cell {
  border: 1px solid var(--line);
  padding: 0.75rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  min-height: 4.5rem;
}

.liuren-cell strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.1em;
}

.note {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--mist);
}

.empty-state {
  color: var(--mist);
  text-align: center;
  padding: 2rem 1rem;
}

/* ========== 西洋星盘 ========== */
.xp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-bottom: 0.15rem;
}

.xp-style-btn {
  appearance: none;
  border: 1px solid rgba(226, 59, 42, 0.45);
  background: rgba(255, 255, 255, 0.88);
  color: var(--cinnabar);
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.xp-style-btn:hover {
  background: var(--cinnabar-soft);
  border-color: var(--cinnabar);
}

.xp-toolbar-meta {
  font-size: 0.84rem;
  color: var(--mist);
  letter-spacing: 0.04em;
}

.xp-type-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.xp-type-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.95);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  padding: 0.55rem 0.35rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.xp-type-btn:hover {
  border-color: rgba(226, 59, 42, 0.4);
  color: var(--cinnabar);
}

.xp-type-btn.active {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  box-shadow: inset 0 0 0 1px rgba(226, 59, 42, 0.2);
}

.xp-type-desc {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--mist);
  letter-spacing: 0.04em;
}

.xp-extra {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.xp-fada-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.xp-fada-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.35rem;
  border: 1px solid var(--line);
  text-align: center;
  font-size: 0.78rem;
  color: var(--mist);
  background: rgba(255, 253, 248, 0.9);
}

.xp-fada-cell strong {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: 0.06em;
  font-weight: 600;
}

.xp-fada-cell.on {
  border-color: rgba(226, 59, 42, 0.5);
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
}

.xp-fada-cell.on strong {
  color: var(--cinnabar);
}

.xp-row-transit td {
  color: var(--mist);
  font-style: italic;
}

.xp-svg.classical .xp-ring-outer {
  stroke: rgba(74, 85, 96, 0.65);
}

.xp-sheet {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 52rem;
  margin: 0 auto;
}

.xp-summary {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.xp-sub {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--mist);
}

.xp-board {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(12rem, 0.8fr);
  gap: 1rem;
  align-items: center;
}

.xp-svg {
  width: 100%;
  max-width: 26rem;
  height: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 10px 28px -18px var(--shadow));
}

.xp-ring-outer {
  fill: rgba(255, 253, 248, 0.96);
  stroke: rgba(226, 59, 42, 0.55);
  stroke-width: 1.6;
}

.xp-ring {
  fill: none;
  stroke: rgba(26, 23, 20, 0.14);
  stroke-width: 1;
}

.xp-ring-inner {
  fill: rgba(247, 243, 234, 0.55);
  stroke: rgba(26, 23, 20, 0.12);
  stroke-width: 1;
}

.xp-sign-wedge {
  stroke: rgba(26, 23, 20, 0.08);
  stroke-width: 0.5;
  opacity: 0.55;
}

.xp-el-火 { fill: rgba(226, 59, 42, 0.14); }
.xp-el-土 { fill: rgba(212, 160, 23, 0.16); }
.xp-el-风 { fill: rgba(15, 138, 107, 0.12); }
.xp-el-水 { fill: rgba(61, 110, 165, 0.14); }

.xp-sign-label {
  font-size: 13px;
  fill: var(--ink-soft);
  pointer-events: none;
}

.xp-house-line {
  stroke: rgba(26, 23, 20, 0.18);
  stroke-width: 1;
}

.xp-house-num {
  font-size: 10px;
  fill: var(--mist);
}

.xp-axis-label {
  font-size: 10px;
  fill: var(--cinnabar);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.xp-asp {
  stroke-width: 1.1;
  opacity: 0.55;
}

.xp-asp-conj { stroke: #e23b2a; }
.xp-asp-opposition { stroke: #c45c26; }
.xp-asp-square { stroke: #a65d3a; stroke-dasharray: 3 2; }
.xp-asp-trine { stroke: #0f8a6b; }
.xp-asp-sextile { stroke: #2a7a8c; stroke-dasharray: 2 2; }

.xp-side {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.xp-elements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.xp-el-pill {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.xp-el-pill.fire { border-color: rgba(226, 59, 42, 0.35); color: #b52f22; }
.xp-el-pill.earth { border-color: rgba(212, 160, 23, 0.4); color: #8a6a12; }
.xp-el-pill.air { border-color: rgba(15, 138, 107, 0.35); color: #0b6b53; }
.xp-el-pill.water { border-color: rgba(61, 110, 165, 0.35); color: #2f5680; }

.xp-key {
  display: grid;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.xp-key div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.xp-key span {
  color: var(--mist);
}

.xp-key strong {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

.xp-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--mist);
  line-height: 1.55;
}

.xp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.xp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.xp-table th,
.xp-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.xp-table th {
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(247, 243, 234, 0.85);
  letter-spacing: 0.06em;
}

.xp-table tr:last-child td {
  border-bottom: none;
}

.xp-glyph {
  display: inline-block;
  min-width: 1.1em;
  font-weight: 700;
}

.xp-block-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.xp-asp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.4rem;
}

.xp-asp-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.45rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.86rem;
}

.xp-asp-item em {
  font-style: normal;
  color: var(--cinnabar);
  letter-spacing: 0.06em;
}

.xp-asp-item small {
  margin-left: auto;
  color: var(--mist);
}

.wheel-extra input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

@keyframes seal-in {
  from {
    opacity: 0;
    transform: rotate(-18deg) scale(0.85);
  }
  to {
    opacity: 1;
    transform: rotate(-6deg) scale(1);
  }
}

@media (max-width: 860px) {
  .site-header {
    position: sticky;
    top: 0;
    padding: 0.65rem 0.85rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top, 0px));
    border-radius: 0;
    gap: 0.45rem;
  }

  .brand-seal {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.15rem;
  }

  .brand-text {
    font-size: 1.15rem;
  }

  .auth-user {
    max-width: 12ch;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
  }

  .auth-btn {
    min-height: 2.35rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.82rem;
  }

  main {
    padding: 0.35rem 0.75rem calc(7.5rem + env(safe-area-inset-bottom, 0px));
  }

  .section-title {
    font-size: 1.45rem;
  }

  .xp-board {
    grid-template-columns: 1fr;
  }

  .xp-svg {
    max-width: 22rem;
  }

  .xp-type-panel {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.25rem;
  }

  .xp-type-btn {
    flex: 0 0 auto;
    min-width: 4.8rem;
    scroll-snap-align: start;
    min-height: 2.45rem;
    font-size: 0.82rem;
  }

  .section-desc {
    font-size: 0.86rem;
    line-height: 1.55;
  }

  .panel,
  .result-panel,
  .bazi-form-panel {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .bazi-form-panel {
    padding-top: 1rem;
  }

  .bz-reverse-pillars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bz-reverse-range {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-panel {
    padding: 0.75rem 0.55rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-shell {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .gz-pillars,
  .pillars,
  .dayun-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .liunian-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .day-cell {
    min-height: 3.2rem;
    padding: 0.28rem 0.1rem 0.35rem;
  }

  .day-cell .solar {
    font-size: calc(0.95rem + 4px);
  }

  .day-cell .lunar {
    font-size: calc(0.62rem + 2px);
    line-height: 1.2;
  }

  .day-badge {
    font-size: 0.55rem;
    padding: 0.05rem 0.18rem;
  }

  .almanac-detail {
    padding: 1rem 0.85rem;
  }

  .almanac-hours-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .zw-sanhe-sep {
    display: none;
  }

  .zw-sanhe-linear-row {
    gap: 0.3rem;
  }

  .zw-sanhe-card {
    flex: 1 1 calc(50% - 0.3rem);
    max-width: none;
  }

  .almanac-lunar-title {
    font-size: 1.55rem;
  }

  .wheel-picker {
    grid-template-columns: 0.7fr 1.05fr 0.8fr 0.8fr 1.05fr;
    gap: 0.22rem;
  }

  .wheel-picker[style*="--wheel-cols:6"],
  .wheel-picker.cols-6 {
    grid-template-columns: 0.6fr 0.95fr 0.7fr 0.7fr 0.95fr 0.65fr;
  }

  .wheel-picker[style*="--wheel-cols:5"],
  .wheel-picker.cols-5 {
    grid-template-columns: 1fr 0.8fr 0.8fr 1fr 0.65fr;
  }

  .cal-mode-wrap {
    margin: 0 0 0.5rem;
  }

  .cal-mode-bar {
    width: 7rem;
    gap: 0.12rem;
    padding: 0.14rem;
  }

  .cal-mode-btn {
    min-height: 1.7rem;
    padding: 0.18rem 0.25rem;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
  }

  .wheel-cal-note {
    font-size: 0.74rem;
    margin-top: 0.35rem;
  }

  .wheel-picker[style*="--wheel-cols:4"],
  .wheel-picker.cols-4 {
    grid-template-columns: 1.05fr 0.85fr 0.85fr 1.1fr;
  }

  .wheel-viewport {
    height: 8.4rem;
  }

  .wheel-item {
    font-size: 0.78rem;
    height: 2.55rem;
  }

  .wheel-item.selected {
    font-size: 1.02rem;
    transform: scale(1.04);
  }

  .wheel-highlight {
    height: 2.55rem;
  }

  .bz-ss-row {
    grid-template-columns: 4.2rem 1fr;
  }

  .bz-gan,
  .bz-zhi {
    font-size: 1.3rem;
  }

  .bz-dy-gz {
    font-size: 1rem;
  }

  .bz-meta-row {
    grid-template-columns: 2.6rem 1fr;
  }

  .bz-dayun-wrap {
    position: relative;
  }

  .bz-dayun-wrap::after {
    content: "左右滑动查看大运 →";
    display: block;
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--mist);
    padding: 0.35rem 0.5rem 0.45rem;
    border-top: 1px dashed var(--line);
  }

  .bz-dayun-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.15rem;
    min-width: 0;
    grid-template-columns: repeat(8, minmax(3.35rem, 1fr));
  }

  .bz-dy-col {
    scroll-snap-align: start;
  }

  .palace-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* —— 紫微盘（平板/手机） —— */
  .zw-sheet {
    gap: 0.65rem;
  }

  .zw-summary {
    font-size: 0.95rem;
  }

  .zw-sub {
    font-size: 0.75rem;
    line-height: 1.45;
  }

  .zw-board {
    /* 取消正方形锁高，宫位随星曜内容撑开，避免裁切 */
    aspect-ratio: auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    grid-template-rows: repeat(4, minmax(7.2rem, auto));
  }

  .zw-cell {
    min-height: 0;
    height: auto;
    padding: 0.22rem 0.25rem;
    font-size: 0.62rem;
    line-height: 1.25;
    overflow: visible;
  }

  .zw-star.major {
    font-size: 0.68rem;
  }

  .zw-star.minor,
  .zw-star.soft,
  .zw-star.shensha,
  .zw-star.boshi,
  .zw-star.jiangqian {
    font-size: 0.52rem;
  }

  .zw-bright,
  .zw-hua {
    font-size: 0.48rem;
  }

  .zw-softs {
    max-width: none;
    gap: 0.08rem 0.14rem;
  }

  .zw-majors,
  .zw-aux,
  .zw-misc {
    max-width: none;
    gap: 0.08rem 0.14rem;
  }

  .zw-aux,
  .zw-misc {
    margin-top: 0.06rem;
  }

  .zw-star {
    max-width: 1.2em;
  }

  .zw-cs {
    font-size: 0.5rem;
  }

  .zw-age {
    font-size: 0.55rem;
  }

  .zw-ganzhi {
    font-size: 0.78rem;
  }

  .zw-ganzhi em {
    font-size: 0.58rem;
  }

  .zw-pname {
    font-size: 0.62rem;
  }

  .zw-center {
    min-height: 0;
    height: 100%;
    padding: 0.4rem 0.35rem;
    font-size: 0.68rem;
    gap: 0.2rem;
  }

  .zw-center-title {
    font-size: 0.95rem;
    letter-spacing: 0.08em;
  }

  .zw-center-meta {
    font-size: 0.62rem;
  }

  .zw-pillars {
    font-size: 0.72rem;
    gap: 0.2rem 0.45rem;
  }

  .zw-sihua-legend {
    font-size: 0.62rem;
    gap: 0.2rem 0.4rem;
  }

  .zw-modes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
    width: 100%;
  }

  .zw-mode-btn {
    min-height: 2.5rem;
    padding: 0.35rem 0.2rem;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
  }

  .zw-fly-info {
    font-size: 0.7rem;
    gap: 0.25rem 0.5rem;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
  }

  .zw-fly-info span {
    flex-shrink: 0;
  }

  .zw-flow {
    grid-template-columns: 2.1rem 1fr;
    gap: 0.3rem;
  }

  .zw-flow-row {
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
    padding-bottom: 0.2rem;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: none;
  }

  .zw-flow-cell {
    flex: 0 0 3.6rem;
    padding: 0.25rem 0.1rem;
  }

  .zw-hl-badge {
    font-size: 0.52rem;
    padding: 0.02rem 0.15rem;
  }

  .zw-legend {
    font-size: 0.72rem;
    gap: 0.35rem 0.55rem;
  }

  /* —— 大六壬 —— */
  .lr-sheet {
    max-width: 100%;
    gap: 0.55rem;
  }

  .lr-head-main {
    font-size: 0.88rem;
    gap: 0.25rem 0.4rem;
  }

  .lr-head-sub {
    font-size: 0.72rem;
    line-height: 1.4;
  }

  .lr-pillars {
    gap: 0.25rem;
  }

  .lr-pillar {
    padding: 0.25rem 0.1rem;
  }

  .lr-pillar strong {
    font-size: 1.15rem;
  }

  .lr-params {
    font-size: 0.75rem;
    gap: 0.25rem 0.55rem;
  }

  .lr-shensha {
    font-size: 0.72rem;
    gap: 0.2rem 0.45rem;
    padding: 0.45rem 0.5rem;
    max-height: 5.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lr-pan-module {
    grid-template-columns: minmax(0, 1.15fr) minmax(9.2rem, 0.9fr);
    gap: 0.45rem 0.55rem;
    padding: 0.5rem 0.5rem 0.55rem;
  }

  .lr-pan-side {
    gap: 0.32rem;
  }

  .lr-block-title {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    padding: 0.16rem 0.25rem;
  }

  .lr-chuan {
    max-width: none;
    gap: 0.16rem;
  }

  .lr-chuan-col {
    padding: 0.12rem 0.25rem;
    font-size: 0.64rem;
    gap: 0.1rem 0.25rem;
  }

  .lr-ke-col {
    padding: 0.14rem 0.05rem;
    font-size: 0.64rem;
  }

  .lr-chuan-col strong,
  .lr-chuan-gz,
  .lr-ke-char {
    font-size: 0.9rem;
  }

  .lr-kes {
    max-width: none;
    gap: 0.16rem;
  }

  .lr-board {
    aspect-ratio: 1 / 1;
    min-height: 0;
    width: 100%;
    max-width: 18.5rem;
  }

  .lr-cell {
    min-height: 0;
    padding: 0.25rem 0.15rem;
    font-size: 0.7rem;
  }

  .lr-cell-gz {
    font-size: 0.68rem;
  }

  .lr-cell-gz strong {
    font-size: 0.72rem;
  }

  .lr-cell-tian {
    font-size: 1.15rem;
  }

  .lr-center {
    min-height: 0;
    gap: 0.2rem;
    padding: 0.25rem;
  }

  .lr-center-day {
    font-size: 1.1rem;
  }

  .lr-center-day strong {
    font-size: 1.2rem;
  }

  .lr-center-ju,
  .lr-center-gui {
    font-size: 0.72rem;
  }

  .lr-mark {
    right: -0.55rem;
    width: 0.9rem;
    height: 0.9rem;
    font-size: 0.55rem;
  }

  .book-tabs {
    gap: 0.3rem;
  }

  .book-tab {
    min-height: 2.35rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .book-page-bar {
    top: 3.85rem;
    gap: 0.55rem;
  }

  .book-page-title {
    font-size: 1.45rem;
  }

  .book-page-body {
    padding: 0.95rem 0.85rem 1.5rem;
  }

  .book-page .content {
    font-size: 1rem;
    line-height: 1.85;
    max-height: none;
    overflow: visible;
  }

  .book-reader .content {
    font-size: 0.92rem;
    line-height: 1.75;
    max-height: none;
    overflow: visible;
  }

  .book-reader-body.has-toc {
    grid-template-columns: 1fr;
  }

  .book-toc {
    position: static;
    max-height: none;
  }

  .book-toc-list {
    columns: 2;
    column-gap: 0.75rem;
  }

  /* 窄屏三列等宽自适应，爻象随列宽伸缩 */
  .hexagram-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem 0.85rem;
    margin: 0.75rem 0 0.5rem;
    align-items: stretch;
    width: 100%;
  }

  .hexagram-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
  }

  .hexagram-panel h4 {
    flex: 0 0 1.35rem;
    height: 1.35rem;
    margin: 0 0 0.15rem;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    line-height: 1.35rem;
  }

  .hexagram-panel .hexagram-name {
    flex: 0 0 2.5em;
    height: 2.5em;
    min-height: 2.5em;
    max-height: 2.5em;
    margin: 0 0 0.28rem;
    font-size: 0.62rem;
    line-height: 1.25;
    overflow: hidden;
  }

  .hexagram-panel .hexagram {
    flex: 1 1 auto;
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    min-height: 7.2rem;
  }

  .hexagram-panel .yao {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.18rem;
    height: 1.45rem;
    min-height: 1.45rem;
    box-sizing: border-box;
    min-width: 0;
  }

  .hexagram-panel .yao .mark {
    width: auto;
    min-width: 0.85rem;
    flex: 0 0 auto;
    font-size: 0.5rem;
    line-height: 1;
  }

  .hexagram-panel .yao .bars {
    flex: 1 1 1.8rem;
    width: auto;
    max-width: none;
    min-width: 1.2rem;
    height: 0.55rem;
    gap: 0.12rem;
  }

  .hexagram-panel .yao .meta {
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    font-size: 0.55rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .feedback-fab {
    min-width: 3.1rem;
    min-height: 2.5rem;
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
  }

  .feedback-fab-list {
    min-height: 2.4rem;
    font-size: 0.78rem;
  }

  /* 手机：默认隐藏，滚动中显示，停滚后收起 */
  .feedback-fab-group {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.55rem);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  }

  .feedback-fab-group.is-scrolling {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.feedback-open .feedback-fab-group.is-scrolling {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .feedback-dialog {
    max-height: min(86vh, 36rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .feedback-modal {
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.4rem;
    min-height: 2.45rem;
    font-size: 0.9rem;
  }

  .site-header {
    flex-wrap: wrap;
  }

  .auth-slot {
    order: 2;
    margin-left: auto;
  }

  .nav-toggle {
    order: 3;
    margin-left: 0.35rem;
  }

  .header-left {
    order: 1;
    gap: 0.3rem;
  }

  .auth-btn-compact {
    padding: 0.22rem 0.45rem;
    min-height: 1.9rem;
    font-size: 0.76rem;
  }

  .site-nav {
    order: 4;
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0.85rem;
    left: 0.85rem;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 16px 36px -20px var(--shadow);
    padding: 0.85rem;
    z-index: 30;
  }

  .site-nav a {
    padding: 0.55rem 0.35rem;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
  }

  .site-nav.open {
    display: flex;
  }

  .hero {
    min-height: auto;
    padding-top: 1.5rem;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .btn {
    min-height: 2.6rem;
  }
}

/* 小屏手机竖屏 */
@media (max-width: 480px) {
  main {
    padding: 0.2rem 0.5rem calc(8rem + env(safe-area-inset-bottom, 0px));
  }

  .brand-text {
    font-size: 1.05rem;
    max-width: 4.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-slot {
    gap: 0.25rem;
    flex: 0 0 auto;
  }

  .auth-user {
    max-width: none;
    font-size: 0.78rem;
    letter-spacing: 0;
  }

  .header-left {
    gap: 0.3rem;
  }

  .bazi-form-panel {
    padding-top: 0.9rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .wheel-picker {
    grid-template-columns: 0.62fr 0.95fr 0.72fr 0.72fr 0.95fr;
    gap: 0.14rem;
  }

  .wheel-picker[style*="--wheel-cols:6"],
  .wheel-picker.cols-6 {
    grid-template-columns: 0.55fr 0.85fr 0.65fr 0.65fr 0.85fr 0.55fr;
  }

  .wheel-picker[style*="--wheel-cols:5"],
  .wheel-picker.cols-5 {
    grid-template-columns: 0.9fr 0.72fr 0.72fr 0.9fr 0.55fr;
  }

  .wheel-picker.cols-4 {
    grid-template-columns: 0.95fr 0.78fr 0.78fr 1fr;
  }

  .wheel-label {
    font-size: 0.66rem;
    margin-bottom: 0.22rem;
  }

  .wheel-item {
    font-size: 0.7rem;
    height: 2.4rem;
  }

  .wheel-item.selected {
    font-size: 0.92rem;
    transform: scale(1.03);
  }

  .wheel-viewport {
    height: 7.4rem;
  }

  .wheel-highlight {
    height: 2.4rem;
    left: 0.1rem;
    right: 0.1rem;
  }

  .cal-mode-bar {
    width: 6.6rem;
  }

  .cal-mode-btn {
    min-height: 1.55rem;
    font-size: 0.7rem;
  }

  .day-cell {
    min-height: 2.95rem;
    padding: 0.2rem 0.05rem 0.28rem;
  }

  .day-cell .solar {
    font-size: calc(0.88rem + 4px);
  }

  .day-cell .lunar {
    font-size: calc(0.56rem + 2px);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .day-badge {
    top: 0.08rem;
    right: 0.08rem;
    font-size: 0.5rem;
  }

  .almanac-head {
    gap: 0.35rem;
  }

  .almanac-title {
    font-size: 1.05rem;
  }

  /* 紫微：小屏也完整展示辅星/杂曜/博士将前，仅略缩字号 */
  .zw-board {
    grid-template-rows: repeat(4, minmax(7.6rem, auto));
  }

  .zw-cell {
    padding: 0.16rem 0.12rem;
    font-size: 0.56rem;
    line-height: 1.22;
  }

  .zw-star.major {
    font-size: 0.64rem;
  }

  .zw-star.minor,
  .zw-star.shensha {
    font-size: 0.48rem;
  }

  .zw-star.soft,
  .zw-star.boshi,
  .zw-star.jiangqian {
    font-size: 0.46rem;
  }

  .zw-bright,
  .zw-hua {
    font-size: 0.42rem;
  }

  .zw-majors,
  .zw-softs,
  .zw-aux,
  .zw-misc {
    max-width: none;
    gap: 0.06rem 0.1rem;
  }

  .zw-aux,
  .zw-misc {
    display: flex;
    margin-top: 0.04rem;
  }

  .zw-star {
    max-width: 1.15em;
  }

  .zw-cs {
    font-size: 0.44rem;
  }

  .zw-ganzhi {
    font-size: 0.68rem;
  }

  .zw-ganzhi em {
    font-size: 0.52rem;
  }

  .zw-pname {
    font-size: 0.54rem;
    letter-spacing: 0.02em;
  }

  .zw-pname i {
    font-size: 0.46rem;
    padding: 0 0.06rem;
  }

  .zw-center {
    padding: 0.28rem 0.2rem;
    font-size: 0.56rem;
  }

  .zw-center-title {
    font-size: 0.8rem;
  }

  .zw-center-row {
    gap: 0.25rem;
  }

  .zw-center-meta {
    font-size: 0.52rem;
  }

  .zw-pillars {
    font-size: 0.58rem;
  }

  .zw-mode-btn {
    min-height: 2.35rem;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
  }

  .zw-flow-cell {
    flex: 0 0 3.2rem;
  }

  .zw-flow-cell strong {
    font-size: 0.85rem;
  }

  .bz-dayun-grid {
    grid-template-columns: repeat(8, minmax(3rem, 1fr));
  }

  .bz-dy-age {
    font-size: 0.78rem;
  }

  .lr-pillar strong {
    font-size: 1rem;
  }

  .lr-cell {
    padding: 0.15rem 0.08rem;
    font-size: 0.62rem;
  }

  .lr-cell-j {
    font-size: 0.58rem;
  }

  .lr-cell-gz {
    font-size: 0.62rem;
  }

  .lr-cell-gz strong {
    font-size: 0.68rem;
  }

  .lr-cell-tian {
    font-size: 0.95rem;
  }

  .lr-center-day {
    font-size: 0.95rem;
  }

  .lr-center-day strong {
    font-size: 1.05rem;
  }

  .lr-chuan-col strong,
  .lr-chuan-gz,
  .lr-ke-char {
    font-size: 0.92rem;
  }

  .lr-pan-module {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.5rem;
  }

  /* 手机：三传 → 四课 → 天地盘 */
  .lr-pan-side {
    order: -1;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: visible;
  }

  .lr-block-board {
    order: 1;
  }

  .lr-block-chuan,
  .lr-block-kes {
    flex: none;
    overflow: visible;
    width: 100%;
  }

  /* 三传固定行高，避免 flex 压缩叠字 */
  .lr-block-chuan {
    height: 9.6rem;
    min-height: 9.6rem;
  }

  .lr-chuan {
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.28rem;
  }

  .lr-chuan-col {
    flex: 1 1 0;
    min-height: 2.15rem;
    height: 2.15rem;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    overflow: hidden;
  }

  .lr-chuan-col strong,
  .lr-chuan-gz {
    font-size: 1rem;
    line-height: 1;
  }

  .lr-kes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .lr-block-kes {
    min-height: 5.2rem;
  }

  .lr-ke-col {
    min-height: 4.2rem;
    padding: 0.28rem 0.08rem;
  }

  .lr-board {
    max-width: min(100%, 17.5rem);
  }

  .bz-chart {
    font-size: 0.82rem;
  }

  .bz-side {
    min-width: 2.2rem;
  }

  .book-toc-list {
    columns: 1;
  }

  .book-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.2rem;
  }

  .book-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 4.2rem;
  }

  .book-page-bar {
    top: calc(3.4rem + env(safe-area-inset-top, 0px));
  }

  .xp-type-btn {
    min-width: 4.4rem;
    font-size: 0.78rem;
  }

  .hexagram-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem 0.55rem;
    width: 100%;
  }

  .hexagram-panel h4 {
    flex-basis: 1.2rem;
    height: 1.2rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    line-height: 1.2rem;
  }

  .hexagram-panel .hexagram-name {
    flex-basis: 2.3em;
    height: 2.3em;
    min-height: 2.3em;
    max-height: 2.3em;
    font-size: 0.56rem;
  }

  .hexagram-panel .hexagram {
    min-height: 7.2rem;
    gap: 0;
    width: 100%;
  }

  .hexagram-panel .yao {
    height: 1.25rem;
    min-height: 1.25rem;
    gap: 0.1rem;
  }

  .hexagram-panel .yao .mark {
    min-width: 0.72rem;
    font-size: 0.46rem;
  }

  .hexagram-panel .yao .bars {
    flex: 1 1 1.4rem;
    width: auto;
    max-width: none;
    min-width: 1rem;
    height: 0.48rem;
    gap: 0.1rem;
  }

  .hexagram-panel .yao .meta {
    max-width: none;
    overflow: visible;
    font-size: 0.48rem;
    white-space: nowrap;
  }

  .site-footer {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    font-size: 0.78rem;
  }
}

/* 防止盘面横向撑破 */
@supports (width: 100dvw) {
  @media (max-width: 860px) {
    .lr-board {
      width: min(100%, 18.5rem);
      max-width: 18.5rem;
    }
  }
}



/* —— 排盘档案 —— */
.archive-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem max(0.75rem, env(safe-area-inset-bottom));
}
.archive-modal[hidden] {
  display: none;
}
.archive-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 23, 20, 0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.archive-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 22.5rem);
  max-height: min(88vh, 38rem);
  overflow: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(226, 59, 42, 0.1), transparent 55%),
    linear-gradient(180deg, #fffdf9 0%, var(--paper) 48%, #f3ebe0 100%);
  border: 1px solid rgba(226, 59, 42, 0.16);
  border-radius: 1.15rem;
  box-shadow:
    0 28px 56px -28px rgba(26, 23, 20, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  padding: 1.35rem 1.15rem 1.2rem;
  animation: archive-dialog-in 0.28s ease-out;
}
@keyframes archive-dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.archive-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--mist);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px -4px var(--shadow);
  transition: background 0.15s ease, color 0.15s ease;
}
.archive-close:hover {
  background: #fff;
  color: var(--cinnabar);
}
.archive-dialog-hero {
  position: relative;
  display: flex;
  justify-content: center;
  margin: -0.15rem 0 0.55rem;
  height: 3.4rem;
}
.archive-hero-seal {
  position: relative;
  z-index: 1;
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(145deg, var(--cinnabar-bright), var(--cinnabar));
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    0 10px 22px -10px rgba(226, 59, 42, 0.7),
    0 0 0 4px rgba(226, 59, 42, 0.1);
}
.archive-hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5.5rem;
  height: 5.5rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 59, 42, 0.22), transparent 68%);
  pointer-events: none;
}
.archive-dialog-head {
  text-align: center;
  margin-bottom: 0.95rem;
  padding: 0 1.5rem;
}
.archive-dialog-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.archive-dialog-sub {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--mist);
  letter-spacing: 0.04em;
  line-height: 1.45;
}
.archive-name-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
}
.archive-name-label {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  font-family: var(--font-display);
}
.archive-name-field input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.98rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.archive-name-field input:focus {
  border-color: rgba(226, 59, 42, 0.45);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}
.archive-name-field input::placeholder {
  color: rgba(26, 23, 20, 0.32);
}
.archive-rel-panel {
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
  max-height: min(42vh, 18rem);
  overflow: auto;
  padding-right: 0.15rem;
  margin-bottom: 0.35rem;
}
.archive-rel-group {
  margin: 0;
}
.archive-rel-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.42rem;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.archive-rel-bar {
  width: 0.22rem;
  height: 0.95rem;
  border-radius: 999px;
  background: var(--cinnabar);
  flex-shrink: 0;
}
.archive-rel-group.tone-intimate .archive-rel-bar { background: #e56b8a; }
.archive-rel-group.tone-family .archive-rel-bar { background: #d4a017; }
.archive-rel-group.tone-social .archive-rel-bar { background: #4a90c8; }
.archive-rel-group.tone-work .archive-rel-bar { background: #7b6bb0; }
.archive-rel-group.tone-other .archive-rel-bar { background: #c45a9a; }

.archive-rel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}
.archive-rel-tag {
  border: 1px solid rgba(26, 23, 20, 0.1);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.38rem 0.82rem;
  font: inherit;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.archive-rel-tag:hover {
  border-color: rgba(226, 59, 42, 0.35);
  color: var(--cinnabar);
  transform: translateY(-1px);
}
.archive-rel-tag.active {
  background: linear-gradient(145deg, rgba(226, 59, 42, 0.16), rgba(226, 59, 42, 0.08));
  border-color: rgba(226, 59, 42, 0.55);
  color: var(--cinnabar);
  font-weight: 600;
  box-shadow: 0 4px 12px -8px rgba(226, 59, 42, 0.65);
}
.archive-save-msg {
  margin: 0.45rem 0 0.15rem;
  font-size: 0.86rem;
  text-align: center;
}
.archive-save-actions {
  margin-top: 0.85rem;
  position: sticky;
  bottom: 0;
  padding-top: 0.35rem;
  background: linear-gradient(180deg, transparent, var(--paper) 28%);
}
.archive-confirm-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.82rem 1rem;
  font: inherit;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(145deg, var(--cinnabar-bright), var(--cinnabar));
  box-shadow: 0 12px 28px -14px rgba(226, 59, 42, 0.75);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.archive-confirm-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px -14px rgba(226, 59, 42, 0.85);
}
.archive-confirm-btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}
.archive-list-host {
  position: relative;
}
.archive-search-bar {
  margin: 0 0 0.85rem;
}
.archive-search-field {
  position: relative;
  display: block;
}
.archive-search-field input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 2.4rem 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.archive-search-field input[type="search"]:focus {
  border-color: rgba(226, 59, 42, 0.45);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}
.archive-search-field input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.archive-search-clear {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.8rem;
  height: 1.8rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--mist);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.archive-search-clear:hover {
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}
.archive-search-hint {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.archive-page.feedback-page {
  max-width: var(--max);
  width: 100%;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
  padding-right: 3.4rem;
}
.archive-page .feedback-page-sub {
  max-width: none;
}
.archive-browse {
  display: block;
}
.archive-grouped-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.archive-index-rail {
  position: fixed;
  right: max(0.2rem, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.15rem;
  max-height: min(72vh, 28rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.4rem 0.28rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 14px 32px -18px rgba(26, 23, 20, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.archive-index-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.38rem 0.42rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.archive-index-item:hover,
.archive-index-item.active {
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
}
.archive-rel-section {
  scroll-margin-top: 4.5rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 0.75rem 0.8rem 0.85rem;
  box-shadow: 0 10px 28px -24px var(--shadow);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.archive-rel-section.is-flash {
  border-color: rgba(226, 59, 42, 0.45);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 720px) {
  .archive-page.feedback-page {
    padding-right: 2.85rem;
    padding-left: 0;
  }
  .archive-index-rail {
    right: max(0.12rem, env(safe-area-inset-right));
    padding: 0.32rem 0.18rem;
    max-height: min(68vh, 24rem);
  }
  .archive-index-item {
    font-size: 0.72rem;
    padding: 0.32rem 0.3rem;
    letter-spacing: 0.04em;
  }
  .archive-rel-section {
    padding: 0.5rem 0.55rem 0.55rem;
  }
  .archive-rel-section-head {
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
  }
  .archive-rel-section-title {
    font-size: 0.92rem;
  }
  .archive-rel-section-body {
    gap: 0.4rem;
  }
  .archive-card.feedback-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.15rem 0.45rem;
    padding: 0.42rem 0.55rem;
  }
  .archive-card-head {
    margin-bottom: 0;
    gap: 0.25rem 0.4rem;
  }
  .archive-card-name {
    font-size: 0.92rem;
  }
  .archive-card-type {
    font-size: 0.68rem;
    padding: 0.08rem 0.35rem;
  }
  .archive-card-meta {
    font-size: 0.72rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .archive-card-place,
  .archive-card-time {
    display: none;
  }
  .archive-card-actions {
    grid-row: 1 / span 2;
    grid-column: 2;
    flex-direction: column;
    gap: 0.22rem;
  }
  .archive-card-actions .btn.sm {
    padding: 0.18rem 0.45rem;
    font-size: 0.72rem;
    min-height: 0;
    line-height: 1.2;
  }
  .archive-search-field input[type="search"] {
    padding: 0.55rem 2.2rem 0.55rem 0.8rem;
    font-size: 0.9rem;
  }
  .archive-page .feedback-page-sub {
    font-size: 0.8rem;
    margin-bottom: 0.7rem;
  }
}
.archive-rel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed rgba(26, 23, 20, 0.12);
}
.archive-rel-section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--cinnabar);
}
.archive-rel-section-count {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  letter-spacing: 0.04em;
}
.archive-rel-section-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.archive-rel-section .archive-card {
  margin: 0;
}
.archive-card.feedback-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.1rem;
  padding: 0.85rem 1rem;
}
.archive-card-body {
  min-width: 0;
  flex: 1;
}
.archive-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.25rem;
}
.archive-card-name {
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}
.archive-card-type {
  font-size: 0.78rem;
}
.archive-card-meta {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.archive-card-place {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}
.archive-card-time {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
}
.archive-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex-shrink: 0;
  margin: 0;
}
.archive-card-actions .btn.sm {
  padding: 0.35rem 0.7rem;
}
body.archive-open {
  overflow: hidden;
}
body.archive-open .feedback-fab-group {
  opacity: 0;
  pointer-events: none;
}

/* ========== 七政四余 ========== */
.qz-result {
  margin-top: 1rem;
}
.qz-error {
  color: #b33;
  padding: 0.75rem 1rem;
  background: #fff5f5;
  border-radius: 0.5rem;
}
.qz-head {
  margin-bottom: 0.75rem;
}
.qz-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.qz-summary {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted, #666);
  line-height: 1.45;
}
.qz-chart-wrap {
  width: min(100%, 36rem);
  margin: 0.5rem auto 1rem;
}
.qz-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #fafafa;
  border-radius: 50%;
}
.qz-ring {
  fill: none;
  stroke: #c8c4bc;
  stroke-width: 1;
}
.qz-core-circle {
  fill: #fff;
  stroke: #b0aaa0;
  stroke-width: 1.2;
}
.qz-wedge {
  fill: rgba(255, 255, 255, 0.35);
  stroke: #d5d0c8;
  stroke-width: 0.6;
}
.qz-wedge-ming {
  fill: rgba(232, 90, 74, 0.12);
  stroke: #e85a4a;
  stroke-width: 1.2;
}
.qz-radial {
  stroke: #e8e4dc;
  stroke-width: 0.5;
}
.qz-mingdu-mark {
  stroke: #e85a4a;
  stroke-width: 1.5;
  opacity: 0.85;
}
.qz-palace-ming {
  fill: #e85a4a;
  font-weight: 700;
}
.qz-zhi {
  font-size: 16px;
  font-weight: 600;
}
.qz-zhi-木 { fill: #2f7d4a; }
.qz-zhi-火 { fill: #c45c26; }
.qz-zhi-土 { fill: #8a5a2b; }
.qz-zhi-金 { fill: #b8860b; }
.qz-zhi-水 { fill: #3d6ea5; }
.qz-palace-name {
  font-size: 12px;
  fill: #555;
}
.qz-star {
  font-size: 15px;
  font-weight: 700;
}
.qz-star-line {
  stroke-width: 1;
  stroke-dasharray: 2.5 2;
  opacity: 0.85;
}
.qz-star-dot {
  stroke: #fff;
  stroke-width: 0.6;
}
.qz-xiu {
  font-size: 11px;
  fill: #555;
  font-weight: 600;
}
.qz-xiu-arc {
  fill: rgba(90, 120, 160, 0.06);
  stroke: #c5cdd8;
  stroke-width: 0.6;
}
.qz-xiu-arc.alt {
  fill: rgba(90, 120, 160, 0.12);
}
.qz-year {
  font-size: 12px;
  fill: #8a9bb0;
  font-weight: 500;
}
.qz-year-current {
  fill: #c45c26;
  font-weight: 700;
}
.qz-age {
  font-size: 8.5px;
  fill: #4a6a8a;
}
.qz-age-current {
  fill: #c45c26;
  font-weight: 700;
  font-size: 9.5px;
}
.qz-age-mark {
  stroke: #b0b8c4;
  stroke-width: 0.6;
}
.qz-deg-tick {
  stroke: #9aa3b0;
  stroke-width: 0.45;
}
.qz-deg-tick.mid {
  stroke: #7a8494;
  stroke-width: 0.7;
}
.qz-deg-tick.major {
  stroke: #5a6474;
  stroke-width: 0.9;
}
.qz-deg-label {
  font-size: 7.5px;
  fill: #7a8494;
}
.qz-ring-age {
  stroke: #b8c4d4;
}
.qz-age-band {
  fill: none;
  stroke: rgba(120, 155, 190, 0.14);
  stroke-width: 30;
}
.qz-ring-shensha {
  stroke: #c8c4bc;
}
.qz-shensha {
  font-size: 12px;
  fill: #333;
  font-weight: 600;
  paint-order: stroke fill;
  stroke: #fafafa;
  stroke-width: 2.4px;
}
.qz-shensha-ming,
.qz-shensha-shen {
  fill: #c45c26;
  font-weight: 700;
  font-size: 12px;
}
.qz-core {
  font-size: 15px;
  font-weight: 600;
  fill: #222;
}
.qz-panels {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 800px) {
  .qz-panels {
    grid-template-columns: 1fr 1fr;
  }
}
.qz-panel h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.qz-table-wrap {
  overflow-x: auto;
}
.qz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.qz-table th,
.qz-table td {
  border-bottom: 1px solid #e8e4dc;
  padding: 0.35rem 0.4rem;
  text-align: left;
}
.qz-table tr.qz-lim-current {
  background: #fff4ec;
  font-weight: 600;
}
@media (max-width: 520px) {
  .qz-zhi { font-size: 13px; }
  .qz-palace-name { font-size: 10px; }
  .qz-star { font-size: 13px; }
  .qz-xiu { font-size: 9px; }
  .qz-year { font-size: 10px; }
  .qz-shensha { font-size: 10px; }
  .qz-core { font-size: 13px; }
}

@media (max-width: 420px) {
  .archive-dialog {
    width: min(100%, 100%);
    border-radius: 1rem;
    padding: 1.2rem 0.95rem 1.05rem;
  }
  .archive-rel-panel {
    max-height: min(46vh, 17rem);
  }
}

/* —— 导航重构：天气 / 每日一句 / 工具 —— */
.section-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9a6b4f;
}
.tools-page { padding-top: 0.5rem; }
.tools-head h1 {
  margin: 0 0 0.85rem;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
  color: #2a211c;
}
.tools-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(90, 60, 40, 0.12);
}
.tools-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(90, 60, 40, 0.14);
  background: rgba(255, 252, 247, 0.9);
  color: #5c4a3d;
  text-decoration: none;
  font-size: 0.92rem;
}
.tools-tab:hover {
  border-color: rgba(226, 59, 42, 0.35);
  color: #c43324;
}
.tools-tab.active {
  background: #e23b2a;
  border-color: #e23b2a;
  color: #fff;
}
.tools-panel > .section { margin-top: 0; }
.weather-page { max-width: 720px; }
.weather-source {
  margin: 1.25rem 0 0;
  text-align: right;
  font-size: 0.75rem;
  color: rgba(90, 60, 40, 0.45);
  letter-spacing: 0.02em;
}
.weather-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.weather-head h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", serif;
  font-size: clamp(1.6rem, 3vw, 2rem);
}
.weather-search {
  position: relative;
  display: flex;
  gap: 0.5rem;
  flex: 1 1 240px;
  max-width: 360px;
}
.weather-search input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(90, 60, 40, 0.18);
  border-radius: 0.65rem;
  padding: 0.55rem 0.75rem;
  background: #fffefb;
}
.weather-suggest {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 0.2rem;
  margin: 0;
  padding: 0.35rem;
  max-height: min(280px, 50vh);
  overflow-y: auto;
  border: 1px solid rgba(90, 60, 40, 0.14);
  border-radius: 0.75rem;
  background: #fffefb;
  box-shadow: 0 10px 28px rgba(60, 40, 20, 0.12);
}
.weather-suggest[hidden] {
  display: none !important;
}
.weather-suggest-item {
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  color: #3a2f28;
  font: inherit;
}
.weather-suggest-item:hover,
.weather-suggest-item:focus-visible {
  background: rgba(226, 59, 42, 0.08);
  outline: none;
}
.weather-suggest-empty {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
}
.weather-card {
  border-radius: 1.25rem;
  padding: 1.35rem 1.4rem 1.2rem;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 214, 170, 0.55), transparent 55%),
    linear-gradient(160deg, #f7f1e8 0%, #efe6d8 48%, #e7f0f4 100%);
  border: 1px solid rgba(120, 90, 60, 0.1);
  box-shadow: 0 12px 40px rgba(80, 50, 30, 0.06);
}
.weather-now {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.weather-place h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}
.weather-temp-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}
.weather-now-icon {
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1;
  color: #3a2f28;
}
.weather-temp {
  margin: 0;
  font-size: clamp(3rem, 8vw, 4.2rem);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: #2c221c;
}
.weather-temp span {
  font-size: 0.45em;
  margin-left: 0.05em;
}
.weather-text {
  margin: 0.35rem 0 0;
  text-align: right;
  color: #6a5648;
}
.weather-meta {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 1.1rem 0 1.2rem;
  padding: 0;
}
.weather-meta li {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0.8rem;
  padding: 0.65rem 0.7rem;
}
.weather-meta span {
  display: block;
  font-size: 0.75rem;
  color: #8a7464;
  margin-bottom: 0.2rem;
}
.weather-meta strong {
  font-size: 0.98rem;
  color: #3a2f28;
  font-weight: 600;
}
.weather-hourly {
  margin: 0 0 1.1rem;
}
.weather-hourly-title {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: #8a7464;
  letter-spacing: 0.04em;
}
.weather-hourly-list {
  list-style: none;
  display: flex;
  gap: 0.45rem;
  margin: 0;
  padding: 0.15rem 0.1rem 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.weather-hourly-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 3.4rem;
  padding: 0.55rem 0.45rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}
.weather-hourly-time {
  color: #8a7464;
  font-size: 0.78rem;
}
.weather-hourly-icon {
  font-size: 1.35rem;
  line-height: 1;
  color: #3a2f28;
  min-height: 1.35rem;
}
.weather-hourly-temp {
  font-weight: 600;
  color: #3a2f28;
}
.weather-forecast {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.weather-day {
  display: grid;
  grid-template-columns: 7.5rem 1.6rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.42);
  font-size: 0.92rem;
}
.weather-day-icon {
  font-size: 1.2rem;
  line-height: 1;
  color: #3a2f28;
  text-align: center;
}
.weather-empty,
.weather-loading { padding: 1.5rem 0.5rem; }
.quote-page {
  position: relative;
  max-width: 760px;
  min-height: 58vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.4rem 0 3.2rem;
  isolation: isolate;
}
.quote-page::before {
  content: "";
  position: absolute;
  inset: -1.5rem -8% auto;
  height: min(420px, 70vh);
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 18% 28%, rgba(226, 59, 42, 0.08), transparent 62%),
    radial-gradient(ellipse 55% 45% at 88% 18%, rgba(212, 160, 23, 0.1), transparent 58%),
    linear-gradient(165deg, rgba(255, 252, 246, 0.55) 0%, transparent 72%);
  opacity: 0.95;
}
.quote-date {
  margin: 0 0 1.35rem;
  letter-spacing: 0.08em;
}
.quote-stage {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.quote-block {
  position: relative;
  margin: 0;
  padding: 2.6rem 0.35rem 1.6rem;
  border: none;
  background: transparent;
  animation: quote-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.quote-mark {
  position: absolute;
  top: -0.15rem;
  left: -0.15rem;
  margin: 0;
  font-size: clamp(4.2rem, 9vw, 6.2rem);
  line-height: 1;
  color: rgba(226, 59, 42, 0.16);
  font-family: Georgia, "Times New Roman", var(--font-display), serif;
  pointer-events: none;
  animation: quote-mark-soft 5.5s ease-in-out infinite;
}
.quote-text {
  margin: 0;
  padding-left: 0.15rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.8vw, 2.65rem);
  line-height: 1.58;
  color: var(--ink);
  letter-spacing: 0.05em;
  font-weight: 500;
}
.quote-author {
  margin-top: 1.55rem;
  text-align: right;
  color: var(--ink-soft);
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  opacity: 0.88;
}
.quote-empty {
  padding-top: 1.2rem;
  animation: quote-rise 0.55s ease both;
}
.quote-empty p {
  font-size: 1.08rem;
  color: var(--mist);
  line-height: 1.7;
}
.poem-aside {
  margin: 0;
  padding: 1rem 0 0.2rem;
  border-top: 1px solid var(--line);
  max-width: 28rem;
  animation: poem-fade-in 0.65s ease 0.18s both;
}
.poem-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: none;
  color: var(--mist);
}
.poem-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}
.poem-meta {
  margin: 0.25rem 0 0.55rem;
  font-size: 0.78rem;
  color: var(--mist);
  letter-spacing: 0.04em;
}
.poem-content {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--ink-soft);
  white-space: pre-wrap;
  letter-spacing: 0.04em;
  opacity: 0.92;
}
@keyframes quote-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes poem-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes quote-mark-soft {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.85;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .quote-block,
  .quote-empty,
  .poem-aside,
  .quote-mark {
    animation: none;
  }
}
@media (max-width: 640px) {
  .weather-meta { grid-template-columns: 1fr; }
  .weather-day {
    grid-template-columns: auto 1.4rem 1fr;
    grid-template-rows: auto auto;
    gap: 0.2rem 0.45rem;
  }
  .weather-day-date { grid-column: 1; }
  .weather-day-icon { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .weather-day-text { grid-column: 3; }
  .weather-day-temp { grid-column: 3; }
  .weather-search { max-width: none; }
}
