/* A single nine-slice preserves the copper corner straps on every size of board. */
.victory-tools { display: flex; align-items: center; flex: none; }
.victory-tools img + img { margin-left: -10px; }
@media (max-width: 470px) {
  .victory-reward:has(.victory-art + .victory-art) strong { font-size: 14px; }
}
.modal .sheet:not([data-view="result-win"]) {
  border: 8px solid transparent;
  border-image: url('./art/watch-board.webp') 128 fill / 23px stretch;
  border-radius: 2px;
  background: #173b31;
  box-shadow: 0 9px 32px #09110e9e;
}
.sheet[data-view="guide"], .sheet[data-view="challenges"] {
  display: flex;
  flex-direction: column;
  width: min(100%, 780px);
  overflow: hidden;
}
.sheet[data-view="guide"] .sheet-top, .sheet[data-view="challenges"] .sheet-top { flex: none; margin-bottom: 8px; }
.journal-tabs { flex: none; display: flex; gap: 4px; }
.journal-tab {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #a08960;
  border-bottom: 0;
  border-radius: 5px 7px 0 0;
  background: #304a3c;
  color: #f3dfac;
  padding: 3px;
  font: 700 clamp(12px, 2vw, 15px) var(--body);
}
.journal-tab[aria-pressed="true"] { color: #51351e; background: #efd8ac; box-shadow: inset 0 3px #ca9756; }
.journal-page, .challenge-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #927249 #deca9e;
}
.journal-page {
  padding: clamp(8px, 1.4vw, 16px);
  color: #4a3726;
  background: linear-gradient(90deg, #b28d5d6e, transparent 4%, transparent 97%, #92714d33),
    linear-gradient(#f2deb6f5, #ead1a7f7), url('./art/valley-atlas.webp') center / 200%;
}
.field-note { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field-note img { width: 50px; height: 45px; object-fit: contain; }
.sheet .field-note p, .sheet .guide-rule { margin: 0 0 5px; color: #4b3926; font-size: 14px; }
.journal-page .guide-list { gap: 0 15px; }
.journal-page .guide-unit {
  border: 0;
  border-top: 1px solid #a7835288;
  border-radius: 0;
  align-items: flex-start;
  padding: 10px 0;
  background: none;
}
.journal-page .guide-unit img { width: 46px; height: 52px; }
.journal-page .guide-unit strong { font: 700 16px/1.1 var(--title); color: #47321c; }
.journal-page .guide-unit small, .journal-page .guide-unit .guide-lock { color: #514132; font-size: 13px; }
.journal-page .guide-unit .guide-profile { color: #6f482a; font-weight: 700; }
.journal-page .guide-unit .guide-counter { color: #294f40; }
.journal-page .guide-unit .guide-status { color: #8a682f; font-style: italic; }
.journal-page .guide-hidden { margin: 2px 0 7px; color: #62492c; font-size: 13px; font-style: italic; }
.journal-page .keepsakes { color: #503a24; }
.defence-families {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding-bottom: 6px;
}
.family-tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 3px 1px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #51391f;
  background: none;
  font: 700 12px/1.1 var(--body);
}
.family-tab img { width: 31px; height: 28px; object-fit: contain; }
.family-tab[aria-pressed="true"] { background: #dfc49a; border-color: #997043; box-shadow: inset 0 -2px #7d552b; }
.defence-index .guide-price { font-weight: 700; color: #6b4a23; }
.defence-index .guide-unit:only-child { grid-column: 1 / -1; }
.guide-improvement summary {
  display: flex; align-items: center; gap: 7px; min-height: 44px; width: fit-content;
  list-style: none; font: 700 13px/1.2 var(--body); color: #604324; cursor: pointer;
}
.guide-improvement summary::-webkit-details-marker { display: none; }
.guide-improvement summary::before {
  content: ''; width: 7px; height: 7px; border: solid #946628; border-width: 2px 2px 0 0; transform: rotate(45deg);
}
.guide-improvement[open] summary::before { transform: rotate(135deg); }
.guide-improvement[open] { padding-bottom: 6px; }
@media (max-width: 480px) {
  .defence-families { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.challenge-list { display: flex; flex-direction: column; gap: 8px; }
.sheet[data-view="challenges"] .challenge {
  flex: none;
  margin: 0;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-left: 3px solid #bd9056;
  border-radius: 2px;
  background: linear-gradient(105deg, #ead3aaf8, #efdcbdf8), url('./art/valley-atlas.webp') center / 200%;
}
.challenge img { width: 100%; height: 58px; object-fit: contain; }
.challenge strong { color: #432d18; font: 700 16px var(--title); }
.sheet .challenge p { color: #4a3726; }
.sheet .challenge .outcome-number { font-size: 12px; color: #6b4b31; }
.challenge-mark { display: block; color: #375143; }
.challenge button { min-height: 44px; }
.pause-note { display: flex; justify-content: center; align-items: center; gap: 11px; padding: 4px 0 8px; }
.pause-note img { width: 40px; height: 54px; object-fit: contain; }
.sheet[data-view="pause"], .sheet[data-view="result-lose"] { width: min(100%, 455px); }
.sheet[data-view="options"] { width: min(100%, 510px); }
.sheet[data-view="options"] .toggle-row { border-bottom-color: #d2b16f4f; }
.sheet[data-view="options"] button[role="switch"] {
  position: relative;
  border: 1px solid #b39254;
  border-radius: 20px;
  min-width: 75px;
  min-height: 44px;
  padding: 0 31px 0 8px;
  background: #162d29;
  color: #f3ddb0;
}
.sheet[data-view="options"] button[role="switch"]::after {
  content: "";
  position: absolute;
  top: calc(50% - 10px);
  right: 7px;
  width: 19px;
  height: 19px;
  border: 1px solid #9e7c4b;
  border-radius: 50%;
  background: radial-gradient(at 35% 25%, #d9c7a1, #7c684a 75%, #493c2b);
}
.sheet[data-view="options"] button[aria-checked="true"] { background: #405540; padding: 0 8px 0 31px; }
.sheet[data-view="options"] button[aria-checked="true"]::after { left: 7px; right: auto; background: radial-gradient(at 35% 25%, #fff0a2, #c99446 74%, #7d592e); }
.sheet[data-view="kit"] .kit-footer { background: none; }
.sheet[data-view="kit"] .kit-choice { border-radius: 3px; }
.sheet[data-view="kit"] .kit-choice[aria-pressed="true"] { background: #e4c795; border-color: #f4dba6; }
.sheet[data-view="kit"] .kit-choice[aria-pressed="true"] strong, .sheet[data-view="kit"] .kit-choice[aria-pressed="true"] small { color: #463421; }
.sheet[data-view="kit"] .kit-choice[aria-pressed="true"]::after { border-color: #4e472b; }
.sheet[data-view="kit"] .kit-footer .plank,
.sheet[data-view="pause"] .plank, .sheet[data-view="result-lose"] .plank {
  --plank: 44px; min-width: 0; font-size: 15px; padding: 0 3px; border-inline-width: 16px;
}
.sheet[data-view="kit"] .kit-footer .plank { width: auto; }
@media (orientation: landscape) and (max-height: 520px) {
  .modal .sheet:not([data-view="result-win"]) { border-width: 5px; border-image-width: 15px; }
  .sheet[data-view="guide"], .sheet[data-view="challenges"], .sheet[data-view="options"] {
    width: min(100%, 700px); max-height: calc(100svh - 20px); padding: 7px 12px;
  }
  .sheet[data-view="guide"] .sheet-top, .sheet[data-view="challenges"] .sheet-top { margin-bottom: 3px; }
  .journal-page .guide-unit small { font-size: 12px; }
  .journal-page .guide-unit img { width: 39px; height: 45px; }
}
.defence-families { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.guide-improvement[open] .fitted-portrait { width: 68px; height: 55px; object-fit: contain; }
.pack-filters { display: flex; flex-wrap: wrap; gap: 3px; padding: 2px 0 5px; }
.pack-tab { border: 1px solid #967644; background: #293d32; color: #f8dfab; padding: 4px 9px; min-height: 44px; border-radius: 4px; font: 700 13px var(--body); }
.pack-tab[aria-pressed="true"] { color: #3c301e; background: #e7c98e; }
.kit-list .kit-choice[hidden], .workshop-actions button[hidden] { display: none; }
#fair-drops { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.field-token { position: absolute; pointer-events: auto; transform: translate(-50%, -105%); width: 44px; height: 44px; background: none; border: 0; padding: 3px; }
.field-token img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 4px #ffcb54); }
@media (max-width: 540px) { .defence-families { grid-template-columns: repeat(4,minmax(0,1fr)); } }

.tool-layers { display:flex; flex-wrap:wrap; gap:4px; }
.tool-layers[hidden] { display:none; }
.layer-tab { min-height:44px; border:1px solid #93754a; border-radius:3px; background:#253b32; color:#ffe3ad; padding:3px 8px; font:700 12px var(--body); }
.layer-tab[aria-pressed="true"] { background:#e5c58b; color:#48361e; }
