/* ==========================================================================
   Casino row: one component for the catalog (/casino/) and the rankings in
   posts and pages (Casino List / Casino Card blocks, casino archives).
   Layout follows the width of the surrounding container (.cat-scope), not the
   screen: in a narrow article column the row becomes the compact card.
   The thresholds match the catalog's former screen breakpoints
   (catalog list 884px ≈ screen 1180px, 736px ≈ screen 1024px / 768px).
   Theme tokens only (colours, fonts, radii, shadows from main.css)
   ========================================================================== */

.cat-scope { container: catitems / inline-size; }
/* Rows inside post content (Casino List / Casino Card blocks): the article
   typography (.prose / .entry-content: heading margins, underlined links,
   list bullets, image margins) must not reach the row. */
.cat-scope .cat-item h3 { margin: 0; } /* in case a child theme uses a heading */
.cat-scope .cat-item a { text-decoration: none; }
.cat-scope .cat-item__name a { color: var(--color-text); }
.cat-scope .cat-item__name a:hover { color: var(--color-primary-text, var(--color-primary)); }
.cat-scope .cat-item .btn--cta { color: var(--color-on-cta); }
.cat-scope .cat-item img { margin: 0; }
.cat-scope .cat-item ul { margin: 0; padding: 0; list-style: none; }
.cat-scope .cat-item li { margin: 0; line-height: normal; }

/* --- Items: shared --- */
.cat-items__section {
    margin: var(--space-md) 0 0;
    font-size: var(--text-xl);
}

.cat-items__section:first-of-type { margin-top: 0; }

/* The casino row is <article class="cat-item">. WordPress gives category list items the same class
   (<li class="cat-item"> in the Categories widget / block): :where(article) keeps the card off them
   without raising the specificity (modifiers like .cat-item--closed still override). */
:where(article).cat-item {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-fast, .15s);
}

:where(article).cat-item:hover { box-shadow: var(--shadow-card-hover); }

.cat-item__logo { position: relative; }
.cat-item__logo-link { display: block; }

.cat-item__logo img,
.cat-item__logo-text {
    display: flex;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 1;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.cat-item__logo-text {
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: var(--color-light-bg);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: var(--color-text-muted);
    text-align: center;
}

.cat-item__main { min-width: 0; }

.cat-item__name {
    margin: 0;
    font-family: var(--font-heading); /* a div since 1.23.3: same look as the former h3 */
    font-weight: var(--weight-bold);
    color: var(--color-text);
    font-size: var(--text-base);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;          /* max 2 lines, full name in the title tooltip */
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.cat-item__name a { color: var(--color-text); text-decoration: none; }
.cat-item__name a:hover { color: var(--color-primary-text, var(--color-primary)); }

/* Badge: a tab on the card's top edge (half above the card, half on the border),
   left-aligned. It covers nothing inside the card; cut only if wider than the card. */
.cat-item__badge {
    position: absolute;
    top: 0;
    left: 12px;
    z-index: 2;
    max-width: calc(100% - 24px);
    transform: translateY(-50%);
    padding: 2px 8px;
    border-radius: var(--radius-badge);
    background: var(--color-success);
    color: var(--color-on-primary);
    font-size: 10px;
    font-weight: var(--weight-bold);
    line-height: 14px;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.cat-item__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.cat-item__rating--none strong { color: var(--color-text-muted, #8a8f98); font-weight: 600; }

.cat-item__rating .rating-stars { display: inline-flex; gap: 1px; }
.cat-item__rating .rating-stars .star { width: 15px; height: 15px; }
.cat-item__rating strong { font-family: var(--font-heading); color: var(--color-primary-text, var(--color-primary)); }

.cat-item__bonus-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--font-heading);
    font-weight: var(--weight-bold);
    line-height: 1.3;
    color: var(--color-text);
}

.cat-item__fs { display: block; margin-top: 2px; font-size: var(--text-sm); color: var(--color-text-secondary); }
/* Narrow rows: the full "+ 400 gratisspinn" line gives way to "+ 400 GS" (never hidden altogether) */
.cat-item__fs-short { display: none; margin-top: 2px; font-size: var(--text-sm); font-weight: var(--weight-semibold, 600); color: var(--color-text-secondary); white-space: nowrap; }

.cat-item__pays { position: relative; display: flex; align-items: center; gap: 4px; }

/* "+N": a tile in a thin frame on the surface colour, in every skin and view (rows, grid cards, catalog), as wide and
   tall as the icons beside it (the size rules below name both). Skins whose icons have no frame keep it on "+N". */
.cat-item__pays img,
.cat-item__pays-more {
    width: 42px;
    height: 27px;
    padding: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}
.cat-item__pays img {
    object-fit: contain;
    opacity: 1;
    filter: none;
}

.cat-item__pays-more {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin: 0;
    font: inherit;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--color-text-secondary);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.cat-item__pays-more:hover,
.cat-item__pays-more[aria-expanded="true"] { border-color: var(--color-primary); color: var(--color-primary-text, var(--color-primary)); }
.cat-item__pays-more:focus { outline: none; }
.cat-item__pays-more:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* "+N" popup: the rest of the payment methods */
.cat-item__pays-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; /* casino-item.js places it at the "+N" button, away from the buttons */
    z-index: 50;
    width: max-content;
    min-width: 180px;
    max-width: 260px;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}
.cat-item__pays-pop[hidden] { display: none; }
/* Open: casino-item.js moves it to <body> (no row, card or overflow: hidden of the list can cover or cut it) and keeps
   it on the screen at the "+N" button */
.cat-item__pays-pop.is-floating { position: fixed; z-index: 1000; }
.cat-item__pays-pop ul { list-style: none; margin: 0; padding: 0; }
.cat-item__pays-pop li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px;
    font-size: var(--text-sm);
    color: var(--color-text);
    white-space: nowrap;
}
.cat-item__pays-pop li img { width: 42px; height: 27px; flex: 0 0 auto; object-fit: contain; box-sizing: border-box; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); } /* the list is out of the row when open: its own icon frame */
.cat-item__pays-pop li .cat-item__pays-noicon { width: 42px; flex: 0 0 auto; }

