/* Poker hands trainer (/poker-hands-trainer): only what is the drill's own, the green felt with the hands and the board,
   the answer buttons, the verdict and the hand ranking beside the table. 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 page. */

/* The shared app layout gives the stage a fixed height with overflow hidden: the stage scrolls on its own. */
body .filter-landing-app.pht-landing-app > .filter-landing-stage.ak-stage {
    justify-content: flex-start;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.pht-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 ----------------------------------------------------------------------- */

.pht-landing-app .pht-table {
    --pht-felt: #1f6b45;
    --pht-felt-dark: #154d32;
    --pht-ink: #f4f1e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: radial-gradient(ellipse at 50% 30%, var(--pht-felt) 0%, var(--pht-felt-dark) 100%);
    border-color: color-mix(in srgb, var(--pht-felt-dark) 70%, #000);
    color: var(--pht-ink);
}

.pht-landing-app[data-theme="dark"] .pht-table {
    --pht-felt: #18563a;
    --pht-felt-dark: #0e3523;
}

.pht-landing-app .pht-question {
    margin: 0;
    color: #fffdf8;
    font-size: var(--ak-fs-xl, 1.35rem);
    font-weight: 800;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* The hands side by side (a row each in Five-card hands), then the board. */
.pht-landing-app .pht-hands {
    display: grid;
    grid-template-columns: repeat(var(--pht-cols, 2), minmax(0, 1fr));
    gap: 0.75rem clamp(0.5rem, 3vw, 1.5rem);
    width: 100%;
}

.pht-landing-app .pht-hands[data-count="1"] { --pht-cols: 1; }
.pht-landing-app .pht-hands[data-count="3"] { --pht-cols: 3; }
.pht-landing-app .pht-hands[data-count="4"] { --pht-cols: 4; }
.pht-landing-app[data-drill="five"] .pht-hands { --pht-cols: 1; }

@media (max-width: 560px) {
    .pht-landing-app .pht-hands[data-count="4"] { --pht-cols: 2; }
}

.pht-landing-app .pht-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    margin: 0;
    padding: 0.4rem;
    border: 2px solid transparent;
    border-radius: var(--ak-radius-lg);
    transition: border-color 0.2s, background-color 0.2s;
}

.pht-landing-app[data-drill="five"] .pht-hand {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 0.75rem;
}

.pht-landing-app[data-drill="five"] .pht-hand-name {
    min-width: 4.5rem;
}

.pht-landing-app .pht-hand.is-winner {
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.12);
}

.pht-landing-app .pht-hand.is-wrong {
    border-color: rgba(254, 202, 202, 0.75);
    border-style: dashed;
}

.pht-landing-app .pht-hand-name {
    color: rgba(244, 241, 232, 0.82);
    font-size: var(--ak-fs-sm);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pht-landing-app .pht-hand.is-winner .pht-hand-name {
    color: #fde68a;
}

.pht-landing-app .pht-hand-result {
    margin: 0;
    color: #fffdf8;
    font-size: var(--ak-fs-sm);
    font-weight: 700;
    text-align: center;
    overflow-wrap: anywhere;
}

.pht-landing-app[data-drill="five"] .pht-hand-result {
    flex-basis: 100%;
}

.pht-landing-app .pht-hand.is-winner .pht-hand-result {
    color: #fde68a;
}

.pht-landing-app .pht-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(244, 241, 232, 0.18);
}

.pht-landing-app .pht-cards {
    display: flex;
    justify-content: center;
    gap: clamp(0.2rem, 1vw, 0.45rem);
    max-width: 100%;
}

.pht-landing-app .pht-card {
    position: relative;
    flex: 0 1 auto;
    width: clamp(2.6rem, 9vw, 5.2rem);
    aspect-ratio: 167.087 / 242.667;
    border-radius: 4.1% / 2.8%;
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}

.pht-landing-app .pht-hands[data-count="4"] .pht-card,
.pht-landing-app .pht-hands[data-count="3"] .pht-card {
    width: clamp(2.4rem, 7vw, 4.4rem);
}

.pht-landing-app .pht-board .pht-card {
    width: clamp(2.8rem, 10vw, 5.8rem);
}

.pht-landing-app[data-drill="name"] .pht-hands[data-count="1"] .pht-card {
    width: clamp(3rem, 12vw, 6.4rem);
}

.pht-landing-app .pht-card img {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.35));
}

/* After the answer: the best five cards of the winning hand light up, the others step back. */
.pht-landing-app .pht-card.is-best {
    box-shadow: 0 0 0 3px #facc15, 0 0 14px rgba(250, 204, 21, 0.55);
    transform: translateY(-4px);
}

