#modal.almanac-dialog {
  --wood-dark: #4e2c19;
  --wood-mid: #855433;
  --parchment: #f6deb0;
  --ink: #3f3021;
  width: min(1030px, 96vw);
  max-width: 96vw;
  max-height: 94svh;
  border: 3px solid #493323;
  border-radius: 13px;
  background: #805535;
  box-shadow: 0 14px 52px #08100bd6, inset 0 0 0 1px #e0ad72;
  color: var(--ink);
  scrollbar-color: #a67d51 #ead1a6;
}
#modal.almanac-dialog #modalInner { padding: 0; }
.almanac-dialog .dialog-close {
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 33px;
  height: 33px;
  padding: 7px;
  border: 1px solid #a67b4e;
  background: #56361f;
  color: #ffedc2;
}
.pv-almanac {
  padding: 8px;
  background: repeating-linear-gradient(176deg,#9c6a4140 0 2px,transparent 3px 14px),
    linear-gradient(110deg,#ba8753,#795130 39%,#97663e 68%,#694028);
}
.pv-almanac *, .pv-almanac { box-sizing: border-box; }
.alm-header {
  position: relative;
  display: grid;
  place-items: center;
  padding: 7px 44px 9px;
  min-height: 49px;
  border: 1px solid #442918;
  border-radius: 6px;
  background: radial-gradient(ellipse at 50% 100%,#a3673c 0%,transparent 75%), linear-gradient(#784322,#61351f);
  box-shadow: inset 0 2px #c28a58, inset 0 -2px #4c2c1b, 0 1px #c28f60;
}
.alm-header h2 {
  margin: 0;
  font: 900 clamp(21px,2.5vw,29px)/1.25 "Microsoft YaHei",sans-serif;
  color: #ffdd98;
  letter-spacing: .15em;
  text-shadow: 1px 2px #4f301d;
}
.alm-tabs {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 4px;
  padding: 9px 8px 0;
  background: linear-gradient(#74482d,#654229);
}
.alm-tab {
  min-width: 90px;
  min-height: 33px;
  padding: 5px 13px;
  color: #f8e6bd;
  font-weight: 800;
  border: 1px solid #583b23;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(#aa7950,#87603e);
  box-shadow: inset 0 1px #c3986b;
}
.alm-tab[aria-selected="true"] {
  position: relative;
  z-index: 1;
  color: #553a21;
  background: linear-gradient(#ffe9b8,#efd2a0);
  box-shadow: inset 0 3px #ffeecb;
}
.alm-tab:focus-visible, .alm-card:focus-visible {
  outline: 3px solid #416c31;
  outline-offset: 1px;
}
.alm-spread {
  display: grid;
  grid-template-columns: minmax(0,1.55fr) minmax(0,1fr);
  align-items: start;
  gap: clamp(10px,1.7vw,21px);
  padding: clamp(10px,1.55vw,17px);
  border: 1px solid #79542e;
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #f6daa7, inset 0 0 30px #bb925a68;
  background: radial-gradient(ellipse at 18% 0%,#ffebc8,transparent 55%),
    radial-gradient(ellipse at 95% 95%,#dbb67b,transparent 62%),var(--parchment);
}
.alm-catalog {
  min-width: 0;
  max-height: min(74svh,630px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #ad8756 #e7c999;
  padding: 4px;
  overscroll-behavior: contain;
}
.alm-cards {
  display: grid;
  grid-template-columns: repeat(8,minmax(0,1fr));
  align-items: start;
  gap: clamp(4px,.46vw,7px);
}
.alm-card {
  position: relative;
  display: flex;
  flex-flow: column;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  padding: 2px;
  border: 1px solid #4d5a38;
  border-radius: 3px;
  color: #324327;
  background: #dbe3a7;
  box-shadow: inset 0 0 0 1px #f1f0bd, 0 1px 2px #5b452433;
}
.alm-card-name {
  display: block;
  padding: 1px 0;
  font-size: clamp(9px,.83vw,11px);
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  background: #c5d6a8;
  letter-spacing: -.04em;
}
.alm-card-picture {
  display: grid;
  place-items: center;
  aspect-ratio: 1.14;
  border: 1px solid #a7b384;
  background: radial-gradient(ellipse at 45% 27%,#edfbdd,#c1e2ab);
}
.alm-card-picture img { width: 100%; height: 100%; object-fit: contain; }
.alm-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 1px;
  font: bold clamp(10px,1vw,13px)/1.15 Arial,sans-serif;
  color: #333a25;
}
.alm-price i { display: block; width: 13px; height: 13px; }
.alm-price svg { display: block; width: 100%; height: 100%; }
.alm-upgrade, .pv-almanac[data-section="evolutions"] .alm-card,
.pv-almanac[data-section="talents"] .alm-card { background: #dfc8e4; border-color: #6f5a75; }
.alm-upgrade .alm-card-picture, .pv-almanac[data-section="evolutions"] .alm-card-picture,
.pv-almanac[data-section="talents"] .alm-card-picture { background: radial-gradient(#f3e8fb,#c7b1d6); border-color: #b59fc0; }
.alm-upgrade .alm-card-name, .pv-almanac[data-section="evolutions"] .alm-card-name,
.pv-almanac[data-section="talents"] .alm-card-name { background: #dbc6df; color: #56415d; }
.alm-card:hover { filter: brightness(1.05); border-color: #725022; }
.alm-card[aria-pressed="true"] {
  z-index: 1;
  border-color: #74501f;
  outline: 2px solid #a56822;
  outline-offset: 1px;
  box-shadow: inset 0 0 0 1px #fff2b7, 0 0 0 4px #f5cd72;
}
.pv-almanac:not([data-section="plants"]) .alm-cards { grid-template-columns: repeat(4,minmax(0,1fr)); }
.pv-almanac:not([data-section="plants"]) .alm-card-name { font-size: clamp(11px,1.2vw,14px); padding: 4px 0; }
.pv-almanac:not([data-section="plants"]) .alm-card-picture { aspect-ratio: 1; }
.alm-detail {
  overflow: hidden;
  text-align: left;
  border: 2px solid var(--wood-dark);
  padding: clamp(6px,1vw,10px);
  border-radius: 9px;
  background: linear-gradient(120deg,#a87144,#775033 66%,#8e5e38);
  box-shadow: inset 0 1px #d49a65, 0 2px 4px #69492f40;
}
.alm-figure {
  position: relative;
  width: 100%;
  height: clamp(135px,25svh,235px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  border: 2px solid #4f512f;
  background: radial-gradient(ellipse at 50% 39%,#d8e9a5 0,#a5c576 52%,#7f9d60 100%);
  box-shadow: inset 0 1px 10px #4256365e;
}
.alm-figure img { position: absolute; inset: 5%; width: 90%; height: 90%; object-fit: contain; }
.pv-almanac[data-section="talents"] .alm-figure,
.pv-almanac[data-section="evolutions"] .alm-figure { background: radial-gradient(ellipse at 50% 40%,#dbcbe8,#b5a2b8 70%,#907e95); }
.alm-detail-text { min-width: 0; }
.alm-detail-title { text-align: center; padding: 9px 4px; }
.alm-detail-title h3 {
  color: #ffdfa1;
  margin: 0 0 4px;
  font-size: clamp(21px,2.1vw,29px);
  line-height: 1.2;
  text-shadow: 1px 2px #59391d;
}
.alm-status { font-size: 11px; color: #fbeac8; }
.alm-detail .alm-description, .alm-stats { background: #f7dfb6; color: #533b23; text-align: left; }
.alm-detail .alm-description {
  margin: 0;
  font-size: clamp(12px,1.25vw,15px);
  line-height: 1.65;
  padding: 12px 13px 10px;
  border: 1px solid #76502f;
  border-bottom-width: 0;
  border-radius: 3px 3px 0 0;
}
.alm-stats {
  margin: 0;
  padding: 0 13px 10px;
  border: 1px solid #76502f;
  border-top-width: 0;
  border-radius: 0 0 3px 3px;
  font-size: clamp(11px,1.05vw,13px);
}
.alm-stats div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-top: 1px dashed #cfae7f;
}
.alm-stats dt { color: #795b37; flex-shrink: 0; }
.alm-stats dd { margin: 0; text-align: right; font-weight: 700; }
@media (max-width:790px) and (min-width:641px) {
  .alm-cards { grid-template-columns: repeat(6,minmax(0,1fr)); }
}
@media (max-width:640px) {
  #modal.almanac-dialog { width: 97vw; max-width: 97vw; max-height: 95svh; border-width: 2px; }
  .pv-almanac { padding: 5px; }
  .alm-header { min-height: 39px; padding: 6px 38px; }
  .almanac-dialog .dialog-close { right: 10px; top: 9px; width: 30px; height: 30px; }
  .alm-tabs { padding: 6px 3px 0; gap: 3px; }
  .alm-tab { flex: 1; min-width: 0; min-height: 34px; padding: 4px 2px; font-size: 13px; }
  .alm-spread { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 8px; }
  .alm-catalog { max-height: 38svh; }
  .alm-cards { grid-template-columns: repeat(6,minmax(0,1fr)); gap: 6px; }
  .alm-card-name { font-size: clamp(9px,2.4vw,12px); }
  .alm-detail { display: grid; align-items: start; grid-template-columns: minmax(72px,.58fr) minmax(0,1fr); gap: 7px; }
  .alm-figure { height: clamp(95px,24vw,165px); }
  .alm-detail-title { padding: 1px 0 5px; text-align: left; }
  .alm-detail-title h3 { display: inline; margin-right: 6px; font-size: 18px; }
  .alm-status { display: inline-block; font-size: 10px; }
  .alm-detail .alm-description { padding: 6px 7px 5px; font-size: 12px; line-height: 1.5; }
  .alm-stats { padding: 0 7px 5px; font-size: 11px; }
  .alm-stats div { padding: 2px 0; }
}
@media (max-width:410px) { .alm-cards { grid-template-columns: repeat(5,minmax(0,1fr)); } }
@media (max-height:470px) and (min-width:641px) {
  .alm-header { min-height: 35px; padding: 3px 38px; }
  .alm-header h2 { font-size: 19px; }
  .alm-tabs { padding-top: 4px; }
  .alm-tab { min-height: 28px; padding: 3px 8px; }
  .alm-catalog { max-height: 62svh; }
  .alm-figure { height: 78px; }
  .alm-detail-title { padding: 3px 0; }
  .alm-detail-title h3 { display: inline; font-size: 17px; margin-right: 6px; }
  .alm-detail .alm-description, .alm-stats { padding: 4px 7px; font-size: 11px; }
  .alm-stats div { padding: 2px 0; }
}

.pv-almanac[data-section="talents"] .alm-detail {
  display: grid;
  grid-template-columns: clamp(48px,7vw,72px) minmax(0,1fr);
  align-items: start;
  gap: 9px;
}
.pv-almanac[data-section="talents"] .alm-figure {
  height: auto;
  aspect-ratio: 1;
}
.pv-almanac[data-section="talents"] .alm-detail-title {
  padding: 1px 0 5px;
  text-align: left;
}
.pv-almanac[data-section="talents"] .alm-detail-title h3 {
  display: inline;
  margin-right: 5px;
  font-size: clamp(16px,1.7vw,22px);
}
.pv-almanac[data-section="talents"] .alm-stats {
  padding: 5px 7px;
  border: 1px solid #76502f;
  border-radius: 4px;
}
.pv-almanac[data-section="talents"] .alm-stats div:first-child {border-top: 0;}
.alm-tier-comparison {
  grid-column: 1 / -1;
  width: 100%;
  border-collapse: collapse;
  background: #f7dfb6;
  color: #49351f;
  font-size: clamp(12px,1vw,14px);
  line-height: 1.55;
}
.alm-tier-comparison caption {
  padding: 6px 9px;
  background: #e8c692;
  color: #664624;
  text-align: left;
  font-weight: 800;
  border-radius: 4px 4px 0 0;
}
.alm-tier-comparison td, .alm-tier-comparison th {
  padding: 8px 7px;
  border-top: 1px solid #d3b48a;
  text-align: left;
  vertical-align: top;
}
.alm-tier-comparison th {
  width: 5em;
  color: #563d24;
  white-space: nowrap;
}
.alm-tier-mark {
  display: inline-block;
  margin: 0 5px 1px 1px;
  width: .7em;
  height: .7em;
  vertical-align: middle;
  transform: rotate(45deg);
  border: 1px solid #775d44;
  background: linear-gradient(135deg,#fff7d7,var(--hex-accent,#c19065) 56%,#987e67);
}
.alm-tier-comparison [data-hex-tier="silver"] .alm-tier-mark {
  background: linear-gradient(135deg,#fbffff,var(--hex-accent,#bbd4db) 55%,#839caa);
}
.alm-tier-comparison [data-hex-tier="gold"] .alm-tier-mark {
  background: linear-gradient(135deg,#fff6a7,var(--hex-accent,#eabe46) 55%,#af782a);
}
.alm-tier-comparison [data-hex-tier="prismatic"] .alm-tier-mark {
  background: linear-gradient(135deg,#a9ece2,#d5b1ed 53%,#e5a0b6);
}
@media (max-width:640px) {
  .pv-almanac[data-section="talents"] .alm-detail {
    grid-template-columns: 50px minmax(0,1fr);
    gap: 7px;
  }
  .alm-tier-comparison td, .alm-tier-comparison th {padding: 6px;}
}
