.head {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin-bottom: 70px;
    background-color: var(--gray-dark);
}

/* h1,h2,h3,h4 and basic text styling for paragraphs */
h1,
h2,
h3,
h4,
p,
a {
    font-family: 'Roboto', sans-serif;
}

.header {
    width: 100%;
    background-color: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 5px solid var(--red-primary);
    margin-bottom: 10px;
}

.inner-header {
    max-width: 1200px;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.header-left {
    display: flex;
    flex-wrap: nowrap;
}

img.header-logo {
    margin-right: 15px;
    margin-left: 5px;
    width: 50px;
}

.header-title>h4 {
    padding-top: 10px;
    margin: 0px;
    font-family: 'Inknut Antiqua';
}

.header-title>h4>a {
    text-decoration: none;
    color: inherit;
}

.header-title>p {
    padding-top: 5px;
    margin: 0px;
    color: var(--gray-light-text);
    font-family: 'Inknut Antiqua';
}

.header-nav>a {
    text-decoration: none;
    color: var(--gray-light-text);
}

nav {
    height: 100%;
    max-width: 1200px;
    width: 100%;
}

/* Bootstrap navbar overrides to match site theme */
#top-nav-banner .navbar {
    background-color: var(--gray-light) !important;
    width: 100%;
}

#top-nav-banner .navbar-brand {
    font-family: 'Inknut Antiqua', serif;
    color: var(--gray-text) !important;
    font-size: 1.1rem;
}

#top-nav-banner .nav-link {
    color: var(--gray-light-text) !important;
    font-family: 'Roboto', sans-serif;
}

#top-nav-banner .nav-link:hover,
#top-nav-banner .nav-link.active {
    color: var(--red-primary) !important;
}

/* .section styling to maximize size to 1000px, automatically scale down, center this to the page. */
section {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 15px 25px 15px 25px;
    min-width: 0;
    background-color: var(--gray-light);
    border-radius: 15px;
    flex-wrap: nowrap;
    flex-direction: column;
}

.page-content {
    margin-left: 10px;
    margin-right: 10px;
}

.full-page {
    width: 100% !important;
    margin: 0 !important;
}

/* Card effects */
.playing-card {
    transition: transform 0.3s ease-in-out;
}

.playing-card:hover {
    transform: translateY(-20px);
}

@media screen and (min-width: 567px) {
    div:has(.regel-ruiten10:hover) .regel-r10-desc {
        display: block;
    }
    div:has(.regel-schoppen2:hover) .regel-r2s-desc {
        display: block;
    }
    div:has(.regel-schoppenaas:hover) .regel-r1s-desc {
        display: block;
    }
    div:has(.regel-klaveraas:hover) .regel-r1k-desc {
        display: block;
    }
    div:has(.regel-ruitenaas:hover) .regel-r1r-desc {
        display: block;
    }
    div:has(.regel-hartenaas:hover) .regel-r1h-desc {
        display: block;
    }
}

.regel-r2s-desc,
.regel-r1s-desc,
.regel-r1k-desc,
.regel-r1h-desc,
.regel-r1r-desc,
.regel-r10-desc {
    display: none;
}

/* On screens smaller than 566px, make playing cards smaller */
@media screen and (max-width: 566px) {
    .playing-card {
        width: 52px;
    }
}

/* button styling */
.btn-primary {
    background-color: var(--red-secondary);
    padding: 10px 20px;
    border-radius: 15px;
    display: inline-flex;
    border: 1px solid var(--gray-dark);
    color: #fff;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--red-quartinary);
    border: 1px solid var(--gray-dark);
    text-decoration: none;
}

.btn-primary:focus {
    background-color: var(--red-secondary) !important;
    border: 1px solid var(--gray-dark) !important;
    text-decoration: none !important;
    box-shadow: none;
}

.btn-primary:active {
    background-color: var(--red-secondary) !important;
    border: 1px solid var(--gray-dark) !important;
    text-decoration: none !important;
    box-shadow: none !important;
}


