.aux-dialog {
  position: fixed;
  inset: 0;
  z-index: 12;
  width: min(960px, calc(100vw - 14px));
  max-width: none;
  max-height: calc(100dvh - 14px);
  padding: 0;
  border: 0;
  border-radius: 9px;
  margin: auto;
  background: #513420;
  color: #45291a;
  box-shadow: 0 0 0 100vmax #1b0e09b5, 0 8px 29px #2b180ebb;
  overflow: auto;
}
#professions {
  inset: var(--panel-center) auto auto 50%;
  width: var(--panel-width);
  height: var(--panel-height);
  max-height: none;
  margin: 0;
  transform: translate(-50%, -50%);
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  overscroll-behavior: contain;
  container: profession-window / inline-size;
}
#professions::backdrop { background: transparent; backdrop-filter: none; }
.aux-board { display: grid; gap: 8px; padding: clamp(9px, 2vw, 23px); background: url('assets/techniques/reference/frame-wood.webp') center / 101px auto #4a2d19; }
.aux-board header { display: grid; grid-template-columns: 1fr 40px; align-items: center; gap: 10px; }
.aux-board h2 {
  justify-self: center;
  margin: 0;
  padding: .22em .8em;
  color: #fff0c1;
  font: 700 clamp(25px, 4vw, 44px)/1 Georgia, serif;
  text-shadow: 0 2px #471e12;
}
.aux-close { width: 38px; height: 38px; border: 0; padding: 0; background: url('assets/techniques/reference/close-stud.webp') center / contain no-repeat; }
.aux-tabs, .aux-hunt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.aux-tabs button, .hunt-movement button {
  min-height: 34px;
  border: 0;
  padding: 5px 11px;
  color: #492712;
  font-weight: bold;
  background: var(--cardboard-label) center / 100% 100% no-repeat;
}
.aux-tabs button[aria-pressed='true'] { outline: 1px solid #ffeab0; box-shadow: 0 0 6px #ffc47a; }
.aux-tabs :is([data-prof-tab], [data-hunt-area]) { display: inline-flex; align-items: center; gap: 4px; }
.aux-tabs :is([data-prof-tab], [data-hunt-area]) img { width: 23px; height: 23px; object-fit: contain; }
.aux-lesson { color: #f0c08c; }
.aux-paper {
  padding: clamp(8px, 2vw, 19px);
  background: #e9bd80 url('assets/techniques/reference/dossier-paper.webp') center / 100% 100% no-repeat;
  border: 2px solid #936339;
  border-radius: 8px;
  color-scheme: light;
}
.aux-paper h3 { margin: 4px 0; font: 700 20px Georgia, serif; }
.aux-status { margin: 0; min-height: 1.1em; color: #ffebbf; line-height: 1.2; overflow-wrap: anywhere; }
.aux-list { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 5px; }
.aux-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-width: 0; padding: 6px; border-bottom: 1px dashed #8754318a; }
.aux-row strong, .aux-row small { display: block; }
.aux-paper form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.aux-paper form + form { margin-top: 1em; }
.aux-paper form h3 { width: 100%; }
.aux-paper label { display: flex; flex-direction: column; gap: 3px; max-width: 100%; }
.aux-paper select { max-width: 100%; }
.aux-paper input[type='number'] { width: 86px; }
.pack-loot-icon { width: 23px; height: 23px; object-fit: contain; vertical-align: middle; margin-inline-end: 5px; }
.market-material-icon { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; margin-inline-end: 6px; }

@media (orientation: landscape) and (max-height: 540px) {
  html[data-mobile-game] #yard-market {
    --market-page-size: 3;
    inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    width: calc(100% - env(safe-area-inset-left) - env(safe-area-inset-right) - 12px);
    height: calc(var(--yard-visible-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 10px);
    max-height: none;
    overflow: clip;
  }
  html[data-mobile-game] #yard-market .aux-board {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100%;
    gap: 4px;
    padding: 5px 8px 7px;
  }
  html[data-mobile-game] #yard-market :is(.aux-board h2, .aux-paper h3) { padding: 0; margin: 0; }
  html[data-mobile-game] #yard-market .aux-board h2 { font-size: clamp(19px, 3.4vw, 28px); }
  html[data-mobile-game] #yard-market .aux-close { height: 34px; width: 34px; }
  html[data-mobile-game] #yard-market .aux-tabs button { min-height: 29px; padding-block: 2px; font-size: .84rem; }
  html[data-mobile-game] #yard-market .aux-paper { min-height: 0; padding: 6px 10px; overflow: clip; }
  html[data-mobile-game] #yard-market .aux-paper > p { margin: 0 0 4px; font-size: .87rem; line-height: 1.12; overflow-wrap: anywhere; }
  html[data-mobile-game] #yard-market .aux-list { margin: 0; gap: 0; }
  html[data-mobile-game] #yard-market .aux-row {
    gap: 6px;
    min-height: 36px;
    padding: 2px 3px;
    font-size: .84rem;
    line-height: 1.08;
  }
  html[data-mobile-game] #yard-market .aux-row span { min-width: 0; overflow-wrap: anywhere; }
  html[data-mobile-game] #yard-market .aux-row small { margin-top: 1px; font-size: .72rem; }
  html[data-mobile-game] #yard-market .aux-row .pack-primary { flex: none; }
  html[data-mobile-game] #yard-market :is(.pack-loot-icon, .market-material-icon) { width: 18px; height: 18px; }
  html[data-mobile-game] #yard-market .aux-paper form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, .65fr) minmax(0, .85fr) auto;
    gap: 3px 6px;
    align-items: end;
  }
  html[data-mobile-game] #yard-market .aux-paper form h3 { grid-column: 1 / -1; font-size: 1rem; }
  html[data-mobile-game] #yard-market .aux-paper form[data-market-form='list'] { grid-template-columns: minmax(0, 1.6fr) minmax(0, .65fr) minmax(0, 1fr) minmax(0, .85fr) auto; }
  html[data-mobile-game] #yard-market .aux-paper:has(> :is([data-market-form='deposit'], [data-market-form='withdraw'])) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    column-gap: 10px;
  }
  html[data-mobile-game] #yard-market .aux-paper:has(> [data-market-form='deposit']) > p { grid-column: 1/-1; }
  html[data-mobile-game] #yard-market .aux-paper :is([data-market-form='deposit'], [data-market-form='withdraw']) {
    grid-template-columns: minmax(0, .75fr) minmax(0, 1fr) auto;
    align-content: start;
    min-width: 0;
  }
  html[data-mobile-game] #yard-market .aux-paper :is([data-market-form='deposit'], [data-market-form='withdraw']) label:has(select[name='stack']) { grid-column: 1/-1; }
  html[data-mobile-game] #yard-market .aux-paper form[data-market-form='withdraw'] { margin-top: 0; padding-inline-start: 9px; border-inline-start: 1px solid #a47c52; }
  html[data-mobile-game] #yard-market [data-market-unit][hidden] { display: none; }
  html[data-mobile-game] #yard-market .aux-paper label { min-width: 0; font-size: .76rem; line-height: 1.1; }
  html[data-mobile-game] #yard-market .aux-paper label :is(input, select) { width: 100%; min-width: 0; min-height: 29px; }
  html[data-mobile-game] #yard-market .aux-paper form button { grid-column: -2 / -1; }
  html[data-mobile-game] #yard-market :is(.pack-primary, .pack-secondary) { min-height: 29px; padding: 3px 7px; font-size: .8rem; white-space: normal; }
  html[data-mobile-game] #yard-market .aux-status { min-height: 0; font-size: .77rem; }
  html[data-mobile-game] #yard-market .aux-status:empty { display: none; }
  html[data-mobile-game] .market-pages { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 3px; }
  html[data-mobile-game] .market-pages button { min-width: 40px; min-height: 27px; border: 1px solid #a77647; border-radius: 4px; background: #f6d39c; }
  html[data-mobile-game] .market-pages button:disabled { opacity: .55; }
  html[data-mobile-game] .market-pages output { text-align: center; min-width: 4ch; font-size: .79rem; }
}

