/* All controls and card additions belong only to the bestiary. */
.ay-bestiary [hidden] { display: none !important; }
.ay-bestiary-toolbar { margin-bottom: 1.5rem; padding: 1.25rem; border: 1px solid color-mix(in srgb, var(--ay-primary), transparent 62%); border-radius: 8px; background: var(--ay-card); }
.ay-bestiary-toolbar-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ay-bestiary-toolbar-heading h3 { margin: 0; color: var(--ay-text); font-size: 1.1rem; font-weight: 850; }
.ay-bestiary-reset { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .4rem .55rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ay-muted); font: inherit; font-size: .85rem; }
.ay-bestiary-reset:hover { color: var(--ay-text); border-color: var(--ay-primary); }
.ay-bestiary-origins { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.15rem; }
.ay-bestiary-origin { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: .55rem .85rem; border: 1px solid color-mix(in srgb, var(--ay-muted), transparent 70%); border-radius: 7px; color: var(--ay-muted); background: transparent; font: inherit; font-size: .9rem; font-weight: 800; }
.ay-bestiary-origin[aria-pressed="true"], .ay-bestiary-origin:hover { color: var(--ay-text); border-color: var(--ay-primary); background: color-mix(in srgb, var(--ay-primary), transparent 87%); }
.ay-bestiary-origin > span { padding: .05rem .4rem; border-radius: 4px; color: var(--ay-text); background: color-mix(in srgb, var(--ay-muted), transparent 88%); font-size: .75rem; }
.ay-bestiary-searches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.ay-bestiary-field { display: grid; align-content: start; gap: .45rem; min-width: 0; color: var(--ay-text); font-size: .85rem; font-weight: 750; }
.ay-bestiary .form-control, .ay-bestiary .form-select { width: 100%; min-width: 0; min-height: 44px; font-size: .9rem; font-weight: 500; }
/* Override the shared theme's fixed dark select background in both schemes. */
body.aynoot-theme .ay-bestiary .form-select { color: var(--ay-text) !important; background-color: var(--ay-surface) !important; }
body.aynoot-theme .ay-bestiary .form-select option { color: var(--ay-text) !important; background-color: var(--ay-surface) !important; }
.ay-bestiary-refine { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--ay-muted), transparent 78%); }
.ay-bestiary-refine summary { color: var(--ay-text); font-size: .9rem; font-weight: 800; cursor: pointer; line-height: 1.6; }
.ay-bestiary-refine summary::marker { color: var(--ay-primary); }
.ay-bestiary-refine summary > span { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 4px; color: var(--ay-text); background: color-mix(in srgb, var(--ay-primary), transparent 83%); font-size: .75rem; }
.ay-bestiary-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding-top: 1rem; }
.ay-bestiary-help { margin: .9rem 0 0; color: var(--ay-muted); font-size: .8rem; line-height: 1.65; }
.ay-bestiary-error { margin: .8rem 0 0; color: var(--ay-text); font-size: .9rem; font-weight: 700; }
.ay-bestiary [aria-invalid="true"] { border-color: #d96545; }
.ay-bestiary-results-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--ay-muted), transparent 78%); }
.ay-bestiary-result-count { margin: 0; color: var(--ay-muted); font-size: .85rem; line-height: 1.5; }
.ay-bestiary-sort { display: flex; align-items: center; gap: .65rem; min-width: 0; color: var(--ay-muted); font-size: .85rem; }
.ay-bestiary-sort .form-select { width: 225px; }
.ay-bestiary-empty { padding: 2rem 1rem; border: 1px dashed color-mix(in srgb, var(--ay-muted), transparent 60%); border-radius: 8px; text-align: center; }
.ay-bestiary-empty > i { color: var(--ay-primary); font-size: 1.75rem; }
.ay-bestiary-empty h3 { margin: .85rem 0 .6rem; font-size: 1.3rem; font-weight: 850; }
.ay-bestiary-empty p { color: var(--ay-muted); line-height: 1.7; }
.ay-bestiary-source { margin: -.3rem 0 .65rem; color: var(--ay-muted); font-size: .75rem; }
.ay-bestiary-stats { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem .75rem; margin: .2rem 0 .7rem; color: var(--ay-muted); font-size: .8rem; }
.ay-bestiary-stats i { color: var(--ay-primary); }
.ay-bestiary-danger { margin: .8rem 0 0; color: var(--ay-muted); font-size: .8rem; }
.ay-bestiary .ay-resident-action { width: 100%; }
.ay-bestiary .ay-resident-description { flex-grow: 1; }
.ay-bestiary-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.2rem; margin-bottom: 1.5rem; padding: 1rem; border: 1px solid color-mix(in srgb, var(--ay-muted), transparent 76%); border-radius: 7px; }
.ay-bestiary-facts dt { color: var(--ay-muted); font-size: .8rem; font-weight: 600; }
.ay-bestiary-facts dd { margin: .2rem 0 0; font-size: .9rem; font-weight: 750; }
/* Original Minecraft textures, cropped by CSS without changing the image files. */
.ay-bestiary-skin-head { --ay-face-size: 142px; --ay-face-unit-x: calc(var(--ay-face-size) / var(--ay-face-w)); --ay-face-unit-y: calc(var(--ay-face-size) / var(--ay-face-h)); position: relative; display: block; flex: 0 0 auto; width: var(--ay-face-size); height: var(--ay-face-size); background-image: var(--ay-face-texture); background-repeat: no-repeat; background-size: calc(var(--ay-face-unit-x) * var(--ay-sheet-w)) calc(var(--ay-face-unit-y) * var(--ay-sheet-h)); background-position: calc(var(--ay-face-unit-x) * var(--ay-face-x) * -1) calc(var(--ay-face-unit-y) * var(--ay-face-y) * -1); image-rendering: pixelated; }
.ay-bestiary-face-overlay { position: absolute; left: calc(var(--ay-face-unit-x) * var(--ay-overlay-left)); top: calc(var(--ay-face-unit-y) * var(--ay-overlay-top)); width: calc(var(--ay-face-unit-x) * var(--ay-overlay-w)); height: calc(var(--ay-face-unit-y) * var(--ay-overlay-h)); background-image: var(--ay-overlay-texture, var(--ay-face-texture)); background-repeat: no-repeat; background-size: calc(var(--ay-face-unit-x) * var(--ay-overlay-sheet-w, var(--ay-sheet-w))) calc(var(--ay-face-unit-y) * var(--ay-overlay-sheet-h, var(--ay-sheet-h))); background-position: calc(var(--ay-face-unit-x) * var(--ay-overlay-x) * -1) calc(var(--ay-face-unit-y) * var(--ay-overlay-y) * -1); image-rendering: pixelated; }
.ay-character-modal .ay-bestiary-skin-head { --ay-face-size: 48px; }
.ay-bestiary button:focus-visible, .ay-bestiary input:focus-visible, .ay-bestiary select:focus-visible, .ay-bestiary summary:focus-visible { outline: 3px solid var(--ay-primary); outline-offset: 3px; }
@media (max-width: 767.98px) {
    .ay-bestiary-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ay-bestiary-results-bar { align-items: stretch; flex-direction: column; }
    .ay-bestiary-sort { justify-content: space-between; }
    .ay-bestiary-sort .form-select { flex: 1; max-width: 260px; }
}
@media (max-width: 575.98px) {
    .ay-bestiary-toolbar { padding: 1rem; }
    .ay-bestiary-searches, .ay-bestiary-fields { grid-template-columns: 1fr; }
    .ay-bestiary-toolbar-heading { gap: .4rem; }
    .ay-bestiary-toolbar-heading h3 { font-size: 1rem; }
    .ay-bestiary-origin { padding: .5rem .65rem; font-size: .85rem; }
    .ay-character-modal .ay-bestiary-skin-head { --ay-face-size: 40px; }
}

.ay-bestiary-version { margin-top: .65rem !important; font-size: .8rem; }
.ay-bestiary-sources { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid color-mix(in srgb, var(--ay-muted), transparent 75%); font-size: .85rem; color: var(--ay-muted); }
.ay-bestiary-sources summary { cursor: pointer; font-weight: 700; }
.ay-bestiary-sources a { color: var(--ay-primary); }
.ay-bestiary-sources p { font-size: .8rem; }

/* Native model captures keep a whole creature or a complete head in the frame. */
.ay-bestiary .ay-resident-portrait > .ay-bestiary-render { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.ay-character-modal .ay-bestiary-render { display: block; flex: 0 0 48px; width: 48px; height: 48px; object-fit: contain; }
.ay-bestiary-field > span, .ay-bestiary-sort > span { font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: 600; line-height: 20px; letter-spacing: 0; font-synthesis: none; }
@media (max-width: 575.98px) { .ay-character-modal .ay-bestiary-render { flex-basis: 40px; width: 40px; height: 40px; } }
