#profession-station.station-ledger {
  --ledger-ink: #4a2b16;
  --ledger-rule: #88582d45;
  --ledger-sky: url('assets/act-two/workshop-armory-v2.webp');
  width: min(700px, calc(100vw - 18px));
  height: min(782px, var(--panel-height, 90dvh));
  background: transparent;
  box-shadow: none;
  overflow: visible;
  container-type: inline-size;
  color: var(--ledger-ink);
}

#profession-station.station-ledger:is([data-profession='alchemy'], [data-profession='herbs']) { --ledger-sky: url('assets/act-two/workshop-textile.webp'); }

#profession-station.station-ledger .station-board {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#profession-station.station-ledger .station-board > header {
  position: absolute;
  z-index: 3;
  inset: 1.5% 4.5% auto;
  display: grid;
  grid-template-columns: minmax(34px, 1fr) minmax(0, 8fr) minmax(34px, 1fr);
  align-items: start;
  gap: 0;
  padding: 0;
  border: 0;
}

#profession-station.station-ledger h2 {
  grid-column: 2;
  justify-self: stretch;
  padding: .23em .9em .31em;
  color: #492716;
  text-align: center;
  text-shadow: none;
  font: 700 clamp(22px, 5.6cqw, 44px)/1.16 Georgia, serif;
}

#profession-station.station-ledger .aux-close {
  width: clamp(34px, 8cqw, 54px);
  height: auto;
  aspect-ratio: 1;
  margin-left: auto;
}

.station-ledger .station-layout {
  isolation: isolate;
  grid-template: minmax(0, 52fr) minmax(0, 48fr) / minmax(0, 1fr);
  gap: 0;
  height: 100%;
}

.station-ledger .station-illustration {
  position: relative;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  align-content: normal;
  align-items: end;
  gap: 0;
  padding: 9% 8% 2%;
  margin: 0 1.3%;
  border: 0;
  border-radius: 9% 9% 1% 1%;
  box-shadow: none;
  background: #5894a4 var(--ledger-sky) center 57% / cover no-repeat;
}

.station-ledger .station-illustration::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: url('assets/professions/station-arch.webp') center / 100% 100% no-repeat;
}

.station-ledger .station-illustration img {
  position: absolute;
  inset: auto 9% 0;
  width: 82%;
  height: calc(100% - clamp(50px, 12cqw, 86px));
  min-height: 0;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 4px 3px #40231770);
}

.station-ledger .station-skill {
  position: absolute;
  z-index: 3;
  inset: auto 6% 6% auto;
  display: flex;
  flex-wrap: nowrap;
  padding: .38em .6em;
  font-size: clamp(10px, 2cqw, 15px);
}

.station-ledger .station-recipes {
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10%;
  min-height: 0;
  margin: -2.2% 0 0;
  padding: 5.7% 7.1% 6%;
  border: 0;
  border-radius: 0;
  background: url('assets/professions/station-ledger.webp') center / 100% 100% no-repeat;
  overflow: hidden;
  color: var(--ledger-ink);
}