@media (orientation: landscape) and (max-height: 340px) {
  html[data-mobile-game] #yard-market { --market-page-size: 2; }
}

@media (orientation: landscape) and (max-height: 265px) {
  html[data-mobile-game] #yard-market {
    --market-page-size: 1;
    height: calc(var(--yard-visible-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 4px);
  }
  html[data-mobile-game] #yard-market .aux-close { width: 27px; height: 27px; }
  html[data-mobile-game] #yard-market .aux-tabs button { min-height: 25px; }
  html[data-mobile-game] #yard-market .aux-board { grid-template-rows: auto auto minmax(0, 1fr); }
  html[data-mobile-game] #yard-market .aux-board > header { grid-area: 1 / 1; }
  html[data-mobile-game] #yard-market .aux-board > nav { grid-area: 2 / 1; }
  html[data-mobile-game] #yard-market .aux-board > .aux-paper { grid-area: 3 / 1; }
  html[data-mobile-game] #yard-market .aux-board > .aux-status {
    grid-area: 2 / 1;
    align-self: center;
    justify-self: end;
    max-width: 36%;
    pointer-events: none;
    text-align: right;
    font-size: .71rem;
  }
  html[data-mobile-game] #yard-market .aux-paper { padding-block: 4px; }
  html[data-mobile-game] #yard-market .aux-paper > p { margin-bottom: 2px; font-size: .75rem; }
  html[data-mobile-game] #yard-market .aux-paper label :is(input, select) { min-height: 23px; padding-block: 1px; }
  html[data-mobile-game] #yard-market .aux-paper form h3 { font-size: .92rem; }
  html[data-mobile-game] #yard-market :is(.pack-primary, .pack-secondary) { min-height: 24px; font-size: .75rem; }
}

