/* ——— 扑克牛牛 (js/casino/niuniu.js). Chips, rail, tools, slip and the result card come from roulette.css. ——— */

.nn-stage {
    --nn-gold: #f3cf7a;
    --nn-player: #38bdf8;
    --nn-banker: #fb7185;
    --nn-tie: #34d399;
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 14px 20px 0;
}

.nn-top {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 12px;
}

.nn-result {
    min-width: 0;
}

.nn-result__icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(160deg, #e11d48, #9f1239);
    box-shadow: 0 0 0 2px rgba(243, 207, 122, 0.55), 0 8px 18px -8px rgba(225, 29, 72, 0.9);
    color: #fff;
    font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--cas-font);
    font-size: 26px;
    font-weight: 800;
}

.nn-result.is-live .nn-result__icon {
    animation: nn-pulse 1s ease-in-out infinite;
}

@keyframes nn-pulse {
    50% { transform: scale(0.92); filter: brightness(1.25); }
}

/* recent hands: a bead road (闲 blue, 庄 red, 和 green) */

.nn-road {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--cas-line);
    border-radius: 18px;
    background: rgba(7, 10, 16, 0.5);
}

.nn-road__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--cas-on-dark-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cas .nn-rules-btn,
.nn-rules-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--cas-line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--cas-on-dark);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}

.nn-rules-btn .cas-i {
    width: 13px;
    height: 13px;
}

.nn-rules-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nn-road__list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 34px;
}

.nn-road__empty {
    color: var(--cas-on-dark-3);
    font-size: 12.5px;
}

.nn-road__bead {
    --c: var(--nn-player);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--c) 18%, #0b1018);
    box-shadow: inset 0 0 0 1.5px var(--c);
    line-height: 1;
}

.nn-road__bead b {
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.nn-road__bead small {
    color: #e2e8f0;
    font-family: var(--cas-mono);
    font-size: 8.5px;
    font-weight: 700;
}

.nn-road__bead.is-banker { --c: var(--nn-banker); }
.nn-road__bead.is-tie { --c: var(--nn-tie); }

.nn-road__bead.is-new {
    animation: nn-bead 0.5s var(--cas-spring);
}

@keyframes nn-bead {
    from { opacity: 0; transform: scale(0.4); }
}

/* the felt with two hands */

.nn-felt {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    background:
        radial-gradient(110% 120% at 50% 0%, rgba(16, 185, 129, 0.16), transparent 60%),
        linear-gradient(180deg, #0f3b2c, #0a2a20);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 0 0 6px rgba(0, 0, 0, 0.18), 0 18px 30px -22px rgba(0, 0, 0, 0.8);
}

.nn-hand {
    --c: var(--nn-player);
    display: grid;
    grid-template-columns: 150px minmax(0, 390px);
    align-items: center;
    justify-content: center;
    gap: 8px 18px;
    padding: 8px 10px 10px;
    border-radius: 16px;
    transition: background 0.3s, box-shadow 0.3s;
}

.nn-hand--banker { --c: var(--nn-banker); }

.nn-hand.is-win {
    background: color-mix(in srgb, var(--c) 12%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, transparent);
}

.nn-hand__head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
}

.nn-hand__name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ecfdf5;
    font-size: 14px;
    font-weight: 700;
}

.nn-hand__name b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--c);
    color: #0b1018;
    font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--cas-font);
    font-size: 15px;
    font-weight: 800;
}

.nn-score {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(5, 12, 9, 0.6);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    animation: nn-pop 0.4s var(--cas-spring);
}

.nn-score b {
    color: #fff;
    font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--cas-font);
    font-size: 17px;
    font-weight: 800;
}

.nn-score small {
    color: #d1fae5;
    font-size: 12px;
    font-weight: 600;
}

