:root {
    color-scheme: light;
    color: #20322f;
    background: #f4f1e9;
    font: 16px/1.55 system-ui, sans-serif;
    --line: #d9dcd0;
    --green: #285a50;
}

body { margin: 0; }
.wrap { width: min(1100px, calc(100% - 2rem)); margin-inline: auto; }
header { background: #173d36; color: #faf5e5; padding: 1.5rem 0 2.2rem; border-bottom: 4px solid #bb965b; }
header a { color: #f4d69e; }
header p { margin: .4rem 0 0; }
.edition { margin-top: 1.8rem; color: #f4d69e; font-size: .77rem; letter-spacing: .18em; }
h1 { font: 500 clamp(2.5rem, 6vw, 4.25rem)/1 Georgia, serif; margin: .4rem 0; }
form { display: grid; grid-template-columns: 1.3fr 1fr auto; align-items: end; gap: .8rem; margin-top: 1.5rem; }
label { display: grid; gap: .25rem; min-width: 0; font-weight: 650; }
input, select, button { box-sizing: border-box; min-width: 0; width: 100%; border: 1px solid #9cae9f; border-radius: .4rem; padding: .55rem .7rem; background: #fffdf7; color: inherit; font: inherit; }
button { cursor: pointer; }
button:hover { background: #e6eee6; }
:focus-visible { outline: 3px solid #986a22; outline-offset: 2px; }
#count, #building-count, footer, .meta { color: #4e6058; font-size: .9rem; }
.catalog { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 1.5rem; margin-top: 1.5rem; }
.catalog section { min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
#all-items, .close { width: auto; padding: .2rem .55rem; font-size: .85rem; }
.building-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: .45rem; }
.building-card { display: grid; justify-items: center; align-content: start; gap: .3rem; padding: .55rem .35rem; height: 100%; overflow-wrap: anywhere; border-color: var(--line); font-size: .8rem; line-height: 1.25; }
.building-card[aria-pressed="true"] { background: #ddebe2; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.building-card[hidden] { display: none; }
.item-section { position: sticky; top: .75rem; max-height: calc(100vh - 1.5rem); overflow: auto; border: 1px solid var(--line); border-radius: .55rem; padding: .8rem; background: #fffdf7; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: .4rem; padding: .2rem; }
.item-card { display: grid; place-items: center; padding: .2rem; min-height: 52px; background: #eeeade; border-color: var(--line); }
.item-card[aria-expanded="true"] { background: #ddebe2; border-color: var(--green); }
.icon { display: grid; place-items: center; width: 42px; height: 42px; flex: none; }
.icon img { width: 100%; height: 100%; object-fit: contain; }
.icon-fallback { border-radius: .35rem; background: #e3dfd0; color: #36564c; font-weight: 750; }
#effects { position: fixed; inset: auto; width: min(350px, calc(100vw - 24px)); max-height: min(460px, 65dvh); overflow: auto; box-sizing: border-box; margin: 0; padding: .8rem 1rem; color: inherit; border: 1px solid #a1ad9e; border-radius: .6rem; background: #fffdf7; box-shadow: 0 .45rem 1.8rem #173d3633; overflow-wrap: anywhere; }
h2 { font-size: 1.13rem; margin: 0; }
.meta { margin: .12rem 0 .55rem; }
.targets, .effect { margin: .3rem 0; }
.targets { color: var(--green); }
.group + .group { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .45rem; }
details { margin: .4rem 0 0; }
summary { cursor: pointer; color: var(--green); }
ul { margin: .2rem 0; padding-left: 1.3rem; }
footer { padding: 1.3rem 0; }

@media (max-width: 750px) {
    form { grid-template-columns: 1fr 1fr; }
    .catalog { grid-template-columns: 1fr; }
    .building-grid { max-height: 45dvh; overflow-y: auto; padding: .25rem; }
    .item-section { position: static; max-height: none; }
}
@media (hover: none), (max-width: 600px) {
    #effects { inset: auto 12px 12px; width: auto; max-height: 55dvh; }
}
@media (max-width: 440px) {
    form { grid-template-columns: 1fr; }
}
