.rt-layout {
    align-items: stretch;
}

.rt-block {
    max-width: none;
}

.rt-block--side {
    position: sticky;
    top: 1rem;
}

.rt-hands {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--site-border, rgba(255, 255, 255, 0.12));
}

.rt-hands__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--site-text-muted);
    margin-bottom: 0.65rem;
}

.rt-hands__list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rt-hands__row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 1fr) 3.2rem minmax(4rem, 1.4fr);
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.35rem 0.45rem;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--site-text, #e8e8e8);
    text-align: left;
    cursor: pointer;
}

.rt-hands__row:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.rt-hands__row:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.07);
}

.rt-hands__row.is-active {
    outline: 1px solid #4a8fd4;
    background: rgba(74, 143, 212, 0.15);
}

.rt-hands__label {
    font-size: 0.82rem;
    white-space: nowrap;
}

.rt-hands__pct {
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--site-text-muted, #aaa);
}

.rt-hands__track {
    display: block;
    height: 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.rt-hands__bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #c94c4c 0%, #c94c4c 72%, #3a9e6a 72%, #3a9e6a 100%);
    min-width: 0;
}

.range-grid-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.range-grid {
    display: grid;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    grid-template-rows: repeat(13, minmax(0, 1fr));
    gap: 2px;
    width: min(100%, 40rem);
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0;
    user-select: none;
    touch-action: none;
    border-collapse: unset;
    border-spacing: 0;
}

.range-grid tbody,
.range-grid tr {
    display: contents;
}

.range-grid-wrap.is-painting,
.range-grid-wrap.is-painting .range-cell {
    cursor: crosshair;
}

.range-cell {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font-size: clamp(0.5rem, 1.45vw, 0.72rem);
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.1;
    box-sizing: border-box;
    transition: background-color 0.08s ease, box-shadow 0.08s ease, opacity 0.08s ease;
}

.range-cell__label {
    display: block;
    pointer-events: none;
}

.range-cell__count {
    position: absolute;
    right: 3px;
    bottom: 2px;
    font-size: 0.55em;
    font-weight: 600;
    opacity: 0.55;
    pointer-events: none;
}

.range-cell.is-suited {
    background: #ebe0d0;
    color: #9a9a9a;
}

.range-cell.is-offsuit,
.range-cell.is-pair {
    background: #ececec;
    color: #9a9a9a;
}

.range-cell.is-out-of-range {
    opacity: 0.35;
}

.range-cell.is-out-of-range .range-cell__count {
    opacity: 0.35;
}

.range-cell.is-related {
    background: #f3e6a0;
    color: #7a7a7a;
    border-color: #d4c878;
    opacity: 0.4;
}

.range-cell.is-related.is-related-strong {
    background: #e8d078;
    border-color: #c4a84a;
    opacity: 0.45;
}

.range-cell.is-selected {
    background: #4a8fd4;
    color: #fff;
    border-color: #3a74ad;
    opacity: 1;
}

.range-cell.is-selected .range-cell__count {
    color: #fff;
    opacity: 0.75;
}

.range-cell.is-intersection {
    background: #e85d04;
    color: #fff;
    border-color: #c44a00;
    opacity: 1;
}

.range-cell.is-intersection .range-cell__count {
    color: #fff;
    opacity: 0.75;
}

.range-cell.is-intersection.is-related-strong {
    background: #c73e00;
    border-color: #9e3200;
}

.range-cell.is-filtered-out {
    opacity: 0.12;
    cursor: not-allowed;
}

/* While a hand-class filter is on, hide everything outside the range */
.range-cell.is-hidden-by-filter {
    opacity: 0.06;
    background: #2a2a2a !important;
    color: transparent !important;
    border-color: transparent !important;
    cursor: not-allowed;
}

.range-cell.is-hidden-by-filter .range-cell__label,
.range-cell.is-hidden-by-filter .range-cell__count {
    visibility: hidden;
}

.range-cell:hover {
    box-shadow: inset 0 0 0 2px #7ec27a;
}

.range-cell.is-selected:hover,
.range-cell.is-intersection:hover {
    box-shadow: inset 0 0 0 2px #9fd49c;
}

.rt-legend {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--site-text-muted);
}

.rt-legend__swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    margin-right: 0.35rem;
    vertical-align: -0.1rem;
}

@media (max-width: 991px) {
    .rt-block--side {
        position: static;
    }
}

@media (max-width: 576px) {
    .rt-block {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .rt-hands__row {
        grid-template-columns: minmax(4.5rem, 1fr) 2.8rem minmax(3rem, 1fr);
    }

    .range-cell__count {
        display: none;
    }
}