footer {
    width: 100%;
    background-color: var(--gray-light);
    position: fixed;
    bottom: 0;
    left: 0;
    border-top: 5px solid var(--red-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

/* ── Form elements ─────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--gray-text);
}

.form-group input[type="text"] {
    padding: 10px 12px;
    border: 2px solid var(--gray-dark);
    border-radius: 10px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    background-color: #f5f5f5;
    color: var(--gray-text);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    border-color: var(--red-primary);
}

.form-error {
    color: #c0392b;
    font-size: 0.9rem;
    margin-top: 6px;
    min-height: 1.2em;
}

/* ── Card panels ────────────────────────────────────────── */
.card-panel {
    background-color: #ebebeb;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-dark);
}

.card-panel h2 {
    margin-top: 0;
    margin-bottom: 16px;
}

.divider {
    text-align: center;
    color: var(--gray-light-text);
    margin: 10px 0 20px;
    font-size: 0.95rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    padding: 10px 20px;
    border-radius: 15px;
    display: inline-flex;
    border: 2px solid var(--gray-dark);
    color: var(--gray-light-text);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    margin-top: 8px;
}

.btn-secondary:hover {
    background-color: var(--gray-dark);
}

/* ── Lobby ──────────────────────────────────────────────── */
.session-code-display {
    font-size: 2.8rem;
    font-weight: bold;
    letter-spacing: 0.25em;
    color: var(--gray-text);
    font-family: 'Roboto', monospace;
    margin: 8px 0;
}

.lobby-label {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--gray-light-text);
    margin: 0 0 4px;
}

.lobby-hint {
    font-size: 0.9rem;
    color: var(--gray-light-text);
    margin: 4px 0 0;
}

.player-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-dark);
    font-size: 1rem;
}

.player-item:last-child {
    border-bottom: none;
}

.player-item.me {
    font-weight: bold;
}

.player-name {
    flex: 1;
}

.badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.badge.host {
    background-color: var(--red-primary);
    color: #fff;
}

.badge.you {
    background-color: var(--gray-dark);
    color: var(--gray-text);
}

/* ── Game board (Phase 2) ───────────────────────────────── */
.game-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}

.table-area {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    background-color: #4a7c59;
    border-radius: 16px;
    padding: 20px 28px;
    min-height: 120px;
    align-items: center;
}