.station-ledger-menu { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.station-ledger-navigation { display: none; }
.station-ledger-pager { display: none; }
.station-ledger .station-recipes h3 {
  margin: 0;
  padding-block-end: .31em;
  border-bottom: 1px solid var(--ledger-rule);
  color: inherit;
  overflow-wrap: anywhere;
  font: 700 clamp(17px, 3.85cqw, 30px)/1.08 Georgia, serif;
}

.station-ledger-list,
.station-ledger-sheet { min-height: 0; padding: 0 .2em .2em; overflow: auto; scrollbar-width: thin; scrollbar-color: #95633a #f0cb8e70; }
.station-ledger-list { margin: .35em 0 0; }
.station-ledger-list { list-style: none; }
.station-ledger-list li + li { border-top: 1px solid var(--ledger-rule); }
.station-ledger-list button {
  display: flex;
  align-items: center;
  width: 100%;
  gap: .45em;
  min-height: 37px;
  padding: .32em .35em;
  border: 0;
  text-align: start;
  background: transparent;
  color: var(--ledger-ink);
  font: 700 clamp(13px, 2.60cqw, 20px)/1.08 Georgia, serif;
}
.station-ledger-list button::first-letter { text-transform: uppercase; }
.station-ledger-list button[aria-pressed='true'] {
  color: #fff1ca;
  background: url('assets/cardboard/red-label.webp') center / 100% 100% no-repeat;
}
.station-ledger-list [data-locked] button:not([aria-pressed='true']) { opacity: .69; }
.station-ledger-list button:disabled:not([aria-pressed='true']) { opacity: .66; }
.station-ledger-list button img { width: clamp(22px, 5cqw, 35px); height: clamp(22px, 5cqw, 35px); flex: none; object-fit: contain; }

.station-ledger-detail { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: .24em; min-width: 0; min-height: 0; }
.station-ledger-actions { display: grid; }
.station-ledger-detail h3 { font-size: clamp(17px, 3.45cqw, 26px); }
.station-ledger-result img { display: none; }
.station-ledger-stock { margin: .48em 0 .2em; }
.station-ledger-stock li { display: flex; align-items: center; gap: .5em; padding: .19em 0; }
.station-ledger-stock li img { width: clamp(28px, 8.7cqw, 62px); height: clamp(28px, 8.7cqw, 62px); object-fit: contain; }
.station-ledger-stock strong { display: block; font: 700 clamp(13px, 2.9cqw, 21px)/1.12 Georgia, serif; }
.station-ledger-stock small { display: block; margin-block-start: .2em; font-size: clamp(10px, 1.9cqw, 14px); }
.station-ledger-yield, .station-ledger-count, .station-ledger-detail .station-trial-note { margin: .2em 0; font-size: clamp(11px, 2.05cqw, 14px); }

.cardboard-game .station-ledger-detail .station-convert {
  justify-self: stretch;
  min-height: clamp(33px, 7.1cqw, 52px);
  margin: auto 0 0;
  padding: .3em .8em;
  border: 0;
  box-shadow: none;
  background: url('assets/professions/station-command.webp') center / 100% 100% no-repeat;
  color: #fff2ca;
  font: 700 clamp(16px, 4.10cqw, 29px)/1.13 Georgia, serif;
}
.station-ledger-detail .station-convert:disabled { opacity: .64; filter: saturate(.66); }
.station-ledger .station-treatment { display: grid; padding: .45em; }
#profession-station.station-ledger .station-status {
  position: absolute;
  z-index: 3;
  inset: auto auto 49% 7%;
  max-width: 76%;
  padding: .45em 1em;
  text-align: center;
  color: #fff0c5;
  background: url('assets/cardboard/red-label.webp') center / 100% 100% no-repeat;
  pointer-events: none;
}
#profession-station.station-ledger .station-status:empty { display: none; }
.station-status[data-working] {
  display: inline-grid;
  grid-template-columns: auto minmax(30px, 4.4em) auto;
  gap: .56em;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 540px) {
  #profession-station.station-ledger {
    --station-edge-inline: max(6px, env(safe-area-inset-left), env(safe-area-inset-right));
    --station-edge-block: max(5px, env(safe-area-inset-top), env(safe-area-inset-bottom));
    --station-rail: 25%;
    inset-block-start: 50%;
    width: min(1060px, calc(100vw - 2 * var(--station-edge-inline)));
    height: calc(100dvh - 2 * var(--station-edge-block));
    max-height: none;
    -webkit-tap-highlight-color: transparent;
  }
  #profession-station.station-ledger .station-board {
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0;
    padding: 0 5px 5px;
    border: 2px solid #ab683e;
    border-radius: 14px 14px 11px 11px;
    background: url('assets/craft-reference/compact-desk.webp') center / 190px auto #552b18;
    box-shadow: inset 0 0 0 1px #f3b36f8f, 0 3px 7px #251408a8;
  }
  #profession-station.station-ledger .station-board > header {
    position: static;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    min-height: 50px;
    padding: 1px 6px 0;
    background: url('assets/professions/station-arch.webp') center top / 100% 234px no-repeat;
  }
  #profession-station.station-ledger h2 {
    padding: 0 8px 3px;
    font-size: clamp(20px, 3.2cqw, 34px);
  }
  #profession-station.station-ledger .aux-close { width: 42px; height: 42px; }
  .station-ledger .station-layout {
    grid-template: minmax(0, 1fr) / minmax(0, var(--station-rail)) minmax(0, 1fr);
    gap: 5px;
    min-height: 0;
  }
  .station-ledger .station-illustration {
    grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 6px 7px;
    border: 1px solid #c48b57;
    border-radius: 4px 5px 10px 8px;
    box-shadow: inset 0 0 14px #53240f9c;
  }
  .station-ledger .station-illustration::after { display: none; }
  .station-ledger .station-illustration img { position: static; width: 100%; height: 100%; object-position: center 65%; }
  .station-ledger .station-skill {
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px 8px;
    padding: 5px 7px;
    font-size: clamp(11px, 1.9cqw, 16px);
  }
  .station-ledger .station-recipes {
    --station-spine: 40%;
    position: relative;
    isolation: isolate;
    grid-template-columns: minmax(0, var(--station-spine)) minmax(0, 1fr);
    gap: 0;
    margin: 0;
    padding: 0;
    background: none;
  }
  .station-ledger .station-recipes::before,
  .station-ledger .station-recipes::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset-block: 0;
    pointer-events: none;
    background: url('assets/professions/station-ledger.webp') left center / 200% 100% no-repeat;
  }
  .station-ledger .station-recipes::before { inset-inline: 0 calc(100% - var(--station-spine)); }
  .station-ledger .station-recipes::after { inset-inline: var(--station-spine) 0; background-position: right center; }
  .station-ledger :is(.station-ledger-menu, .station-ledger-detail) { padding: 15px 10% 13px; }
  .station-ledger-menu { grid-template-rows: auto minmax(0, 1fr) auto; }
  .station-ledger :is(.station-ledger-list, .station-ledger-sheet) { overflow: clip; }
  .station-ledger .station-ledger-list { margin-block-start: 4px; padding: 0; }
  .station-ledger .station-ledger-list li[data-other-page] { display: none; }
  .station-ledger-navigation { display: grid; }
  .station-ledger-list button {
    min-height: 40px;
    padding: 3px 5px;
    gap: 5px;
    overflow-wrap: anywhere;
    font-size: clamp(13px, 1.95cqw, 18px);
  }
  .station-ledger-list button img { width: 24px; height: 24px; }
  .station-ledger-pager {
    display: grid;
    grid-template-columns: minmax(32px, 1fr) minmax(38px, .7fr) minmax(32px, 1fr);
    align-items: center;
    text-align: center;
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
  }
  .station-ledger-pager button {
    min-height: 35px;
    padding: 0;
    border: 0;
    background: url('assets/cardboard/paper-label.webp') center / 100% 100% no-repeat;
    color: #4a2b16;
    font: 700 1.35rem/1 Georgia, serif;
  }
  .station-ledger .station-recipes h3 {
    min-height: 24px;
    padding-block-end: 4px;
    font-size: clamp(16px, 2.35cqw, 21px);
  }
  .station-ledger .station-ledger-result { display: flex; align-items: center; gap: 7px; }
  .station-ledger-result img { display: block; width: 29px; height: 29px; flex: none; object-fit: contain; }
  .station-ledger-sheet { display: flex; flex-direction: column; }
  .station-ledger .station-ledger-requirements { margin-block: 4px; }
  .station-ledger .station-ledger-stock { display: grid; gap: 3px; margin: 0 0 5px; }
  .station-ledger .station-ledger-stock li { min-width: 0; gap: 5px; padding-block: 0; margin: 0; }
  .station-ledger-stock li img { width: 29px; height: 29px; flex: none; }
  .station-ledger-stock li > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
  .station-ledger .station-ledger-stock li strong { display: inline; font-size: clamp(13px, 1.8cqw, 16px); }
  .station-ledger .station-ledger-stock li small {
    display: inline-block;
    margin: 0 0 0 5px;
    white-space: nowrap;
    font-size: .75rem;
  }
  .station-ledger .station-ledger-outcome { padding-block-start: 4px; border-top: 1px solid var(--ledger-rule); }
  .station-ledger :is(.station-recipe-effect, .station-ledger-count, .station-ledger-yield, .station-trial-note) {
    margin: 2px 0;
    font-size: clamp(12px, 1.65cqw, 14px);
    line-height: 1.19;
  }
  .cardboard-game .station-ledger-detail .station-convert { min-height: 41px; font-size: clamp(16px, 2.55cqw, 22px); }
  #profession-station.station-ledger .station-status {
    inset: auto auto 59px 13px;
    width: calc((100% - 32px) * var(--station-rail));
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: .46em .55em;
    font-size: .78rem;
    line-height: 1.14;
  }
  #profession-station.station-ledger .station-status[data-working] { grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
  .station-ledger .station-status[data-working] .craft-timer { grid-row: 2; grid-column: 1 / -1; }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 365px) {
  #profession-station.station-ledger { --station-rail: 22%; }
  #profession-station.station-ledger .station-board > header { min-height: 43px; background-size: 100% 202px; }
  #profession-station.station-ledger h2 { font-size: clamp(18px, 3cqw, 26px); }
  .station-ledger :is(.station-ledger-menu, .station-ledger-detail) { padding-block: 11px 10px; }
  .station-ledger .station-recipes { --station-spine: 37%; }
  .station-ledger-list button { min-height: 34px; font-size: clamp(12px, 1.8cqw, 16px); }
  .station-ledger-list button img { width: 22px; height: 22px; }
  .station-ledger .station-recipes h3 { padding-block-end: 3px; font-size: clamp(15px, 2cqw, 18px); }
  .station-ledger-result img { width: 24px; height: 24px; }
  .station-ledger .station-ledger-requirements { margin-block: 3px; }
  .station-ledger .station-ledger-stock { gap: 2px; margin-block-end: 3px; }
  .station-ledger .station-ledger-stock li img { width: 22px; height: 22px; }
  .station-ledger .station-ledger-stock li strong { font-size: clamp(12px, 1.65cqw, 14px); }
  .station-ledger .station-ledger-stock li small { font-size: .7rem; }
  .station-ledger .station-ledger-outcome { padding-block-start: 2px; }
  .station-ledger-meta { display: flex; flex-wrap: wrap; column-gap: 7px; }
  .station-ledger :is(.station-recipe-effect, .station-ledger-count, .station-ledger-yield, .station-trial-note) { font-size: .74rem; }
  .cardboard-game .station-ledger-detail .station-convert { min-height: 36px; }
}

