:root {
    color-scheme: dark;
    --shell-bg: #0b1a2c;
    --shell-surface: rgba(255,255,255,0.06);
    --shell-border: rgba(255,255,255,0.10);
    --shell-text: #e8ece9;
    --shell-muted: #9ca8b3;
    --shell-accent: #c9a84c;
    --shell-accent-hover: #dfc06a;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--shell-bg);
    color: var(--shell-text);
}

body {
    min-height: 100vh;
}

h1:focus {
    outline: none;
}

a,
.btn-link {
    color: var(--shell-accent);
}

a:hover,
.btn-link:hover {
    color: var(--shell-accent-hover);
}

.btn-primary {
    color: #0b1a2c;
    background-color: var(--shell-accent);
    border-color: var(--shell-accent);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem rgba(11,26,44,0.5), 0 0 0 0.25rem rgba(201,168,76,0.35);
}

.content {
    padding-top: 0;
}

.shell-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.shell-hero {
    max-width: 56rem;
}

.shell-hero p {
    margin: 0.5rem 0 0;
    color: var(--shell-muted);
    line-height: 1.6;
}

.eyebrow {
    margin: 0;
    color: var(--shell-accent);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.shell-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
}

.shell-card {
    background: var(--shell-surface);
    border: 1px solid var(--shell-border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.shell-card h1,
.shell-card h2 {
    margin-top: 0;
}

.shell-card dl {
    display: grid;
    gap: 0.85rem;
    margin: 0;
}

.shell-card dl div {
    display: grid;
    gap: 0.2rem;
}

.shell-card dt {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--shell-muted);
}

.shell-card dd {
    margin: 0;
    word-break: break-word;
}

.status-list,
.foundation-list {
    margin: 0;
    padding: 0;
}

.status-list li,
.foundation-list li {
    list-style: none;
}

.status-list li + li,
.foundation-list li + li {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.foundation-list li {
    line-height: 1.5;
}

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.endpoint,
.hint {
    color: var(--shell-muted);
}

.endpoint {
    margin-top: 0.35rem;
    word-break: break-word;
}

.hint {
    margin: 1rem 0 0;
    line-height: 1.5;
}

.shell-button {
    margin-top: 1rem;
}

.shell-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.shell-actions .btn-link {
    padding-left: 0;
    padding-right: 0;
}

.shell-form-card {
    max-width: 42rem;
}

.shell-form-grid {
    display: grid;
    gap: 1rem;
}

.shell-loading-card {
    max-width: 42rem;
    margin: 3rem auto 0;
}

.shell-nav-link {
    display: block;
    padding: 0.45rem 0;
    font-weight: 600;
}

.shell-nav-note {
    margin-top: 0.75rem;
    color: var(--shell-muted);
    line-height: 1.5;
}

.participant-list {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.participant-row {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.participant-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.participant-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.participant-pill,
.participant-seat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.participant-pill-host {
    background: rgba(201,168,76,0.2);
    color: #c9a84c;
}

.participant-pill-local {
    background: rgba(99,102,241,0.2);
    color: #a5b4fc;
}

.participant-pill-ready {
    background: rgba(74,222,128,0.2);
    color: #4ade80;
}

.participant-pill-pending {
    background: rgba(255,255,255,0.08);
    color: #9ca8b3;
}

.participant-pill-offline {
    background: rgba(248,113,113,0.2);
    color: #f87171;
}

.participant-seat {
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
}

.participant-pill-ai {
    background: rgba(201, 168, 76, 0.2);
    color: var(--shell-accent, #c9a84c);
    border: 1px solid rgba(201, 168, 76, 0.4);
}

.ai-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.ai-player-remove {
    background: none;
    border: 1px solid rgba(248, 113, 113, 0.4);
    border-radius: 999px;
    color: #f87171;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.ai-player-remove:hover {
    opacity: 1;
    background: rgba(248, 113, 113, 0.15);
}

.ai-player-remove:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-idle {
    background: rgba(255,255,255,0.08);
    color: #9ca8b3;
}

.status-ok {
    background: rgba(74,222,128,0.2);
    color: #4ade80;
}

.status-working {
    background: rgba(96,165,250,0.2);
    color: #60a5fa;
}

.status-warn {
    background: rgba(251,191,36,0.2);
    color: #fbbf24;
}

code {
    color: #e879a0;
    background: rgba(232,121,160,0.12);
    padding: 0.1rem 0.35rem;
    border-radius: 0.35rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #4ade80;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: #f87171;
}

#blazor-error-ui {
    background: rgba(180,33,33,0.9);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOng9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

@media (min-width: 768px) {
    .shell-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: rgba(255,255,255,0.15);
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #c9a84c;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Bootstrap dark-theme overrides */
.form-control, .form-select {
    background-color: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    color: var(--shell-text);
}
.form-control:focus, .form-select:focus {
    background-color: rgba(255,255,255,0.10);
    border-color: var(--shell-accent);
    color: var(--shell-text);
    box-shadow: 0 0 0 0.25rem rgba(201,168,76,0.25);
}
.form-control::placeholder {
    color: var(--shell-muted);
}
.form-text {
    color: var(--shell-muted);
}
.form-label {
    color: var(--shell-text);
}
.btn-outline-primary {
    color: var(--shell-accent);
    border-color: var(--shell-accent);
}
.btn-outline-primary:hover {
    background-color: var(--shell-accent);
    border-color: var(--shell-accent);
    color: #0b1a2c;
}
.btn-outline-secondary {
    color: #9ca8b3;
    border-color: rgba(255,255,255,0.15);
}
.btn-outline-secondary:hover {
    background-color: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.25);
    color: var(--shell-text);
}
.btn-link {
    color: var(--shell-accent);
}
.btn-link:hover {
    color: var(--shell-accent-hover);
}

.gameplay-summary-list {
    margin-top: 1rem;
}

/* ── Game table layout ── */
.game-table {
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    flex: 1;
    min-height: 0;
    padding: 0.5rem;
    gap: 0.5rem;
    position: relative;
    max-width: 80rem;
    width: 100%;
    margin: 0 auto;
}

.game-auth-guard,
.game-connecting {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 1rem;
    padding: 2rem;
}

/* ── Round info bar ── */
.round-info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.4rem 1rem;
    background: rgba(0,0,0,0.25);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
}
.round-info-bar strong { color: #c9a84c; }
.round-info-blind { color: #facc15; font-weight: 600; }

/* ── Opponent bar ── */
.opponent-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.4rem;
}
.opponent-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 0.5rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.8);
    transition: all 0.3s ease;
}
.opponent-chip-active {
    border-color: #c9a84c;
    box-shadow: 0 0 12px rgba(201,168,76,0.3);
}
.opponent-chip .badge { font-size: 0.7rem; padding: 0.15rem 0.4rem; border-radius: 999px; }
.badge-dealer { background: #92400e; color: #fef3c7; }
.badge-lead { background: #1d6942; color: #d8f0e4; }
.badge-bidding { background: #254c9e; color: #e7efff; }

/* ── Viewer stats bar ── */
.viewer-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.4rem 1rem;
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.35);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
}
.viewer-stats-bar strong {
    color: #c9a84c;
}
.viewer-stats-name {
    font-weight: 600;
    color: #c9a84c;
    margin-right: 0.5rem;
}

/* AI Player Indicators */
.ai-indicator {
    font-size: 0.7rem;
    margin-right: 0.15rem;
}

.ai-thinking {
    font-size: 0.65rem;
    color: var(--shell-accent, #c9a84c);
    font-style: italic;
    animation: thinking-dots 1.5s ease-in-out infinite;
}

@keyframes thinking-dots {
    0%   { opacity: 0.3; }
    50%  { opacity: 1; }
    100% { opacity: 0.3; }
}

/* ── Trick area ── */
.trick-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 200px;
}
.trick-cards {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    justify-content: center;
}
.trick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}
.trick-card-img {
    width: 7rem;
    aspect-ratio: 5/7;
    border-radius: 0.6rem;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
    object-fit: cover;
    background: #1a2a1a;
}
.trick-card-name {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}
.trick-message {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
    font-style: italic;
}
.trick-winner-msg {
    font-size: 0.85rem;
    color: #c9a84c;
    text-align: center;
}

/* ── Player hand ── */
.player-hand {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 0.5rem 1rem 0.75rem;
    gap: 0;
    perspective: 800px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.hand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: transform 0.2s ease, margin 0.2s ease;
    margin-left: -1rem;
}
.hand-card:first-child { margin-left: 0; }
.hand-card:hover:not(.hand-card-disabled) {
    transform: translateY(-12px) scale(1.05);
    z-index: 10;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}
.hand-card-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.hand-card-active {
    filter: brightness(1.1);
}
.hand-card-img {
    width: 6rem;
    aspect-ratio: 5/7;
    border-radius: 0.5rem;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
    object-fit: cover;
    background: #1a2a1a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.hand-card:hover:not(.hand-card-disabled) .hand-card-img {
    border-color: #c9a84c;
    box-shadow: 0 8px 24px rgba(201,168,76,0.25), 0 2px 6px rgba(0,0,0,0.2);
}
.hand-card-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    text-align: center;
    white-space: nowrap;
}

/* ── Bidding panel ── */
.bidding-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
}
.bidding-panel {
    background: rgba(20,35,20,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    max-width: 24rem;
}
.bidding-panel h3 { color: #c9a84c; margin: 0 0 0.75rem; }
.bidding-panel p { color: rgba(255,255,255,0.6); margin: 0 0 1rem; font-size: 0.85rem; }
.bid-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.bid-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.bid-btn:hover:not(:disabled) {
    border-color: #c9a84c;
    background: rgba(201,168,76,0.2);
    transform: scale(1.1);
}
.bid-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.bid-btn-forbidden {
    opacity: 0.3;
    text-decoration: line-through;
    cursor: not-allowed;
    border-color: rgba(248, 113, 113, 0.4) !important;
}
.bid-btn-forbidden:hover {
    transform: none !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
    background: transparent !important;
}
.bid-btn-zero-info {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    margin-top: 0.5rem;
}

/* ── Score overlay ── */
.score-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(28rem, 90vw);
    background: rgba(10,22,40,0.97);
    border-left: 1px solid rgba(255,255,255,0.1);
    padding: 1.5rem;
    z-index: 200;
    overflow-y: auto;
    backdrop-filter: blur(8px);
}
.score-overlay h2 { color: #c9a84c; margin: 0 0 1rem; }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.score-table th { text-align: left; color: rgba(255,255,255,0.5); padding: 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.score-table td { padding: 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.05); color: rgba(255,255,255,0.8); }
.score-positive { color: #4ade80; }
.score-negative { color: #f87171; }

/* ── Trick pause overlay ── */
.trick-pause-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(3px);
    z-index: 55;
    cursor: pointer;
    animation: overlay-fade-in 0.3s ease-out both;
}
.trick-pause-card {
    background: rgba(20,35,20,0.95);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 1rem;
    padding: 1.5rem 2rem;
    text-align: center;
    cursor: default;
}
.trick-pause-card h3 { color: #c9a84c; margin: 0 0 0.5rem; }
.trick-pause-winner { color: rgba(255,255,255,0.85); margin: 0 0 1rem; font-size: 0.95rem; }
.trick-pause-winner strong { color: #c9a84c; }
.trick-pause-cards {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

/* ── Round results overlay ── */
.round-results-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 60;
}
.round-results-card {
    background: rgba(20,35,20,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 1rem;
    padding: 1.5rem;
    min-width: 20rem;
    max-width: 32rem;
}
.round-results-card h3 { color: #c9a84c; margin: 0 0 1rem; text-align: center; }

/* ── Final standings ── */
.final-standings {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 70;
}
.standings-card {
    background: rgba(20,35,20,0.95);
    border: 1px solid rgba(201,168,76,0.3);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    min-width: 24rem;
}
.standings-card h2 { color: #c9a84c; margin: 0 0 1.5rem; }
.standing-row { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; }
.standing-medal { width: 2.5rem; height: 2.5rem; }
.standing-name { flex: 1; text-align: left; color: rgba(255,255,255,0.9); }
.standing-score { color: #c9a84c; font-weight: 700; font-size: 1.1rem; }

/* ── Debug panel ── */
.debug-toggle {
    position: fixed;
    bottom: 0.5rem;
    left: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.4);
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 100;
}
.debug-panel {
    position: fixed;
    bottom: 3rem;
    left: 0.5rem;
    background: rgba(10,22,40,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    z-index: 100;
    max-width: 20rem;
}
.debug-panel dt { color: rgba(255,255,255,0.4); font-size: 0.7rem; text-transform: uppercase; }
.debug-panel dd { margin: 0 0 0.5rem; word-break: break-all; }

/* ── Status messages ── */
.game-status-msg {
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    padding: 0.5rem;
}
.game-status-msg strong { color: #c9a84c; }
.game-your-turn {
    color: #4ade80;
    font-weight: 600;
    animation: turnTextPulse 1.5s ease-in-out infinite;
}
.bid-confirmation {
    color: #60a5fa;
    font-weight: 600;
    animation: bidConfirmFade 3s ease-out forwards;
}

@keyframes bidConfirmFade {
    0% { opacity: 0; transform: scale(1.15); }
    15% { opacity: 1; transform: scale(1); }
    75% { opacity: 1; }
    100% { opacity: 0.3; }
}

@keyframes turnTextPulse {
    0%, 100% { text-shadow: 0 0 4px rgba(74, 222, 128, 0.2); }
    50% { text-shadow: 0 0 10px rgba(74, 222, 128, 0.5); }
}

/* ── Gameplay animations ── */

@keyframes card-appear {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes active-pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(201,168,76,0.2); }
    50% { box-shadow: 0 0 16px rgba(201,168,76,0.5); }
}

@keyframes hand-fan-in {
    from { opacity: 0; transform: translateY(40px) rotate(5deg); }
    to { opacity: 1; transform: translateY(0) rotate(var(--card-rotate, 0deg)); }
}

@keyframes bid-press {
    0% { transform: scale(1); }
    40% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes results-slide-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes standing-enter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes medal-bounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes score-flash-positive {
    0% { color: #4ade80; transform: scale(1.3); }
    100% { color: inherit; transform: scale(1); }
}

@keyframes score-flash-negative {
    0% { color: #f87171; transform: scale(1.3); }
    100% { color: inherit; transform: scale(1); }
}

@keyframes overlay-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Trick card entrance */
.trick-card-enter {
    animation: card-appear 0.4s ease-out both;
}

/* Active opponent pulse */
.opponent-chip-active {
    animation: active-pulse 2s ease-in-out infinite;
}

/* Hand card staggered entrance */
.hand-card-enter {
    animation: hand-fan-in 0.4s ease-out both;
    animation-delay: calc(var(--card-index, 0) * 0.06s);
}

/* Bid button press feedback */
.bid-btn:active:not(:disabled) {
    animation: bid-press 0.3s ease;
}

/* Round results overlay entrance */
.round-results-enter {
    animation: overlay-fade-in 0.3s ease-out both;
}
.round-results-row-enter {
    animation: results-slide-in 0.4s ease-out both;
    animation-delay: calc(var(--row-index, 0) * 0.08s);
}

/* Score delta flash */
.score-delta-positive {
    display: inline-block;
    animation: score-flash-positive 0.6s ease both;
    animation-delay: calc(var(--row-index, 0) * 0.08s + 0.15s);
}
.score-delta-negative {
    display: inline-block;
    animation: score-flash-negative 0.6s ease both;
    animation-delay: calc(var(--row-index, 0) * 0.08s + 0.15s);
}

/* Final standings entrance */
.standings-enter {
    animation: overlay-fade-in 0.3s ease-out both;
}
.standing-row-enter {
    animation: standing-enter 0.5s ease-out both;
    animation-delay: calc(var(--row-index, 0) * 0.1s);
}
.standing-medal-enter {
    animation: medal-bounce 0.6s ease-out both;
    animation-delay: calc(var(--row-index, 0) * 0.1s + 0.15s);
}

/* ─── Chat Panel ─── */
.chat-panel {
    position: fixed;
    right: -22rem;
    top: 0;
    bottom: 0;
    width: 22rem;
    background: rgba(10, 22, 40, 0.97);
    border-left: 1px solid rgba(201, 168, 76, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: right 0.3s ease;
    backdrop-filter: blur(8px);
}

.chat-panel-visible {
    right: 0;
}

.chat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.chat-panel-header h3 {
    margin: 0;
    color: var(--shell-accent, #c9a84c);
    font-size: 1rem;
}

.chat-panel-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
}

.chat-panel-close:hover {
    color: rgba(255, 255, 255, 0.8);
}

.chat-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-message {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    max-width: 90%;
}

.chat-message-human {
    background: rgba(255, 255, 255, 0.08);
    align-self: flex-start;
}

.chat-message-ai {
    background: rgba(201, 168, 76, 0.12);
    border: 1px solid rgba(201, 168, 76, 0.2);
    align-self: flex-start;
}

.chat-message-header {
    margin-bottom: 0.2rem;
}

.chat-message-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--shell-accent, #c9a84c);
}

.chat-message-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
    word-break: break-word;
}

.chat-panel-input {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(201, 168, 76, 0.2);
}

.chat-panel-input input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    color: var(--shell-text, #e8ece9);
    font-size: 0.85rem;
}

.chat-panel-input input:focus {
    outline: none;
    border-color: var(--shell-accent, #c9a84c);
}

.chat-send-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* ─── Floating Game Toolbar ─── */
.game-floating-toolbar {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 199;
}
.toolbar-btn {
    background: rgba(10, 22, 40, 0.9);
    border: 1px solid rgba(201, 168, 76, 0.4);
    color: var(--shell-accent, #c9a84c);
    font-size: 1.1rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.toolbar-btn:hover {
    background: rgba(201, 168, 76, 0.15);
    transform: scale(1.05);
}
.toolbar-btn-active {
    background: rgba(201, 168, 76, 0.2);
    border-color: #c9a84c;
    box-shadow: 0 0 8px rgba(201, 168, 76, 0.3);
}
.toolbar-btn-unread {
    animation: chat-pulse 2s infinite;
}

.chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: white;
    font-size: 0.65rem;
    min-width: 1rem;
    height: 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes chat-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(201, 168, 76, 0); }
}

/* ─── Floating Chat Blurbs ─── */
.chat-blurb {
    position: absolute;
    padding: 0.5rem 0.85rem;
    border-radius: 0.75rem;
    max-width: 15rem;
    font-size: 0.88rem;
    z-index: 100;
    animation: blurb-appear 0.3s ease forwards, blurb-fade 0.5s ease 5.5s forwards;
    pointer-events: none;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.chat-blurb-human {
    background: rgba(20, 35, 55, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
}

.chat-blurb-ai {
    background: rgba(40, 30, 10, 0.88);
    border: 1px solid rgba(201, 168, 76, 0.5);
    color: #e2d0a0;
}

.chat-blurb-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--shell-accent, #c9a84c);
    margin-bottom: 0.2rem;
}

.chat-blurb-text {
    line-height: 1.3;
    word-break: break-word;
}

/* Position blurbs near player seats — pushed down to avoid RoundInfo/OpponentBar overlap */
.chat-blurb-self { bottom: 12rem; left: 50%; margin-left: -7.5rem; }
.chat-blurb-seat-0 { top: 30%; left: 5%; }
.chat-blurb-seat-1 { top: 30%; left: 25%; }
.chat-blurb-seat-2 { top: 30%; right: 25%; }
.chat-blurb-seat-3 { top: 30%; right: 5%; }
.chat-blurb-seat-4 { top: 45%; left: 5%; }
.chat-blurb-seat-5 { top: 45%; left: 25%; }
.chat-blurb-seat-6 { top: 45%; right: 25%; }
.chat-blurb-seat-7 { top: 45%; right: 5%; }
.chat-blurb-seat-8 { top: 55%; left: 15%; }
.chat-blurb-seat-9 { top: 55%; right: 15%; }

@keyframes blurb-appear {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes blurb-fade {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ─── Responsive: Tablet (768px – 1024px) ─── */
@media (max-width: 1024px) {
    .hand-card-img {
        width: 5rem;
    }

    .trick-card-img {
        width: 6rem;
    }

    .bidding-panel {
        padding: 1.25rem;
        max-width: 20rem;
    }

    .bid-btn {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1rem;
    }

    .score-overlay {
        width: min(28rem, 80vw);
    }

    .standings-card {
        min-width: 20rem;
        padding: 1.5rem;
    }

    .round-results-card {
        min-width: 18rem;
        max-width: 28rem;
    }
}

/* ─── Responsive: Phone (<768px) ─── */
@media (max-width: 768px) {
    .chat-panel {
        width: 100vw;
        right: -100vw;
        border-left: none;
    }

    .chat-panel-visible {
        right: 0;
    }

    .chat-blurb {
        max-width: 10rem;
        font-size: 0.72rem;
    }

    .opponent-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding-bottom: 0.25rem;
    }

    .opponent-chip {
        flex-shrink: 0;
    }

    .hand-card-img {
        width: 4.5rem;
    }

    .hand-card {
        margin-left: -0.7rem;
    }

    .hand-card:first-child {
        margin-left: 0;
    }

    .trick-card-img {
        width: 5rem;
    }

    .trick-area {
        min-height: 150px;
        gap: 0.75rem;
    }

    .trick-cards {
        gap: 0.6rem;
    }

    .score-overlay {
        width: 100vw;
        border-left: none;
        border-radius: 0;
    }

    .round-info-bar {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .bidding-panel {
        padding: 1rem;
        max-width: 90vw;
    }

    .bid-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.95rem;
        min-width: 44px;
        min-height: 44px;
    }

    .standings-card {
        min-width: auto;
        width: 90vw;
        padding: 1.25rem;
    }

    .round-results-card {
        min-width: auto;
        max-width: 90vw;
        padding: 1.25rem;
    }

    .game-status-msg {
        font-size: 0.82rem;
    }

    .viewer-stats-bar {
        font-size: 0.78rem;
        gap: 0.5rem;
        padding: 0.3rem 0.5rem;
    }

    .player-hand {
        padding: 0.35rem 0.5rem 0.5rem;
    }
}

/* ─── Responsive: Small phone (<480px) ─── */
@media (max-width: 480px) {
    .hand-card-img {
        width: 3.5rem;
    }

    .hand-card {
        margin-left: -0.8rem;
    }

    .hand-card:first-child {
        margin-left: 0;
    }

    .hand-card-label {
        font-size: 0.6rem;
    }

    .trick-card-img {
        width: 4rem;
    }

    .trick-cards {
        gap: 0.4rem;
    }

    .trick-card-name {
        font-size: 0.65rem;
    }

    .opponent-chip {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
        gap: 0.3rem;
    }

    .opponent-chip .badge {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }

    .round-info-bar {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        gap: 0.4rem 0.75rem;
    }

    .bidding-panel h3 {
        font-size: 1rem;
    }

    .bidding-panel p {
        font-size: 0.78rem;
    }

    .bid-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 0.9rem;
        min-width: 44px;
        min-height: 44px;
    }

    .bid-buttons {
        gap: 0.35rem;
    }

    .standings-card {
        padding: 1rem;
    }

    .standing-row {
        gap: 0.6rem;
        padding: 0.5rem 0;
    }

    .standing-medal {
        width: 2rem;
        height: 2rem;
    }

    .standing-score {
        font-size: 0.95rem;
    }

    .score-table {
        font-size: 0.78rem;
    }

    .score-table th,
    .score-table td {
        padding: 0.3rem;
    }

    .game-status-msg {
        font-size: 0.78rem;
    }

    .viewer-stats-bar {
        font-size: 0.72rem;
        gap: 0.4rem;
        padding: 0.25rem 0.4rem;
        flex-wrap: wrap;
    }

    .player-hand {
        padding: 0.25rem 0.25rem 0.4rem;
    }
}

/* ─── Responsive: Ultrawide (>1600px) ─── */
@media (min-width: 1600px) {
    .hand-card-img {
        width: 7rem;
    }

    .trick-card-img {
        width: 8rem;
    }

    .round-info-bar {
        font-size: 0.95rem;
    }

    .opponent-chip {
        font-size: 0.9rem;
        padding: 0.4rem 0.9rem;
    }

    .viewer-stats-bar {
        font-size: 0.95rem;
    }

    .trick-pause-card {
        padding: 2rem 3rem;
    }
}

/* ── Leave game confirmation modal ── */
.leave-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

.leave-modal {
    background: linear-gradient(145deg, #122640, #0e1f35);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 1rem;
    padding: 2rem 2.5rem;
    max-width: 24rem;
    width: 90vw;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), 0 0 12px rgba(201, 168, 76, 0.1);
    animation: modalSlideIn 0.2s ease-out;
}

.leave-modal-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.leave-modal-title {
    color: var(--shell-accent);
    margin: 0 0 0.75rem;
    font-size: 1.3rem;
}

.leave-modal-text {
    color: rgba(232, 236, 233, 0.8);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 1.5rem;
}

.leave-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.leave-modal-actions .btn {
    padding: 0.45rem 1.25rem;
    font-size: 0.85rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-danger {
    background-color: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background-color: #e74c3c;
    border-color: #e74c3c;
}

.btn-danger:disabled,
.btn-outline-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Enhanced turn indicator ── */
.your-turn-pulse {
    animation: turnPulse 1.5s ease-in-out infinite;
}

@keyframes turnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(201, 168, 76, 0.25); }
}

/* ── Accessibility: prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .leave-modal-backdrop,
    .leave-modal {
        animation: none;
    }
}