.player-hand {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.playing-card {
    width: 70px;
    height: 100px;
    background: white;
    border-radius: 8px;
    border: 2px solid #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.3s ease-in-out;
}

.playing-card:hover {
    transform: translateY(-20px);
}

.playing-card.red {
    color: #c0392b;
}

.playing-card.black {
    color: #2c2c2c;
}

.playing-card.face-down {
    background: #2c5aa0;
    color: transparent;
    cursor: default;
}

.playing-card.face-down:hover {
    transform: none;
}

.turn-indicator {
    font-weight: bold;
    font-size: 1.1rem;
    color: #fff;
    background-color: var(--red-secondary);
    padding: 6px 16px;
    border-radius: 20px;
}

/* ── Opponent panels ────────────────────────────────────── */
.opponents-area {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 14px;
}

.opponent-panel {
    background-color: #ebebeb;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--gray-dark);
    flex: 1;
    min-width: 130px;
    max-width: 260px;
    text-align: center;
}

.opponent-panel.active-turn {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 2px rgba(233,0,0,0.2);
}

.opponent-label {
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.badge-info {
    color: var(--gray-light-text);
    font-size: 0.78rem;
}

/* Overlapping face-down cards */
.opponent-hand {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 60px;
}

.opponent-card {
    margin-left: -56px; /* ~80% overlap of 70px card */
    flex-shrink: 0;
}

.opponent-card:first-child {
    margin-left: 0;
}

/* ── Table items ────────────────────────────────────────── */
.table-item {
    width: 70px;
    min-height: 100px;
    background: white;
    border-radius: 8px;
    border: 2px solid #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.12);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    font-weight: bold;
    padding: 4px;
}

.table-item:hover {
    transform: translateY(-4px);
    box-shadow: 3px 6px 10px rgba(0,0,0,0.2);
}

.table-item.selected {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px rgba(233,0,0,0.25), 3px 6px 10px rgba(0,0,0,0.2);
    transform: translateY(-6px);
}

.table-item.drag-over {
    border-color: var(--red-tertiary);
    box-shadow: 0 0 0 3px rgba(233,0,0,0.15);
}

.table-item-build {
    background: #fffde7;
    border-style: dashed;
    border-color: #d4a017;
    min-height: 110px;
}

.table-item-build.selected {
    border-style: solid;
}

.table-item .card-rank { font-size: 1.2rem; line-height: 1.1; }
.table-item .card-suit { font-size: 1rem; }
.table-item.red   { color: #c0392b; }
.table-item.black { color: #2c2c2c; }

.build-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #b8860b;
    line-height: 1;
}

.build-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    margin-top: 4px;
}

.mini-card {
    font-size: 0.6rem;
    font-weight: bold;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 3px;
    color: #2c2c2c;
}

.mini-card.red { color: #c0392b; }

.table-empty-msg {
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
}

/* ── Action bar ─────────────────────────────────────────── */
.action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background-color: #ebebeb;
    border: 1px solid var(--gray-dark);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0;
}

.selection-info {
    flex: 1;
    font-size: 0.85rem;
    color: var(--gray-light-text);
    min-width: 100px;
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-cancel {
    background: none;
    border: 2px solid var(--gray-dark);
    border-radius: 10px;
    padding: 7px 12px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    color: var(--gray-light-text);
}

.btn-cancel:hover { background-color: var(--gray-dark); }

.btn-primary:disabled,
.btn-action-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Hand card selection state ──────────────────────────── */
.playing-card.selected-hand {
    border-color: var(--red-primary) !important;
    box-shadow: 0 0 0 3px rgba(233,0,0,0.3), 0 4px 14px rgba(0,0,0,0.2) !important;
    transform: translateY(-20px);
}

.playing-card.card-rank { font-size: 1.2rem; line-height: 1.1; }
.playing-card.card-suit { font-size: 1rem; }

/* ── Game status bar ────────────────────────────────────── */
.game-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── My hand area ───────────────────────────────────────── */
.my-hand-area {
    margin-top: 14px;
}

/* ── Board row: dealer + table ──────────────────────────── */
.board-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.dealer-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 80px;
}

.dealer-stack {
    width: 60px;
    height: 86px;
    background: #1a3a6e;
    border-radius: 7px;
    border: 2px solid #3a5a9e;
    box-shadow: 3px 3px 0 #0d2245, 4px 4px 0 #0d2245;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: default;
    position: relative;
}

.dealer-stack.dealing {
    animation: dealerPulse 0.5s ease-in-out;
}

.dealer-count {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--gray-light-text);
    text-align: center;
    line-height: 1.3;
}

/* ── Player stack visual ────────────────────────────────── */
.stack-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stack-card {
    width: 50px;
    height: 70px;
    background: #1a3a6e;
    border-radius: 6px;
    border: 2px solid #3a5a9e;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 #0d2245;
    position: relative;
}

.stack-card.empty {
    opacity: 0.3;
    background: var(--gray-dark);
    border-color: #888;
    box-shadow: none;
}

.stack-count {
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--gray-light-text);
    text-align: center;
}

.wip-badge {
    background: gold;
    color: #7a5c00;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 1px 5px;
    border-radius: 8px;
}

/* ── My area: hand + stack side by side ─────────────────── */
.my-area {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-top: 14px;
    flex-wrap: wrap;
}

.my-hand-area {
    flex: 1;
    min-width: 200px;
    margin-top: 0;
}

.my-stack-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 70px;
}

.my-stack-area .lobby-label {
    text-align: center;
}

/* ── Build owner label ──────────────────────────────────── */
.build-owner {
    font-size: 0.6rem;
    color: #b8860b;
    font-style: italic;
    margin-top: 3px;
    text-align: center;
    line-height: 1.1;
}

.table-item-build.mine {
    border-color: var(--red-secondary);
}

/* ── Game log ────────────────────────────────────────────── */
.game-log-panel {
    margin-top: 16px;
    background-color: #ebebeb;
    border: 1px solid var(--gray-dark);
    border-radius: 12px;
    overflow: hidden;
}

