.album-panel {
  width: min(760px, 100%);
  max-height: calc(100dvh - 32px);
  background: #edf0e9;
}

.album-panel .tool-header { padding: 6px 20px; }
.album-panel .tool-header h2 { font-size: 23px; }
.album-panel .album-summary {
  gap: 6px 18px;
  padding: 6px 20px;
  background: #e4e9e0;
  font-size: 12px;
}
.album-views {
  display: flex;
  flex-shrink: 0;
  gap: 24px;
  padding: 0 20px;
  border-bottom: 1px solid #cbd2c7;
}
.album-views button {
  min-height: 36px;
  padding: 8px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #667063;
  font-size: 13px;
  cursor: pointer;
}
.album-views button[aria-pressed="true"] { border-bottom-color: #285442; color: #234c3e; font-weight: 700; }
.album-dynasties { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 20px 0; }
.album-dynasties button {
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid #c0c8ba;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  color: #59604e;
  background: #dfe4d8;
  font-size: 12px;
  cursor: pointer;
}
.album-dynasties button[aria-pressed="true"] { background: #274d40; border-color: #274d40; color: #fff4d6; }
.album-panel button:focus-visible { outline: 2px solid #aa4c32; outline-offset: 3px; }

.album-book {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 16px;
  padding: 9px 7px 12px;
  border: 1px solid #203e33;
  border-radius: 3px 5px 5px 3px;
  background: #2c5142;
  box-shadow: 0 6px 14px #203c3426, inset 0 0 0 3px #42604a;
  isolation: isolate;
}
/* The fold belongs to the book, so pagination never changes its geometry. */
.album-book::after {
  content: "";
  position: absolute;
  inset: 14px auto 14px 3px;
  width: 4px;
  background: repeating-linear-gradient(180deg, transparent 0 25px, #d2c49a 25px 27px, transparent 27px 70px);
  pointer-events: none;
}
.album-leaf {
  min-width: 0;
  padding: 10px 16px 7px;
  background: #f7f5ec;
  box-shadow: 0 2px 0 #d6d3c3, 0 4px 0 #f0ecdc, 0 5px 0 #a7aa94;
}
.album-leaf:first-child { border-radius: 2px 0 0 2px; }
.album-leaf:last-child { border-radius: 0 2px 2px 0; }
.album-leaf-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 9px;
  border-bottom: 3px double #a2a894;
  color: #52604b;
  font-size: 13px;
}
.album-leaf-heading small { color: #818776; font-variant-numeric: tabular-nums; }
.album-slots { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(74px, auto)); grid-auto-flow: row; column-gap: 8px; }
#albumList .album-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 36px auto;
  justify-items: center;
  align-items: center;
  gap: 2px;
  min-height: 0;
  padding: 3px 2px;
  border: 0;
  border-bottom: 1px solid #c6cbbb;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
  transform: none;
  transition: none;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}
#albumList .album-entry:hover { background: #e9ecdf; }
#albumList .album-entry:nth-child(n + 17) { border-bottom: 0; }
#albumList .album-coin-info { width: 100%; gap: 1px; opacity: 1; align-self: center; }
#albumList .coin-name { font-size: 13px; line-height: 1.2; overflow-wrap: anywhere; }
#albumList .album-coin-info small { white-space: normal; color: #737a6b; font-size: 10px; line-height: 1.2; }
#albumList .is-ready .album-coin-info small { color: #2e644b; font-weight: 700; }
.album-specimen {
  --coin-patina: #8d8244;
  display: grid;
  grid-row: 1;
  justify-items: center;
  align-content: center;
  gap: 5px;
}
.album-specimen.coin-level-1 { --coin-patina: #3b7e58; }
.album-specimen.coin-level-2 { --coin-patina: #83579b; }
.album-specimen.coin-level-3 { --coin-patina: #ac4439; }
.album-coin-relief {
  position: relative;
  display: block;
  width: 36px;
  aspect-ratio: 1;
  border: 3px double #a4ab94;
  border-radius: 50%;
  background: #e4e6db;
  box-shadow: inset 0 0 0 5px #f1f1e7, inset 0 0 0 6px #bdc3af;
}
.album-coin-relief i { position: absolute; inset: 34%; border: 1px solid #a4ab94; background: #f7f5ec; }
.is-collected .album-coin-relief {
  border-color: #665d32;
  background: conic-gradient(from 30deg, #c0b06c, #778571, #c5b77a, #99924e, #c0b06c);
  box-shadow: inset 0 0 0 4px #b4ac70, inset 0 0 0 5px #655e39, 1px 3px 3px #3e432c35;
}
.is-collected .album-coin-relief::before {
  content: "";
  position: absolute;
  inset: 15% 40%;
  border-top: 7px double #555c3b;
  border-bottom: 7px double #555c3b;
}
.is-collected .album-coin-relief::after {
  content: "";
  position: absolute;
  inset: 40% 15%;
  border-left: 7px double #555c3b;
  border-right: 7px double #555c3b;
}
.is-collected .album-coin-relief i { border-color: #605c39; box-shadow: 1px 1px 0 #ded19a; }
.album-specimen small { display: none; color: #7d8471; font-size: 10px; }
.is-collected .album-specimen small { color: var(--coin-patina); font-weight: 700; }
.is-ready .album-specimen small { color: #2e644b; font-weight: 700; }
.album-endpaper { grid-area: 1 / 1 / -1 / -1; align-self: center; justify-self: center; writing-mode: vertical-rl; color: #89907c; line-height: 2; font-size: 16px; }
.album-pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 8px 16px; color: #53634e; font-size: 12px; }
.album-pagination span { flex: 0 1 170px; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; }
.album-pagination button { flex-shrink: 0; width: 40px; height: 40px; padding: 0; border: 1px solid #a8b39e; border-radius: 50%; background: #f6f7ef; color: #30533f; font-size: 21px; cursor: pointer; }
.album-pagination button:disabled { opacity: 0.35; cursor: default; }
#albumNotesView { min-height: 400px; }
#albumNotesView .album-sets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
#albumNotesView .album-set { min-width: 0; animation: none; }

@media (max-width: 600px) {
  .album-panel { max-height: calc(100dvh - 16px); }
  .album-panel .tool-header { padding: 8px 14px; }
  .album-panel .tool-header h2 { font-size: 21px; }
  .album-panel .album-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 8px 14px; font-size: 11px; }
  .album-panel .album-summary b { font-size: 12px; }
  .album-views { gap: 22px; padding: 0 14px; }
  .album-views button { min-height: 38px; }
  .album-dynasties { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px 12px 0; }
  .album-dynasties button { min-width: 0; min-height: 36px; padding: 6px 2px; font-size: 11px; }
  .album-book { grid-template-columns: minmax(0, 1fr); margin: 0 10px; padding: 7px 6px 9px 13px; }
  .album-book::after { inset: 14px auto 14px 5px; width: 6px; transform: none; background: repeating-linear-gradient(180deg, transparent 0 25px, #d2c49a 25px 27px, transparent 27px 70px); }
  .album-leaf { padding: 10px 14px 4px; }
  .album-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(4, minmax(76px, auto)); column-gap: 6px; }
  #albumList .album-entry { grid-template-columns: minmax(0, 1fr); grid-template-rows: 30px auto; gap: 1px; padding: 2px 1px; }
  #albumList .album-entry:nth-child(n + 10) { border-bottom: 0; }
  #albumList .coin-name { font-size: 12px; line-height: 1.15; }
  #albumList .album-coin-info { gap: 1px; }
  #albumList .album-coin-info small { font-size: 10px; line-height: 1.1; }
  .album-coin-relief { width: 30px; }
  .album-pagination { gap: 10px; padding: 9px 12px; }
  #albumNotesView .album-sets { grid-template-columns: 1fr; }
}

@media (max-width: 600px) and (max-height: 640px) {
  .album-panel .tool-header { padding-block: 6px; }
  .album-panel .tool-header > div > span { display: none; }
  .album-slots { grid-template-rows: repeat(4, minmax(62px, auto)); }
  .album-pagination { padding-block: 5px; }
  .album-leaf-heading { padding-bottom: 5px; }
  #albumList .album-entry { position: relative; grid-template-columns: minmax(0, 1fr); grid-template-rows: 24px auto; gap: 1px; padding: 2px 0; }
  #albumList .album-specimen { justify-self: start; margin-left: 5px; }
  #albumList .album-coin-info small { position: absolute; top: 8px; right: 2px; font-size: 9px; }
  #albumList .album-coin-info { gap: 1px; }
  #albumList .coin-name { font-size: 11px; }
  .album-coin-relief { width: 24px; }
}

@media (min-width: 601px) and (max-width: 800px) {
  #albumList .album-entry { position: relative; grid-template-rows: 32px auto; }
  #albumList .album-coin-relief { width: 32px; }
  #albumList .coin-name { font-size: 12px; }
  #albumList .album-specimen { justify-self: start; margin-left: 10px; }
  #albumList .album-coin-info small { position: absolute; top: 14px; right: 3px; }
}

.album-coin-dialog { width: min(380px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; border: 1px solid #829078; border-radius: 6px; background: #f7f5ec; color: #2b3c30; box-shadow: 0 20px 70px #101e1977; }
.album-coin-dialog::backdrop { background: #102019aa; backdrop-filter: blur(3px); }
.album-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.album-detail-header h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.album-detail-header .icon-button { flex-shrink: 0; color: #385440; border-color: #a3ae95; background: transparent; }
#albumCoinContent .album-entry { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: none; transform: none; }
#albumCoinContent .album-coin-info { opacity: 1; }
#albumCoinContent .album-coin-info strong { display: none; }
#albumCoinContent .album-coin-relief { width: 88px; }
#albumCoinContent .album-actions { display: flex; justify-content: center; flex-wrap: wrap; width: 100%; gap: 10px; }
#albumCoinContent .album-actions button { flex: 1; min-width: 95px; min-height: 44px; font-size: 14px; border-radius: 4px; }
#albumCoinContent .album-action.is-collect:not(:disabled) { color: white; background: #2e644b; }
#albumCoinContent .album-action.is-withdraw { color: #a04435; border-color: #c1816e; background: #fbf0e8; }
.album-detail-count { text-align: center; font-size: 13px; }
.album-detail-note { border-top: 1px solid #cdd1c0; padding-top: 12px; color: #6c7565; font-size: 12px; line-height: 1.7; }
.album-detail-notice { min-height: 20px; margin-bottom: 0; color: #2e644b; font-size: 13px; }
.album-coin-dialog button:focus-visible { outline: 2px solid #aa4c32; outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  #albumOverlay .album-panel { animation: none; }
}