.cat-item__actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
/* Buttons of a row may wrap a long text (main.css). In a row of buttons (phones, grid cards) each stays as wide as
   its text while that fits (as with nowrap before); only a longer text wraps. */
.cat-item__actions .btn { min-width: -webkit-fit-content; min-width: fit-content; }
/* Desktop rows: the buttons stand in a narrow column (~120–130px; rankings ≥ 560px, catalog list > 736px). There the
   column sets the width (no fit-content: it would widen the column) and the side padding is thin, so «Jugar ahora»,
   «Ver alternativas» and the like stay on one line in every skin (pill buttons have 1.6rem otherwise); a longer text
   («Katso vaihtoehdot» at 14px) takes two lines inside the button. */
@container catitems (width >= 560px) {
    .cat-items--rankings.cat-items--list .cat-item__actions .btn { min-width: 0; padding-left: 6px; padding-right: 6px; }
}
@container catitems (width > 736px) {
    .cat-items--list:not(.cat-items--rankings) .cat-item__actions .btn { min-width: 0; padding-left: 6px; padding-right: 6px; }
}
.cat-item__review { font-size: var(--text-sm); text-align: center; color: var(--color-primary-text, var(--color-primary)); }
/* Closed casino: "See alternatives" (same yellow button) + small grey "Closed" badge next to "Read review" */
.cat-item__closed-meta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; }
.cat-item__closed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1.5;
    white-space: nowrap;
}
.cat-item__closed svg { flex: 0 0 auto; }

/* --- List view --- */
.cat-items--list {
    display: flex;
    flex-direction: column;
    gap: 18px; /* room for the badge tab above a card */
}

.cat-items--list .cat-item {
    display: grid;
    /* Same columns in every row, so bonus and payments line up down the list:
       logo | name + stars | bonus (free space) | payments (3 icons + "+N") | buttons */
    grid-template-columns: 120px 190px minmax(0, 1fr) 170px 128px;
    column-gap: 16px;
    align-items: center;
    height: 116px; /* fits the tallest content (2-line bonus + free spins + code): every row the same */
    padding: 12px 16px;
}

