body[data-edition] {
  --paper-panel: #fffefa;
  --line-warm: #ded2b9;
  --metal-light: #efd9a5;
  --metal-dark: #a68143;
}
body:is([data-page=topics],[data-page=zodiac]) .masthead { display:none; }
body:is([data-page=topics],[data-page=zodiac]) main.shell { width:min(830px,100%);background:var(--paper-panel); }
.record-titlebar > :first-child { justify-self:start; }

.site-directory {
  border-block: 1px solid var(--line-warm);
  background: linear-gradient(180deg, #fffdf6, #f5ecda);
  padding: 0 9px 9px;
}
.site-directory h2 {
  margin: 0 -9px 2px;
  padding: 9px 8px 8px;
  color: #fff3d5;
  background: linear-gradient(110deg, var(--edition-dark), var(--directory-head));
  border-bottom: 1px solid #baa068;
  letter-spacing: .12em;
}
.site-directory .presentations {
  gap: 5px;
  padding-top: 6px;
  background: none;
  overflow: visible;
}
.site-directory .presentations a {
  position: relative;
  min-height: 39px;
  border: 1px solid #dac8a1;
  border-radius: 7px;
  background: linear-gradient(160deg, #ffffff, #f8f0db);
  color: var(--edition-ink);
  box-shadow: inset 0 1px #fff, 0 2px 3px #50371f0b;
  font-weight: 760;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.site-directory .presentations a[aria-current] {
  color: #fff1cb;
  border-color: var(--edition-dark);
  background: linear-gradient(135deg, var(--edition-rich), var(--edition-dark));
  box-shadow: inset 0 1px #ffffff35, 0 2px 5px #432e291d;
}
.edition-shortcuts { background: #f8f8f9; }
body[data-edition][data-page=home] .edition-shortcuts button,
body[data-edition][data-page=home] .edition-shortcuts a {
  min-height: 33px;
  border: 1px solid #ced7dd;
  border-radius: 6px;
  color: var(--edition-dark);
  background: linear-gradient(170deg, #fff, var(--edition-soft));
  box-shadow: inset 0 1px #fff, 0 1px 2px #28354316;
  font-weight: 780;
  transition: transform .16s, background-color .16s, box-shadow .16s;
}
.draw-bottom .neutral-button,.record-search-controls button[type=submit] {
  border: 1px solid #c7a56c;
  border-radius: 6px;
  transition: transform .16s, box-shadow .16s;
}
.draw-history-link { border-bottom: 1px solid #ad7945; padding-block: 1px; }
.tools-panel a,.history-tabs button {
  transition: background-color .16s, color .16s, transform .16s;
}
.tools-panel a { gap: 6px; background: #fffefb; }
.tools-panel .tool-icon,body[data-page=history] .history-tabs .tool-icon {
  display: grid;
  place-items: center;
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid #ffffff75;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--chip-high), var(--chip-low));
  box-shadow: inset 0 1px #ffffff52, 0 2px 4px #2632372c;
}
body[data-page=history] .history-tabs .tool-icon { width: 35px; height: 35px; }
.tool-records { --chip-high: #528fbd; --chip-low: #26538d; }
.tool-trend { --chip-high: #de8069; --chip-low: #a6303d; }
.tool-frequency { --chip-high: #78a979; --chip-low: #2e6c50; }
.tool-missing { --chip-high: #d39a57; --chip-low: #9a591e; }
.tool-icon::before,.tool-icon::after { content: "";position: absolute; }
.tool-records::before { width: 41%;height: 48%;border: 2px solid currentColor;border-radius: 2px; }
.tool-records::after { width: 24%;height: 1.5px;background: currentColor;box-shadow: 0 4px currentColor;top: 39%; }
.tool-trend::before { width: 56%;height: 56%;background: currentColor;clip-path: polygon(0 78%, 32% 40%, 48% 56%, 76% 16%, 72% 8%, 98% 5%, 99% 35%, 88% 28%, 49% 76%, 32% 59%, 8% 93%); }
.tool-frequency::before { width: 50%;height: 54%;background: currentColor;clip-path: polygon(0 100%,0 61%,25% 61%,25% 100%,38% 100%,38% 34%,62% 34%,62% 100%,75% 100%,75% 0,100% 0,100% 100%); }
.tool-missing::before { width: 47%;height: 47%;border: 2px solid currentColor;border-radius: 50%; }
.tool-missing::after { width: 16%;height: 20%;border-left: 2px solid currentColor;border-bottom: 2px solid currentColor;top: 30%;left: 49%; }

.ball-attributes { display:flex;justify-content:center;align-items:center;gap:4px; }
.animal-label,.element-label { display:inline-flex;align-items:center;justify-content:center;gap:2px;white-space:nowrap; }
.animal-label img {
  width: 16px;
  height: 16px;
  flex:none;
  border-radius: 50%;
  border: 1px solid #b5a181;
  object-fit: cover;
  background:#f4e6c5;
}
.element-symbol { display:inline-block;flex:none;width:11px;height:11px;background:currentColor; }
.element-metal { color:#89651f; }
.element-metal .element-symbol { transform:rotate(45deg) scale(.76);border:1px solid #f2d486;background:#b78a2d; }
.element-wood { color:#28714a; }
.element-wood .element-symbol { border-radius:90% 10% 90% 10%;transform:rotate(-16deg); }
.element-water { color:#266399; }
.element-water .element-symbol { border-radius:65% 44% 65% 43%;transform:rotate(-44deg); }
.element-fire { color:#aa3529; }
.element-fire .element-symbol { background:linear-gradient(170deg,#f7a443,#c33724 70%);clip-path:polygon(55% 0,69% 34%,68% 47%,85% 32%,95% 70%,75% 100%,25% 100%,6% 76%,28% 43%,31% 66%,44% 51%); }
.element-earth { color:#7e542d; }
.element-earth .element-symbol { clip-path:polygon(0 85%,32% 23%,56% 49%,74% 16%,100% 85%,100% 95%,0 95%); }
.draw-card .ball-pair .ball-attributes {
  min-width: 100%;
  padding: 2px 1px;
  border-radius: 3px;
  font-size: .82rem;
  line-height: 1.1;
  background: #fffff9;
  font-weight: 820;
}
#history-results .compact .ball-pair .ball-attributes,.recent .compact .ball-pair .ball-attributes {
  font-size:.74rem;
  font-weight:760;
  line-height:1.1;
}
.draw-band { position: relative; box-shadow: inset 0 1px #ffffff22; }
.draw-card.is-live .draw-band::after {
  position: absolute;
  content: "";
  width: 7px;
  height: 7px;
  right: 13px;
  top: calc(50% - 3.5px);
  background: #ffe4a6;
  border-radius: 50%;
  animation: draw-pulse 1.5s ease-out infinite;
}
.ball-pair.ball-revealed { animation: reveal-ball .52s cubic-bezier(.23,.78,.27,1.38) both; }
.status-pill.live::before { animation: draw-pulse 1.5s ease-out infinite; }
@keyframes draw-pulse {
  0% { box-shadow: 0 0 0 0 #ffcf837f; }
  78%, 100% { box-shadow: 0 0 0 9px #ffcf8300; }
}
@keyframes reveal-ball {
  from { transform: translateY(-7px) scale(.86);opacity:.25; }
  to { transform:none;opacity:1; }
}

.zodiac-board { background: #fbf4e4; }
.zodiac-board>.section-head {
  background: linear-gradient(115deg,var(--edition-dark),var(--edition-rich));
  border-bottom: 1px solid #ad8f54;
  padding: 9px 11px;
  color: #f4dfac;
}
.zodiac-switch { gap: 4px; padding: 6px; background: #e9dfca; }
.zodiac-switch button {
  display:grid;
  place-items:center;
  align-content:center;
  gap:5px;
  min-height:59px;
  padding:4px 2px;
  border:1px solid #d5c6a6;
  border-radius:6px;
  background:linear-gradient(157deg,#fffef7,#f5e8cb);
  box-shadow:inset 0 1px #fff, 0 2px 2px #4e3c2011;
  transition:transform .18s,border-color .18s,box-shadow .18s;
  font-size:1.01rem;
  line-height:1.05;
}
.zodiac-switch button img {
  display:block;
  width:29px;
  height:29px;
  object-fit:cover;
  border-radius:50%;
  border:1px solid #bda578;
  background:#e7d4ac;
}
.zodiac-switch button[aria-pressed=true] {
  background:linear-gradient(140deg,var(--edition-rich),var(--edition-dark));
  border-color:#c0a06b;
  box-shadow:inset 0 0 0 1px #f3dba2a0,0 2px 5px #36272429;
  color:#fff3d9;
}
.zodiac-switch button[aria-pressed=true] img { border-color:#f8d99a; }
.zodiac-visual img { height:clamp(205px,46vw,350px);object-position:center 46%;animation:zodiac-arrive .27s ease-out both; }
.zodiac-visual::before,.zodiac-feature a::before { z-index:1;background:linear-gradient(90deg,#f9ecd3e8,transparent 69%); }
.zodiac-caption,.zodiac-feature figcaption { z-index:2;color:#452c19; }
.zodiac-seal {
  display:inline-grid;
  place-items:center;
  width:29px;
  height:29px;
  border:1px solid #99312b;
  outline:1px solid #a93f3566;
  outline-offset:2px;
  border-radius:3px;
  background:#a43732;
  color:#fff1d5;
  font:bold 1rem/1 "Songti SC","SimSun",serif;
  margin-bottom:8px;
}
.zodiac-caption h3 { font-size:clamp(1.75rem,5vw,2.65rem); }
.zodiac-feature { margin:7px 0; }
.zodiac-feature img { height:clamp(198px,48vw,315px);transition:transform .45s ease-out; }
.zodiac-number-grid { gap:5px;align-items:stretch;background:#f4ead8; }
.zodiac-fact { display:grid;justify-items:center;align-content:center;gap:1px;min-width:0;flex:0 1 123px;padding:5px 3px;border:1px solid #ddcbab;border-radius:5px;background:#fffefb; }
.zodiac-fact strong { font-size:1.08rem; }
.zodiac-fact .element-label { font-size:.78rem;font-weight:740; }
@keyframes zodiac-arrive {
  from { opacity: .55; transform:translateY(3px) scale(1.006); }
  to { opacity: 1; transform:none; }
}

.period-board h3 { font-weight:810; }
.period-table td:nth-child(2) { font-size:.89rem; }
@media(hover:hover) {
  .site-directory .presentations a:hover,.edition-shortcuts button:hover,.edition-shortcuts a:hover,.zodiac-switch button:hover { transform:translateY(-2px); border-color:#b99a5c; box-shadow:0 4px 8px #44362023; text-decoration:none; }
  .tools-panel a:hover,.history-tabs button:hover { background:#f9f0df; }
  .zodiac-feature a:hover img { transform:scale(1.035); }
}
.site-directory .presentations a:active,.edition-shortcuts button:active,.edition-shortcuts a:active,.zodiac-switch button:active,.tools-panel a:active,.history-tabs button:active,.draw-bottom .neutral-button:active { transform:translateY(1px) scale(.98); }
@media(max-width:730px) {
  .site-directory .presentations a { min-height:34px; }
  .tools-panel .tool-icon { width:23px;height:23px; }
  body[data-page=history] .history-tabs .tool-icon { width:31px;height:31px; }
  .zodiac-switch { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .zodiac-switch button { min-height:46px;gap:2px; }
  .zodiac-switch button img { width:24px;height:24px; }
  .draw-card .ball-pair .ball-attributes { display:grid;gap:2px;font-size:.79rem;padding:2px 1px; }
  .draw-card .ball-attributes .animal-label img { width:13px;height:13px; }
  #history-results .compact .ball-pair .ball-attributes,.recent .compact .ball-pair .ball-attributes { display:grid;gap:2px;font-size:.72rem; }
  .recent .history-meta { width:75px; }
  .recent .history-meta strong { font-size:.69rem; }
  .compact .animal-label img { width:12px;height:12px; }
  .compact .element-symbol { width:9px;height:9px; }
  .zodiac-caption h3 { font-size:1.65rem; }
}
@media(prefers-reduced-motion:reduce) {
  .site-directory .presentations a,.edition-shortcuts button,.edition-shortcuts a,.tools-panel a,.history-tabs button,.draw-bottom .neutral-button,.record-search-controls button[type=submit],.zodiac-switch button,.zodiac-visual img,.zodiac-feature img,.draw-card.is-live .draw-band::after,.status-pill.live::before,.ball-pair.ball-revealed { animation:none;transition:none;transform:none; }
  .zodiac-feature a:hover img { transform:none; }
}
