.letter-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px dashed #d5c5aa;
}
.letter-tools-label {
  grid-column: 1 / -1;
  color: #958873;
  font-size: 10px;
  line-height: 1.5;
}
.letter-tools button {
  min-width: 0;
  min-height: 67px;
  padding: 8px 4px;
  border: 1px solid #d5c5aa;
  background: #f8efdf;
  color: #765f51;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.letter-tools button:hover,
.letter-tools button:focus-visible {
  transform: translateY(-2px);
  border-color: #b47a83;
  background: #fff7e8;
}
.letter-tools button > span {
  color: #a66370;
  font-size: 18px;
  line-height: 1;
}
.letter-tools button b {
  font-size: 12px;
  font-weight: 500;
}
.letter-tools button small {
  color: #9d896f;
  font-size: 9px;
}
.bazi-method-note {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 18px 0;
  padding: 10px;
  border: 1px solid #e0cfb2;
  background: #fffaf0;
  color: #9a806c;
  font-size: 10px;
  text-align: center;
}
.bazi-method-note b {
  display: block;
  color: #8e5964;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}
.bazi-chart-card {
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid #e0cfb2;
  background: #fffaf0;
  color: #8c715f;
  font-size: 11px;
}
.bazi-chart-card > b {
  color: #8e5964;
  font-weight: 500;
}
.bazi-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 10px 0 8px;
}
.bazi-pillars span {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 3px;
  background: #f4e7d2;
}
.bazi-pillars small {
  color: #a48d72;
  font-size: 9px;
}
.bazi-pillars strong {
  margin-top: 4px;
  color: #815669;
  font: 15px/1.2 "KaiTi", "SimSun", serif;
}
.bazi-chart-card p {
  margin: 0;
  color: #a18c74;
  font-size: 10px;
  line-height: 1.6;
}
dialog.divination-dialog {
  width: min(560px, calc(100vw - 30px));
  max-height: min(760px, calc(100svh - 30px));
  padding: 27px 30px;
  background: #fcf6e9;
  border: 1px solid #d9c4a6;
  box-shadow: 0 24px 70px #3a2b2140;
}
.divination-dialog h2 {
  margin: 6px 0 0;
  font-weight: 500;
  letter-spacing: 2px;
}
.divination-intro {
  color: #786b59;
  font-size: 12px;
  line-height: 1.9;
}
.divination-form {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 20px;
}
.divination-form label {
  flex: 1;
  color: #8d7964;
  font-size: 11px;
}
.divination-form input {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 9px;
  border: 1px solid #d0bfa4;
  background: #fffdf5;
  color: #675b4a;
}
.divination-result,
.tarot-result {
  margin-top: 19px;
  padding: 20px 22px;
  border: 1px solid #dfc9ab;
  background: linear-gradient(135deg, #fffaf0, #f5e8d2);
  color: #725f4d;
  line-height: 1.8;
}
.divination-result h3,
.tarot-result h3 {
  margin: 7px 0;
  color: #8d5967;
  font: 23px/1.4 "KaiTi", "SimSun", serif;
  letter-spacing: 2px;
}
.divination-result p,
.tarot-result p {
  font-size: 13px;
  margin: 7px 0 0;
}
.divination-mark {
  display: block;
  color: #b06e79;
  font-size: 34px;
  line-height: 1;
}
.divination-prompt {
  border-top: 1px dashed #d4bea0;
  padding-top: 10px;
  color: #a36c72;
  font-family: "KaiTi", "SimSun", serif;
}
.divination-source {
  margin-top: 18px;
  color: #a08c73;
  font-size: 10px;
  line-height: 1.8;
}
.divination-source a {
  color: #956672;
}
.zodiac-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.zodiac-date-grid label {
  color: #8d7964;
  font-size: 11px;
}
.zodiac-date-grid input {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 9px;
  border: 1px solid #d0bfa4;
  background: #fffdf5;
  color: #675b4a;
}
.compatibility-result {
  padding: 2px 0;
}
.compatibility-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}
.compatibility-heading h3 {
  margin: 0;
  font-size: 20px;
}
.compatibility-score {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  color: #a66370;
  font-family: "KaiTi", "SimSun", serif;
}
.compatibility-score strong {
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
}
.compatibility-score small {
  color: #9d806f;
  font-size: 13px;
}
.compatibility-note {
  color: #a0806b !important;
  font-size: 11px !important;
}
.compatibility-analysis {
  color: #6f5e4c;
}
.compatibility-details {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}
.compatibility-details > div {
  display: grid;
  grid-template-columns: minmax(120px, .65fr) 1fr;
  gap: 10px;
  padding: 8px 10px;
  border-left: 2px solid #c48e8e;
  background: #fffaf0;
  font-size: 11px;
}
.compatibility-details b {
  color: #8e5964;
  font-weight: 500;
}
.compatibility-details span {
  color: #987f6b;
}
.compatibility-result details {
  margin-top: 15px;
  color: #987f6b;
  font-size: 11px;
}
.compatibility-result details summary {
  color: #8e5964;
  cursor: pointer;
}
.compatibility-result details p {
  font-size: 11px;
}
.zodiac-pair-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 13px 0 5px;
}
.zodiac-sign-card {
  padding: 12px;
  border: 1px solid #e1ceb0;
  background: #fffaf0;
}
.zodiac-sign-card .divination-mark {
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
  font-size: 25px;
}
.zodiac-sign-card b {
  color: #8d5966;
  font-size: 12px;
  font-weight: 500;
}
.zodiac-sign-card small {
  display: block;
  margin-top: 5px;
  color: #aa8d73;
  font-size: 10px;
}
.zodiac-sign-card p {
  margin-bottom: 0 !important;
  font-size: 11px !important;
}
.tarot-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
  margin: 25px 0 8px;
}
.tarot-card {
  position: relative;
  min-height: 178px;
  border: 3px double #ba8790;
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, #eac8c9 0 7px, #f3ded5 8px 14px);
  color: #a45d6e;
  box-shadow: 3px 4px 0 #ad7a6d2b;
  transition: transform .25s ease, opacity .25s ease, filter .25s ease;
}
.tarot-card::before,
.tarot-card::after {
  content: "✦";
  position: absolute;
  font-size: 12px;
  opacity: .65;
}
.tarot-card::before { left: 10px; top: 8px; }
.tarot-card::after { right: 10px; bottom: 8px; }
.tarot-card > span {
  display: block;
  font-size: 31px;
  transform: rotate(-8deg);
}
.tarot-card:hover:not(:disabled),
.tarot-card:focus-visible:not(:disabled) {
  transform: translateY(-7px) rotate(-2deg);
}
.tarot-card.is-revealed {
  background: linear-gradient(145deg, #fff6e6, #f0d7c2);
  transform: translateY(-4px);
}
.tarot-card.is-revealed > span {
  font-size: 45px;
  transform: none;
}
.tarot-card.is-muted {
  opacity: .4;
  filter: grayscale(.35);
}
.board-tabs {
  display: flex;
  gap: 3px;
  padding: 0 12px 12px;
}
.board-tabs button {
  padding: 9px 16px;
  border: 1px solid #b48356;
  background: #815438;
  color: #f9dfbd;
  font-size: 11px;
}
.board-tabs button.is-active {
  background: #fffcf1;
  color: #714d35;
  border-bottom-color: #fffcf1;
}
.board-page[hidden] { display: none; }
.board-letter-page { min-height: 330px; }
.board-letter-paper {
  min-height: 310px;
  padding: 37px 38px 28px;
  background: linear-gradient(#fffdf5, #fff9eb);
  border: 1px solid #ead9ba;
  box-shadow: inset 0 0 22px #c29b5c18;
  font-family: "KaiTi", "SimSun", serif;
  color: #6d5b49;
}
.board-letter-paper h3 {
  margin: 38px 0 25px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 1px;
}
.board-letter-paper p {
  font-size: 17px;
  line-height: 2.2;
}
.board-letter-paper .board-letter-sign {
  margin-top: 55px;
  text-align: right;
  color: #956672;
}
.board-letter-paper small {
  display: block;
  margin-top: 25px;
  color: #aa9276;
  font-family: sans-serif;
  font-size: 10px;
  line-height: 1.7;
}
@media (max-width: 700px) {
  .letter-tools { margin-top: 16px; }
  .bazi-method-note { font-size: 9px; }
  dialog.divination-dialog { padding: 22px 20px; }
  .divination-form { align-items: stretch; flex-direction: column; }
  .divination-form .primary { width: 100%; }
  .zodiac-date-grid { grid-template-columns: 1fr; gap: 8px; }
  .compatibility-heading { align-items: start; flex-direction: column; gap: 5px; }
  .compatibility-score strong { font-size: 32px; }
  .compatibility-details > div { grid-template-columns: 1fr; gap: 3px; }
  .zodiac-pair-cards { grid-template-columns: 1fr; }
  .tarot-card { min-height: 145px; }
  .board-letter-paper { padding: 28px 22px 22px; }
  .board-letter-paper h3 { margin-top: 28px; font-size: 19px; }
  .board-letter-paper p { font-size: 15px; }
  .board-letter-paper .board-letter-sign { margin-top: 36px; }
}
