/*
 * Game-only companion to the landing page. The table grid, card fans, scrolling,
 * sticky phone controls and all state/visibility classes remain owned by app.css.
 */
body:has(#gameView:not(.hidden)) {
    background: var(--bg);
}
#gameView,
#gameView :is(button, select, input, h2, h3),
.leave-dialog,
.leave-dialog :is(button, h2),
.reconnect-view,
.app-alert {
    font-family: var(--font-editorial);
}
#gameView {
    line-height: 1.5;
}
#gameView .room-header,
#gameView.game-view--active .room-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.05rem 1.25rem;
    padding: 1.25rem 1.375rem;
    border-color: var(--editorial-border);
    border-radius: 14px;
    background: var(--editorial-paper);
    box-shadow: none;
    backdrop-filter: none;
}
#gameView .game-brand {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem 1.4rem;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
}
.game-brand .brand-title {
    margin: 0;
    font-size: 2rem;
    overflow-wrap: anywhere;
}
.game-brand .brand-title span {
    margin-left: 0.5625rem;
    letter-spacing: -0.045em;
}
.game-brand .brand-suits {
    margin: 0;
    gap: 1.125rem;
    font: 0.875rem/1 Georgia, serif;
    opacity: 1;
}
#gameView .room-summary {
    order: 2;
    flex: 1 1 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eceae7;
    min-width: 0;
}
#gameView .room-title-row {
    gap: 0.75rem;
    min-width: 0;
}
#gameView .room-title {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0;
}
#gameView .room-code {
    font-family: var(--font-editorial);
    font-weight: 600;
    letter-spacing: 0.1em;
}
#gameView .room-code-group { gap: 0.5625rem; }
#gameView .room-copy-btn {
    color: var(--text-soft);
    border: 0;
    border-radius: 5px;
    background: transparent;
    box-shadow: none;
}
#gameView .room-copy-btn:hover { background: #e8e7e4; }
#gameView .room-copy-btn[data-copied="true"] { color: var(--editorial-green-text); }
#gameView :is(.status-pill, .visibility-pill) {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
#gameView .status-pill {
    color: var(--editorial-green-text);
}
#gameView .status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}
#gameView .room-meta {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
#gameView .room-player-name { color: var(--text); font-weight: 500; }
#gameView .room-player-separator { color: #aaa298; }
#gameView .visibility-pill .game-icon { width: 0.75rem; height: 0.75rem; }
#gameView .room-waiting {
    font-size: 0.85rem;
}
#gameView .room-actions {
    /* Keep these after the room heading in DOM/tab order, even above it visually. */
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
#gameView .room-header > :is(.room-waiting, .game-open-tables) {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
}
/* Keep the approved masthead and separate metadata row during play too.
 * Content-driven wrapping handles large text without changing that hierarchy. */
