/* Holder scrolls horizontally. Grid stays content-sized. */

.bias-table * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base holder */
.bias-table {
    position: relative;
    width: 100%;
    max-width: 100vw;
    overflow: visible; /* do not clip at the top level */
    font-family: var(--wp--preset--font-family--avenir-black);
}

/* Dedicated scroller INSIDE the holder (horizontal scroll lives here) */
.bias-table__scroller {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

/* Avoid combining fullwidth with scroll on the same node */
.bias-table--fullwidth {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.entry-content .bias-table--fullwidth,
.wp-block-post-content .bias-table--fullwidth,
.page-content .bias-table--fullwidth,
.site-main .bias-table--fullwidth {
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: calc(-50vw + 50%);
}

/* Grid container. Content-sized width so scroller can overflow */
.bias-table__grid {
    position: relative;
    display: grid;
    gap: 5px;
    padding: 0; /* you’ll add space later */
    width: max-content;
    margin: 0;
}

/* category label */
.category-label {
    display: flex;
    align-items: end;
    justify-content: center;
    font-weight: bold;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    z-index: 10;
    height: 65px;
    align-self: end;
    padding: 10px;
    word-break: break-word;
    text-align: center;
}

/* element card */
.element-card {
    position: relative;
    border-radius: 5px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: none;
    z-index: 10;
    min-width: 0;
    user-select: none;
    will-change: auto;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.element-card:focus,
.element-card:active {
    outline: none !important;
    box-shadow: none !important;
}

/* Remove hover effects */
.element-card:hover {
    transform: none;
    z-index: 10;
    box-shadow: none;
}

.element-top-bar {
    display: flex;
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.element-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    word-break: break-word;
    flex: 1;
}

.element-number {
    display: flex;
    justify-content: center;
    line-height: 1;
    width: 20px;
    height: 20px;
    align-items: center;
    font-size: 9px;
    border-radius: 50px;
    padding: 3px;
    letter-spacing: 0;
    font-weight: 700;
    flex-shrink: 0;
}

.element-symbol {
    font-size: 64px;
    font-weight: bold;
    line-height: 1;
    word-break: keep-all;
    text-align: center;
}

.element-name {
    font-size: 9px;
    text-align: center;
    line-height: 1.2;
    font-weight: 800;
    word-break: break-word;
    padding-top: 15px;
}

/* modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.active { display: flex; }

.modal-content {
    background: #3C3A3C;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    position: relative;
    color: #fff;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}
.modal-close:hover { color: #fff; }

.modal-header {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-right: 30px;
}

.modal-body { color: #aaa; line-height: 1.6; }

/* debug */
.debug-info {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.9);
    color: #0f0;
    padding: 10px;
    font-family: monospace;
    font-size: 11px;
    z-index: 9999;
    border: 1px solid #0f0;
    border-radius: 4px;
    line-height: 1.4;
}

/* empty state */
.bias-table-empty {
    padding: 40px;
    text-align: center;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #666;
    font-size: 1.1rem;
    margin: 20px auto;
    max-width: 600px;
}

/* Responsive tweaks only when NOT scrollable */
@media (max-width: 768px) {
    .bias-table:not(.bias-table--scrollable) .bias-table__grid { gap: 4px; }
    .bias-table:not(.bias-table--scrollable) .element-symbol { font-size: 3.2rem; margin: 6px 0; }
    .bias-table:not(.bias-table--scrollable) .element-name { font-size: 0.58rem; }
    .bias-table:not(.bias-table--scrollable) .element-label { font-size: 0.5rem; }
    .bias-table:not(.bias-table--scrollable) .element-number { font-size: 0.48rem; padding: 2px 5px; }
    .bias-table:not(.bias-table--scrollable) .category-label { font-size: 0.58rem; height: 60px; padding: 8px; }
    .bias-table:not(.bias-table--scrollable) .modal-content { width: 95%; padding: 1.5rem; }
    .bias-table:not(.bias-table--scrollable) .modal-header { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .bias-table:not(.bias-table--scrollable) .bias-table__grid { gap: 3px; }
    .bias-table:not(.bias-table--scrollable) .element-card { padding: 8px; }
    .bias-table:not(.bias-table--scrollable) .element-symbol { font-size: 2.8rem; margin: 4px 0; }
    .bias-table:not(.bias-table--scrollable) .element-name { font-size: 0.55rem; line-height: 1.1; }
    .bias-table:not(.bias-table--scrollable) .element-label { font-size: 0.48rem; }
    .bias-table:not(.bias-table--scrollable) .element-number { font-size: 0.45rem; padding: 2px 4px; }
    .bias-table:not(.bias-table--scrollable) .category-label { font-size: 0.55rem; height: 55px; padding: 6px; letter-spacing: 0.3px; }
    .bias-table:not(.bias-table--scrollable) .modal-content { padding: 1.25rem; max-height: 85vh; }
    .bias-table:not(.bias-table--scrollable) .modal-header { font-size: 1.2rem; margin-bottom: 0.75rem; }
    .bias-table:not(.bias-table--scrollable) .modal-body { font-size: 0.9rem; }
    .bias-table:not(.bias-table--scrollable) .modal-close { font-size: 1.5rem; width: 25px; height: 25px; }
    .bias-table:not(.bias-table--scrollable) .debug-info { font-size: 10px; padding: 8px; top: 5px; right: 5px; }
}

@media (max-width: 360px) {
    .bias-table:not(.bias-table--scrollable) .element-symbol { font-size: 2.4rem; }
    .bias-table:not(.bias-table--scrollable) .element-name,
    .bias-table:not(.bias-table--scrollable) .element-label,
    .bias-table:not(.bias-table--scrollable) .category-label { font-size: 0.5rem; }
    .bias-table:not(.bias-table--scrollable) .element-number { font-size: 0.42rem; }
}

/* ensure grid items do not impose min size limits */
.bias-table__grid > * {
    min-width: 0;
    min-height: 0;
}