.cardboard-game .tester-dialog {
  box-sizing: border-box;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100dvh - 20px);
  overflow: auto;
  overscroll-behavior: contain;
}

.cardboard-game .tester-settings:not([hidden]) { display: grid; gap: .8rem; }
.tester-dialog > form[method='dialog'] { margin-top: .56rem; }
.tester-settings fieldset {
  min-width: 0;
  margin: 0;
  padding: .6rem .75rem .75rem;
  border: 1px solid #946b42;
  border-radius: 3px 6px 3px 5px;
  background: #f9dfb455;
}
.tester-settings legend { padding: 0 .35rem; font-weight: 800; }
.tester-fields, .tester-professions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem .8rem;
}
.tester-fields > label { display: grid; gap: .25rem; min-width: 0; }
.tester-fields > .tester-check { display: flex; align-self: end; align-items: center; min-height: 38px; }
.tester-settings :is(input:not([type='checkbox']), select) {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  min-width: 0;
  padding: .25rem .4rem;
  border: 1px solid #946b42;
  border-radius: 3px 5px 3px 4px;
  background: #f9e9ca;
  color: #422919;
  font: inherit;
}
.tester-settings input[type='checkbox'] { width: 17px; height: 17px; accent-color: #465f52; }
.tester-professions > p { grid-column: 1 / -1; margin: 0 0 .22rem; font-size: .84rem; }
.tester-skill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.1rem auto;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
}
.tester-skill label:last-child:not(:first-child) { display: inline-flex; align-items: center; white-space: nowrap; }
.tester-settings > button { justify-self: start; }
#tester-message { margin: 0; color: #633020; }
#tester-message:empty { display: none; }

@media (max-width: 600px) {
  .tester-fields, .tester-professions { grid-template-columns: minmax(0, 1fr); }
}

.tester-pages { display: none; }
@media (orientation: landscape) {
  html[data-mobile-game] .cardboard-game .tester-dialog[open] {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: min(280px, var(--mobile-modal-height, calc(100dvh - 8px)));
    padding: 7px 12px;
  }
  html[data-mobile-game] .tester-dialog > p { margin: 3px 0; font-size: 11px; }
  html[data-mobile-game] .tester-dialog h2 { font-size: clamp(17px, 5dvh, 26px); }
  html[data-mobile-game] .tester-settings:not([hidden]) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    gap: 3px;
  }
  html[data-mobile-game] .tester-pages { display: flex; gap: 4px; }
  html[data-mobile-game] .tester-pages button {
    min-height: 42px;
    padding: 2px 7px;
    border: 1px solid #946b42;
    border-radius: 4px;
    background: #f9e9ca;
    font-size: 11px;
  }
  html[data-mobile-game] .tester-pages button[aria-pressed='true'] { background: #904429; color: #fff1c9; }
  html[data-mobile-game] .tester-settings fieldset:not([data-tester-page-active]) { display: none; }
  html[data-mobile-game] .tester-settings fieldset {
    grid-column: 1/-1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    min-height: 0;
    gap: 3px 6px;
    padding: 3px 6px;
    font-size: 11px;
  }
  html[data-mobile-game] .tester-settings .tester-professions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  html[data-mobile-game] .tester-professions > p { font-size: 11px; margin-bottom: 0; }
  html[data-mobile-game] .tester-skill { grid-template-columns: minmax(36px, .7fr) minmax(0, 1fr); gap: 1px 4px; font-size: 11px; }
  html[data-mobile-game] .tester-skill > label:first-child { grid-column: 1/-1; font-weight: 700; }
  html[data-mobile-game] .tester-settings :is(input:not([type='checkbox']), select) { min-height: 23px; padding: 2px; }
  html[data-mobile-game] .tester-settings input[type='checkbox'] { width: 13px; height: 13px; margin: 0 2px; }
  html[data-mobile-game] .tester-settings > button[type='submit'] { grid-area: 1 / 2; }
  html[data-mobile-game] #tester-message { grid-column: 1/-1; }
  html[data-mobile-game] .tester-dialog button:is(.pack-primary, .pack-secondary) { min-height: 42px; padding: 3px 9px; font-size: 12px; }
  html[data-mobile-game] .tester-dialog > form[method='dialog'] { margin-top: 4px; }
}

@media (orientation: landscape) and (max-height: 260px) {
  html[data-mobile-game] .cardboard-game .tester-dialog[open] {
    grid-template-rows: auto minmax(0, 1fr);
  }
  html[data-mobile-game] .tester-dialog h2 { min-height: 37px; padding-inline-end: min(45%, 210px); }
  html[data-mobile-game] .tester-dialog > #reset-description { display: none; }
  html[data-mobile-game] .tester-dialog > form[method='dialog'] {
    position: absolute;
    inset: 5px 10px auto auto;
    margin: 0;
  }
  html[data-mobile-game] .tester-pages button,
  html[data-mobile-game] .tester-dialog button:is(.pack-primary, .pack-secondary) { min-height: 36px; }
}