.game-log-header {
    padding: 10px 16px;
    font-weight: bold;
    font-size: 0.85rem;
    background-color: var(--gray-light);
    border-bottom: 1px solid var(--gray-dark);
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-log-entries {
    max-height: 160px;
    overflow-y: auto;
    padding: 6px 0;
}

.log-entry {
    padding: 5px 16px;
    font-size: 0.82rem;
    color: var(--gray-light-text);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    animation: logSlideIn 0.25s ease-out;
}

.log-entry:last-child { border-bottom: none; }

.log-entry.log-wip {
    color: #7a5c00;
    font-weight: bold;
    background: rgba(255, 215, 0, 0.2);
}

.log-entry.log-round {
    color: var(--red-secondary);
    font-weight: bold;
    background: rgba(190, 0, 0, 0.05);
}

.log-entry.log-point {
    color: #2a6a2a;
    font-weight: 600;
    background: rgba(0, 160, 0, 0.08);
    border-left: 3px solid #4caf50;
}

.log-entry.log-game {
    color: var(--gray-text);
    font-weight: bold;
}

/* ── Toasts ─────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    align-items: center;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 10px 20px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: toastIn 0.3s ease-out forwards;
    pointer-events: none;
    border: 2px solid var(--gray-dark);
}

.toast.toast-wip {
    background: gold;
    border-color: #b8860b;
    color: #7a5c00;
    font-size: 1.2rem;
}

.toast.toast-round {
    background: var(--gray-light);
    border-color: var(--red-secondary);
    color: var(--red-secondary);
}

.toast.toast-out {
    animation: toastOut 0.3s ease-in forwards;
}

/* ── Round overlay ──────────────────────────────────────── */
.deal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.2s ease-out;
}

.deal-overlay-box {
    background: var(--gray-light);
    border-radius: 16px;
    padding: 28px 40px;
    text-align: center;
    border: 3px solid var(--red-secondary);
}

.deal-overlay-box h2 { margin: 0 0 4px; color: var(--red-secondary); }
.deal-overlay-box p  { margin: 0; color: var(--gray-light-text); }

