/* Biom-Wiki - builds on text-generators.css (.tg-*) and biome-map.css (.bm-btn, .bm-dim-dot). */
.bw-app {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    align-items: start;
    gap: 16px;
}

/* ----- sidebar: tabs, search, dimension filter, list ----- */
.tg-panel.bw-side {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 110px);
    padding: 14px;
}

.bw-tabs,
.bw-dims {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--tg-line);
    border-radius: 12px;
    background: var(--tg-field);
}

.bw-tabs button,
.bw-dims button {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 6px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
}

.bw-dims button {
    padding: 5px 4px;
    font-size: 0.74rem;
}

.bw-tabs button.active,
.bw-dims button.active {
    background: var(--tg-accent-soft);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--tg-accent);
}

.tg-panel .bw-search {
    width: 100%;
    padding: 9px 12px;
}

.bw-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 0;
    margin: 0 -4px;
    padding: 0 4px;
    overflow-y: auto;
}

.main .bw-group {
    margin: 10px 0 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
}

.main .bw-group:first-child {
    margin-top: 0;
}

.main .bw-entry {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.86rem;
    text-decoration: none;
}

.bw-entry img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
}

.main .bw-entry:hover {
    background: var(--tg-field);
}

.main .bw-entry.active {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
}

.bw-swatch {
    display: inline-block;
    flex: none;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.main .bw-empty,
.main .bw-info {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
}

/* ----- detail ----- */
.tg-panel.bw-detail {
    min-height: 480px;
    padding: 22px;
    text-align: center;
}

.bw-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.bw-head-swatch {
    flex: none;
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
}

.bw-head-icon {
    flex: none;
    width: 56px;
    height: 56px;
    padding: 8px;
    border: 1px solid var(--tg-line);
    border-radius: 12px;
    background: var(--tg-field);
    object-fit: contain;
    image-rendering: pixelated;
}

.main .bw-head h2 {
    display: block;
    margin: 0;
    font-size: 1.5rem;
}

.main .bw-head p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    text-align: left;
}

.bw-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 4px;
}

.main .bw-actions a.bm-btn {
    text-decoration: none;
}

.main .bw-intro {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    text-align: center;
}

.bw-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.bw-fact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 12px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
}

.bw-fact span {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bw-fact strong {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.bw-fact small {
    color: var(--text-muted);
    font-weight: 400;
}

.bw-fact code,
.bw-loot code,
.bw-variant code {
    font-family: var(--mono-font);
    font-size: 0.8rem;
}

.bw-section {
    margin-top: 22px;
}

.main .bw-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 1rem;
}

.bw-section h3 i {
    color: var(--tg-accent);
}

.main .bw-sub {
    margin: 12px 0 6px;
    color: var(--text-muted);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* colors */
.bw-colors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.bw-color {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: copy;
}

.bw-color:hover {
    border-color: var(--tg-accent);
}

.bw-color span {
    height: 34px;
    border-radius: 6px;
}

.bw-color small {
    font-size: 0.74rem;
}

.bw-color code {
    color: var(--text-muted);
    font-family: var(--mono-font);
    font-size: 0.72rem;
}

/* chips */
.bw-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.main .bw-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid var(--tg-line);
    border-radius: 9px;
    background: var(--tg-field);
    color: var(--text-primary);
    font-size: 0.82rem;
    text-decoration: none;
}

.bw-chip img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: pixelated;
}

.main a.bw-chip:hover {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
}

.bw-ore-blocks {
    margin-top: 14px;
}

/* mobs */
.bw-mobs {
    display: flex;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.bw-mob {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 9px;
    padding: 6px 10px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    font-size: 0.84rem;
}

.bw-mob img {
    grid-row: span 2;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.bw-mob small {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.bw-mob small:first-of-type {
    color: var(--tg-accent);
    font-weight: 700;
    text-align: right;
}

.bw-mob small:last-of-type {
    grid-column: 2 / 4;
}

/* loot */
.bw-loot {
    margin-bottom: 8px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
}

.bw-loot summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 9px 12px;
    cursor: pointer;
}

.bw-loot summary small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.bw-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 4px;
    padding: 0 10px 10px;
}

.bw-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 8px;
    padding: 4px 6px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.bw-item:hover {
    background: var(--tg-accent-soft);
}

.bw-item img {
    grid-row: span 2;
    width: 28px;
    height: 28px;
    object-fit: contain;
    image-rendering: pixelated;
}

.bw-item small {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.bw-item .bw-p {
    grid-column: 3;
    grid-row: 1;
    color: var(--tg-accent);
    font-weight: 700;
}

/* ores */
.bw-chart {
    margin: 0;
}

.bw-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.bw-bars rect {
    fill: var(--tg-accent);
}

.bw-grid line {
    stroke: var(--tg-line);
    stroke-width: 1;
}

.bw-grid text {
    fill: var(--text-muted);
    font-family: var(--mono-font);
    font-size: 11px;
    text-anchor: middle;
}

.bw-best {
    stroke: #ffd25a;
    stroke-width: 2;
    stroke-dasharray: 4 3;
}

.main .bw-chart figcaption {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: left;
}

.bw-chart figcaption strong {
    color: #ffd25a;
}

.bw-variant {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--tg-line);
    border-radius: 12px;
}

.main .bw-variant h4 {
    margin: 0;
}

.bw-variant .bw-facts {
    margin: 8px 0 10px;
}

.bw-rules {
    display: grid;
    gap: 8px;
    max-width: 820px;
    margin: 0 auto 10px;
    padding: 0;
    list-style: none;
}

.main .bw-rules li {
    padding: 8px 12px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    font-size: 0.86rem;
    line-height: 1.5;
    text-align: left;
}

@media (max-width: 900px) {
    .bw-app {
        grid-template-columns: 1fr;
    }

    .tg-panel.bw-side {
        position: static;
        max-height: none;
    }

    .bw-list {
        max-height: 320px;
    }

    .tg-panel.bw-detail {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .bw-tabs button {
        font-size: 0.76rem;
    }

    .bw-tabs button i {
        display: none;
    }

    .bw-head {
        gap: 12px;
    }

    .main .bw-head h2 {
        font-size: 1.25rem;
    }
}

.main .bw-detail .bw-fact,
.main .bw-detail .bw-variant h4,
.main .bw-detail .bw-section h3,
.main .bw-detail .bw-sub {
    text-align: center;
}

.main .bw-detail .bw-section h3 {
    justify-content: flex-start;
}

.main .bw-pool {
    margin: 4px 12px 2px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
}

.main .bw-detail .bw-item,
.main .bw-detail .bw-mob {
    text-align: left;
}

/* site-modern-v1.css centres span, small, div … everywhere - the wiki reads left to right */
.bw-app :is(span, small, strong, div, p, code, figcaption, h2, h3, h4) {
    text-align: left;
}

.bw-mob small,
.bw-item small {
    white-space: nowrap;
}

/* the site's page sections have big paddings - these are small parts of one card */
.main section.bw-section {
    min-height: 0;
    padding: 0;
    background: none;
}

@media (max-width: 480px) {
    .bw-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.bw-fact code {
    overflow-wrap: anywhere;
}