@media (orientation: landscape) and (max-width: 670px) and (max-height: 335px) {
  .station-ledger .station-layout { isolation: auto; grid-template-columns: minmax(0, 1fr); }
  .station-ledger :is(.station-ledger-menu, .station-ledger-detail) { padding: 9px 9% 8px; }
  .station-ledger .station-recipes { --station-spine: 34%; }
  .station-ledger .station-illustration {
    position: absolute;
    z-index: 3;
    inset: 3px auto auto 8px;
    width: min(145px, 27%);
    height: 38px;
    grid-template: minmax(0, 1fr) / 32px minmax(0, 1fr);
    padding: 2px 3px;
    border: 0;
    background: none;
    box-shadow: none;
    pointer-events: none;
  }
  .station-ledger .station-skill { gap: 2px; padding: 3px; }
  .station-ledger-list button { min-height: 32px; }
  .station-ledger-pager button { min-height: 31px; }
  .station-ledger .station-ledger-requirements { margin-block: 2px; }
  .station-ledger .station-ledger-stock li img { width: 19px; height: 19px; }
  .station-ledger .station-recipe-effect { margin: 0; line-height: 1.14; }
  #profession-station.station-ledger .station-status {
    inset: 3px 52px auto auto;
    width: min(105px, 19%);
    padding: 3px 4px;
    font-size: .65rem;
  }
}