/* ── Animations ─────────────────────────────────────────── */
@keyframes cardPlaced {
    0%   { transform: translateY(-24px) scale(0.85); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cardTaken {
    0%   { transform: translateY(0) scale(1); opacity: 1; filter: brightness(1.4); }
    60%  { transform: translateY(-20px) scale(1.05); opacity: 0.6; }
    100% { transform: translateY(-50px) scale(0.5); opacity: 0; }
}

@keyframes wipFlash {
    0%, 100% { background-color: white; box-shadow: none; }
    40%      { background-color: gold; box-shadow: 0 0 24px gold; }
}

@keyframes dealerPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes logSlideIn {
    0%   { transform: translateX(-12px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes toastIn {
    0%   { transform: translateY(-16px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-16px); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.anim-placed { animation: cardPlaced 0.3s ease-out; }
.anim-taken  { animation: cardTaken  0.4s ease-in forwards; }
.anim-wip    { animation: wipFlash   0.8s ease-in-out; }

/* ── Score screen ────────────────────────────────────────── */
.score-screen { margin-top: 16px; }

.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 8px;
}

.score-table th,
.score-table td {
    padding: 7px 10px;
    border: 1px solid var(--gray-dark);
    text-align: center;
}

.score-table th {
    background-color: var(--gray-light);
    font-weight: bold;
    color: var(--gray-text);
}

.score-table td:first-child { text-align: left; font-weight: bold; }
.score-table tr:nth-child(even) { background-color: #f0f0f0; }
.score-table .highlight-cell { color: var(--red-secondary); font-weight: bold; }
.score-table .winner-row { background-color: rgba(255, 215, 0, 0.2) !important; }

.winner-banner {
    background: linear-gradient(135deg, gold, #ffcc00);
    border-radius: 12px;
    padding: 18px 24px;
    text-align: center;
    border: 2px solid #d4a017;
    margin-bottom: 16px;
}

.winner-banner h2 { margin: 0 0 6px; color: #7a5c00; font-size: 1.5rem; }
.winner-banner p  { margin: 0; color: #7a5c00; }

/* ── Patience card layout ────────────────────────────────── */
.patience-section {
    margin-bottom: 24px;
}

.patience-section h4 {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--gray-light-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.patience-grid {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.patience-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.patience-card {
    background: white;
    border-radius: 5px;
    border: 1px solid #ccc;
    padding: 4px 5px 0;
    font-weight: bold;
    font-size: 0.75rem;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: -52px;
    height: 72px;
    overflow: hidden;
    position: relative;
}

.patience-card:last-child {
    margin-bottom: 0;
    height: auto;
    min-height: 72px;
    padding-bottom: 6px;
}

.patience-card .pc-rank { display: block; font-size: 0.85rem; }
.patience-card .pc-suit { display: block; font-size: 0.75rem; }
.patience-card.red     { color: #c0392b; }
.patience-card.black   { color: #2c2c2c; }
.patience-card.special {
    background: #fff9e6;
    border-color: #d4a017;
    border-width: 2px;
}

.stack-summary-label {
    font-size: 0.78rem;
    color: var(--gray-light-text);
    margin: 6px 0 0;
    font-style: italic;
}

/* variables with colors codes */
:root {
    --orange-primary: #FFAE3E;
    --orange-secondary: #FFA500;
    --orange-tertiary: #F8C20F;

    --red-primary: #e90000;
    --red-secondary: #be0000;
    --red-tertiary: #e04242;
    --red-quartinary: #ff8080;

    --gray-light: #D9D9D9;
    --gray-dark: #b1b1b1;
    --gray-light-text: #2E2E2E;
    --gray-text: #121212;

}

/* ══════════════════════════════════════════════════════════
   Chat
   ══════════════════════════════════════════════════════════ */

/* ── Desktop side panel ─────────────────────────────────── */
.chat-panel {
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: #fff;
    border-left: 1px solid var(--gray-dark);
    display: flex;
    flex-direction: column;
    z-index: 900;
    box-shadow: -4px 0 12px rgba(0,0,0,0.08);
    transition: transform 0.25s ease;
}

.chat-panel.hidden {
    transform: translateX(100%);
}

.chat-panel-header {
    background: var(--red-primary);
    color: #fff;
    padding: 10px 14px;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-panel-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
}

.chat-msg {
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 10px;
    word-break: break-word;
    line-height: 1.35;
}

.chat-msg.mine {
    background: var(--red-primary);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.chat-msg.other {
    background: #ebebeb;
    color: var(--gray-light-text);
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

.chat-msg-nick {
    font-size: 0.68rem;
    font-weight: bold;
    opacity: 0.7;
    margin-bottom: 2px;
}

.chat-input-row {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--gray-dark);
    background: #fafafa;
    flex-shrink: 0;
}

.chat-input-row input {
    flex: 1;
    border: 1px solid var(--gray-dark);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-family: 'Roboto', sans-serif;
    outline: none;
}

.chat-input-row input:focus {
    border-color: var(--red-primary);
}

.chat-input-row button {
    background: var(--red-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Roboto', sans-serif;
}

.chat-input-row button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Toggle button (desktop, always visible) ────────────── */
.chat-toggle-btn {
    position: fixed;
    right: 290px;
    bottom: 20px;
    background: var(--red-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 901;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.25s ease;
}

.chat-toggle-btn.panel-hidden {
    right: 16px;
}

.chat-unread-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background: #ff3b30;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}

.chat-unread-dot.visible {
    display: block;
}

/* ── Mobile: floating bubble + modal ───────────────────── */
.chat-bubble {
    display: none; /* shown only on mobile */
    position: fixed;
    bottom: 20px;
    right: 16px;
    width: 52px;
    height: 52px;
    background: var(--red-primary);
    border-radius: 50%;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 1000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.chat-bubble .chat-unread-dot {
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
}

.chat-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1100;
    align-items: flex-end;
}

.chat-modal-overlay.open {
    display: flex;
}

.chat-modal {
    background: #fff;
    width: 100%;
    max-height: 75vh;
    border-radius: 18px 18px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpModal 0.22s ease-out;
}

@keyframes slideUpModal {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.chat-modal .chat-panel-header {
    border-radius: 18px 18px 0 0;
}

.chat-modal .chat-messages {
    max-height: 50vh;
}

@media screen and (max-width: 600px) {
    .chat-panel,
    .chat-toggle-btn { display: none !important; }

    .chat-bubble { display: flex; }
}

@media screen and (min-width: 601px) {
    .chat-bubble,
    .chat-modal-overlay { display: none !important; }
}


@media screen and (max-width: 600px) {

    section {
        padding: 10px 10px;
        border-radius: 10px;
    }

    /* Cards in MY hand + on table: smaller */
    .playing-card,
    .table-item {
        width: 52px;
        height: 74px;
        font-size: 0.85rem;
        border-radius: 6px;
    }

    .playing-card .card-rank,
    .table-item  .card-rank { font-size: 0.9rem; }
    .playing-card .card-suit,
    .table-item  .card-suit { font-size: 0.75rem; }

    /* Hover lifts are distracting on touch */
    .playing-card:hover             { transform: none; }
    .playing-card.selected-hand     { transform: translateY(-12px); }

    /* ── Opponent panels: all in one row, compact ── */
    .opponents-area {
        flex-wrap: nowrap;
        gap: 5px;
        margin-bottom: 8px;
        align-items: stretch;
    }
    .opponent-panel {
        min-width: 0;
        max-width: none;
        flex: 1;
        padding: 5px 5px;
        border-radius: 8px;
        text-align: center;
    }
    .opponent-label {
        font-size: 0.66rem;
        margin-bottom: 3px;
    }
    .opponent-label strong { font-size: 0.7rem; }
    .badge-info            { font-size: 0.6rem; }
    .opponent-hand         { min-height: 26px; }

    /* Opponent face-down cards: much smaller than hand cards */
    .playing-card.opponent-card {
        width: 22px !important;
        height: 32px !important;
        border-radius: 3px !important;
    }
    .opponent-card            { margin-left: -14px; }
    .opponent-card:first-child{ margin-left: 0; }

    /* Opponent stack visual */
    .opponent-panel .stack-count { font-size: 0.62rem; }

    /* ── Board row: dealer above table as compact strip, table full-width ── */
    .board-row {
        flex-direction: column;
        gap: 6px;
    }
    .dealer-area {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-width: 0;
        width: 100%;
        background: rgba(0,0,0,0.05);
        border-radius: 8px;
        padding: 4px 10px;
        flex-wrap: nowrap;
    }
    .dealer-stack {
        width: 28px;
        height: 40px;
        font-size: 0.8rem;
        box-shadow: 2px 2px 0 #0d2245;
        flex-shrink: 0;
    }
    .dealer-count { font-size: 0.7rem; white-space: nowrap; }

    /* Table area: full width, reduced padding */
    .table-area    { padding: 10px 8px; min-height: 80px; gap: 6px; }
    .table-item    { min-height: 74px; }

    /* ── My area: stack vertically ── */
    .my-area                    { flex-direction: column; align-items: stretch; gap: 8px; }
    .my-hand-area               { min-width: 0; }
    .my-stack-area              { flex-direction: row; align-items: center; gap: 10px; justify-content: center; min-width: 0; }
    .my-stack-area .lobby-label { display: none; }
    .stack-card                 { width: 38px; height: 54px; }

    /* Player hand: tighter gaps */
    .player-hand { gap: 4px; }

    /* Action bar: more compact */
    .action-bar                  { padding: 8px 10px; gap: 6px; }
    .action-buttons              { gap: 5px; }
    .btn-primary, .btn-secondary { padding: 10px 14px; font-size: 0.8rem; min-height: 44px; }

    /* Status bar */
    .game-status-bar { font-size: 0.8rem; }
    .turn-indicator  { font-size: 0.85rem; padding: 4px 10px; }

    /* Game log: smaller */
    .game-log-header  { font-size: 0.78rem; padding: 8px 12px; }
    .game-log-entries { max-height: 100px; }
    .log-entry        { font-size: 0.73rem; padding: 3px 8px; }

    /* Score screen patience cards */
    .patience-card            { height: 52px; margin-bottom: -36px; font-size: 0.65rem; padding: 3px 4px 0; }
    .patience-card:last-child { min-height: 52px; }
    .patience-card .pc-rank   { font-size: 0.7rem; }
    .patience-card .pc-suit   { font-size: 0.6rem; }
    .patience-grid            { gap: 4px; }

    /* Score table: smaller text */
    .score-table               { font-size: 0.75rem; }
    .score-table th,
    .score-table td            { padding: 4px 5px; }

    /* Session code display on lobby */
    .session-code-display { font-size: 1.6rem; }
}