/* ======================================================================
   GAME LAUNCH LAYER  -  favourite star, info sheet, Demo + Jouer
   ----------------------------------------------------------------------
   Every game tile on the site (home rails, casino slots, live, games list)
   gets the same four controls Kartoosh shows on a tile:

     * a favourite star, top right, persisted in localStorage
     * an info button, which opens a sheet about the game
     * "Demo"  - secondary button, launches the demo build
     * "Jouer" - primary button, launches the real build

   assets/js/game-launch.js injects the markup and owns the behaviour; this
   file only styles it. Both are loaded from includes/layout/header.php so
   every page has them, including tiles rendered later by the casino
   infinite scroll.

   The controls sit above a full-tile <a>, so a tap anywhere else on the
   tile launches the game and the buttons never nest inside a link.
   ====================================================================== */

.ktl {
    position: relative;
}

/* This link wraps the whole tile, so while it was interactive every region of
   the tile was a hyperlink. Tapping a corner could therefore activate a game
   instead of revealing the controls, and on a phone a long-press offered
   "open in new tab" straight into play.php. Only the revealed Demo / Jouer
   buttons are allowed to navigate now, so the whole tile behaves identically
   on the first tap wherever the finger lands. */
.ktl__link {
    position: absolute;
    inset: 0;
    /* kept at 2 for the same stacking reason as before: the artwork image is
       position:absolute at z-index 1 and would otherwise swallow taps */
    z-index: 2;
    display: block;
    border-radius: inherit;
    text-decoration: none;
    pointer-events: none;
}

/* Some tiles are their own anchor (<a class="kt-game" href="play.php...">),
   flagged by game-launch.js. Those need taking out of the pointer path for the
   same reason as the wrapper link above: a corner tap must never be able to
   launch a game, and a long-press must not offer "open in new tab". Clicks still
   bubble from the artwork inside it to the .ktl host, which reveals the
   controls. */
[data-ktl-own="1"] {
    pointer-events: none;
}

/* The card artwork is the real tap surface for a closed tile, so it has to stay
   clickable while the overlay link is inert. */
.ktl__art,
.ktc-card__art,
.kt-gtile__art,
.kt-gv__art,
.kt-ftile__art {
    pointer-events: auto;
}

