.dialog:has(.habitat-options) {
  width: min(690px, calc(100% - 30px));
  max-height: min(91dvh, 820px);
  overscroll-behavior: contain;
}
.dialog:has(.habitat-options) .dialog-body { padding: 16px; }
.habitat-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.habitat-option {
  display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden;
  text-align: left; color: #334336; background: #fffdf0;
  border: 1.5px solid #87907a; border-radius: 4px; box-shadow: 2px 2px 0 #a7aa91;
}
.habitat-option:not(:disabled):hover { border-color: #526947; background: #f5f7e5; }
.habitat-option:not(:disabled):active { transform: translate(1px,1px); box-shadow: 1px 1px 0 #849078; }
.habitat-option:focus-visible { outline: 3px solid #c78420; outline-offset: 2px; }
.habitat-option:disabled { opacity: 1; color: #334336; border-color: #4c6442; background: #eff4dc; box-shadow: 2px 2px 0 #61734f; }
.habitat-picture { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border-bottom: 1px solid #8e947c; background: #e6e6d4; }
.habitat-picture > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.habitat-picture > .build-scene { position: absolute; top: 50%; left: 50%; width:var(--thumb-width); transform:translate(-50%,-50%); }
.habitat-workshop { display: flex; justify-content: flex-end; margin-top: 14px; }
.habitat-selected { position: absolute; right: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border: 1px solid #d5dfbc; border-radius: 2px; background: #364f37; color: #fffce7; font: 750 11px/1.2 var(--sans); }
.habitat-selected svg { width: 12px; height: 12px; color: #e1efa9; }
.habitat-details { display: grid; gap: 4px; padding: 9px 12px 11px; }
.habitat-details strong { font-size: 17px; font-weight: 850; line-height: 1.4; }
.habitat-size { display: inline-flex; align-items: center; gap: 5px; color: #54644b; font: 700 13px/1.35 var(--mono); }
.habitat-size svg { flex: none; width: 16px; height: 13px; }
.habitat-size small { font: inherit; font-size: 11px; }
.habitat-description { color: #5d6756; font-size: 12px; line-height: 1.55; }
@media (max-width: 500px) {
  .dialog:has(.habitat-options) { width: calc(100% - 18px); }
  .dialog:has(.habitat-options) .dialog-body { padding: 9px; }
  .habitat-options { gap: 8px; }
  .habitat-details { padding: 6px 7px 8px; gap: 3px; }
  .habitat-details strong { font-size: 15px; }
  .habitat-size { font-size: 11px; gap: 3px; }
  .habitat-size svg { width: 12px; }
  .habitat-selected { right: 3px; bottom: 3px; font-size: 10px; padding: 2px 4px; }
}
@media (max-width: 330px) {
  .habitat-options { grid-template-columns: minmax(0,1fr); }
}
