/* Biom-Karte - builds on text-generators.css (.tg-* panels). */
.bm-app {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bm-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ----- top bar: seed, dimension, go to, share ----- */
.tg-panel.bm-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    padding: 12px 14px;
}

.bm-seed,
.bm-goto {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bm-seed {
    flex: 1 1 360px;
}

.main .bm-bar label {
    margin: 0;
}

.tg-panel .bm-seed input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    font-family: var(--mono-font);
}

.tg-panel .bm-goto input {
    width: 90px;
    padding: 9px 10px;
    font-family: var(--mono-font);
}

.bm-goto label {
    color: var(--text-muted);
    font-family: var(--mono-font);
    font-size: 0.85rem;
}

.bm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 13px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}

.bm-btn:hover,
.bm-btn:focus-visible {
    border-color: var(--tg-accent);
}

.bm-btn-primary {
    border-color: var(--tg-accent);
    background: var(--tg-accent);
    color: #04140c;
    font-weight: 700;
}

.bm-btn-small {
    padding: 5px 10px;
    font-size: 0.75rem;
}

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

.bm-dims button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

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

.bm-dim-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.bm-dim-ow { background: #5fa83b; }
.bm-dim-ne { background: #b0402c; }
.bm-dim-en { background: #dcd79e; }

.main .bm-seedinfo {
    flex-basis: 100%;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
}

/* ----- markers: tabs (structures / ores), named list or icon row ----- */
.tg-panel.bm-markers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
}

.bm-markers-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.bm-markers-head .bm-label {
    color: var(--tg-accent);
}

.bm-markers-toggle {
    display: grid;
    flex: none;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--tg-line);
    border-radius: 8px;
    background: var(--tg-field);
    color: var(--text-secondary);
    cursor: pointer;
}

.bm-markers-toggle i {
    transition: transform 0.15s;
}

.bm-markers.is-list .bm-markers-toggle i {
    transform: rotate(180deg);
}

.bm-mtabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--tg-line);
    border-radius: 11px;
    background: var(--tg-field);
}

.bm-mtabs button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
}

.bm-mtabs button img {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
}

.bm-mtabs button.active {
    background: var(--tg-accent);
    color: #04140c;
}

.bm-mtabs button:not(.active):hover {
    color: var(--text-primary);
}

.bm-markers-all {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
}

/* icon row */
.bm-structs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.bm-struct {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}

.bm-struct:hover {
    border-color: color-mix(in srgb, var(--tg-accent) 60%, var(--tg-line));
}

.bm-struct img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.55;
}

.bm-struct span {
    display: none;
}

.bm-struct > i {
    color: #e5484d;
    font-size: 1.1rem;
}

.bm-struct.active {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
    color: var(--text-primary);
}

.bm-struct.active img {
    opacity: 1;
}

.bm-struct.is-approx {
    border-style: dashed;
}

/* active, but too far zoomed out to show: a yellow dot */
.bm-struct.active.is-far::after {
    content: '';
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffd25a;
}

.bm-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: 0.68rem;
    line-height: 1.4;
    text-align: center;
}

/* named list */
.bm-markers.is-list .bm-structs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}

.bm-markers.is-list .bm-struct {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    width: auto;
    height: 36px;
    padding: 0 10px;
    font-size: 0.84rem;
    text-align: left;
}

.bm-markers.is-list .bm-struct img {
    width: 20px;
    height: 20px;
}

.bm-markers.is-list .bm-struct span {
    display: block;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-markers.is-list .bm-badge {
    position: static;
    margin-left: auto;
}

.bm-markers.is-list .bm-struct.active.is-far::after {
    top: 50%;
    right: 10px;
    bottom: auto;
    transform: translateY(-50%);
}

/* ----- map ----- */
.bm-stage {
    position: relative;
    border: 1px solid var(--tg-line);
    border-radius: 14px;
    overflow: hidden;
    background: #0c1220;
}

#bmCanvas {
    display: block;
    width: 100%;
    height: min(72vh, 720px);
    cursor: crosshair;
    touch-action: none;
}

.bm-stage:fullscreen #bmCanvas {
    height: 100vh;
}

#bmCanvas:focus-visible {
    outline: 2px solid var(--tg-accent);
    outline-offset: -2px;
}