.nn-score[data-points="10"] {
    background: linear-gradient(180deg, #fde68a, #d6a647);
    box-shadow: 0 0 18px rgba(243, 207, 122, 0.55);
}

.nn-score[data-points="10"] b,
.nn-score[data-points="10"] small {
    color: #3a2400;
}

.nn-score[data-points="0"] b {
    color: #cbd5e1;
}

.nn-hand.is-win .nn-score {
    box-shadow: inset 0 0 0 1.5px var(--c), 0 0 16px color-mix(in srgb, var(--c) 45%, transparent);
}

@keyframes nn-pop {
    from { opacity: 0; transform: scale(0.6); }
}

.nn-vs {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(236, 253, 245, 0.75);
    font-family: var(--cas-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.nn-vs::before,
.nn-vs::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(243, 207, 122, 0.45), transparent);
}

/* cards */

.nn-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.nn-card {
    position: relative;
    aspect-ratio: 5 / 7;
    perspective: 700px;
    transition: transform 0.35s var(--cas-spring);
}

.nn-card__in {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    transform-style: preserve-3d;
    transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.nn-card.is-open .nn-card__in {
    transform: rotateY(0deg);
}

.nn-card__face,
.nn-card__back {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.nn-card__back {
    transform: rotateY(180deg);
    background:
        radial-gradient(circle at 50% 50%, rgba(243, 207, 122, 0.35) 0 14%, transparent 15%),
        repeating-linear-gradient(45deg, #9f1239 0 6px, #be123c 6px 12px);
    box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px rgba(0, 0, 0, 0.15), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}

.nn-card__face {
    display: grid;
    grid-template-rows: auto 1fr;
    padding: 6px 7px;
    background: linear-gradient(180deg, #fff, #f1f5f9);
    box-shadow: inset 0 0 0 1px #cbd5e1, 0 6px 14px -6px rgba(0, 0, 0, 0.7);
    color: #111827;
    transition: box-shadow 0.3s;
}

.nn-card__face.is-red {
    color: #b91c1c;
}

.nn-card__rank {
    font-family: var(--cas-font);
    font-size: clamp(15px, 2.2vw, 22px);
    font-weight: 800;
    line-height: 1;
}

.nn-card__suit {
    position: absolute;
    top: calc(6px + clamp(15px, 2.2vw, 22px) + 2px);
    left: 7px;
    font-size: clamp(11px, 1.5vw, 15px);
    line-height: 1;
}

.nn-card__pip {
    align-self: center;
    justify-self: center;
    font-size: clamp(24px, 4vw, 40px);
    line-height: 1;
}

.nn-card.is-bull {
    transform: translateY(-6px);
}

.nn-card.is-bull .nn-card__face {
    box-shadow: inset 0 0 0 2px #10b981, 0 0 0 2px rgba(16, 185, 129, 0.55), 0 10px 18px -6px rgba(16, 185, 129, 0.8);
}

.nn-card.is-rest .nn-card__face {
    box-shadow: inset 0 0 0 2px #d6a647, 0 0 0 2px rgba(243, 207, 122, 0.45), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}

.nn-card.is-none .nn-card__face {
    filter: saturate(0.8) brightness(0.96);
}

.nn-hand.is-lose .nn-card.is-open {
    opacity: 0.9;
}

/* bets */

.nn-spots {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.nn-spots.is-refused {
    animation: cas-shake 0.4s;
}

.nn-spot {
    --c: var(--nn-player);
    position: relative;
    display: grid;
    grid-column: span 2;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 74px;
    padding: 8px 6px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, #0d141e), color-mix(in srgb, var(--c) 10%, #0a0f17));
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent);
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.nn-spot--banker { --c: var(--nn-banker); }
.nn-spot--tie { --c: var(--nn-tie); }
.nn-spot--player_nn { --c: var(--nn-player); grid-column: span 3; min-height: 60px; }
.nn-spot--banker_nn { --c: var(--nn-banker); grid-column: span 3; min-height: 60px; }

.nn-spot__tag {
    color: #fff;
    font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--cas-font);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.1;
}

.nn-spot__name {
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.nn-spot__name.is-zh {
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

.nn-spot__odds {
    color: var(--nn-gold);
    font-family: var(--cas-mono);
    font-size: 12.5px;
    font-weight: 700;
}

.nn-spot:hover {
    filter: brightness(1.18);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 85%, #fff);
}

.nn-spot:focus-visible {
    outline: 2px solid var(--nn-gold);
    outline-offset: 2px;
}

.nn-spots.is-locked .nn-spot {
    cursor: default;
}

.nn-spots.is-locked .nn-spot:hover {
    filter: none;
}

.nn-spot.is-win {
    box-shadow: inset 0 0 0 2px var(--nn-gold), 0 0 24px rgba(243, 207, 122, 0.5);
    animation: nn-win 1s ease-in-out 3;
}

.nn-spot.is-push {
    box-shadow: inset 0 0 0 2px #cbd5e1;
}

@keyframes nn-win {
    50% { filter: brightness(1.45); }
}

.nn-spot > .nn-spot__chip {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 30px;
    height: 30px;
    font-size: 9.5px;
    pointer-events: none;
    transition: opacity 0.3s, filter 0.3s, box-shadow 0.3s;
}

.nn-spot > .nn-spot__chip.is-stack {
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 0 0 2px color-mix(in srgb, var(--c) 72%, #000), 0 2px 0 color-mix(in srgb, var(--c) 55%, #000), 0 4px 0 color-mix(in srgb, var(--c) 40%, #000), 0 7px 10px -2px rgba(0, 0, 0, 0.6);
}

.nn-spot > .nn-spot__chip.is-drop {
    animation: nn-drop 0.34s var(--cas-spring);
}

@keyframes nn-drop {
    from { opacity: 0; transform: translateY(-60%) scale(1.25); }
}

.nn-spot > .nn-spot__chip.is-lost {
    opacity: 0.38;
    filter: grayscale(0.7);
}

.nn-spot > .nn-spot__chip.is-won {
    box-shadow: 0 0 0 2px var(--nn-gold), 0 0 18px rgba(243, 207, 122, 0.75), 0 4px 10px -3px rgba(0, 0, 0, 0.6);
}

.nn-spot__win {
    bottom: calc(100% - 6px);
}

/* rules: an example hand and small cards (also in the verifier) */

.nn-example {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.nn-example__eq {
    margin-left: 4px;
    color: var(--cas-text-2);
    font-size: 13px;
    font-weight: 600;
}

.nn-mini {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 42px;
    border-radius: 6px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #cbd5e1;
    color: #111827;
    font-size: 12px;
    line-height: 1.05;
}

.nn-mini b {
    font-size: 13px;
}

.nn-mini.is-red {
    color: #b91c1c;
}

.nn-mini.is-bull {
    box-shadow: inset 0 0 0 2px #059669;
}

.nn-vhands {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 10px;
}

.nn-vhands div {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.nn-paytable td b {
    font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", var(--cas-font);
}

/* ——— responsive ——— */

@media (max-width: 900px) {
    .nn-top { grid-template-columns: minmax(0, 1fr); }

    .nn-hand { grid-template-columns: minmax(0, 1fr); }

    .nn-hand__head {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .nn-stage {
        gap: 10px;
        padding: 12px 12px 0;
    }

    .nn-result { padding: 12px; }

    .nn-result__icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .nn-road { padding: 10px 12px; }

    .nn-road__list {
        flex-wrap: nowrap;
        overflow: hidden;
        mask-image: linear-gradient(90deg, #000 85%, transparent);
    }

    .nn-road__bead { flex: none; }

    .nn-felt { padding: 10px 8px; }
    .nn-hand { padding: 6px; }
    .nn-cards { gap: 6px; }

    .nn-card__face { padding: 4px 5px; }
    .nn-card__rank { font-size: 15px; }

    .nn-card__suit {
        top: 21px;
        left: 5px;
        font-size: 11px;
    }

    .nn-card__pip { font-size: 26px; }

    .nn-spots { gap: 6px; }

    .nn-spot {
        min-height: 66px;
        padding: 6px 4px;
    }

    .nn-spot--player_nn,
    .nn-spot--banker_nn { min-height: 54px; }

    .nn-spot__tag { font-size: 15px; }
    .nn-spot__name { font-size: 11.5px; }

    .nn-spot > .nn-spot__chip {
        top: 4px;
        right: 4px;
        width: 26px;
        height: 26px;
        font-size: 8.5px;
    }

    .rl-hint {
        order: 1;
        min-height: 0;
        padding: 0 4px;
        font-size: 12.5px;
    }

    .nn-rail {
        position: sticky;
        bottom: 0;
        z-index: 6;
        order: 3;
        justify-content: center;
        gap: 8px;
        margin: 0 -12px;
        padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--cas-line);
        background: rgba(11, 16, 24, 0.9);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
    }

    .nn-rail .rl-rack {
        justify-content: space-between;
        gap: 4px;
        width: 100%;
    }

    .nn-rail .rl-rack .rl-chip {
        width: 44px;
        height: 44px;
    }

    .nn-rail .rl-tools {
        gap: 6px;
        width: 100%;
    }

    .nn-rail .rl-tool {
        flex: none;
        width: 44px;
        height: 48px;
        padding: 0;
    }

    .nn-rail .rl-tool span { display: none; }

    .nn-rail .rl-rail__spin {
        display: flex;
        flex: 1;
        min-width: 0;
        height: 48px;
        border-radius: 14px;
        font-size: 15.5px;
    }

    .nn-rail .rl-rail__spin .cas-action__sub { font-size: 13px; }

    .cas-console__panel > [data-deal] { display: none; }
}

@media (max-width: 380px) {
    .nn-rail .rl-rack .rl-chip {
        width: 42px;
        height: 42px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nn-card,
    .nn-card__in { transition: none; }
}

.nn-paytable td:first-child {
    white-space: nowrap;
}