@media (orientation: landscape) and (max-width: 1180px) and (max-height: 310px) {
  .station-ledger .station-ledger-navigation .station-trial-note {
    margin: 2px 0;
    padding-inline: 3px;
    font-size: .69rem;
    line-height: 1.13;
  }
  .station-ledger-actions {
    grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
    align-items: center;
    gap: 6px;
  }
  .station-ledger-actions .station-ledger-meta {
    display: block;
    align-self: start;
    padding-block-start: 2px;
    padding-inline-start: 3px;
  }
  .station-ledger-actions .station-ledger-count { margin: 0; font-size: .69rem; }
  .cardboard-game .station-ledger-detail .station-convert { min-height: 34px; }
}

@media (orientation: landscape) and (max-height: 540px) {
  html[data-mobile-game] #profession-station.station-ledger .station-board > header {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    min-height: 46px;
    border-radius: 8px;
    border-bottom: 1px solid #b08551;
    background: #304a38 url('assets/cardboard/cloth-grain.webp') center / 220px auto;
    background-blend-mode: multiply;
  }
  html[data-mobile-game] #profession-station.station-ledger h2 {
    color: #fff0ce;
    text-shadow: 0 1px #242f23;
  }
  html[data-mobile-game] #profession-station.station-ledger .aux-close {
    width: 44px;
    height: 44px;
    background-size: 34px;
  }
  html[data-mobile-game] .station-ledger-list button,
  html[data-mobile-game] .station-ledger-pager button,
  html[data-mobile-game] .cardboard-game .station-ledger-detail .station-convert { min-height: 44px; }
}

@media (orientation: landscape) and (max-height: 265px) {
  html[data-mobile-game] #profession-station.station-ledger .station-board > header { min-height: 42px; }
  html[data-mobile-game] #profession-station.station-ledger .aux-close { height: 40px; }
  html[data-mobile-game] .station-ledger .station-ledger-detail { padding-block: 7px 6px; }
  html[data-mobile-game] .station-ledger-list button,
  html[data-mobile-game] .station-ledger-pager button,
  html[data-mobile-game] .cardboard-game .station-ledger-detail .station-convert { min-height: 36px; }
}