.bm-tools,
.bm-zoom {
    position: absolute;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bm-tools {
    top: 26px;
}

.bm-zoom {
    bottom: 12px;
}

.bm-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background: rgba(12, 18, 32, 0.85);
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.bm-icon-btn:hover,
.bm-icon-btn:focus-visible {
    border-color: var(--tg-accent);
    color: var(--tg-accent);
}

.bm-status,
.bm-scale {
    position: absolute;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.76rem;
    pointer-events: none;
}

.bm-status {
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
}

.bm-status[hidden] {
    display: none;
}

.bm-scale {
    bottom: 12px;
    left: auto;
    right: 58px;
    font-family: var(--mono-font);
}

.bm-statusline {
    position: absolute;
    bottom: 12px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 200px);
    padding: 5px 11px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.66);
    color: #fff;
    font-family: var(--mono-font);
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.bm-statusline:empty {
    display: none;
}

/* floating tooltip at the cursor */
.bm-tip {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 260px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9px;
    background: rgba(12, 18, 32, 0.92);
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.35;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.bm-tip span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bm-tip small {
    color: #ffd25a;
}

.bm-tip-pos {
    color: rgba(255, 255, 255, 0.72);
    font-family: var(--mono-font);
}

.bm-tip-slime {
    color: #7bd88f;
}

.bm-tip .bm-swatch,
.bm-statusline .bm-swatch,
.bm-mappop .bm-swatch,
.bm-sel-chip .bm-swatch {
    width: 11px;
    height: 11px;
    border-radius: 3px;
}

/* ----- click popup: coordinates, details, pins ----- */
.main .bm-mappop,
.main .bm-mappop *,
.main .bm-popup,
.main .bm-tip {
    text-align: center;
}

.bm-pop-block {
    align-items: flex-start;
}

.bm-mappop {
    position: absolute;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(300px, calc(100% - 16px));
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(14, 20, 34, 0.97);
    color: #fff;
    font-size: 0.82rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.bm-pop-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.bm-pop-head img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.bm-pop-head strong {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
}

.bm-pop-head .bm-swatch {
    width: 16px;
    height: 16px;
}

.bm-pop-pin {
    color: #e5484d;
    font-size: 1.15rem;
}

.bm-pop-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin: 2px 0 6px;
}

.bm-pop-color {
    position: relative;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: var(--c);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.bm-pop-color:hover,
.bm-pop-color:focus-visible {
    transform: scale(1.15);
    outline: none;
}

.bm-pop-color.is-on {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.bm-pop-color-own {
    background: conic-gradient(#e5484d, #ffc53d, #46a758, #0090ff, #8e4ec6, #e5484d);
    color: #fff;
    font-size: 0.65rem;
    text-shadow: 0 0 3px #000;
}

.bm-pop-color-own.is-on {
    background: var(--c);
}

.bm-pop-colorpick {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.bm-mappop .bm-pop-name {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: inherit;
    font-weight: 700;
}

.bm-mappop .bm-pop-name:focus {
    border-color: var(--tg-accent);
    outline: none;
}

.bm-pop-btn {
    display: grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
}

.bm-pop-btn:hover,
.bm-pop-btn:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tg-accent);
}

.bm-pop-btn[data-act="delete"]:hover {
    color: #ff7a7f;
}

.bm-pop-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bm-pop-row > span:not(.bm-pop-label) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bm-pop-row code {
    flex: 1;
    font-family: var(--mono-font);
    font-size: 0.85rem;
    white-space: pre;
}

.bm-pop-label {
    min-width: 92px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bm-pop-acc {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(63, 191, 111, 0.2);
    color: #7bd88f;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.bm-pop-acc.is-approx {
    background: rgba(255, 210, 90, 0.18);
    color: #ffd25a;
}

.bm-pop-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.bm-pop-links:empty {
    display: none;
}

.main .bm-pop-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    color: #fff;
    font-size: 0.76rem;
    text-decoration: none;
}

.main .bm-pop-links a:hover {
    border-color: var(--tg-accent);
    color: var(--tg-accent);
}

.main .bm-pop-done {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    color: #fff;
    font-size: 0.82rem;
    cursor: pointer;
}

.bm-pop-done input {
    width: 16px;
    height: 16px;
    accent-color: #3fbf6f;
}

.bm-pop-details {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 6px;
}

.bm-pop-details summary {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.bm-pop-details[open] summary {
    margin-bottom: 6px;
}

.bm-pop-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-bottom: 7px;
}

.bm-pop-block span:not(.bm-pop-label) {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bm-pop-block small {
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--mono-font);
    font-size: 0.72rem;
}

.bm-pop-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 9px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: var(--mono-font);
    font-size: 0.76rem;
    cursor: pointer;
}

.bm-pop-jump i {
    margin-left: auto;
}

.bm-pop-jump:hover {
    border-color: var(--tg-accent);
}

.bm-pop-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

/* ----- bottom bar ----- */
.tg-panel.bm-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
}

.tg-panel.bm-bottom {
    position: relative;
}

.bm-power {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-muted);
    cursor: pointer;
}