@media (orientation: landscape) and (max-height: 540px) {
  html[data-mobile-game] #yard-market .aux-board > header {
    grid-template-columns: minmax(0, 1fr) 44px;
    min-height: 46px;
    padding-inline: 8px 1px;
    border: 1px solid #966540;
    border-radius: 8px;
    background: #304a38 url('assets/cardboard/cloth-grain.webp') center / 220px auto;
    background-blend-mode: multiply;
  }
  html[data-mobile-game] #yard-market .aux-board h2 { justify-self: start; }
  html[data-mobile-game] #yard-market .aux-close {
    width: 44px;
    height: 44px;
    background-size: 34px;
  }
  html[data-mobile-game] #yard-market .aux-tabs button,
  html[data-mobile-game] #yard-market :is(.pack-primary, .pack-secondary),
  html[data-mobile-game] #yard-market .market-pages button { min-height: 44px; }
  html[data-mobile-game] #yard-market .market-pages button { min-width: 44px; }
  html[data-mobile-game] #yard-market .aux-row { padding-block: 3px; }
  html[data-mobile-game] #yard-market .aux-paper:has(> .market-pages) {
    display: grid;
    grid-template: 'balance pager' auto 'lots lots' minmax(0, 1fr) / minmax(0, 1fr) auto;
    align-content: start;
    align-items: start;
  }
  html[data-mobile-game] #yard-market .aux-paper:has(> .market-pages) > p {
    grid-area: balance;
    align-self: center;
  }
  html[data-mobile-game] #yard-market .aux-paper > .market-pages { grid-area: pager; margin-block: 0 3px; }
  html[data-mobile-game] #yard-market .aux-paper:has(> .market-pages) > .aux-list { grid-area: lots; }
}

@media (orientation: landscape) and (max-height: 265px) {
  html[data-mobile-game] #yard-market .aux-tabs button,
  html[data-mobile-game] #yard-market :is(.pack-primary, .pack-secondary),
  html[data-mobile-game] #yard-market .market-pages button { min-height: 34px; }
}

