/* =========================================================
   Lucre 21 (blackjack) — game-specific styles
   Shared chrome, felt and card faces come from styles.css
   ========================================================= */

.felt::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: url(btn/lucre21Logo.png) center / min(52%, 420px) no-repeat;
    opacity: 0.1;
    pointer-events: none;
}

.hand-block {
    position: relative;
    margin-bottom: 1.1rem;
}

/* Split turns "You" into up to four hand blocks, stacked down the felt. JS
   creates the blocks and sets data-count; one empty block is the
   no-cards-yet placeholder. */
.player-hands[data-count="2"] .hand {
    --cw: clamp(56px, 7.4vw, 88px);
}

.player-hands[data-count="3"] .hand {
    --cw: clamp(46px, 6vw, 72px);
}

.player-hands[data-count="4"] .hand {
    --cw: clamp(38px, 5vw, 60px);
}

.player-hands[data-count="2"] .hand-block {
    margin-bottom: 0.8rem;
}

.player-hands[data-count="3"] .hand-block,
.player-hands[data-count="4"] .hand-block {
    margin-bottom: 0.55rem;
}

.hand-block--player .hand-label h2 {
    transition: color 0.2s ease;
}

.hand-block--player.is-done .hand {
    opacity: 0.55;
}

.hand-block--player.is-done .hand-label h2 {
    color: rgba(234, 255, 208, 0.55);
}

.hand-block--player.is-active .total {
    border-color: rgba(196, 222, 0, 0.85);
    box-shadow: 0 0 0 1px rgba(196, 222, 0, 0.35), 0 0 14px rgba(196, 222, 0, 0.35);
    color: #f4ffd5;
}

/* Per-hand result, shown once the round is settled. */
.hand-result {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.75);
}

.hand-result:empty {
    display: none;
}

.hand-result.is-win {
    color: #b6f07a;
}

.hand-result.is-lose {
    color: #ff8f8f;
}

.hand-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
}

.hand-label h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 0.95rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #eaffd0;
}

.total {
    min-width: 2.3rem;
    padding: 0.05rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.hand {
    --cw: clamp(72px, 9.5vw, 112px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: calc(var(--cw) * 193 / 121);
}

.hand .card + .card {
    margin-left: calc(var(--cw) * -0.18);
}

.hand:empty::after {
    content: "No cards yet";
    align-self: center;
    margin-left: 0.35rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
    font-style: italic;
}

/* ---------- Console / status ----------
   The bar is the btn/status.png art (348x22): "BET" then a field, a stack
   of chips then a field, and an alert mark then the long status field.
   The live values sit inside those fields, positioned by percentage so
   they track the art as it scales. */
.console {
    container-type: inline-size;
    position: relative;
    width: 100%;
    aspect-ratio: 348 / 22;
    margin-top: 1.3rem;
    background: url(btn/status.png) center / 100% 100% no-repeat;
    image-rendering: pixelated;
    font-variant-numeric: tabular-nums;
}

.console-field {
    position: absolute;
    top: 27.3%;
    height: 45.5%;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 0.3em;
    font-size: 12px;
    font-size: clamp(9px, 1.62cqw, 20px);
    line-height: 1;
    color: #10162e;
}

/* Measured from the sprite: 33-67, 80-114 and 130-339 of 348 px. */
.console-field--bet,
.console-field--bank {
    justify-content: center;
}

.console-field--bet {
    left: 9.48%;
    width: 10.06%;
}

.console-field--bank {
    left: 22.99%;
    width: 10.06%;
}

.console-field--status {
    left: 37.36%;
    width: 60.34%;
}

.console-field .money,
.console-field input,
.console-field #message {
    font: inherit;
    font-weight: 700;
    color: inherit;
}

#mybet {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
}

#mybet::-webkit-outer-spin-button,
#mybet::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#mybet:disabled {
    opacity: 0.55;
}

/* JS sets these class names to colour the message by tone. */
#message {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#message.msg-info {
    color: #10162e;
}

#message.msg-win {
    color: #14661f;
}

#message.msg-lose {
    color: #a3162f;
}

#message.msg-push {
    color: #10162e;
}

/* ---------- Sprite buttons ---------- */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.7rem;
    margin-top: 1.1rem;
}

/* Start screen: Start is the only control, centred on the table. */
.table-actions.is-attract {
    justify-content: center;
}

.table-actions.is-attract .sprite:not(.sprite-start) {
    display: none;
}

/* …and once the game is running it steps aside for them. */
.table-actions:not(.is-attract) .sprite-start {
    display: none;
}

.sprite {
    width: 116px;
    height: 44px; /* exact 2x of the 58x22 source art */
    image-rendering: pixelated;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    cursor: pointer;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
    transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.sprite:hover:not([disabled]) {
    transform: translateY(-2px);
    filter: drop-shadow(0 9px 16px rgba(0, 0, 0, 0.45));
}

.sprite:active:not([disabled]) {
    transform: translateY(0);
}

.sprite[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    filter: none;
}

.sprite-start {
    background-image: url(btn/start.png);
}

.sprite-start:hover:not([disabled]) {
    background-image: url(btn/startHover.png);
}

.sprite-maxbet {
    width: 116px;
    height: 68px;
    background-image: url(btn/maxBet.png);
}

.sprite-maxbet:hover:not([disabled]) {
    background-image: url(btn/maxBetHover.png);
}

.sprite-deal {
    background-image: url(btn/deal.png);
}

.sprite-deal:hover:not([disabled]) {
    background-image: url(btn/dealHover.png);
}

.sprite-hit {
    background-image: url(btn/hit.png);
}

.sprite-hit:hover:not([disabled]) {
    background-image: url(btn/hitHover.png);
}

.sprite-stand {
    background-image: url(btn/stand.png);
}

.sprite-stand:hover:not([disabled]) {
    background-image: url(btn/standHover.png);
}

.sprite-double {
    width: 122px;
    height: 68px;
    background-image: url(btn/doubleDown.png);
}

.sprite-double:hover:not([disabled]) {
    background-image: url(btn/doubleDownHover.png);
}

.sprite-split {
    background-image: url(btn/split.png);
}

.sprite-split:hover:not([disabled]) {
    background-image: url(btn/splitHover.png);
}

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
    .hand {
        --cw: clamp(62px, 17vw, 92px);
    }

    /* The bar keeps the sprite's own 348:22 proportions and its text scales
       with the container, so the art is never stretched and the values never
       spill out of their fields. */
    .console-field {
        font-size: 8px;
        font-size: 2.8cqw;
    }

    /* The bet and bank fields are only a few characters wide at phone
       widths, so the numbers get the whole field and a slightly smaller size. */
    .console-field--bet,
    .console-field--bank {
        padding: 0;
        font-size: 7.5px;
        font-size: 2.55cqw;
    }
}
