.aicoh-shell {
    padding: 2.5rem 0 5rem;
}

.aicoh-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.aicoh-utility-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.sound-toggle[aria-pressed="true"] {
    border-color: var(--wolfe-blue);
    color: var(--wolfe-blue-dark);
    background: #eef7fd;
}

.aicoh-heading h1 {
    margin: 0;
    color: var(--wolfe-navy);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -.04em;
}

.aicoh-heading p:last-child,
.aicoh-disclaimer {
    margin: 0;
    color: var(--wolfe-muted);
}

.aicoh-breadcrumb {
    display: flex;
    gap: .45rem;
    margin-bottom: .35rem;
    color: var(--wolfe-muted);
    font-size: .9rem;
}

.aicoh-breadcrumb a,
.aicoh-back-link { color: var(--wolfe-blue); font-weight: 700; }

.aicoh-disclaimer {
    padding: .8rem 1rem;
    border: 1px solid var(--wolfe-border);
    border-radius: .75rem;
    background: var(--wolfe-light);
    font-size: .9rem;
}

.aicoh-scoreboard {
    position: relative;
    display: grid;
    grid-template-columns: 1fr .9fr 1.2fr .9fr 1fr;
    gap: .75rem;
    margin: 1.25rem 0;
}

.score-tile {
    padding: .85rem 1rem;
    border: 1px solid var(--wolfe-border);
    border-radius: .85rem;
    background: #fff;
}

.score-tile span,
.score-tile strong {
    display: block;
}

.score-tile span {
    color: var(--wolfe-muted);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.score-tile strong {
    color: var(--wolfe-navy);
    font-size: 1.2rem;
}

.score-tile strong small {
    color: var(--wolfe-blue);
    font-size: .8em;
    font-weight: 800;
}

.score-pot {
    border-color: rgba(23, 105, 170, .38);
    text-align: center;
    background: linear-gradient(180deg, #f2f8fd, #fff);
    box-shadow: 0 10px 26px rgba(15, 79, 134, .12);
    transform: translateY(-.2rem);
}

.score-pot strong {
    color: var(--wolfe-blue-dark);
    font-size: 1.5rem;
}

.chip-stack {
    position: relative;
    display: block;
    width: 2.5rem;
    height: .8rem;
    margin: .45rem auto 0;
}

.chip-stack i,
.chip-packet i {
    position: absolute;
    width: 2.35rem;
    height: .58rem;
    border: 2px dashed rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: #1769aa;
    box-shadow: inset 0 0 0 3px #1769aa, 0 2px 3px rgba(15, 39, 68, .22);
}

.chip-stack i { left: 0; bottom: calc(var(--chip-index) * .18rem); }
.chip-value-2 { left: .08rem !important; background: #d14a5b !important; box-shadow: inset 0 0 0 3px #d14a5b, 0 2px 3px rgba(15, 39, 68, .22) !important; }
.chip-value-3 { background: #e9a826 !important; box-shadow: inset 0 0 0 3px #e9a826, 0 2px 3px rgba(15, 39, 68, .22) !important; }

.score-player {
    border-color: rgba(23, 105, 170, .28);
}

.aicoh-table {
    position: relative;
    display: grid;
    gap: 1.5rem;
    padding: clamp(1rem, 3vw, 2.25rem);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 1.4rem;
    color: #fff;
    background: radial-gradient(circle at 50% 48%, #1b5c73 0%, #103f58 46%, #09283e 100%);
    box-shadow: 0 24px 60px rgba(15, 39, 68, .2);
}

.pot-chip-layer {
    position: absolute;
    z-index: 6;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
}

.chip-packet {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.6rem;
    height: 1.8rem;
    opacity: 0;
    transform: translate(-50%, -50%);
}

.chip-packet i {
    left: .1rem;
    bottom: calc(var(--chip-index) * .16rem);
}

.wager-in .chip-packet-computer { animation: chips-wager-computer 620ms cubic-bezier(.2, .75, .3, 1) both; }
.wager-in .chip-packet-player { animation: chips-wager-player 620ms 70ms cubic-bezier(.2, .75, .3, 1) both; }
.settle-computer .chip-packet-computer { animation: chips-settle-computer 680ms ease-in both; }
.settle-player .chip-packet-player { animation: chips-settle-player 680ms ease-in both; }
.settle-tie .chip-packet-computer { animation: chips-settle-computer 680ms ease-in both; }
.settle-tie .chip-packet-player { animation: chips-settle-player 680ms ease-in both; }

.aicoh-table::before {
    display: block;
    height: 1px;
    margin: -.3rem 8% 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .32), transparent);
    content: "";
}

.aicoh-hand-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .8rem;
}

.aicoh-hand-heading h2,
.aicoh-log h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 750;
}

.aicoh-hand-heading > span {
    color: #d7e9f3;
    font-size: .85rem;
}

.aicoh-state-badge {
    padding: .25rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
}

.aicoh-cards {
    display: flex;
    justify-content: center;
    gap: clamp(.4rem, 1.35vw, 1rem);
}

.card-form {
    margin: 0;
}

.playing-card {
    position: relative;
    width: clamp(4rem, 10.5vw, 7.25rem);
    aspect-ratio: 5 / 7;
    padding: .6rem;
    border: 2px solid rgba(15, 39, 68, .18);
    border-radius: .7rem;
    color: #172033;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .2);
}

.card-corner {
    display: grid;
    justify-items: center;
    width: min-content;
}

.playing-card.is-red {
    color: #b42334;
}

.card-rank,
.card-suit,
.corner-suit {
    display: block;
    font-weight: 800;
    line-height: 1;
}

.card-rank {
    font-size: clamp(1.15rem, 3vw, 1.8rem);
}

.corner-suit {
    margin-top: .12rem;
    font-size: clamp(.8rem, 2vw, 1.15rem);
}

.card-suit {
    position: absolute;
    inset: 50% auto auto 50%;
    font-size: clamp(1.5rem, 5vw, 3rem);
    transform: translate(-50%, -50%);
}

.card-back {
    border-color: rgba(255, 255, 255, .85);
    background-color: #0e5a91;
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .1) 0 2px, transparent 2px 8px), repeating-linear-gradient(-45deg, rgba(6, 39, 67, .2) 0 2px, transparent 2px 8px);
    box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 8px #1769aa, inset 0 0 0 10px rgba(255, 255, 255, .55), 0 10px 22px rgba(0, 0, 0, .25);
}