#hunt-screen {
  position: absolute;
  inset: 0;
  z-index: 18;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #2c3321;
  color: #ffebbf;
}
.hunt-field { position: absolute; inset: 0; }
.hunt-field canvas { width: 100%; height: 100%; touch-action: none; }
.hunt-field canvas:focus-visible { outline: 2px solid #eed697; outline-offset: -2px; }
.hunt-header, .hunt-footer { position: absolute; pointer-events: none; }
.hunt-header {
  inset: 0 0 auto;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: clamp(4px, 1cqw, 10px);
  padding: clamp(5px, 1.25cqw, 14px);
}
.hunt-header h2 {
  margin: 0 0 2px;
  color: #ffedbf;
  font: 700 clamp(15px, 2.2cqw, 27px)/1.1 Georgia, serif;
  text-shadow: 0 2px 3px #28190c;
}
.hunt-heading .aux-status { font-size: clamp(.72rem, 1.5cqw, .92rem); text-shadow: 0 1px 3px #24170c; }
.hunt-tool-hint {
  display: inline-block;
  margin: 3px 0 0;
  color: #fff3cf;
  font: 700 clamp(.68rem, 1.36cqw, .83rem)/1.2 'Trebuchet MS', sans-serif;
  text-shadow: 0 1px 2px #27180d, 0 0 4px #27180d, 0 0 8px #27180d;
}
.hunt-header button, .hunt-footer button, .hunt-selection button { pointer-events: auto; }
.hunt-header .aux-tabs { gap: 4px; }
.hunt-header .aux-tabs button { white-space: nowrap; }
.hunt-header .hunt-exit {
  padding-inline: .8em;
  color: #fff0cb;
  background: var(--cardboard-stamp) center / 100% 100% no-repeat #8e442b;
}
.hunt-social-button {
  min-height: 34px;
  padding: .3em .65em;
  border: 1px solid #a68856;
  border-radius: 4px;
  background: #362e23e8;
  color: #ffedbf;
  font: 700 clamp(.72rem, 1.4cqw, .94rem)/1.15 'Trebuchet MS', sans-serif;
}
.hunt-social-button:hover, .hunt-social-button:focus-visible { border-color: #ffe2a0; background: #58452e; }
.hunt-selection {
  position: absolute;
  z-index: 1;
  top: var(--hunt-selection-y, 50%);
  left: var(--hunt-selection-x, 50%);
  display: grid;
  justify-items: center;
  gap: 3px;
  width: max-content;
  max-width: min(13rem, 50%);
  transform: translateX(-50%);
  pointer-events: none;
}
.hunt-selection[data-anchor='above'] { transform: translate(-50%, -100%); }
.hunt-selection-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 4px;
  max-width: 100%;
  text-align: center;
}
.hunt-target, .hunt-requirement {
  padding: 2px 5px;
  overflow-wrap: anywhere;
  font: 800 clamp(.68rem, 1.36cqw, .83rem)/1.2 'Trebuchet MS', sans-serif;
  text-shadow: 0 1px 2px #27180d, 0 0 5px #27180d;
}
.hunt-target { color: #fff0c9; }
.hunt-requirement {
  border: 1px solid #9a5b30;
  border-radius: 3px 5px 3px 4px;
  color: #5a2d16;
  background: #e9bc82;
  text-shadow: none;
  font-size: .68rem;
}
.hunt-selection [data-hunt-claim] {
  min-width: 72px;
  min-height: 36px;
  padding: 3px 12px;
}
.hunt-selection [data-hunt-claim]:disabled { opacity: .7; }
.hunt-footer {
  inset: auto auto 0 0;
  display: grid;
  align-content: end;
  justify-items: start;
  max-width: min(90%, 32rem);
  gap: 4px;
  padding: clamp(5px, 1.25cqw, 14px);
}
.hunt-threat {
  margin: 0;
  padding: 4px 7px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #a68052;
  border-radius: 5px;
  background: #30291fee;
  color: #ffecbf;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 2px #341b12, 0 0 5px #341b12;
}
.hunt-threat[data-kind='passive'] { color: #e7efbb; }
.hunt-threat[data-kind='alert'] { color: #ffd0a0; border-color: #bf7953; }
.hunt-threat-elite {
  margin-inline-start: .45em;
  padding: 0 4px;
  border: 1px solid #db9d64;
  border-radius: 3px;
  background: #883b2a;
  color: #fff0ca;
  font-size: .7rem;
  white-space: nowrap;
}
.hunt-threat-details:not([hidden]) { display: block; }
.hunt-threat-details { font-weight: 600; }
@media (orientation: landscape) and (max-width: 700px) and (max-height: 320px) {
  .hunt-footer:has(.hunt-threat:not([hidden])) {
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: end;
  }
  .hunt-footer:has(.hunt-threat:not([hidden])) > :is(.hunt-join, .hunt-progress, [data-hunt-notice]) { grid-column: 1 / -1; }
  .hunt-footer:has(.hunt-threat:not([hidden])) > :is(.hunt-threat, .aux-hunt-actions) { grid-row: 3; }
  .hunt-footer:has(.hunt-threat:not([hidden])) > .aux-hunt-actions { grid-column: 1; }
  .hunt-footer > .hunt-threat { grid-column: 2; }
}
#hunt-screen.is-pursuit :is([data-hunt-exit], [data-hunt-claim]):disabled { opacity: .52; cursor: not-allowed; }
.hunt-progress {
  width: min(12rem, 100%); height: .5rem; display: block; appearance: none; border: 1px solid #996a3b;
  border-radius: .15rem; overflow: hidden; background: #432717; accent-color: #c9d081;
}
.hunt-progress[hidden] { display: none; }
.hunt-progress::-webkit-progress-bar { background: #432717; }
.hunt-progress::-webkit-progress-value { background: linear-gradient(90deg, #839f5b, #e2d98a); }
.hunt-progress::-moz-progress-bar { background: #c9d081; }
.hunt-join {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 5px 8px;
  background: #e7bb81 url('assets/techniques/reference/dossier-paper.webp') center / 100% 100%;
}
.hunt-join[hidden] { display: none; }
.hunt-join p { margin: 0 auto 0 0; color: #4b2917; font-size: .83rem; font-weight: 700; }
.hunt-join button { min-height: 36px; }
.hunt-join button:disabled { opacity: .63; }
#hunt-screen canvas.is-gatherable { cursor: pointer; }
#hunt-screen [data-hunt-notice] { min-height: 0; font-size: clamp(.68rem, 1.36cqw, .82rem); text-shadow: 0 1px 3px #24170c, 0 0 5px #24170c; }
#hunt-screen [data-hunt-notice]:empty { display: none; }
.hunt-movement { display: flex; gap: 3px; touch-action: none; }
.hunt-movement button { min-width: 34px; }
.aux-hunt-actions > button { min-height: 34px; padding-inline: 9px; }
.aux-hunt-actions button[hidden] { display: none; }
.hunt-footer .pack-secondary { color: #492712 !important; }
.profile-injury { color: #993521; font-weight: 800; }
.player-identity .player-injury { color: #ffd082; }
@container game-stage (min-width: 380px) and (max-width: 1145px) {
  .cardboard-game .stage-tools #hunt-opener .hud-button-label { display: inline; }
}
@container game-stage (max-width: 470px) {
  .hunt-header { grid-template-columns: minmax(0, 1fr) auto; }
  .hunt-heading { grid-column: 1 / -1; }
  .hunt-header .aux-tabs { justify-content: start; gap: 3px; }
  .hunt-header .aux-tabs button { padding-inline: 5px; font-size: .73rem; }
  .hunt-header .aux-tabs img { width: 16px; height: 16px; }
}
@media (max-width: 520px) {
  .aux-tabs [data-prof-tab] { padding-inline: 7px; font-size: .74rem; }
  .aux-hunt-actions > button { min-height: 40px; }
  .aux-row { align-items: start; }
  .aux-row > button { flex-shrink: 0; font-size: .7rem; }
  .aux-paper form { align-items: stretch; }
}
