/* Higher or Lower (/higher-or-lower): only what is the game's own, the green card table, the two cards and the flip,
   the Higher and Lower buttons with their odds, and the row of played cards. Tiles, panels, buttons, the games accent
   and the colours come from the app kit (css/app-kit, css/app-kit/games.css, docs/app-kit.md). Loaded only on this
   game's page. */

/* The shared app layout gives the stage a fixed height with overflow hidden: the stage scrolls on its own. */
body .filter-landing-app.higher-or-lower-landing-app > .filter-landing-stage.ak-stage {
    justify-content: flex-start;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.higher-or-lower-landing-app > .filter-landing-stage.ak-stage > * {
    flex-shrink: 0;
    align-self: stretch;
    min-width: 0;
    max-width: 100%;
}

/* --- The table: green felt in both themes ----------------------------------------------------------------------- */

.higher-or-lower-landing-app .hl-table {
    --hl-felt: #1f6b45;
    --hl-felt-dark: #154d32;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    background: radial-gradient(ellipse at 50% 30%, var(--hl-felt) 0%, var(--hl-felt-dark) 100%);
    border-color: color-mix(in srgb, var(--hl-felt-dark) 70%, #000);
    color: #f4f1e8;
}

.higher-or-lower-landing-app[data-theme="dark"] .hl-table {
    --hl-felt: #18563a;
    --hl-felt-dark: #0e3523;
}

.higher-or-lower-landing-app .hl-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.75rem, 4vw, 2.5rem);
    width: 100%;
    max-width: 26rem;
}

.higher-or-lower-landing-app .hl-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    margin: 0;
}