.card-empty {
    border: 2px dashed rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .04);
    box-shadow: none;
}

.selectable-card {
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.selection-check {
    position: absolute;
    z-index: 2;
    top: -.7rem;
    right: -.7rem;
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    border: 3px solid #fff;
    border-radius: 50%;
    place-items: center;
    color: #0b2a42;
    background: #ffd166;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .35);
    font-weight: 900;
    opacity: 0;
    transform: scale(.65);
}

.selectable-card.is-selected {
    border-color: #ffd166;
    outline: 4px solid rgba(255, 209, 102, .45);
    outline-offset: 3px;
    transform: translateY(-9px);
}

.selectable-card.is-selected .selection-check {
    opacity: 1;
    transform: scale(1);
}

.selectable-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 14px 24px rgba(0, 0, 0, .3);
}

.selectable-card:focus-visible,
.aicoh-table .btn:focus-visible {
    outline: 3px solid #ffd166;
    outline-offset: 4px;
}

.aicoh-center {
    min-height: 8rem;
    padding: 1.1rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 1rem;
    text-align: center;
    background: rgba(5, 24, 38, .32);
}

.aicoh-center.is-win {
    border-color: rgba(117, 230, 172, .65);
    background: rgba(17, 91, 67, .5);
}

.aicoh-center.is-loss {
    border-color: rgba(255, 161, 161, .55);
    background: rgba(112, 33, 45, .42);
}

.aicoh-center.is-tie {
    border-color: rgba(255, 209, 102, .65);
}

.aicoh-center h2 {
    max-width: 48rem;
    margin: .25rem auto 1rem;
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.aicoh-phase {
    margin: 0;
    color: #a9d2e8;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.action-prompt {
    margin: -.2rem 0 .9rem;
    color: #d5e8f2;
    font-size: .9rem;
}

.aicoh-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .55rem;
}

.wager-actions {
    align-items: stretch;
}

.wager-actions form {
    display: flex;
}