.cat-items--list .cat-item--pinned {
    border-left: 4px solid var(--color-cta);
    padding-left: 13px;
}

.cat-items--list .cat-item__pays { justify-content: flex-end; }

/* Keep columns aligned when a part is missing */
.cat-items--list .cat-item__logo   { grid-column: 1; }
.cat-items--list .cat-item__main   { grid-column: 2; }
.cat-items--list .cat-item__bonus  { grid-column: 3; }
.cat-items--list .cat-item__pays   { grid-column: 4; }
.cat-items--list .cat-item__actions { grid-column: 5; }

/* --- Grid view --- */
.cat-items--grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 16px;
}

.cat-items--grid .cat-items__section,
.cat-items--grid > h2 { grid-column: 1 / -1; }

.cat-items--grid .cat-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: var(--radius-lg);
}

.cat-items--grid .cat-item__logo img,
.cat-items--grid .cat-item__logo-text { border-radius: var(--radius-md); }

.cat-items--grid .cat-item--pinned { border: 2px solid var(--color-cta); }
.cat-items--grid .cat-item--pinned .cat-item__badge { top: -1px; } /* centred on the 2px border */
/* Logo inset from the card edge, so the badge tab never lies on it */
.cat-items--grid .cat-item__logo { margin: 14px 14px 0; }
.cat-items--grid .cat-item__logo img,
.cat-items--grid .cat-item__logo-text { object-fit: cover; }
.cat-items--grid .cat-item__main,
.cat-items--grid .cat-item__bonus,
.cat-items--grid .cat-item__pays { padding: 0 16px; }
.cat-items--grid .cat-item__actions { margin-top: auto; padding: 4px 16px 16px; }