#gameView .btn,
.leave-dialog .btn {
    border: 1px solid var(--editorial-border);
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    min-height: 38px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: none;
    text-shadow: none;
    background: var(--editorial-paper);
    color: var(--text);
}
#gameView .btn:hover:not(:disabled):not([aria-disabled="true"]),
.leave-dialog .btn:hover:not(:disabled) {
    background: #f0efed;
    box-shadow: none;
    filter: none;
}
#gameView .btn-accent,
.leave-dialog .btn-accent {
    color: #fff;
    background: var(--editorial-green);
    border-color: var(--editorial-green);
}
#gameView .btn-accent:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--editorial-green-hover);
}
#gameView .btn-danger,
.leave-dialog .btn-danger {
    color: var(--danger-strong);
}
#gameView .room-actions #leaveBtn { color: #754a3d; }
#gameView .game-rules-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border-color: transparent;
    color: var(--text-soft);
    white-space: nowrap;
}
#gameView .game-rules-link .game-icon {
    width: 1.1em;
    height: 1.1em;
}
#gameView .table-shell {
    border: 1px solid #a68c58;
    border-radius: 14px;
}
#gameView .hud {
    align-items: center;
    /* Explicit suit column keeps it quietly at the right, even with long player names. */
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.55rem 1.1rem;
}
#gameView .hud .pill {
    min-width: 0;
    justify-self: start;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-shadow: none;
    font-size: 0.85rem;
    line-height: 1.4;
}
#gameView .hud .pill strong {
    font-weight: 500;
    overflow-wrap: anywhere;
}
#gameView .hud .pill-role-after {
    margin-left: 0.1rem;
}
#gameView .hud #trumpSuitHud {
    grid-column: 3;
    justify-self: end;
    align-self: start;
}
#gameView #trumpSuitHud .pill-role {
    font: 1.7rem/1 Georgia, serif;
    font-variant-emoji: text;
    color: #f3f6ed;
}
.game-icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.13em;
    flex: 0 0 auto;
}
/* A shield's narrow outline needs more weight than the other role icons at text size. */
#gameView .game-icon--defender {
    width: 1.25rem;
    height: 1.25rem;
    stroke-width: 2.2;
    fill: currentColor;
    fill-opacity: 0.1;
    vertical-align: -0.25em;
}
#gameView .pill-role,
#gameView .seat-role-inline,
#gameView .taking-lead-icon,
#gameView .pill-take {
    font-family: inherit;
}
#gameView .seat {
    border-radius: 10px;
    border-color: #86a58b80;
}
#gameView .seat-title {
    font-weight: 600;
    line-height: 1.5;
    text-shadow: none;
}
#gameView .ai-badge {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 1rem;
    vertical-align: baseline;
}
#gameView .seat-role-inline {
    font-size: 0.9em;
    font-weight: 500;
}
#gameView .bot-thinking-inline {
    opacity: 1;
    color: #d9e7dc;
}
#gameView .seat.bottom.my-hand {
    background: #e9eeea;
    border: 1px solid #c6d0c5;
}
#gameView .my-hand .muted {
    color: #59655d;
    font-size: 0.85rem;
}
/* Keep team identity, but use legible dark counterparts on the light hand rail. */
#gameView .players-4 .my-hand .seat-title--team0 { color: #1d4f8c; }
#gameView .players-4 .my-hand .seat-title--team1 { color: #86451a; }
#gameView .battle-table-banner {
    border-radius: 7px;
    background: #143723;
    text-shadow: none;
    line-height: 1.5;
    font-size: 0.85rem;
}
#gameView .action-strip button,
#gameView .action-strip select {
    border-color: #bcc8bf;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
    font-weight: 500;
}
#gameView .action-strip button:not(:disabled):not([aria-disabled="true"]) {
    background: var(--editorial-green);
    border-color: var(--editorial-green);
    color: #fff;
}
#gameView .action-strip button:hover:not(:disabled):not([aria-disabled="true"]) {
    background: var(--editorial-green-hover);
}
#gameView .action-strip button:disabled,
#gameView .action-strip button[aria-disabled="true"] {
    opacity: 1;
    color: #64716a;
    background: transparent;
    border-color: #c6cfc8;
}
#gameView .help-toggle-btn {
    border-color: transparent;
    border-radius: 6px;
    background: transparent;
    color: #526457;
}
#gameView .help-toggle-btn:hover {
    color: var(--text);
    background: #dbe4dc;
}
#gameView .result-panel,
#gameView .game-open-tables,
.leave-dialog {
    border-color: var(--editorial-border);
    background: var(--editorial-paper);
    box-shadow: none;
}
#gameView .result-copy h2,
.leave-dialog h2 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 1.15;
}
#gameView :is(a, button:not(.hand-card-btn), select):focus-visible,
.leave-dialog button:focus-visible {
    outline: 2px solid var(--editorial-green);
    outline-offset: 3px;
}
@media (min-width: 701px) {
    /* Reveal focused cards below the masthead without scrolling controls already in it. */
    #gameView.game-view--active .hand-card-btn { scroll-margin-top: var(--masthead-clearance, 11rem); }
    #gameView .action-strip button {
        min-height: 38px;
        padding: 0.5rem 0.85rem;
    }
}
@media (min-width: 701px) and (max-width: 800px) {
    .game-brand .brand-title { font-size: 1.75rem; }
}
@media (max-width: 700px) {
    #gameView .room-header,
    #gameView.game-view--active .room-header {
        gap: 0.35rem 0.75rem;
        padding: 0.45rem 0.75rem;
    }
    .game-brand .brand-suits { display: none; }
    .game-brand .brand-title { font-size: 1.5rem; }
    #gameView .room-summary {
        padding-top: 0.35rem;
        gap: 0.25rem 0.6rem;
    }
    #gameView .room-title-row { gap: 0.6rem; }
    #gameView .room-title { font-size: 0.8rem; }
    #gameView.game-view--active .room-meta { font-size: 0.75rem; }
    #gameView .room-actions .btn {
        padding: 0.4rem 0.65rem;
        min-height: 34px;
        font-size: 0.8rem;
    }
    /* Waiting rooms retain every host action without squeezing the wordmark. */
    #gameView:not(.game-view--active) .room-actions { flex-basis: 100%; justify-content: flex-start; }
    #gameView .hud {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.35rem 0.75rem;
    }
    #gameView .hud .pill { font-size: 0.8rem; }
    #gameView .hud .pill:nth-child(2) { grid-column: 1; grid-row: 2; }
    #gameView .hud #trumpSuitHud { grid-column: 2; grid-row: 1; }
    /* Keep the existing deck beside the names, with the suit at its right. */
    #gameView .hud:has(+ .opening-lead-hud + .table-felt-wrap .deck-area:not(.hidden)) {
        padding-right: 104px;
    }
    #gameView .hud:has(+ .opening-lead-hud + .table-felt-wrap .deck-area:not(.hidden)) #trumpSuitHud {
        position: absolute;
        grid-column: auto;
        grid-row: auto;
        right: 0;
        top: 0;
    }
    #gameView .hud { position: relative; align-self: center; }
    #gameView .deck-outside { align-self: center; margin-right: 32px; }
    #gameView .seat-title { line-height: 1.3; }
    #gameView .action-strip {
        align-items: stretch;
        border-color: #c6d0c5;
        background: #e9eeea;
        box-shadow: 0 -3px 12px #20382612;
        backdrop-filter: none;
    }
}
@media (max-width: 560px) {
    /* As in the approved mock, retain action labels while omitting phone nav decoration. */
    #gameView .room-actions .btn svg { display: none; }
}
@media (max-width: 480px) {
    #gameView .hud { column-gap: 0.4rem; }
    #gameView .room-actions { gap: 0.25rem; }
    #gameView .room-actions .btn { font-size: 0.75rem; padding-inline: 0.4rem; }
    #gameView .game-rules-link { gap: 0.35rem; }
}
@media (max-width: 360px) {
    .game-brand .brand-title { font-size: 1.2rem; }
    #gameView .room-header,
    #gameView.game-view--active .room-header { column-gap: 0.4rem; }
}