.wager-button {
    min-width: 5.7rem;
    padding: .6rem .75rem;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: .75rem;
    color: var(--wolfe-navy);
    background: #fff;
    box-shadow: 0 5px 12px rgba(0, 0, 0, .13);
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.wager-button span,
.wager-button strong {
    display: block;
}

.wager-button span {
    color: #68778a;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.wager-button strong {
    font-size: 1.05rem;
}

.wager-button:hover:not(:disabled) {
    border-color: #ffd166;
    transform: translateY(-3px);
    box-shadow: 0 9px 18px rgba(0, 0, 0, .22);
}

.wager-button:disabled {
    cursor: not-allowed;
    opacity: .42;
}

.all-in-button {
    color: #1f2937;
    background: #ffd166;
}

.round-result {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    margin: 0 auto 1rem;
    padding: .65rem .9rem;
    border-radius: .85rem;
    text-align: left;
    background: rgba(255, 255, 255, .12);
}

.result-mark {
    display: grid;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    place-items: center;
    color: #18324a;
    background: #ffd166;
    font-size: 1.2rem;
}

.round-result strong,
.round-result span {
    display: block;
}

.round-result div > span {
    color: #d7e9f3;
    font-size: .82rem;
}

.replacement-form {
    width: 100%;
}

.replacement-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 2.5rem;
    margin-top: 1rem;
}

.replacement-confirm[hidden] {
    display: none;
}

.selection-message {
    color: #e2f2fa;
    font-size: .9rem;
}

.is-submitting {
    opacity: .7;
    pointer-events: none;
}

.aicoh-log {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--wolfe-border);
    border-radius: 1rem;
    background: #fff;
}

.aicoh-information {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.aicoh-help,
.aicoh-about {
    border: 1px solid var(--wolfe-border);
    border-radius: 1rem;
    background: #fff;
}

.aicoh-help summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    cursor: pointer;
    list-style: none;
}

.aicoh-help summary::-webkit-details-marker { display: none; }
.aicoh-help summary > span:first-child { display: grid; }
.aicoh-help summary strong { color: var(--wolfe-navy); font-size: 1.05rem; }
.aicoh-help summary small { color: var(--wolfe-muted); }

.help-toggle {
    display: grid;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    place-items: center;
    color: var(--wolfe-blue-dark);
    background: var(--wolfe-light);
    font-size: 1.35rem;
    transition: transform 160ms ease;
}

.aicoh-help[open] .help-toggle { transform: rotate(45deg); }

.aicoh-help summary:focus-visible {
    outline: 3px solid var(--wolfe-blue);
    outline-offset: 3px;
    border-radius: .85rem;
}

.help-content {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--wolfe-border);
}

.help-content h2 { margin: 1rem 0 .7rem; color: var(--wolfe-navy); font-size: 1.15rem; }
.help-content ol { display: grid; gap: .45rem; margin: 0; padding-left: 1.35rem; }