.bm-power.active {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
    color: var(--tg-accent);
}

.bm-pickbox {
    display: flex;
    flex: 1 1 260px;
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 38px;
    padding: 4px 10px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    cursor: pointer;
}

.bm-pickbox:hover,
.bm-pickbox:focus-visible,
.bm-pickbox[aria-expanded="true"] {
    border-color: var(--tg-accent);
    outline: none;
}

.bm-pickbox-caret {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.bm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.bm-chips-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.bm-sel-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 4px 2px 8px;
    border-radius: 7px;
    background: var(--tg-accent-soft);
    color: var(--text-primary);
    font-size: 0.78rem;
}

.bm-sel-chip button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.bm-sel-chip button:hover {
    color: #ff7a7f;
}

.bm-bottom .bm-icon-btn {
    border-color: var(--tg-line);
    background: var(--tg-field);
    color: var(--text-secondary);
}

.bm-bottom .bm-gear.active {
    border-color: var(--tg-accent);
    color: var(--tg-accent);
}

/* popups above the bottom bar */
.bm-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--tg-line);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.bm-biome-panel {
    left: 10px;
    width: min(420px, calc(100% - 20px));
    max-height: min(70vh, 560px);
}

.bm-settings {
    right: 10px;
    width: min(340px, calc(100% - 20px));
}

.bm-popup-head,
.bm-popup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.bm-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.main .bm-popup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.95rem;
}

.tg-panel .bm-search {
    width: 100%;
    padding: 8px 11px;
}

.bm-groups {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
    overflow-y: auto;
}

.bm-group-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bm-group-head button {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    cursor: pointer;
}

.bm-group-head button i {
    font-size: 0.7rem;
    transition: transform 0.15s;
}

.bm-group.open .bm-group-head button i {
    transform: rotate(90deg);
}

.bm-group-head small {
    color: var(--text-muted);
    font-weight: 400;
}

.bm-group-items {
    display: none;
    flex-direction: column;
    gap: 1px;
    padding: 0 0 6px 24px;
}

.bm-group.open .bm-group-items {
    display: flex;
}

.main .bm-pick {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.84rem;
    cursor: pointer;
}

.main .bm-pick:hover {
    background: var(--tg-field);
}

.bm-pick input,
.bm-group-head input {
    accent-color: var(--tg-accent);
}

.main .bm-switch {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: var(--text-primary);
    font-size: 0.86rem;
    cursor: pointer;
}

.bm-switch input {
    appearance: none;
    position: relative;
    flex: none;
    width: 34px;
    height: 19px;
    margin: 0;
    border-radius: 999px;
    background: var(--tg-line);
    cursor: pointer;
    transition: background 0.15s;
}

.bm-switch input::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}

.bm-switch input:checked {
    background: var(--tg-accent);
}

.bm-switch input:checked::after {
    transform: translateX(15px);
}

.bm-switch input:focus-visible {
    outline: 2px solid var(--tg-accent);
    outline-offset: 2px;
}

.bm-yset {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 9px 10px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
}

.bm-yset-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
}

.bm-yset input[type="range"] {
    width: 100%;
    accent-color: var(--tg-accent);
}

.bm-yset small {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.bm-border {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bm-seg {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--tg-line);
    border-radius: 9px;
}

.bm-seg button {
    flex: 1;
    padding: 5px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.bm-seg button.active {
    background: var(--tg-accent-soft);
    color: var(--text-primary);
}

.bm-border-fields {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 6px;
}

.main .bm-border-fields label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.tg-panel .bm-border-fields input {
    width: 100%;
    padding: 6px 8px;
    font-family: var(--mono-font);
}

.bm-cmd {
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--tg-field);
    font-family: var(--mono-font);
    font-size: 0.76rem;
    white-space: pre-wrap;
}

.tg-panel .bm-platform {
    width: auto;
    padding: 8px 10px;
}

.tg-panel.bm-bottom select {
    width: auto;
    min-width: 0;
    padding: 8px 10px;
}


#bmYWrap[hidden],
.bm-chip[hidden],
.bm-icon-btn[hidden],
.bm-popup[hidden],
.bm-mappop[hidden],
.bm-tip[hidden],
.bm-yset[hidden],
.bm-border[hidden],
.bm-switch[hidden] {
    display: none;
}

.main .bm-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.bm-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bm-chip:has(input:checked) {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
    color: var(--text-primary);
}

.bm-chip:has(input:focus-visible) {
    outline: 2px solid var(--tg-accent);
    outline-offset: 2px;
}

/* ----- legend ----- */
.main .bm-hint {
    margin: 0;
}

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

.bm-legend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

.bm-biome {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--tg-field);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
}