.higher-or-lower-landing-app .hl-slot-name {
    color: rgba(244, 241, 232, 0.8);
    font-size: var(--ak-fs-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.higher-or-lower-landing-app .hl-card,
.higher-or-lower-landing-app .hl-flip {
    position: relative;
    width: min(100%, 10.5rem);
    aspect-ratio: 250 / 350;
}

.higher-or-lower-landing-app .hl-card svg,
.higher-or-lower-landing-app .hl-face svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

/* The new current card slides in from the deck. */
.higher-or-lower-landing-app .hl-card.is-arriving {
    animation: hl-arrive 0.28s ease-out;
}

@keyframes hl-arrive {
    from { transform: translateX(40%) scale(0.96); opacity: 0.4; }
    to { transform: none; opacity: 1; }
}

/* --- The next card: a back that turns over to its face --------------------------------------------------------- */

.higher-or-lower-landing-app .hl-flip {
    perspective: 900px;
}

.higher-or-lower-landing-app .hl-flip-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform 0.45s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.higher-or-lower-landing-app .hl-flip.is-flipped .hl-flip-inner {
    transform: rotateY(180deg);
}

.higher-or-lower-landing-app .hl-flip.no-anim .hl-flip-inner {
    transition: none;
}

.higher-or-lower-landing-app .hl-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.higher-or-lower-landing-app .hl-face--front {
    transform: rotateY(180deg);
}

/* The back: a woven lattice in the games' orange on deep blue, with a white border. */
.higher-or-lower-landing-app .hl-face--back {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.45rem solid #fffdf8;
    border-radius: 7%;
    background-color: #1d3361;
    background-image:
        repeating-linear-gradient(45deg, rgba(243, 140, 58, 0.55) 0 2px, transparent 2px 12px),
        repeating-linear-gradient(-45deg, rgba(243, 140, 58, 0.55) 0 2px, transparent 2px 12px),
        radial-gradient(circle at 50% 50%, #2b4a86 0%, #1d3361 70%);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35), inset 0 0 0 2px #c9c2b4, inset 0 0 0 6px #1d3361, inset 0 0 0 8px rgba(243, 140, 58, 0.8);
}

.higher-or-lower-landing-app .hl-deck-count {
    min-width: 2.4em;
    padding: 0.15em 0.5em;
    border-radius: 999px;
    background: rgba(255, 253, 248, 0.92);
    color: #1d3361;
    font-size: var(--ak-fs-md);
    font-weight: 800;
    text-align: center;
}

/* The deck is used up: an empty dashed place. */
.higher-or-lower-landing-app .hl-flip.is-empty .hl-flip-inner {
    visibility: hidden;
}

.higher-or-lower-landing-app .hl-flip.is-empty {
    border: 2px dashed rgba(244, 241, 232, 0.45);
    border-radius: 7%;
}

@media (prefers-reduced-motion: reduce) {
    .higher-or-lower-landing-app .hl-flip-inner {
        transition: none;
    }

    .higher-or-lower-landing-app .hl-card.is-arriving {
        animation: none;
    }
}

/* --- The result -------------------------------------------------------------------------------------------------- */

.higher-or-lower-landing-app .hl-result {
    min-height: 1.4em;
    margin: 0.2rem 0 0;
    color: #fffdf8;
    font-size: var(--ak-fs-xl);
    font-weight: 800;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.higher-or-lower-landing-app .hl-result[data-outcome="win"] {
    color: #a7f3c4;
}

.higher-or-lower-landing-app .hl-result[data-outcome="lose"] {
    color: #fecaca;
}

.higher-or-lower-landing-app .hl-result[data-outcome="push"] {
    color: #fde68a;
}

/* --- Higher and Lower ---------------------------------------------------------------------------------------- */

.higher-or-lower-landing-app .hl-guess {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    width: 100%;
    max-width: 26rem;
}

.higher-or-lower-landing-app .hl-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    min-height: 3.6rem;
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--ak-border);
    border-radius: var(--ak-radius-lg);
    background: var(--ak-panel);
    color: var(--ak-text);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.higher-or-lower-landing-app .hl-btn:hover:not(:disabled) {
    border-color: var(--ak-accent);
    transform: translateY(-2px);
}

.higher-or-lower-landing-app .hl-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.higher-or-lower-landing-app .hl-btn:focus-visible {
    outline: 3px solid #fde68a;
    outline-offset: 2px;
}

.higher-or-lower-landing-app .hl-btn:disabled {
    cursor: default;
    opacity: 0.55;
}

/* With Show odds on, the side with more cards left gets a ring. */
.higher-or-lower-landing-app .hl-btn.is-better:not(:disabled) {
    border-color: var(--ak-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ak-accent) 30%, transparent);
}

.higher-or-lower-landing-app .hl-btn-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.higher-or-lower-landing-app .hl-arrow {
    flex: none;
    width: 2rem;
    height: 2rem;
    fill: currentColor;
}

.higher-or-lower-landing-app .hl-btn--higher .hl-arrow {
    color: var(--ak-success);
}

.higher-or-lower-landing-app .hl-btn--lower .hl-arrow {
    color: var(--ak-danger);
}

.higher-or-lower-landing-app .hl-btn-name {
    overflow-wrap: anywhere;
    font-size: var(--ak-fs-lg, 1.1rem);
    font-weight: 800;
}

.higher-or-lower-landing-app .hl-odds {
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.higher-or-lower-landing-app .hl-equal {
    min-height: 1.2em;
    margin: 0;
    color: rgba(244, 241, 232, 0.85);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
    text-align: center;
}

/* --- Played cards --------------------------------------------------------------------------------------------- */

.higher-or-lower-landing-app .hl-played {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    width: 100%;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
}

.higher-or-lower-landing-app .hl-mini {
    width: 1.7rem;
    aspect-ratio: 50 / 70;
}

.higher-or-lower-landing-app .hl-mini svg {
    display: block;
    width: 100%;
    height: 100%;
}

.higher-or-lower-landing-app .hl-mini--wrong {
    border-radius: 0.3rem;
    box-shadow: 0 0 0 2px #f87171;
}