.pht-landing-app .pht-card.is-dim {
    opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
    .pht-landing-app .pht-card,
    .pht-landing-app .pht-hand {
        transition: none;
    }

    .pht-landing-app .pht-card.is-best {
        transform: none;
    }
}

/* --- The answers ------------------------------------------------------------------------------------------------ */

.pht-landing-app .pht-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 0.5rem;
    width: 100%;
    max-width: 40rem;
}

.pht-landing-app .pht-choices[data-kind="kinds"] {
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

.pht-landing-app .pht-choice {
    position: relative;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0.45rem 1.9rem 0.45rem 0.75rem;
    border: 2px solid var(--ak-border);
    background: var(--ak-panel);
    color: var(--ak-text);
    font-weight: 800;
    white-space: normal;
    text-align: center;
}

.pht-landing-app .pht-choice:hover:not(:disabled) {
    border-color: var(--ak-accent);
}

.pht-landing-app .pht-choice:focus-visible {
    outline: 3px solid #fde68a;
    outline-offset: 2px;
}

.pht-landing-app .pht-choice:disabled {
    cursor: default;
    opacity: 0.55;
}

.pht-landing-app .pht-choice.is-answer {
    border-color: var(--ak-success);
    background: color-mix(in srgb, var(--ak-success) 18%, var(--ak-panel));
    opacity: 1;
}

.pht-landing-app .pht-choice.is-wrong {
    border-color: var(--ak-danger);
    background: color-mix(in srgb, var(--ak-danger) 14%, var(--ak-panel));
    opacity: 1;
}

.pht-landing-app .pht-key {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    min-width: 1.15rem;
    padding: 0 0.25rem;
    transform: translateY(-50%);
    border: 1px solid var(--ak-border);
    border-radius: 0.3rem;
    color: var(--ak-muted);
    font: 700 0.72rem/1.4 ui-monospace, monospace;
    text-align: center;
}

@media (hover: none) {
    .pht-landing-app .pht-key {
        display: none;
    }

    .pht-landing-app .pht-choice {
        padding-right: 0.75rem;
    }
}

/* --- The verdict ------------------------------------------------------------------------------------------------ */

.pht-landing-app .pht-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
}

.pht-landing-app .pht-result[hidden] {
    display: none;
}

.pht-landing-app .pht-verdict {
    margin: 0;
    color: #fffdf8;
    font-size: var(--ak-fs-lg, 1.1rem);
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.pht-landing-app .pht-result[data-outcome="win"] .pht-verdict {
    color: #a7f3c4;
}

.pht-landing-app .pht-result[data-outcome="lose"] .pht-verdict {
    color: #fecaca;
}

.pht-landing-app .pht-why {
    margin: 0;
    color: rgba(244, 241, 232, 0.92);
    font-weight: 600;
}

.pht-landing-app .pht-next {
    margin-top: 0.25rem;
}

/* --- The hand ranking ------------------------------------------------------------------------------------------- */

.pht-landing-app .pht-ranking[hidden] {
    display: none;
}

.pht-landing-app .pht-ranking-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: 0.3rem 1rem;
    margin: 0;
    padding: 0 0 0 1.9rem;
}

.pht-landing-app .pht-rank {
    padding: 0.2rem 0.4rem;
    border-radius: var(--ak-radius-sm);
    color: var(--ak-text);
    font-size: var(--ak-fs-sm);
}

.pht-landing-app .pht-rank::marker {
    color: var(--ak-muted);
    font-weight: 700;
}

.pht-landing-app .pht-rank-name {
    display: inline-block;
    min-width: 8.5rem;
    font-weight: 700;
}

.pht-landing-app .pht-rank-cards {
    display: inline-flex;
    gap: 0.2rem;
    white-space: nowrap;
}

.pht-landing-app .pht-chip {
    min-width: 1.8rem;
    padding: 0 0.2rem;
    border: 1px solid var(--ak-border);
    border-radius: 0.25rem;
    background: #fffdf8;
    color: #111827;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.pht-landing-app .pht-chip.is-red {
    color: #c81e1e;
}

/* After an answer: the winning kind of hand and the other kinds on the table. */
.pht-landing-app .pht-rank.is-top {
    background: color-mix(in srgb, #facc15 30%, transparent);
    box-shadow: inset 3px 0 0 #eab308;
}

.pht-landing-app .pht-rank.is-seen {
    background: color-mix(in srgb, var(--ak-accent) 12%, transparent);
}

/* Right to left (Arabic): cards and the "right / asked" count keep their left-to-right order. */
.pht-landing-app .pht-cards,
.pht-landing-app .pht-rank-cards,
.pht-landing-app [data-ak-ref="right"] {
    direction: ltr;
    unicode-bidi: isolate;
}