.bm-biome span:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.bm-biome small {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.bm-biome:hover,
.bm-biome.active {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
}

.main .bm-empty {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.82rem;
}

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

.main .bm-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: 700px) {
    .bm-seed {
        flex-wrap: wrap;
    }

    .bm-seed .bm-label {
        flex-basis: 100%;
    }

    .bm-dims {
        width: 100%;
    }

    .bm-dims button {
        flex: 1;
        justify-content: center;
        padding: 7px 6px;
    }

    .bm-markers-all {
        flex-basis: 100%;
        margin-left: 0;
    }

    .bm-markers.is-list .bm-structs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #bmCanvas {
        height: 62vh;
    }

    .bm-pickbox {
        flex-basis: calc(100% - 46px);
        order: -1;
    }

    .bm-power {
        order: -2;
    }

    .bm-statusline {
        max-width: calc(100% - 70px);
    }

    .bm-scale {
        bottom: 46px;
        left: 10px;
        right: auto;
    }

    .bm-biome-panel,
    .bm-settings {
        left: 0;
        right: 0;
        width: auto;
    }
}

/* ore height: from / to */
.main .bm-ore-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.bm-ore-row small {
    flex: none;
    width: 28px;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.bm-settings {
    max-height: min(75vh, 640px);
    overflow-y: auto;
}

.bm-popup .bm-switch span {
    text-align: left;
}

/* ===== my seeds + my pins ===== */
.bm-saved {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.bm-saved-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.bm-saved-head .tg-subtitle {
    margin: 0;
}

.main .bm-saved-sub {
    margin: 6px 0 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: left;
}

.bm-pin-search {
    flex: 1 1 160px;
    max-width: 240px;
    margin: 0;
}

.bm-saved-list {
    display: grid;
    gap: 6px;
    max-height: 340px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.main .bm-saved-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    text-align: left;
}

.main .bm-saved-item.is-on {
    border-color: var(--tg-accent);
    background: var(--tg-accent-soft);
}

.bm-saved-icon {
    color: var(--tg-accent);
}

.main .bm-saved-main {
    display: grid;
    flex: 1;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.main .bm-saved-main small {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.bm-saved-main code {
    font-size: 0.74rem;
}

.bm-saved-name {
    width: 100%;
    min-width: 0;
    padding: 2px 6px;
    margin-left: -6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
}

.bm-saved-name:hover,
.bm-saved-name:focus {
    border-color: var(--tg-line);
    background: rgba(255, 255, 255, 0.04);
    outline: none;
}

.bm-saved-item .bm-btn[disabled] {
    opacity: 0.45;
    cursor: default;
}

.bm-saved-item .bm-pop-btn:hover,
.bm-saved-item .bm-pop-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.main .bm-pin-go {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

.bm-pin-go > .fa-location-dot {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8));
}

.bm-pin-go strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bm-pin-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.15s ease, color 0.15s ease;
}

.bm-pin-item:hover {
    border-color: var(--tg-accent);
}

.bm-pin-item:hover .bm-pin-arrow {
    color: var(--tg-accent);
    transform: translateX(3px);
}

.main .bm-saved-empty {
    padding: 14px;
    border: 1px dashed var(--tg-line);
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.bm-saved-clear {
    margin-top: 10px;
}

@media (max-width: 480px) {
    .bm-saved {
        grid-template-columns: 1fr;
    }

    .bm-pin-search {
        max-width: none;
    }

    .bm-saved-item .bm-btn-small {
        padding: 5px 8px;
    }
}

.bm-saved-head .bm-badge {
    position: static;
    margin-left: 4px;
    vertical-align: middle;
}

.bm-saved-head .bm-badge:empty {
    display: none;
}

.tg-panel .bm-saved-head .bm-pin-search {
    margin: 0;
}

/* beat .tg-panel input[type='text'] (big centred field) and the subtitle's divider */
.tg-panel input.bm-saved-name {
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    font-size: 0.88rem;
    text-align: left;
}

.tg-panel input.bm-saved-name:hover,
.tg-panel input.bm-saved-name:focus {
    border-color: var(--tg-line);
    background: rgba(255, 255, 255, 0.04);
}

.tg-panel input.bm-pin-search {
    padding: 7px 11px;
    border: 1px solid var(--tg-line);
    border-radius: 10px;
    background: var(--tg-field);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
}

.tg-panel input.bm-pin-search:focus {
    border-color: var(--tg-accent);
}

.bm-saved-head .tg-subtitle {
    padding-top: 0;
    border-top: 0;
}

.main .bm-saved-main strong,
.main .bm-saved-main small {
    justify-self: start;
    text-align: left;
}
