/* Last-mile layout overrides for the online Duel Scorekeeper game screen. */
.tcg-counter-page.is-online-game .tcg-history,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.tcg-counter-page.is-online-game .tcg-history ol,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history ol {
    align-content: start !important;
    display: grid !important;
    gap: .48rem !important;
    height: 100% !important;
    list-style: none !important;
    margin: .5rem 0 0 !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: .42rem !important;
}

.tcg-counter-page.is-online-game .tcg-history li,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li,
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 2),
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 3),
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 4),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 2),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 3),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 4) {
    align-items: start !important;
    display: grid !important;
    gap: .18rem !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: .5rem .58rem !important;
}

.tcg-counter-page.is-online-game .tcg-history li span,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li span {
    display: block !important;
    flex: none !important;
    font-size: .72rem !important;
    line-height: 1.15 !important;
    margin: 0 !important;
}

.tcg-counter-page.is-online-game .tcg-history li strong,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li strong {
    display: block !important;
    font-size: .9rem !important;
    line-height: 1.26 !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
    white-space: normal !important;
    word-break: break-word !important;
}

@media (min-width: 701px) {
    body.tcg-online-game-body .public-main {
        display: block !important;
        height: var(--tcg-safe-vh, 100vh) !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    .tcg-counter-page.is-online-game {
        display: grid !important;
        gap: .75rem !important;
        grid-template-rows: auto minmax(0, 1fr) !important;
        height: var(--tcg-safe-vh, 100vh) !important;
        margin: 0 auto !important;
        max-width: min(1500px, calc(100vw - 2rem)) !important;
        overflow: hidden !important;
        padding: .75rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-online-game-head {
        grid-row: 1 !important;
    }

    .tcg-counter-page.is-online-game .tcg-counter-board {
        align-items: stretch !important;
        display: grid !important;
        gap: .75rem !important;
        grid-row: 2 !important;
        grid-template-areas:
            "controls history"
            "opponent history"
            "you history" !important;
        grid-auto-columns: 0 !important;
        grid-auto-flow: row !important;
        grid-template-columns: minmax(0, 1fr) 25rem !important;
        grid-template-rows: minmax(9.8rem, auto) minmax(7.2rem, .55fr) minmax(14.8rem, 1fr) !important;
        height: 100% !important;
        max-height: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    .tcg-counter-page.is-online-game .tcg-counter-board::before,
    .tcg-counter-page.is-online-game .tcg-counter-board::after {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-center-panel {
        display: grid !important;
        gap: .65rem !important;
        grid-area: controls !important;
        grid-column: 1 !important;
        grid-row: 1 !important;
        grid-template-columns: minmax(10rem, .8fr) minmax(15rem, 1fr) minmax(18rem, 1.1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
        min-height: 0 !important;
        padding: .7rem !important;
        justify-self: stretch !important;
        max-width: none !important;
        width: 100% !important;
    }

    .tcg-counter-page.is-online-game .tcg-round-card,
    .tcg-counter-page.is-online-game .tcg-timer,
    .tcg-counter-page.is-online-game .tcg-tool-grid {
        height: 100% !important;
        min-height: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }

    .tcg-counter-page.is-online-game .tcg-round-card {
        align-content: center !important;
        display: grid !important;
        gap: .7rem !important;
        grid-column: 1 !important;
        grid-row: 1 !important;
        grid-template-columns: 1fr !important;
        padding: .85rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool-grid {
        display: grid !important;
        gap: .6rem !important;
        grid-column: 2 !important;
        grid-row: 1 !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool {
        min-height: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer {
        display: grid !important;
        gap: .65rem !important;
        grid-column: 3 !important;
        grid-row: 1 !important;
        grid-template-columns: minmax(0, .8fr) minmax(0, 1.15fr) !important;
        padding: .85rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-top {
        grid-area: opponent !important;
        grid-column: 1 !important;
        grid-row: 2 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom {
        grid-area: you !important;
        grid-column: 1 !important;
        grid-row: 3 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player,
    .tcg-counter-page.is-online-game .tcg-player .tcg-player-inner {
        max-width: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
        width: 100% !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-top .tcg-player-inner {
        display: grid !important;
        grid-template-rows: 1.35rem minmax(4.8rem, 1fr) !important;
        padding: .85rem 1rem !important;
        row-gap: .45rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-inner {
        display: grid !important;
        grid-template-rows: 1.35rem minmax(6.4rem, 1fr) 4.6rem 2.6rem !important;
        padding: .85rem 1rem !important;
        row-gap: .55rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-lp-display {
        font-size: clamp(3.8rem, 6.2vw, 6rem) !important;
        line-height: .92 !important;
        padding: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row {
        gap: .5rem !important;
        grid-template-rows: repeat(2, minmax(1.9rem, 1fr)) !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc {
        gap: .5rem !important;
        grid-template-columns: minmax(0, 1fr) 4rem 4rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc button[data-calc-action="clear"] {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-history {
        grid-area: history !important;
        grid-column: 2 !important;
        grid-row: 1 / 4 !important;
        height: 100% !important;
        justify-self: stretch !important;
        max-width: none !important;
        min-height: 0 !important;
        padding: .85rem !important;
        width: 100% !important;
    }

    .tcg-counter-page.is-online-game .tcg-history li strong {
        font-size: .96rem !important;
    }
}

@media (max-width: 700px) {
    html.tcg-online-game-document,
    body.tcg-online-game-body,
    body.tcg-online-game-body .public-main {
        height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        max-height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        min-height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        overflow: hidden !important;
    }

    body.tcg-online-game-body .public-main {
        display: block !important;
        padding: 0 !important;
    }

    .tcg-counter-page.is-online-game,
    .tcg-counter-page.is-mobile-fit.is-online-game {
        --hud-gap: .22rem !important;
        box-sizing: border-box !important;
        display: grid !important;
        gap: var(--hud-gap) !important;
        grid-template-rows: auto minmax(0, 1fr) !important;
        height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        margin: 0 !important;
        max-height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        min-height: var(--tcg-safe-vh, var(--tcg-vh, 100dvh)) !important;
        overflow: hidden !important;
        padding: .18rem .2rem max(.18rem, env(safe-area-inset-bottom, 0px)) !important;
    }

    .tcg-counter-page.is-online-game .tcg-online-game-head,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-online-game-head {
        grid-row: 1 !important;
        min-height: 3.5rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-counter-board,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board {
        align-self: stretch !important;
        gap: var(--hud-gap) !important;
        grid-row: 2 !important;
        grid-template-areas:
            "controls"
            "opponent"
            "you"
            "history"
            "footer" !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows:
            minmax(8.95rem, auto)
            minmax(3.72rem, .36fr)
            minmax(8.82rem, auto)
            minmax(8rem, 1fr)
            0 !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .tcg-counter-page.is-online-game .tcg-counter-board::before,
    .tcg-counter-page.is-online-game .tcg-counter-board::after,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board::before,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board::after {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-center-panel,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-center-panel {
        gap: .2rem !important;
        grid-template-rows: 2rem 3.2rem 3.15rem !important;
        min-height: 0 !important;
        padding: .2rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-round-card,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-round-card {
        gap: .34rem !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        height: 2rem !important;
        min-height: 2rem !important;
        padding: .18rem .3rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-round-card > div,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-round-card > div {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-round-card button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-round-card button {
        align-items: center !important;
        display: inline-flex !important;
        font-size: clamp(.9rem, 3.3vw, 1.06rem) !important;
        height: 1.58rem !important;
        justify-content: center !important;
        min-height: 1.58rem !important;
        padding: 0 .42rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer {
        align-items: center !important;
        gap: .26rem !important;
        grid-template-columns: minmax(0, .96fr) minmax(0, 1.56fr) !important;
        min-height: 0 !important;
        padding: .28rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer strong,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer strong {
        font-size: clamp(1.56rem, 7vw, 2.15rem) !important;
        line-height: 1 !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer-actions,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer-actions {
        gap: .22rem !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer-actions button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer-actions button {
        font-size: clamp(.76rem, 2.9vw, .95rem) !important;
        height: 1.28rem !important;
        min-height: 1.28rem !important;
        padding: 0 .26rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool-grid,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-tool-grid {
        gap: .24rem !important;
        min-height: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-tool {
        align-items: center !important;
        display: grid !important;
        gap: .24rem !important;
        grid-template-columns: 2.6rem minmax(0, 1fr) !important;
        grid-template-rows: 1fr !important;
        justify-items: stretch !important;
        min-height: 0 !important;
        padding: .28rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool > span:not(.tcg-dice-stage):not(.tcg-coin-stage),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-tool > span:not(.tcg-dice-stage):not(.tcg-coin-stage),
    .tcg-counter-page.is-online-game .tcg-tool > svg,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-tool > svg {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-dice-stage,
    .tcg-counter-page.is-online-game .tcg-coin-stage,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-dice-stage,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-coin-stage {
        align-items: center !important;
        display: flex !important;
        height: 2.08rem !important;
        justify-content: center !important;
        margin: 0 !important;
        width: 2.08rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-tool strong,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-tool strong {
        align-items: center !important;
        align-self: center !important;
        border: 1px solid rgba(78, 143, 221, .6) !important;
        border-radius: .5rem !important;
        display: flex !important;
        font-size: clamp(.9rem, 3.4vw, 1.06rem) !important;
        height: 1.78rem !important;
        justify-content: center !important;
        line-height: 1 !important;
        min-height: 1.78rem !important;
        text-align: center !important;
    }

    .tcg-counter-page.is-online-game .tcg-player,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player {
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .tcg-counter-page.is-online-game .tcg-player .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player .tcg-player-inner {
        min-height: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-top .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-top .tcg-player-inner {
        grid-template-rows: .96rem minmax(2.26rem, 1fr) !important;
        padding: .28rem .5rem !important;
        row-gap: .14rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-player-inner {
        grid-template-rows: .96rem minmax(2.28rem, .74fr) 3.02rem 1.46rem !important;
        padding: .28rem .5rem !important;
        row-gap: .16rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player .tcg-player-name,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player .tcg-player-name {
        height: .98rem !important;
        line-height: .98rem !important;
        max-height: .98rem !important;
        max-width: min(54%, 12rem) !important;
        min-height: .98rem !important;
        padding: 0 .58rem !important;
        top: .16rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-online-state,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-online-state {
        align-items: center !important;
        display: inline-flex !important;
        font-size: clamp(.48rem, 1.8vw, .62rem) !important;
        height: .9rem !important;
        justify-content: center !important;
        min-height: .9rem !important;
        padding: 0 .34rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-lp-display,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-lp-display {
        align-items: center !important;
        align-self: center !important;
        display: flex !important;
        font-size: clamp(2.08rem, 8.2vw, 2.68rem) !important;
        justify-content: center !important;
        letter-spacing: 0 !important;
        line-height: .92 !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        transform: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-quick-row {
        gap: .22rem !important;
        grid-template-rows: repeat(2, minmax(1.34rem, 1fr)) !important;
        min-height: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-quick-row button,
    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc-input,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc-input,
    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc button {
        font-size: clamp(.76rem, 2.7vw, .92rem) !important;
        height: 1.34rem !important;
        max-height: 1.34rem !important;
        min-height: 1.34rem !important;
        padding: 0 .24rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc {
        gap: .22rem !important;
        grid-template-columns: minmax(0, 1fr) 2.7rem 2.7rem !important;
        min-height: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc button[data-calc-action="clear"],
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc button[data-calc-action="clear"] {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-history,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history {
        align-self: stretch !important;
        height: 100% !important;
        min-height: 0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-history summary,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history summary {
        min-height: 2.12rem !important;
        padding: .35rem .52rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history summary > span:first-child,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history summary > span:first-child {
        font-size: .78rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history summary button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history summary button {
        font-size: .72rem !important;
        min-height: 1.34rem !important;
        padding: 0 .42rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history ol,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history ol {
        gap: .34rem !important;
        align-items: start !important;
        grid-auto-rows: max-content !important;
        padding: .36rem .42rem .5rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history li,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li,
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 2),
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 3),
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 4),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 2),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 3),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 4) {
        height: auto !important;
        max-height: none !important;
        min-height: 1.62rem !important;
        padding: .42rem .5rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history li span,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li span {
        font-size: .62rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history li strong,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li strong {
        font-size: .74rem !important;
        line-height: 1.3 !important;
    }
}

@media (max-width: 390px) {
    .tcg-counter-page.is-online-game .tcg-counter-board,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board {
        grid-template-rows:
            minmax(8.6rem, auto)
            minmax(3.48rem, .34fr)
            minmax(8.35rem, auto)
            minmax(7rem, 1fr)
            0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-center-panel,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-center-panel {
        grid-template-rows: 1.88rem 3.02rem 2.95rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-lp-display,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-lp-display {
        font-size: clamp(1.96rem, 8vw, 2.42rem) !important;
    }
}

@media (max-width: 700px) {
    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li,
    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li:nth-child(n + 2),
    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li:nth-child(n + 3),
    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li:nth-child(n + 4) {
        align-items: start !important;
        display: grid !important;
        gap: .16rem !important;
        grid-template-rows: auto auto !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: .46rem .52rem !important;
    }

    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li span,
    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li strong {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .tcg-counter-page.is-mobile-fit.is-stage-compact.is-online-game .tcg-history li strong {
        line-height: 1.32 !important;
        white-space: normal !important;
    }
}

/* Final mobile online player spacing: LP must never overlap the operation buttons. */
@media (max-width: 700px) {
    .tcg-counter-page.is-online-game .tcg-counter-board,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board {
        grid-template-rows:
            minmax(8.85rem, auto)
            minmax(3.82rem, .34fr)
            minmax(9.75rem, auto)
            minmax(7.2rem, 1fr)
            0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-player-inner {
        display: grid !important;
        gap: .2rem !important;
        grid-template-rows: 1.12rem minmax(3.08rem, .92fr) 3.18rem 1.58rem !important;
        overflow: hidden !important;
        padding: .34rem .56rem .4rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-head,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-player-head {
        min-height: 0 !important;
        overflow: visible !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-lp-display,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-lp-display {
        align-items: center !important;
        display: flex !important;
        font-size: clamp(2.45rem, 10.2vw, 3.12rem) !important;
        height: 100% !important;
        justify-content: center !important;
        line-height: .78 !important;
        margin: 0 !important;
        max-height: 3.18rem !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        position: relative !important;
        transform: none !important;
        z-index: 1 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-quick-row {
        display: grid !important;
        gap: .22rem !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        grid-template-rows: repeat(2, minmax(1.42rem, 1fr)) !important;
        margin-top: .08rem !important;
        min-height: 0 !important;
        position: relative !important;
        z-index: 3 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc {
        display: grid !important;
        gap: .22rem !important;
        grid-template-columns: minmax(0, 1fr) 2.74rem 2.74rem !important;
        min-height: 0 !important;
        position: relative !important;
        z-index: 3 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-quick-row button,
    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc-input,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc-input,
    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-calc button,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-calc button {
        align-items: center !important;
        display: inline-flex !important;
        font-size: clamp(.72rem, 2.55vw, .86rem) !important;
        height: 100% !important;
        justify-content: center !important;
        line-height: 1 !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 .22rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-top .tcg-lp-display,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-top .tcg-lp-display {
        padding: 0 !important;
    }
}

@media (max-width: 390px) {
    .tcg-counter-page.is-online-game .tcg-counter-board,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-counter-board {
        grid-template-rows:
            minmax(8.55rem, auto)
            minmax(3.58rem, .32fr)
            minmax(9.28rem, auto)
            minmax(6.8rem, 1fr)
            0 !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-player-inner {
        grid-template-rows: 1.05rem minmax(2.82rem, .9fr) 2.96rem 1.5rem !important;
        gap: .16rem !important;
        padding: .32rem .48rem .36rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-lp-display,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-lp-display {
        font-size: clamp(2.22rem, 9.6vw, 2.86rem) !important;
        max-height: 2.9rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-quick-row,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-quick-row {
        grid-template-rows: repeat(2, minmax(1.32rem, 1fr)) !important;
    }
}

/* Final online cleanup: the top Exit Game button replaces the duplicate Room action. */
.tcg-counter-page.is-online-game .tcg-timer-actions [data-return-lobby],
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer-actions [data-return-lobby] {
    display: none !important;
}

.tcg-counter-page.is-online-game .tcg-timer,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer {
    align-items: center !important;
    display: grid !important;
    gap: .58rem !important;
    grid-template-columns: minmax(7.2rem, .78fr) minmax(0, 1.22fr) !important;
}

.tcg-counter-page.is-online-game .tcg-timer > div:first-child,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer > div:first-child {
    align-content: center !important;
    align-items: center !important;
    display: grid !important;
    gap: .16rem !important;
    justify-items: center !important;
    min-width: 0 !important;
    text-align: center !important;
}

.tcg-counter-page.is-online-game .tcg-timer span,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer span {
    display: block !important;
    font-size: clamp(.58rem, .9vw, .72rem) !important;
    letter-spacing: .1em !important;
    line-height: 1 !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.tcg-counter-page.is-online-game .tcg-timer strong,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer strong {
    display: block !important;
    line-height: .95 !important;
    margin: 0 !important;
    min-height: 0 !important;
}

.tcg-counter-page.is-online-game .tcg-timer-actions,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer-actions {
    display: grid !important;
    gap: .48rem !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
}

.tcg-counter-page.is-online-game .tcg-player .tcg-player-name,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-player .tcg-player-name {
    font-size: clamp(.78rem, 1.7vw, 1rem) !important;
    height: clamp(1.28rem, 2.4vw, 1.62rem) !important;
    line-height: 1 !important;
    max-height: none !important;
    max-width: min(62%, 18rem) !important;
    min-height: clamp(1.28rem, 2.4vw, 1.62rem) !important;
    min-width: 6.25rem !important;
    padding: .16rem .72rem !important;
    top: .18rem !important;
}

@media (max-width: 700px) {
    .tcg-counter-page.is-online-game .tcg-timer,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer {
        gap: .34rem !important;
        grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr) !important;
    }

    .tcg-counter-page.is-online-game .tcg-timer span,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-timer span {
        display: none !important;
    }

    .tcg-counter-page.is-online-game .tcg-player .tcg-player-name,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player .tcg-player-name {
        font-size: clamp(.78rem, 3.2vw, .95rem) !important;
        height: clamp(1.16rem, 3.8vw, 1.42rem) !important;
        min-height: clamp(1.16rem, 3.8vw, 1.42rem) !important;
        min-width: 6.6rem !important;
        padding: .1rem .7rem !important;
        top: .16rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-top .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-top .tcg-player-inner {
        grid-template-rows: 1.18rem minmax(0, 1fr) !important;
    }

    .tcg-counter-page.is-online-game .tcg-player-bottom .tcg-player-inner,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-player-bottom .tcg-player-inner {
        grid-template-rows: 1.18rem minmax(2.34rem, 1fr) 3.42rem 1.66rem !important;
    }
}

/* Online lobby exit and durable log rows. */
.tcg-online-card {
    position: relative !important;
}

.tcg-online-panel-exit {
    align-items: center !important;
    background: linear-gradient(180deg, rgba(255, 194, 71, .18), rgba(255, 157, 31, .08)) !important;
    border: 1px solid rgba(255, 194, 71, .72) !important;
    border-radius: 999px !important;
    box-shadow: 0 0 1.1rem rgba(255, 194, 71, .16) !important;
    color: #ffd36e !important;
    display: inline-flex !important;
    font-weight: 900 !important;
    gap: .38rem !important;
    min-height: 2.2rem !important;
    padding: 0 .9rem !important;
    position: absolute !important;
    right: clamp(.75rem, 2vw, 1.25rem) !important;
    top: clamp(.75rem, 2vw, 1.25rem) !important;
    z-index: 5 !important;
}

.tcg-online-panel-exit svg {
    height: 1rem !important;
    width: 1rem !important;
}

.tcg-counter-page.is-online-game .tcg-history ol,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history ol {
    align-content: start !important;
    align-items: start !important;
    display: grid !important;
    gap: .48rem !important;
    grid-auto-flow: row !important;
    grid-auto-rows: max-content !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.tcg-counter-page.is-online-game .tcg-history li,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li,
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 2),
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 3),
.tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 4),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 2),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 3),
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 4) {
    align-items: start !important;
    box-sizing: border-box !important;
    display: grid !important;
    flex: 0 0 auto !important;
    gap: .24rem !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
    max-height: none !important;
    min-height: 3.05rem !important;
    overflow: visible !important;
    padding: .54rem .68rem !important;
}

.tcg-counter-page.is-online-game .tcg-history li span,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li span {
    display: block !important;
    flex: none !important;
    font-size: .72rem !important;
    height: auto !important;
    line-height: 1.15 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

.tcg-counter-page.is-online-game .tcg-history li strong,
.tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li strong {
    display: block !important;
    flex: none !important;
    font-size: .9rem !important;
    height: auto !important;
    line-height: 1.28 !important;
    max-height: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    overflow-wrap: anywhere !important;
    text-overflow: clip !important;
    white-space: normal !important;
    word-break: break-word !important;
}

@media (max-width: 700px) {
    .tcg-online-panel-exit {
        font-size: .82rem !important;
        min-height: 1.95rem !important;
        padding: 0 .72rem !important;
        right: .7rem !important;
        top: .7rem !important;
    }

    .tcg-counter-page.is-online-game .tcg-history li,
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li,
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 2),
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 3),
    .tcg-counter-page.is-online-game .tcg-history li:nth-child(n + 4),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 2),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 3),
    .tcg-counter-page.is-mobile-fit.is-online-game .tcg-history li:nth-child(n + 4) {
        min-height: 3.15rem !important;
        padding: .54rem .62rem !important;
    }
}