.aicoh-about {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(17rem, .75fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    padding: clamp(1.25rem, 3vw, 2rem);
}

.aicoh-about h2 { margin: 0 0 .6rem; color: var(--wolfe-navy); font-size: 1.4rem; }
.aicoh-about p { margin-bottom: 0; color: var(--wolfe-muted); }

.display-name-form {
    padding: 1.1rem;
    border-radius: .85rem;
    background: var(--wolfe-light);
}

.display-name-form fieldset { min-width: 0; }
.display-name-form legend { margin: 0; color: var(--wolfe-navy); font-size: 1.05rem; font-weight: 750; }
.display-name-form p { margin: .25rem 0 .85rem; font-size: .85rem; }
.display-name-fields { display: grid; gap: .7rem; margin-bottom: .9rem; }
.display-name-fields label span { display: block; margin-bottom: .25rem; font-size: .82rem; font-weight: 700; }
.aicoh-back-link { display: inline-block; margin-top: 1.5rem; }

.aicoh-log ol {
    margin: .8rem 0 0;
    padding-left: 1.4rem;
}

.status-timeline {
    list-style: none;
}

.status-timeline li {
    position: relative;
    display: flex;
    gap: .75rem;
    padding: .45rem 0;
    color: var(--wolfe-muted);
}

.status-timeline li:not(:last-child)::before {
    position: absolute;
    top: 1.15rem;
    bottom: -.55rem;
    left: .28rem;
    width: 1px;
    background: var(--wolfe-border);
    content: "";
}

.timeline-dot {
    flex: 0 0 auto;
    width: .6rem;
    height: .6rem;
    margin-top: .4rem;
    border: 2px solid var(--wolfe-border);
    border-radius: 50%;
    background: #fff;
}

.status-timeline .is-current {
    color: var(--wolfe-text);
    font-weight: 650;
}

.status-timeline .is-current .timeline-dot {
    border-color: var(--wolfe-blue);
    background: var(--wolfe-blue);
}

.aicoh-table[data-phase="PlayerTurn"] .playing-card,
.aicoh-table[data-phase="AwaitingDeal"] .playing-card {
    animation: deal-card 360ms cubic-bezier(.2, .75, .3, 1) both;
}

.action-deal .playing-card { animation: deal-card 360ms cubic-bezier(.2, .75, .3, 1) both; }
.action-replace .aicoh-hand:last-child .playing-card { animation: replace-card 380ms ease-out both; }

.aicoh-table[data-phase="RoundComplete"] .aicoh-hand:first-of-type .playing-card,
.aicoh-table[data-phase="GameOver"] .aicoh-hand:first-of-type .playing-card {
    animation: reveal-card 430ms ease-out both;
}

.aicoh-table[data-phase="RoundComplete"] .aicoh-center,
.aicoh-table[data-phase="GameOver"] .aicoh-center {
    animation: settle-result 420ms ease-out both;
}

@keyframes deal-card {
    from { opacity: 0; transform: translateY(-12px) scale(.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes reveal-card {
    from { opacity: .35; transform: rotateY(75deg); }
    to { opacity: 1; transform: rotateY(0); }
}

@keyframes settle-result {
    from { opacity: .6; transform: scale(.985); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes replace-card {
    from { opacity: .45; transform: translateY(10px) rotateY(35deg); }
    to { opacity: 1; transform: translateY(0) rotateY(0); }
}

@keyframes chips-wager-computer {
    from { opacity: 0; transform: translate(-50%, calc(-50% - min(28vh, 13rem))) rotate(-8deg) scale(.88); }
    18% { opacity: 1; }
    to { opacity: 0; transform: translate(-50%, -50%) rotate(0) scale(1); }
}

@keyframes chips-wager-player {
    from { opacity: 0; transform: translate(-50%, calc(-50% + min(28vh, 13rem))) rotate(8deg) scale(.88); }
    18% { opacity: 1; }
    to { opacity: 0; transform: translate(-50%, -50%) rotate(0) scale(1); }
}

@keyframes chips-settle-computer {
    from { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1); }
    82% { opacity: 1; }
    to { opacity: 0; transform: translate(-50%, calc(-50% - min(28vh, 13rem))) rotate(-8deg) scale(.88); }
}

@keyframes chips-settle-player {
    from { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1); }
    82% { opacity: 1; }
    to { opacity: 0; transform: translate(-50%, calc(-50% + min(28vh, 13rem))) rotate(8deg) scale(.88); }
}

@media (max-width: 767.98px) {
    .aicoh-shell {
        padding-top: 1.5rem;
    }

    .aicoh-heading {
        align-items: flex-start;
    }

    .aicoh-utility-actions { flex-wrap: wrap; justify-content: flex-end; }

    .aicoh-scoreboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .score-pot {
        grid-column: 1 / -1;
        grid-row: 1;
        transform: none;
    }

    .aicoh-table {
        gap: 1.1rem;
        border-radius: 1rem;
    }

    .playing-card {
        width: clamp(3.75rem, 17vw, 5.4rem);
        padding: .38rem;
        border-radius: .5rem;
    }

    .replacement-confirm {
        align-items: stretch;
        flex-direction: column;
        gap: .55rem;
        text-align: center;
    }

    .aicoh-about { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .aicoh-heading {
        flex-direction: column;
    }

    .aicoh-heading form,
    .aicoh-heading .btn,
    .aicoh-utility-actions {
        width: 100%;
    }

    .aicoh-utility-actions { display: grid; grid-template-columns: 1fr 1fr; }

    .aicoh-table {
        margin-inline: -.5rem;
        padding-inline: .7rem;
    }

    .aicoh-cards {
        gap: .25rem;
    }

    .playing-card {
        width: min(17vw, 4.15rem);
    }

    .wager-actions form {
        flex: 1 1 calc(33.333% - .55rem);
    }

    .wager-button {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .selectable-card,
    .wager-button,
    .selection-check {
        transition: none;
    }

    .help-toggle { transition: none; }

    .selectable-card:hover {
        transform: none;
    }

    .aicoh-table .playing-card,
    .aicoh-table .aicoh-center,
    .chip-packet {
        animation: none !important;
    }
}