/* --- Medium container: payments column hidden --- */
@container catitems (max-width: 884px) {
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item { grid-template-columns: 112px 180px minmax(0, 1fr) 128px; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__pays { display: none; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__actions { grid-column: 4; }
    .cat-items--grid:where(:not(.cat-items--rankings)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* [casino show="…"] without the bonus: the payments take its column (the payments column itself is hidden here) */
@container catitems (736px < width <= 884px) {
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item:not(:has(> .cat-item__bonus)) .cat-item__pays { display: flex; grid-column: 3; justify-content: flex-start; }
}

/* --- Compact horizontal card (narrow container: tablet, mobile, article column) --- */
@container catitems (max-width: 736px) {
    /* Compact horizontal card for both views */
    .cat-items--list:where(:not(.cat-items--rankings)),
    .cat-items--grid:where(:not(.cat-items--rankings)) { display: flex; flex-direction: column; gap: 18px; }

    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item {
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        grid-template-areas: "logo main" "logo bonus" "logo pays" "actions actions";
        gap: 6px 12px;
        align-items: start;
        min-height: 0;
        padding: 12px;
        overflow: visible;
        border-radius: var(--radius-md);
    }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item--pinned,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item--pinned { border: 1px solid var(--color-border); border-left: 4px solid var(--color-cta); padding-left: 9px; }

    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__logo,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo { grid-area: logo; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__main,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__main { grid-area: main; padding: 0; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__bonus,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__bonus { grid-area: bonus; padding: 0; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__actions,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__actions { grid-area: actions; }
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo img,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo-text { border-radius: var(--radius-sm); object-fit: contain; }
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo { margin: 0; }
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item--pinned .cat-item__badge { top: 0; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item { height: auto; }
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__pays { justify-content: flex-start; }

    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__pays,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__pays { grid-area: pays; display: flex; padding: 0; }
    :where(.cat-items:not(.cat-items--rankings)) :is(.cat-item__pays img, .cat-item__pays-more) { width: 38px; height: 24px; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__fs { display: none !important; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__fs-short { display: block; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__bonus-text { font-size: var(--text-sm); }

    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item__actions,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__actions {
        flex-direction: row-reverse;
        align-items: center;
        gap: 12px;
        margin: 4px 0 0;
        padding: 0;
    }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__actions .cat-item__cta { flex: 1; min-height: 42px; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__review { flex: 1; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__closed-meta { flex: 1; }
    :where(.cat-items:not(.cat-items--rankings)) .cat-item__closed-meta .cat-item__review { flex: 0 1 auto; }
}

@container catitems (max-width: 348px) {
    .cat-items--list:where(:not(.cat-items--rankings)) .cat-item,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item { grid-template-columns: 96px minmax(0, 1fr); }
}

/* ==========================================================================
   Rankings in posts / pages (Casino List, Casino Card, casino archives)
   Two floors, by the width of the list's container:
     >= 560px  top:    # | logo | name + stars | bonus + code | buttons
               bottom: strip with 3 pros (left) and payment icons (right)
     <  560px  compact card: pros as a list under the bonus, payments under
               them; "+N" shows the rest of the icons in the same line
   ========================================================================== */

.cat-item__pos {
    font-family: var(--font-heading);
    font-size: var(--text-xl, 1.25rem);
    font-weight: var(--weight-bold, 700);
    line-height: 1;
    text-align: center;
    color: var(--color-primary-text, var(--color-primary));
}
.cat-item--top .cat-item__pos { color: var(--color-cta-text, var(--color-cta)); }

.cat-items--rankings.cat-items--list .cat-item--top {
    border-left: 4px solid var(--color-cta);
    padding-left: 13px;
}

/* Pros: full text, green checks */
.cat-item__pros { list-style: none; margin: 0; padding: 0; min-width: 0; }
.cat-item__pros li {
    position: relative;
    padding-left: 20px;
    font-size: var(--text-sm);
    line-height: 1.45;
    color: var(--color-text);
}
.cat-item__pros li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .2em;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-success, #28a745) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 9px no-repeat;
}

/* "+N" expanded inline (mobile rankings) */
.cat-item__pays-extra { display: contents; }
.cat-item__pays-extra[hidden] { display: none; }
.cat-item__pays-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* --- Two floors (>= 560px) --- */
@container catitems (width >= 560px) {
    .cat-items--rankings.cat-items--list .cat-item {
        grid-template-columns: 104px 140px minmax(0, 1fr) 128px;
        grid-template-areas: "logo main bonus actions" "strip strip strip strip";
        height: auto;
        min-height: 0;
        column-gap: 14px;
        row-gap: 12px;
        padding: 14px 16px 0;
    }
    .cat-items--rankings.cat-items--numbered .cat-item {
        grid-template-columns: 22px 104px 140px minmax(0, 1fr) 128px;
        grid-template-areas: "pos logo main bonus actions" "strip strip strip strip strip";
    }
    .cat-items--rankings.cat-items--list .cat-item--top { padding-left: 13px; }
    .cat-items--rankings.cat-items--list .cat-item:not(:has(.cat-item__strip)) { padding-bottom: 14px; }
    .cat-items--rankings.cat-items--list .cat-item__pos     { grid-area: pos; align-self: center; }
    .cat-items--rankings.cat-items--list .cat-item__logo    { grid-area: logo; align-self: center; }
    .cat-items--rankings.cat-items--list .cat-item__main    { grid-area: main; align-self: center; }
    .cat-items--rankings.cat-items--list .cat-item__bonus   { grid-area: bonus; align-self: center; }
    .cat-items--rankings.cat-items--list .cat-item__actions { grid-area: actions; align-self: center; }
    /* Bonus: up to 2 lines of its own width, never cut */
    .cat-items--rankings.cat-items--list .cat-item__bonus-text { display: block; -webkit-line-clamp: unset; overflow: visible; white-space: normal; }

    .cat-items--rankings.cat-items--list .cat-item__strip {
        grid-area: strip;
        display: flex;
        align-items: center;
        gap: 8px 20px;
        margin: 0 -16px;
        padding: 9px 16px;
        border-top: 1px solid var(--color-border);
        border-radius: 0 0 calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px);
        background: var(--color-light-bg, #f5f6fa);
    }
    .cat-items--rankings.cat-items--list .cat-item--top .cat-item__strip { margin-left: -13px; padding-left: 13px; border-bottom-left-radius: 0; }
    .cat-items--rankings.cat-items--list .cat-item__strip .cat-item__pros {
        flex: 1 1 auto;
        display: flex;
        flex-wrap: wrap;
        gap: 4px 14px;
    }
    .cat-items--rankings.cat-items--list .cat-item__strip .cat-item__pays {
        flex: 0 0 auto;
        display: flex;
        margin-left: auto;
    }
    .cat-items--rankings.cat-items--list :is(.cat-item__pays img, .cat-item__pays-more) { width: 36px; height: 23px; }
}

@container catitems (560px <= width < 720px) {
    .cat-items--rankings.cat-items--list .cat-item { grid-template-columns: 92px 120px minmax(0, 1fr) 116px; column-gap: 12px; }
    .cat-items--rankings.cat-items--numbered .cat-item { grid-template-columns: 20px 92px 120px minmax(0, 1fr) 116px; }
}

/* --- Compact card (< 560px): the catalog's compact card --- */
@container catitems (width < 560px) {
    .cat-items--rankings.cat-items--list { display: flex; flex-direction: column; gap: 18px; }
    .cat-items--rankings.cat-items--list .cat-item {
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        grid-template-areas: "logo main" "logo bonus" "logo strip" "actions actions";
        gap: 6px 12px;
        align-items: start;
        height: auto;
        min-height: 0;
        padding: 12px;
        overflow: visible;
        border-radius: var(--radius-md);
        --cat-pays-more: expand; /* casino-item.js: "+N" opens the rest inline */
    }
    .cat-items--rankings.cat-items--list .cat-item--top { border: 1px solid var(--color-border); border-left: 4px solid var(--color-cta); padding-left: 9px; }
    .cat-items--rankings.cat-items--list .cat-item__logo { grid-area: logo; }
    .cat-items--rankings.cat-items--list .cat-item__main { grid-area: main; padding: 0; }
    .cat-items--rankings.cat-items--list .cat-item__bonus { grid-area: bonus; padding: 0; }
    .cat-items--rankings.cat-items--list .cat-item__actions { grid-area: actions; }
    .cat-items--rankings.cat-items--list .cat-item__strip { grid-area: strip; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
    .cat-items--rankings.cat-items--list .cat-item__pays { display: flex; flex-wrap: wrap; justify-content: flex-start; padding: 0; }
    .cat-items--rankings.cat-items--list :is(.cat-item__pays img, .cat-item__pays-more) { width: 38px; height: 24px; }
    .cat-items--rankings.cat-items--list .cat-item__fs { display: none !important; }
    .cat-items--rankings.cat-items--list .cat-item__fs-short { display: block; }
    .cat-items--rankings.cat-items--list .cat-item__bonus-text { font-size: var(--text-sm); }
    .cat-items--rankings.cat-items--list .cat-item__actions {
        flex-direction: row-reverse;
        align-items: center;
        gap: 12px;
        margin: 4px 0 0;
        padding: 0;
    }
    .cat-items--rankings.cat-items--list .cat-item__actions .cat-item__cta { flex: 1; min-height: 42px; }
    .cat-items--rankings.cat-items--list .cat-item__review { flex: 1; }
    .cat-items--rankings.cat-items--list .cat-item__closed-meta { flex: 1; }
    .cat-items--rankings.cat-items--list .cat-item__closed-meta .cat-item__review { flex: 0 1 auto; }

    /* Number: round tag centred on the card's left edge (half outside), the
       logo keeps its full inset; clear of the badge tab */
    .cat-items--rankings.cat-items--numbered .cat-item { padding-left: 22px; }
    .cat-items--rankings.cat-items--numbered .cat-item--top { padding-left: 19px; }
    .cat-items--numbered .cat-item__pos {
        position: absolute;
        left: -13px;
        top: 20px;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--color-primary);
        color: var(--color-on-primary);
        font-size: var(--text-xs, .75rem);
        box-shadow: 0 0 0 2px var(--color-surface);
    }
    .cat-items--numbered .cat-item--top .cat-item__pos { left: -14px; background: var(--color-cta); color: var(--color-on-cta); }
}

@container catitems (width < 349px) {
    .cat-items--rankings.cat-items--list .cat-item { grid-template-columns: 96px minmax(0, 1fr); }
}

/* --- Rankings as a grid ("Rutenett"): the catalog's grid card + number,
   pros and payments. 2 columns from 560px of container width, else 1 --- */
.cat-items--rankings.cat-items--grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px 16px; }
@container catitems (width >= 560px) {
    .cat-items--rankings.cat-items--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.cat-items--rankings.cat-items--grid .cat-item--top { border: 2px solid var(--color-cta); }
.cat-items--rankings.cat-items--grid .cat-item--top .cat-item__badge { top: -1px; }
.cat-items--rankings.cat-items--grid .cat-item__strip {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px;
}
.cat-items--rankings.cat-items--grid .cat-item__strip .cat-item__pays { display: flex; flex-wrap: wrap; padding: 0; }
.cat-items--rankings.cat-items--grid .cat-item__actions { order: 2; }
.cat-items--rankings.cat-items--grid .cat-item__bonus-text { display: block; -webkit-line-clamp: unset; overflow: visible; }
.cat-items--rankings.cat-items--grid.cat-items--numbered .cat-item__pos {
    position: absolute;
    left: -13px;
    top: 22px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-size: var(--text-xs, .75rem);
    box-shadow: 0 0 0 2px var(--color-surface);
}
.cat-items--rankings.cat-items--grid.cat-items--numbered .cat-item--top .cat-item__pos { left: -14px; background: var(--color-cta); color: var(--color-on-cta); }

/* Casino List / Casino Card blocks in a row: twice the gap between the rows of
   a list (18px; grid 22px), so two blocks never run into each other (site and editor) */
.casino-list,
.casino-card-block { margin-bottom: 36px; }
.casino-list:has(> .cat-items--grid) { margin-bottom: 44px; } /* grid rows: 22px */

/* Block header: title + List / Grid switch on the right */
.casino-list__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 18px;
}
.casino-list__head .casino-list__title { margin: 0; }
.cat-view-switch {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
}
.cat-view-switch[hidden] { display: none; }
.cat-view-switch button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text-secondary);
    cursor: pointer;
}
.cat-view-switch button[aria-pressed="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.cat-view-switch button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }

/* Casino List "Show more": rows over the initial count stay hidden until opened */
.cat-items .cat-item.casino-list__item--hidden:not(.is-shown) { display: none; }

/* ==========================================================================
   Grid cards (catalog and rankings): "+N" shows the rest of the icons inside
   the card (no popup over the neighbours); equal card heights, buttons at the
   bottom.
   ========================================================================== */
.cat-items--grid .cat-item { --cat-pays-more: expand; }
.cat-items--grid .cat-item__pays { flex-wrap: wrap; row-gap: 6px; }

/* Rankings grid: logo in a 2:1 box of limited height, centred */
.cat-items--rankings.cat-items--grid .cat-item__logo {
    display: flex;
    justify-content: center;
    margin: 18px 16px 0;
}
.cat-items--rankings.cat-items--grid .cat-item__logo-link {
    width: 170px;
    max-width: 100%;
    aspect-ratio: 2 / 1;
}
.cat-items--rankings.cat-items--grid .cat-item__logo img,
.cat-items--rankings.cat-items--grid .cat-item__logo-text {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* Rankings grid: the number is a small circle on the card's top edge, left;
   the badge tab moves to the right of it */
.cat-items--rankings.cat-items--grid.cat-items--numbered .cat-item__pos,
.cat-items--rankings.cat-items--grid.cat-items--numbered .cat-item--top .cat-item__pos {
    left: 12px;
    top: 0;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
}
.cat-items--rankings.cat-items--grid.cat-items--numbered .cat-item__badge { left: 42px; max-width: calc(100% - 54px); }

/* Catalog grid (wide container; narrower it becomes the compact card): the
   same logo box as the rankings grid, 2:1 170×85, centred, contain */
@container catitems (width > 736px) {
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo {
        display: flex;
        justify-content: center;
        margin: 18px 16px 0;
    }
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo-link {
        width: 170px;
        max-width: 100%;
        aspect-ratio: 2 / 1;
    }
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo img,
    .cat-items--grid:where(:not(.cat-items--rankings)) .cat-item__logo-text {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: var(--radius-sm);
    }
}