/* ---------- favourite star ---------- */
.ktl__fav {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(8, 12, 18, 0.55);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.ktl__fav svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ktl__fav:hover {
    background: rgba(8, 12, 18, 0.78);
    color: #fff;
}

.ktl__fav.is-active {
    color: #ffc531;
}

.ktl__fav.is-active svg {
    fill: currentColor;
}

/* The green playing-now dot and its counter. Removed at the request of the
   site owner: it fought the info button for the top-left corner. */
.ktc-card__players {
    display: none;
}

/* ---------- info button ---------- */
.ktl__info {
    position: absolute;
    left: 6px;
    top: 6px;
    z-index: 3;
    height: 22px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 22px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ktl__info:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ---------- Demo / Jouer ---------- */
/* The gradient behind the buttons must never capture a tap. On a small card
   (the winners rail is 168x60) the bar covers nearly the whole surface, so
   with pointer-events:auto on the bar, tapping the card landed on the bar,
   the click handler bailed out early and nothing happened - a dead zone.
   Only the buttons themselves take the pointer; the empty gradient falls
   through to the tile, which toggles the reveal. */
.ktl__actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 8px;
    background: linear-gradient(180deg, rgba(5, 6, 8, 0) 0%, rgba(5, 6, 8, 0.72) 55%, rgba(5, 6, 8, 0.92) 100%);
    opacity: 0;
    pointer-events: none;
    /* visibility, not just opacity. Chrome's touch-click synthesis was still
       dispatching clicks to these zero-size, opacity:0 buttons on a resting
       tile, which is how tapping a corner launched a game. A hidden element
       generates no hit-test box at all, so it cannot be pressed. */
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

.ktl img {
    transition: filter 0.18s ease, transform 0.18s ease;
    will-change: filter;
}

.ktl:hover img,
.ktl:focus-within img,
.ktl.is-open img {
    filter: blur(4px) saturate(0.8) brightness(0.72);
    transform: scale(1.06);
}

/* The star and the info pill hide with the bar, so a resting tile is
   artwork only. */
.ktl__fav,
.ktl__info {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

/* Reveal rules. Only opacity here for the bar - its pointer-events must stay
   "none" even while visible, so the gradient never swallows a tap. The star
   and info pill are small and sit clear of the artwork, so they do take the
   pointer when shown. */
.ktl:hover .ktl__actions,
.ktl:focus-within .ktl__actions,
.ktl.is-open .ktl__actions {
    opacity: 1;
    visibility: visible;
}

.ktl:hover .ktl__fav,
.ktl:focus-within .ktl__fav,
.ktl.is-open .ktl__fav,
.ktl:hover .ktl__info,
.ktl:focus-within .ktl__info,
.ktl.is-open .ktl__info {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* Buttons only become clickable once the bar is showing, so an invisible
   control can never be pressed. */
.ktl__btn {
    pointer-events: none;
}

.ktl:hover .ktl__btn,
.ktl:focus-within .ktl__btn,
.ktl.is-open .ktl__btn {
    pointer-events: auto;
}

.ktl__btn {
    flex: 1 1 0;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.ktl__btn--demo {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.ktl__btn--demo:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Kartoosh green, same as the auth buttons. */
.ktl__btn--play {
    background: #1f9d63;
    color: #fff;
}

.ktl__btn--play:hover {
    background: #24b673;
}

/* The card used to paint its own "Jouer" pill on hover; the injected
   buttons replace it, so keep the old one from doubling up. */
.ktc-card__overlay {
    display: none;
}

/* ---------- info sheet ---------- */
.ktl-sheet {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(4, 7, 11, 0.72);
}

.ktl-sheet.is-open {
    display: flex;
}

.ktl-sheet__box {
    width: 100%;
    max-width: 360px;
    max-height: 84vh;
    overflow: auto;
    border-radius: 14px;
    background: #18232d;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.ktl-sheet__art {
    width: 100%;
    aspect-ratio: 183 / 129;
    border-radius: 13px 13px 0 0;
    overflow: hidden;
    background: #0f1720;
}

.ktl-sheet__art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ktl-sheet__body {
    padding: 14px 16px 16px;
}

.ktl-sheet__title {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.ktl-sheet__prov {
    margin: 0 0 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.ktl-sheet__rows {
    margin: 0 0 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    font-size: 13px;
}

.ktl-sheet__rows dt {
    color: rgba(255, 255, 255, 0.5);
}

.ktl-sheet__rows dd {
    margin: 0;
    color: #fff;
    text-align: right;
}

.ktl-sheet__note {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.42);
}

.ktl-sheet__actions {
    display: flex;
    gap: 8px;
}

.ktl-sheet__actions .ktl__btn {
    flex: 1 1 0;
    height: 36px;
    font-size: 13px;
    border-radius: 8px;
}

.ktl-sheet__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 900px) {
    /* Larger targets for fingers, now that the controls only appear on tap. */
    .ktl__fav {
        width: 34px;
        height: 34px;
    }

    .ktl__info {
        width: auto;
        height: 30px;
        padding: 0 10px;
        line-height: 30px;
        font-size: 12px;
    }

    .ktl__btn {
        height: 30px;
    }
}

/* ======================================================================
   FAVOURITES - badge on the 3-dot menu, and the list inside the drawer
   ----------------------------------------------------------------------
   The drawer and the badge elements already existed in the header; the
   badge was hidden outright and the drawer view was either a login prompt
   or an empty placeholder. Favourites are kept in localStorage, so they
   are available to guests too and are rendered from there.
   ====================================================================== */

/* Count bubble on the 3-dot toggle. It keeps its own 28x28 icon box, so the
   bubble is a pseudo element rather than a real child. */
#smart-panel-holder[data-badge]:not([data-badge=""])::after {
    content: attr(data-badge);
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #f8c524;
    color: #18232d;
    font-size: 10px;
    font-weight: 700;
    font-style: normal;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

#smart-panel-holder {
    position: absolute;
}

/* ---------- the list ---------- */
.kt-sp-fav-list-bc {
    padding: 8px;
}

.kt-sp-fav-list-bc .kt-sp-empty-bc {
    padding: 40px 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* The star sits top-right, clear of the thumbnail. */
#ktSpDrawer .ktl__fav {
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    background: rgba(8, 12, 18, 0.6);
}

#ktSpDrawer .ktl__info {
    display: none;
}

/* The Demo / Jouer bar sits at the bottom of the row, over the text. */
#ktSpDrawer .ktl__actions {
    padding: 6px;
}

#ktSpDrawer .ktl__btn {
    height: 28px;
    font-size: 12px;
}

/* ---------- favourites drawer: a tile grid, not list rows ---------- */
.kt-sp-fav-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
}

@media (min-width: 620px) {
    .kt-sp-fav-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* The drawer is a full-height sheet, so on a wide screen the grid would
   stretch to 1440px and each tile would become enormous. Cap it and centre
   it, which is what the drawer looks like on the mobile sheet. */
@media (min-width: 901px) {
    .kt-sp-fav-list-bc {
        display: flex;
        justify-content: center;
        padding: 20px 16px;
    }

    .kt-sp-fav-grid {
        width: 100%;
        max-width: 520px;
        padding: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kt-sp-fav-list-bc .kt-sp-empty-bc {
        text-align: center;
    }
}

.kt-ftile {
    position: relative;
    display: block;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.kt-ftile__art {
    position: relative;
    width: 100%;
    aspect-ratio: 183 / 129;
    background: #0f1720;
    overflow: hidden;
}

.kt-ftile__art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.kt-ftile__meta {
    padding: 7px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kt-ftile__name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kt-ftile__prov {
    font-size: 11px;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The controls sit on the artwork, not under it. */
.kt-ftile .ktl__fav {
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    background: rgba(8, 12, 18, 0.6);
}

.kt-ftile .ktl__info {
    top: 5px;
    left: 5px;
    width: auto;
    height: 22px;
    padding: 0 7px;
    line-height: 22px;
    font-size: 11px;
}

.kt-ftile .ktl__actions {
    padding: 6px;
    gap: 5px;
}

.kt-ftile .ktl__btn {
    height: 26px;
    font-size: 11px;
    border-radius: 5px;
}

/* ---------- clear all ---------- */
.kt-sp-fav-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.kt-sp-fav-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 10px;
}

.kt-sp-fav-clear {
    margin-left: auto;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    /* Hidden by default and revealed by CSS when the grid actually holds
       tiles. It used to ship with the hidden attribute and depend on
       game-launch.js to remove it, which meant a browser holding a cached
       older copy of that script could never show the button at all. :has()
       keeps this working even when the script is stale, and .is-off is the
       belt-and-braces for older engines. */
    display: none;
}

.kt-sp-fav-clear:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.kt-sp-fav-list-bc:has(.kt-ftile) + .kt-sp-fav-foot .kt-sp-fav-clear:not(.is-off) {
    display: inline-block;
}

.kt-sp-fav-clear.is-armed {
    background: rgba(248, 197, 36, 0.16);
    border-color: #f8c524;
    color: #f8c524;
}

@media (min-width: 901px) {
    .kt-sp-fav-foot {
        max-width: 520px;
        margin: 0 auto;
    }
}

/* ---------- legacy hover overlay on the home tiles ----------

   new_index.php renders a .kt-game__play span that used to be the hover
   "play" badge. style.css has a global `svg { width: 100%; height: 100% }`
   and this overlay is inset:0 over the whole tile, so its gold chevron was
   stretched to the full 150x106 of the artwork - a big yellow arrow sitting
   on top of the tile. The Demo / Jouer bar replaces it, so it is hidden the
   same way .ktc-card__overlay is. The explicit svg size below is kept as a
   guard in case the overlay is ever wanted again. */
.kt-game__play {
    display: none;
}

.kt-game__play svg {
    width: 20px;
    height: 20px;
}

/* ---------- top winners rail ---------- */
   These cards are sized with flex: 0 0 168px as direct children of the rail,
   so wrapping each one in a .ktl host moves the sizing onto the wrapper. Keep
   the 168x60 box and the scroll snap or the rail collapses. */
.kt-winners__line > .ktl {
    flex: 0 0 168px;
    width: 168px;
    height: 60px;
    display: flex;
    scroll-snap-align: start;
}

/* The winners rail is a showcase, not a menu. These cards are display only:
   no launch, no controls, no pointer. */
.kt-winners__line .kt-winner {
    pointer-events: none;
    cursor: default;
}

/* No room for an info pill on a 60px card. */
.kt-winner .ktl__info {
    display: none;
}

/* Clear the star away from the winner name on the right. */
.kt-winners__line .ktl:has(.ktl__fav) > .kt-winner {
    padding-right: 26px;
}

.kt-winner .ktl__fav {
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    background: rgba(8, 12, 18, 0.68);
}

.kt-winner .ktl__fav svg {
    width: 13px;
    height: 13px;
}

.kt-winner .ktl__actions {
    padding: 4px;
    gap: 4px;
}

.kt-winner .ktl__btn {
    height: 22px;
    font-size: 11px;
    border-radius: 4px;
}

/* ---------- desktop header: favourites entry ---------- */
/* The five-button smart panel is mobile only, so the desktop header gets its
   own star button in .topbar-right. It opens the same drawer. */
.tb-fav-btn {
    position: relative;
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tb-fav-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.tb-fav-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tb-fav-btn[data-badge]:not([data-badge=""])::after {
    content: attr(data-badge);
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #f8c524;
    color: #18232d;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

@media (min-width: 901px) {
    .tb-fav-btn {
        display: inline-flex;
    }
}

/* The drawer is hidden on desktop by the mobile stylesheet. When it is opened
   from the desktop header it has to be allowed to show. */
@media (min-width: 901px) {
    #ktSpDrawer.kt-fav-desktop {
        display: flex !important;
    }
}
