    .highlight-move { box-shadow: inset 0 0 3px 3px rgba(255, 255, 0, 0.5); }
    .highlight-check { box-shadow: inset 0 0 3px 3px rgba(255, 0, 0, 0.5); }
    .highlight-premove { box-shadow: inset 0 0 3px 3px rgba(255, 170, 0, 0.5); }
    .highlight-last-move { box-shadow: inset 0 0 3px 3px rgba(100, 255, 100, 0.3); }
    /* Legal move hints (Yasal Hamleleri Göster) — pseudo-elements so themed
       square background-image patterns (--cb-*-img) are not clobbered. */
    .legal-move-target::after {
        content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
        background: radial-gradient(circle, rgba(20, 20, 20, 0.25) 16%, transparent 17%);
    }
    .legal-move-capture::after {
        content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
        background: radial-gradient(circle, transparent 62%, rgba(20, 20, 20, 0.22) 63%, rgba(20, 20, 20, 0.22) 79%, transparent 80%);
    }
    #board-container {
        width: 100%;
        max-width: min(560px, calc(100vw - 2rem));
        margin: 0 auto;
        position: relative;
        aspect-ratio: 1;
    }
    #board { width: 100%; height: 100%; }

    /* Resizable grid layout - overrides Tailwind grid-cols-12 on lg */
    @media (min-width: 1024px) {
        .game-grid.board-resizable {
            grid-template-columns: 1fr var(--board-width, 560px) 1fr !important;
        }
        .game-grid.board-resizable > .moves-section,
        .game-grid.board-resizable > .chat-section {
            grid-column: auto !important;
            min-width: 180px;
            overflow: hidden;
        }
        .game-grid.board-resizable > .board-section {
            grid-column: auto !important;
            max-width: none;
        }
        .game-grid.board-resizable #board-container {
            max-width: none;
        }
        /* Member/guest/computer arenas (top/bottom player cards removed, clocks
           live in the right-bar timers): the default board grows up to 640px on
           tall viewports but is capped by the vertical budget
           (viewport − navbar/footer/paddings ≈ 264px) so the page never scrolls
           on load. Specificity (1,1,0) stays below
           `.game-grid.board-resizable #board-container` (1,2,0), so a
           user-dragged size still wins. */
        .member-arena #board-container,
        .guest-arena #board-container,
        .computer-arena #board-container {
            max-width: min(640px, calc(100vw - 2rem), calc(100vh - 264px));
        }
    }

    /* Compact player cards when board is resized */
    .board-section.board-compact .game-player-card {
        padding: 8px 12px;
    }
    .board-section.board-compact .player-piece-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    .board-section.board-compact .player-card-info {
        gap: 0;
    }

    /* Resizable Board */
    .game-board-container {
        position: relative;
    }
    .game-board-container.resizing {
        user-select: none;
        -webkit-user-select: none;
    }
    .board-resize-handle {
        position: absolute;
        bottom: 2px;
        right: 2px;
        width: 22px;
        height: 22px;
        cursor: nwse-resize;
        z-index: 30;
        opacity: .35;
        transition: opacity 0.2s;
    }
    .game-board-container:hover .board-resize-handle {
        opacity: 0.5;
    }
    .board-resize-handle:hover {
        opacity: 1 !important;
    }
    .board-resize-handle svg {
        width: 100%;
        height: 100%;
    }

    /* Mobile responsive */
    @media (max-width: 1023px) {
        .game-grid {
            display: flex !important;
            flex-direction: column;
        }
        .game-grid > .board-section {
            order: 1;
        }
        /* Clocks + control buttons + offer banners live in .chat-section — pull it
           directly under the board so actions are reachable without a long scroll.
           The move list drops to the bottom (order 3). */
        .game-grid > .chat-section {
            order: 2;
        }
        .game-grid > .moves-section {
            order: 3;
        }
        .board-resize-handle {
            display: none;
        }
    }

    /* Promotion Modal */
    .promotion-modal {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
        border: 2px solid #718096;
        border-radius: 12px;
        padding: 16px;
        z-index: 1000;
        display: flex;
        gap: 12px;
        box-shadow: 0 10px 40px var(--card-shadow);
    }
    .promotion-modal .piece-option {
        width: 64px;
        height: 64px;
        cursor: pointer;
        border: 3px solid #a0aec0;
        border-radius: 8px;
        transition: all 0.15s ease;
        background-color: var(--color-bg-secondary);
        background-size: 85%;
        background-repeat: no-repeat;
        background-position: center;
    }
    .promotion-modal .piece-option:hover {
        border-color: #ffd700;
        transform: scale(1.1);
        background-color: #fff;
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    }
    .promotion-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    /* Chess Timer Styles */
    .chess-timer {
        font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
        font-size: 1.75rem;
        font-weight: 700;
        padding: 8px 16px;
        border-radius: 8px;
        min-width: 110px;
        text-align: center;
        letter-spacing: 1px;
        transition: all 0.3s ease;
    }
    .chess-timer.timer-normal {
        background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
        color: var(--color-text-primary);
        border: 2px solid var(--color-border);
        box-shadow: 0 2px 8px var(--card-shadow);
    }
    .chess-timer.timer-active {
        background: linear-gradient(135deg, #065f46 0%, #047857 100%);
        color: #ecfdf5;
        border: 2px solid #34d399;
        box-shadow: 0 0 15px rgba(52, 211, 153, 0.4);
    }
    .chess-timer.timer-warning {
        background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
        color: #fef3c7;
        border: 2px solid #fbbf24;
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    }
    .chess-timer.timer-danger {
        background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
        color: #fef2f2;
        border: 2px solid #f87171;
        box-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
    }

    /* Abort Countdown Bar */
    .abort-countdown-bar {
        width: 100%;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 10px;
        padding: 8px 12px 6px;
        border: 1px solid rgba(251, 191, 36, 0.3);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    /* Rakip masadan ayrıldı — forfeit geri sayımı (bana iyi haber → yeşil ton) */
    .opponent-left-banner {
        border-color: rgba(74, 222, 128, 0.4);
    }
    .opponent-left-banner .abort-countdown-inner {
        color: #86efac;
        font-size: 0.82rem;
        font-weight: 500;
        flex-wrap: wrap;
    }
    .abort-countdown-inner {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 6px;
    }
    .abort-icon {
        width: 16px;
        height: 16px;
        color: #fbbf24;
        flex-shrink: 0;
    }
    .abort-text {
        font-size: 0.8rem;
        color: #fde68a;
        font-weight: 500;
        flex: 1;
    }
    .abort-timer {
        font-family: 'JetBrains Mono', 'Fira Code', monospace;
        font-size: 1.1rem;
        font-weight: 700;
        color: #fbbf24;
        min-width: 28px;
        text-align: right;
        transition: color 0.3s;
    }
    .abort-timer-critical {
        color: #f87171;
        animation: abort-pulse 0.5s ease-in-out infinite alternate;
    }
    @keyframes abort-pulse {
        from { opacity: 1; }
        to { opacity: 0.5; }
    }
    .rt-spinner { width:38px;height:38px;border-radius:50%;border:3px solid rgba(251,146,60,.22);border-top-color:#fb923c;animation:rt-spin .9s linear infinite; }
    @keyframes rt-spin { to { transform:rotate(360deg); } }
    @media (prefers-reduced-motion: reduce) { .rt-spinner { animation:none; } }
    .abort-progress-track {
        height: 3px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
        overflow: hidden;
    }
    .abort-progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #fbbf24, #f59e0b);
        border-radius: 2px;
        transition: width 0.15s linear;
    }
    .abort-fill-critical {
        background: linear-gradient(90deg, #f87171, #ef4444);
    }

    /* Game Control Buttons - Apple Style */
    .game-btn {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        background: var(--color-border);
        border: 1px solid var(--color-input-border);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: var(--color-text-primary);
        position: relative;
        overflow: hidden;
    }
    .game-btn::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
        border-radius: 11px;
        pointer-events: none;
    }
    .game-btn:hover {
        background: var(--color-input-border);
        border-color: var(--color-input-border);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px var(--card-shadow);
    }
    .game-btn:active {
        transform: translateY(0);
        background: var(--color-bg-hover);
    }
    .game-btn svg {
        width: 20px;
        height: 20px;
        position: relative;
        z-index: 1;
    }

    /* Semantic button colors - subtle tints */
    .game-btn-draw {
        background: rgba(251, 191, 36, 0.15);
        border-color: rgba(251, 191, 36, 0.25);
        color: var(--color-warning);
    }
    .game-btn-draw:hover {
        background: rgba(251, 191, 36, 0.25);
        border-color: rgba(251, 191, 36, 0.4);
    }

    .game-btn-resign {
        background: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.25);
        color: var(--color-error);
    }
    .game-btn-resign:hover {
        background: rgba(239, 68, 68, 0.25);
        border-color: rgba(239, 68, 68, 0.4);
    }

    .game-btn-rematch {
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.25);
        color: var(--color-success);
    }
    .game-btn-rematch:hover {
        background: rgba(34, 197, 94, 0.25);
        border-color: rgba(34, 197, 94, 0.4);
    }
    .game-btn-rematch.offered {
        background: rgba(249, 115, 22, 0.15);
        border-color: rgba(249, 115, 22, 0.25);
        color: var(--color-warning);
    }
    .game-btn-rematch.offered:hover {
        background: rgba(249, 115, 22, 0.25);
        border-color: rgba(249, 115, 22, 0.4);
    }
    .game-btn-rematch.cooldown {
        background: rgba(107, 114, 128, 0.15);
        border-color: rgba(107, 114, 128, 0.2);
        color: #9ca3af;
        cursor: not-allowed;
    }

    .game-btn-analyze {
        background: var(--color-accent-muted);
        border-color: var(--color-accent);
        color: var(--color-accent);
    }
    .game-btn-analyze:hover {
        background: var(--color-accent-muted);
        border-color: var(--color-accent);
        filter: brightness(1.15);
    }

    .game-btn-newopp {
        background: rgba(34, 197, 94, 0.12);
        border-color: rgba(34, 197, 94, 0.30);
        color: #22c55e;
    }
    .game-btn-newopp:hover:not(:disabled) {
        background: rgba(34, 197, 94, 0.22);
        border-color: rgba(34, 197, 94, 0.45);
        box-shadow: 0 4px 16px rgba(34, 197, 94, 0.18);
    }
    .game-btn-newopp:disabled {
        opacity: 0.5;
        cursor: default;
    }

    .game-btn-room {
        background: rgba(139, 92, 246, 0.12);
        border-color: rgba(139, 92, 246, 0.22);
        color: #a78bfa;
        position: relative;
    }
    .game-btn-room::after {
        content: '';
        position: absolute;
        inset: 1px;
        border-radius: 10px;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
        pointer-events: none;
    }
    .game-btn-room:hover {
        background: rgba(139, 92, 246, 0.22);
        border-color: rgba(139, 92, 246, 0.38);
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15);
    }

    .game-btn-waiting {
        background: rgba(251, 191, 36, 0.1);
        border-color: rgba(251, 191, 36, 0.2);
        color: var(--color-warning);
        cursor: default;
    }

    #board-container .board-b72b1 {
        border: 2px solid var(--cb-border, #404040);
        border-radius: var(--cb-radius, 0px);
    }
    #board-container .white-1e1d7 {
        background-color: var(--cb-light, #f0d9b5) !important;
    }
    #board-container .black-3c85d {
        background-color: var(--cb-dark, #b58863) !important;
    }

    /* ============================================
       GAME PAGE - MODERN GLASS UI (Apple-style)
       ============================================ */

    /* Base Glass Card */
    .game-glass-card {
        background: linear-gradient(135deg,
            var(--glass-bg) 0%,
            var(--glass-bg-heavy) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--color-border);
        border-radius: 16px;
        box-shadow:
            0 4px 24px -1px var(--card-shadow),
            0 0 0 1px rgba(255, 255, 255, 0.05) inset;
        overflow: hidden;
    }

    .game-card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        background: linear-gradient(180deg,
            var(--color-input-bg) 0%,
            transparent 100%);
        border-bottom: 1px solid var(--color-border);
    }

    .game-icon-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .game-icon-purple {
        background: var(--color-accent-muted);
        color: var(--color-accent);
    }

    .game-icon-blue {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.3) 100%);
        color: var(--color-info);
    }

    .game-icon-green {
        background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.3) 100%);
        color: var(--color-success);
    }

    /* Time Control Badge */
    .game-time-control-badge {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 14px 20px;
    }

    .time-control-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        background: var(--color-accent-muted);
        border-radius: 10px;
        color: var(--color-accent);
    }

    .time-control-text {
        font-size: 16px;
        font-weight: 700;
        color: var(--color-text-primary);
        font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
        letter-spacing: 0.05em;
    }

    /* Moves List */
    .moves-list {
        padding: 8px 12px;
        max-height: 320px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
    }

    .moves-list::-webkit-scrollbar {
        width: 4px;
    }

    .moves-list::-webkit-scrollbar-thumb {
        background: var(--color-scrollbar-thumb);
        border-radius: 2px;
    }

    .move-row {
        display: flex;
        align-items: center;
        padding: 6px 8px;
        border-radius: 6px;
        transition: background 0.15s ease;
    }

    .move-row:hover {
        background: var(--color-input-bg);
    }

    .move-number {
        width: 32px;
        font-size: 11px;
        font-weight: 500;
        color: var(--color-text-muted);
        font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    }

    .move-san {
        width: 64px;
        font-size: 13px;
        font-weight: 500;
        color: var(--color-text-secondary);
        font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    }

    .moves-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 32px 16px;
        color: var(--color-text-muted);
    }

    .moves-empty svg {
        margin-bottom: 8px;
        opacity: 0.3;
    }

    .moves-empty p {
        font-size: 12px;
        margin: 0;
    }

    /* Room Members */
    .room-count-badge {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 24px;
        height: 24px;
        padding: 0 8px;
        background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.3) 100%);
        border: 1px solid rgba(34, 197, 94, 0.3);
        border-radius: 12px;
        font-size: 11px;
        font-weight: 600;
        color: var(--color-success);
    }

    .room-members-list {
        max-height: 140px;
        overflow-y: auto;
        padding: 8px;
        scrollbar-width: thin;
        scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
    }

    .room-member-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 8px 10px;
        border-radius: 8px;
        transition: background 0.15s ease;
    }

    .room-member-row:hover {
        background: var(--color-input-bg);
    }

    .member-status-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .member-name {
        font-size: 13px;
        font-weight: 500;
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: color 0.15s ease;
    }

    .member-name:hover {
        color: var(--color-info);
    }

    .member-rating {
        font-size: 11px;
        font-weight: 600;
        color: var(--color-text-muted);
        font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    }

    .room-members-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 24px 16px;
        color: var(--color-text-muted);
    }

    .room-members-empty svg {
        margin-bottom: 6px;
        opacity: 0.3;
    }

    .room-members-empty p {
        font-size: 12px;
        margin: 0;
    }

    /* Player Cards */
    .game-player-card {
        background: linear-gradient(135deg,
            var(--glass-bg) 0%,
            var(--glass-bg-heavy) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--color-border);
        border-radius: 14px;
        padding: 14px 16px;
        box-shadow: 0 4px 20px -2px var(--card-shadow);
    }

    .player-card-content {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .player-piece-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, var(--color-border) 0%, rgba(255, 255, 255, 0.02) 100%);
        border: 1px solid var(--color-input-border);
        border-radius: 12px;
        font-size: 24px;
    }

    .game-player-avatar {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        object-fit: cover;
        display: block;
    }

    .player-card-info {
        flex: 1;
    }

    .player-card-name {
        font-size: 15px;
        font-weight: 600;
        color: var(--color-text-primary);
        cursor: pointer;
        transition: color 0.15s ease;
    }

    .player-card-name:hover {
        color: var(--color-info);
    }

    .player-card-rating {
        font-size: 13px;
        color: var(--color-text-muted);
        margin-top: 2px;
    }

    .rating-change {
        font-weight: 600;
    }

    .rating-up {
        color: var(--color-success);
    }

    .rating-down {
        color: var(--color-error);
    }

    /* Board Container */
    .game-board-container {
        background: linear-gradient(135deg,
            var(--glass-bg) 0%,
            var(--glass-bg-heavy) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--color-border);
        border-radius: 16px;
        padding: 16px;
        box-shadow:
            0 8px 32px -4px var(--card-shadow),
            0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    }

    /* Premove Indicator */
    .premove-indicator {
        margin-top: 10px;
        text-align: center;
        font-size: 13px;
        color: var(--color-warning);
    }

    .premove-clear-btn {
        margin-left: 8px;
        font-size: 11px;
        text-decoration: underline;
        color: var(--color-warning);
        background: none;
        border: none;
        cursor: pointer;
        transition: color 0.15s ease;
    }

    .premove-clear-btn:hover {
        color: #fde68a;
    }

    /* Game Status Area */
    .game-status-area {
        margin-top: 16px;
        text-align: center;
    }

    .status-connecting,
    .status-waiting {
        font-size: 14px;
        color: var(--color-warning);
    }

    .status-your-turn {
        font-size: 14px;
        font-weight: 600;
        color: var(--color-success);
    }

    .status-opponent-turn {
        font-size: 14px;
        color: var(--color-warning);
    }

    .status-spectator {
        font-size: 14px;
        color: var(--color-text-muted);
    }

    .status-result {
        font-size: 20px;
        font-weight: 700;
        color: var(--color-text-primary);
    }

    .status-error {
        font-size: 14px;
        color: var(--color-error);
    }

    /* Timer Cards */
    .game-timer-card {
        background: linear-gradient(135deg,
            var(--glass-bg) 0%,
            var(--glass-bg-heavy) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--color-border);
        border-radius: 14px;
        padding: 14px 16px;
        box-shadow: 0 4px 20px -2px var(--card-shadow);
    }

    .timer-card-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .timer-player-info {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .timer-piece-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, var(--color-border) 0%, rgba(255, 255, 255, 0.02) 100%);
        border: 1px solid var(--color-border);
        border-radius: 10px;
        font-size: 18px;
    }

    /* Name + ELO stacked vertically next to the timer piece icon (the standalone
       top/bottom player cards were removed to reclaim vertical space). */
    .timer-player-meta {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        gap: 1px;
    }

    .timer-player-name {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        font-weight: 600;
        color: var(--color-text-secondary);
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
        transition: color 0.15s ease;
    }

    /* The username text truncates; the presence dot must never shrink away. */
    .timer-player-name > span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .timer-player-name .presence-dot {
        flex: 0 0 auto;
    }

    .timer-player-name:hover {
        color: var(--color-info);
    }

    .timer-player-rating {
        font-size: 12px;
        font-weight: 500;
        line-height: 1.2;
        color: var(--color-text-muted);
    }

    /* Stacked timer card (guest + computer arenas): nickname (small colour icon
       at its start) on top, full-width clock underneath. Guest has no sub-line
       (nicks already read as guests); computer keeps its level chip inline on
       the name row. */
    .guest-timer-card,
    .computer-timer-card {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 10px 14px;   /* a touch tighter than the default 14px so the
                                 stacked (nick over clock) card stays compact */
    }
    .guest-timer-player,
    .computer-timer-player {
        display: flex;
        align-items: center;
        gap: 7px;
        min-width: 0;
    }
    .guest-timer-icon,
    .computer-timer-icon {
        flex: 0 0 auto;
        font-size: 18px;
        line-height: 1;
        color: var(--color-text-secondary);
    }
    .guest-timer-card .timer-player-name,
    .computer-timer-card .timer-player-name {
        max-width: none;   /* fill the row; ellipsis still trims overflow */
        min-width: 0;
    }
    /* level chip sits after the name and never shrinks */
    .computer-timer-player .cpu-tag {
        flex: 0 0 auto;
        margin-left: 0;
    }
    .guest-timer-card .chess-timer,
    .computer-timer-card .chess-timer {
        width: 100%;         /* clock spans the whole card width */
        font-size: 1.4rem;   /* slightly smaller so the stacked card isn't tall */
        padding: 6px 12px;
    }

    /* Guest/computer game result under the board — result + reason on ONE centered
       line so it reuses the (otherwise empty on game-end) turn-indicator row and
       doesn't grow the board column. Result text was moved here out of the right
       column. */
    .guest-status-result,
    .computer-status-result {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: center;
        gap: 6px 8px;
    }
    .guest-status-result .status-result,
    .computer-status-result .status-result {
        font-size: 18px;
    }
    .guest-status-result .guest-result-reason,
    .computer-status-result .cpu-result-reason {
        margin-top: 0;   /* stay on the same baseline as the result */
    }

    /* Chat Card */
    .game-chat-card {
        display: flex;
        flex-direction: column;
        max-height: 380px;
    }

    .game-chat-messages {
        flex: 1;
        min-height: 0;
        max-height: 180px;
        overflow-y: auto;
        padding: 10px 14px;
        scrollbar-width: thin;
        scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
    }

    .chat-msg {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .chat-msg:last-child {
        margin-bottom: 0;
    }

    .chat-msg-system {
        font-style: italic;
    }

    .chat-msg-system-text {
        color: var(--color-text-muted);
    }

    .chat-system-notice {
        font-size: 11px;
        color: var(--color-text-muted);
        font-style: italic;
        padding: 2px 6px;
        border-left: 2px solid var(--color-input-border);
        display: block;
    }

    .chat-msg-emoji {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 0;
    }

    .chat-msg-sender {
        font-size: 12px;
        font-weight: 600;
        color: var(--color-info);
        cursor: pointer;
        transition: color 0.15s ease;
    }

    .chat-msg-sender:hover {
        text-decoration: underline;
    }

    .chat-emoji-big {
        font-size: 24px;
    }

    .chat-msg-content {
        color: var(--color-text-secondary);
    }

    .chat-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 24px;
        color: var(--color-text-muted);
    }

    .chat-empty svg {
        margin-bottom: 6px;
        opacity: 0.3;
    }

    .chat-empty p {
        font-size: 12px;
        margin: 0;
    }

    /* Quick Messages */
    .chat-quick-messages {
        display: flex;
        border-top: 1px solid var(--color-border);
    }

    .chat-quick-btn {
        flex: 1;
        padding: 8px 4px;
        font-size: 11px;
        font-weight: 500;
        color: var(--color-text-muted);
        background: transparent;
        border: none;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chat-quick-btn:hover {
        color: var(--color-text-primary);
        background: var(--color-input-bg);
    }

    .chat-quick-btn-border {
        border-right: 1px solid var(--color-border);
    }

    /* Emoji Bar */
    .chat-emoji-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
        border-top: 1px solid var(--color-border);
        background: var(--color-input-bg);
    }

    .chat-emoji-quick {
        display: flex;
        gap: 4px;
    }

    .chat-emoji-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        font-size: 18px;
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chat-emoji-btn:hover {
        background: var(--color-bg-hover);
        transform: scale(1.1);
    }

    .chat-emoji-btn:active {
        transform: scale(0.95);
    }

    .chat-emoji-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        color: var(--color-text-muted);
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chat-emoji-toggle:hover {
        color: var(--color-text-primary);
        background: var(--color-bg-hover);
    }

    /* Emoji Picker */
    .chat-emoji-picker {
        margin: 8px 14px;
        padding: 10px;
        background: var(--glass-bg);
        border: 1px solid var(--color-input-border);
        border-radius: 12px;
    }

    .chat-emoji-grid {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
    }

    .chat-emoji-grid-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        font-size: 16px;
        background: transparent;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chat-emoji-grid-btn:hover {
        background: var(--color-input-border);
        transform: scale(1.1);
    }

    /* Chat Input */
    .chat-input-area {
        padding: 12px 14px;
        border-top: 1px solid var(--color-border);
    }

    .chat-input-form {
        display: flex;
        gap: 8px;
    }

    .chat-input {
        flex: 1;
        min-width: 0;
        padding: 10px 14px;
        background: var(--color-input-bg);
        border: 1px solid var(--color-border);
        border-radius: 10px;
        font-size: 13px;
        color: var(--color-text-primary);
        transition: all 0.15s ease;
    }

    .chat-input:focus {
        outline: none;
        border-color: rgba(59, 130, 246, 0.5);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .chat-input::placeholder {
        color: var(--color-text-muted);
    }

    .chat-send-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.4) 100%);
        border: 1px solid rgba(59, 130, 246, 0.3);
        border-radius: 10px;
        color: var(--color-info);
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .chat-send-btn:hover {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.4) 0%, rgba(37, 99, 235, 0.5) 100%);
        transform: scale(1.05);
    }

    /* ============================================
       GAME TAB SYSTEM
       ============================================ */
    .game-tabs {
        display: flex;
        border-bottom: 1px solid var(--color-border);
    }

    .game-tab {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
        font-weight: 600;
        color: var(--color-text-muted);
        background: transparent;
        border: none;
        cursor: pointer;
        position: relative;
        transition: color 0.2s ease;
        text-align: center;
    }

    .game-tab:hover {
        color: var(--color-text-secondary);
    }

    .game-tab.active {
        color: var(--color-text-primary);
    }

    .game-tab.active::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--color-accent);
        border-radius: 2px 2px 0 0;
    }

    .game-tab-content {
        display: none;
    }

    .game-tab-content.active {
        display: block;
    }

    /* Chat tab notification glow */
    .game-tab.chat-notify {
        color: var(--color-success);
        animation: chatTabPulse 1.5s ease-in-out infinite;
    }

    @keyframes chatTabPulse {
        0%, 100% { background: transparent; }
        50% { background: rgba(34, 197, 94, 0.12); }
    }

    /* Rated/Unrated badge in time control */
    .time-control-rated-badge {
        font-size: 11px;
        font-weight: 600;
        padding: 2px 8px;
        border-radius: 6px;
    }

    .time-control-rated-badge.rated {
        background: rgba(34, 197, 94, 0.15);
        color: var(--color-success);
        border: 1px solid rgba(34, 197, 94, 0.3);
    }

    .time-control-rated-badge.casual {
        background: rgba(156, 163, 175, 0.15);
        color: var(--color-text-muted);
        border: 1px solid rgba(156, 163, 175, 0.3);
    }

    /* Game Controls Body */
    .game-controls-body {
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .game-control-buttons {
        display: flex;
        justify-content: center;
        gap: 12px;
    }

    /* Custom Tooltip System */
    .game-btn-tip {
        position: relative;
    }
    .game-btn-tip::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%) translateY(4px);
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        color: #f1f5f9;
        background: rgba(15, 23, 42, 0.88);
        border: 1px solid rgba(148, 163, 184, 0.15);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease;
        z-index: 50;
        letter-spacing: 0.01em;
    }
    .game-btn-tip::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: rgba(15, 23, 42, 0.88);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        z-index: 50;
    }
    .game-btn-tip:hover::after {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    .game-btn-tip:hover::before {
        opacity: 1;
    }

    /* Session Score Badge */
    .session-score-badge {
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.2) 100%);
        border: 1px solid rgba(245, 158, 11, 0.3);
        border-radius: 12px;
        padding: 10px 14px;
    }

    .session-score-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        font-size: 12px;
    }

    .session-label {
        color: var(--color-warning);
        font-weight: 500;
    }

    .session-players {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .session-player-name {
        font-size: 12px;
        font-weight: 600;
        color: var(--color-text-primary);
        max-width: 64px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
        transition: color 0.15s ease;
    }

    .session-player-name:hover {
        color: var(--color-info);
    }

    .session-score {
        padding: 4px 10px;
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(217, 119, 6, 0.4) 100%);
        border-radius: 16px;
        font-weight: 700;
        color: #fff;
    }

    .session-game-number {
        color: var(--color-warning);
        font-size: 11px;
    }

    /* Spectator Notice */
    .spectator-notice {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 14px;
        background: var(--color-input-bg);
        border: 1px solid var(--color-border);
        border-radius: 10px;
        font-size: 13px;
        color: var(--color-text-muted);
    }

    /* Offer Cards */
    .offer-received-card {
        padding: 14px;
        border-radius: 12px;
        text-align: center;
    }

    .offer-draw {
        background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(202, 138, 4, 0.2) 100%);
        border: 1px solid rgba(234, 179, 8, 0.3);
    }

    .offer-rematch {
        background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.2) 100%);
        border: 1px solid rgba(59, 130, 246, 0.3);
    }

    .offer-text {
        font-size: 13px;
        font-weight: 500;
        color: var(--color-text-primary);
        margin: 0 0 12px 0;
    }

    .offer-actions {
        display: flex;
        justify-content: center;
        gap: 8px;
    }

    .offer-btn {
        padding: 8px 16px;
        font-size: 12px;
        font-weight: 600;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .offer-accept {
        background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, rgba(22, 163, 74, 0.4) 100%);
        color: var(--color-success);
        border: 1px solid rgba(34, 197, 94, 0.3);
    }

    .offer-accept:hover {
        background: linear-gradient(135deg, rgba(34, 197, 94, 0.4) 0%, rgba(22, 163, 74, 0.5) 100%);
        transform: scale(1.02);
    }

    .offer-decline {
        background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(220, 38, 38, 0.4) 100%);
        color: var(--color-error);
        border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .offer-decline:hover {
        background: linear-gradient(135deg, rgba(239, 68, 68, 0.4) 0%, rgba(220, 38, 38, 0.5) 100%);
        transform: scale(1.02);
    }

    /* Session Ended Notice */
    .session-ended-notice {
        padding: 10px 14px;
        background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.15) 100%);
        border: 1px solid rgba(245, 158, 11, 0.25);
        border-radius: 10px;
        text-align: center;
    }

    .session-ended-notice p {
        font-size: 13px;
        color: var(--color-warning);
        margin: 0;
    }

    /* Emoji Animation */
    @keyframes emoji-pop {
        0% { transform: scale(0.5); opacity: 0; }
        50% { transform: scale(1.2); }
        100% { transform: scale(1); opacity: 1; }
    }

    .animate-emoji-pop {
        animation: emoji-pop 0.3s ease-out;
    }

    /* Yetersiz jeton uyarısı (cam kart, alert DEĞİL) */
    .wager-warning-overlay {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px;
        background: rgba(245, 245, 245, 0.55);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
    html.dark .wager-warning-overlay {
        background: rgba(26, 26, 46, 0.5);
    }
    .ww-anim-enter { transition: opacity .16s cubic-bezier(.4, 0, .2, 1); }
    .ww-anim-leave { transition: opacity .24s cubic-bezier(.4, 0, .2, 1); }
    .ww-anim-from { opacity: 0; }
    .ww-anim-to { opacity: 1; }

    .wager-warning-card {
        position: relative;
        width: 100%;
        max-width: 400px;
        padding: 30px 28px 24px;
        text-align: center;
        background: var(--glass-bg);
        border: 1px solid var(--color-border);
        border-radius: 16px;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
        overflow: hidden;
        animation: wwCardIn 0.26s cubic-bezier(.4, 0, .2, 1);
    }
    .wager-warning-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--color-warning), var(--color-accent-secondary));
    }
    @keyframes wwCardIn {
        from { opacity: 0; transform: translateY(8px) scale(0.97); }
        to   { opacity: 1; transform: none; }
    }

    .ww-icon {
        width: 56px;
        height: 56px;
        margin: 0 auto 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        color: var(--color-warning);
        background: color-mix(in srgb, var(--color-warning) 14%, transparent);
        border: 1px solid color-mix(in srgb, var(--color-warning) 35%, transparent);
    }
    .ww-icon svg { width: 30px; height: 30px; }

    .ww-title {
        font-size: 1.18rem;
        font-weight: 700;
        color: var(--color-text-primary);
        margin-bottom: 8px;
    }
    .ww-msg {
        font-size: 0.95rem;
        color: var(--color-text-secondary);
        margin-bottom: 6px;
    }
    .ww-msg strong {
        color: var(--color-warning);
        font-weight: 700;
    }
    .ww-balance {
        font-size: 0.9rem;
        color: var(--color-text-muted);
        margin-bottom: 20px;
    }
    .ww-balance strong {
        color: var(--color-text-primary);
        font-weight: 700;
    }

    .ww-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .ww-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 11px 18px;
        border-radius: 11px;
        font-size: 0.95rem;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        border: 1px solid transparent;
        transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
    }
    .ww-btn:hover { transform: translateY(-1px); }
    .ww-btn:active { transform: translateY(0); }

    .ww-lower {
        color: #fff;
        background: linear-gradient(135deg, var(--color-accent), var(--color-accent-secondary));
        box-shadow: 0 8px 20px color-mix(in srgb, var(--color-accent) 35%, transparent);
    }
    .ww-lower:hover {
        box-shadow: 0 10px 26px color-mix(in srgb, var(--color-accent) 45%, transparent);
    }
    .ww-buy {
        color: var(--color-text-primary);
        background: var(--color-bg-tertiary);
        border-color: var(--color-border);
    }
    .ww-buy:hover { background: var(--color-bg-hover); }
    .ww-close {
        color: var(--color-text-muted);
        background: transparent;
    }
    .ww-close:hover { color: var(--color-text-primary); }

    @media (prefers-reduced-motion: reduce) {
        .wager-warning-card { animation: none !important; }
        .ww-btn:hover, .ww-btn:active { transform: none !important; }
    }

    /* Responsive */
    @media (max-width: 1024px) {
        .game-glass-card,
        .game-player-card,
        .game-timer-card,
        .game-board-container {
            border-radius: 12px;
        }
    }

    /* === MOBILE ARENA (marena) === */
    /* Phone-only arena shell shared by the *-mobile blades (computer/guest/member).
       Fully scoped under .marena so the desktop .game-grid layout is untouched.
       Colours use existing theme vars only — verified in both light and dark themes. */
    .marena {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        /* bottom padding clears the sticky action bar so .marena-below scrolls free */
        padding: 8px 8px calc(12px + var(--safe-bottom, 0px));
    }

    /* Player cards (opponent on top, self below the board) */
    .marena-card {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 12px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
    }
    .marena-card-info { margin-right: auto; min-width: 0; }
    .marena-card-name {
        display: flex; align-items: center; gap: 4px;
        font-weight: 600; font-size: 0.95rem; color: var(--color-text-primary);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .marena-card-icon { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }
    .marena-card .chess-timer {
        font-size: 1.35rem; min-width: 78px; text-align: right; flex-shrink: 0;
    }

    /* Topcard meta chips — time-control (all arenas) + compact series score (member).
       Sit between .marena-card-info (margin-right:auto pushes them right) and the
       clock; stack vertically so the horizontal footprint stays one-chip wide. */
    .marena-chips {
        display: flex; flex-direction: column; align-items: flex-end;
        gap: 3px; flex-shrink: 0;
    }
    .marena-chip {
        display: inline-flex; align-items: center; gap: 4px;
        padding: 2px 8px; border-radius: 8px;
        font-size: 0.7rem; font-weight: 600; line-height: 1.4;
        color: var(--color-text-muted);
        background: var(--glass-bg-heavy);
        border: 1px solid var(--glass-border);
        white-space: nowrap;
    }
    .marena-series-chip strong { color: var(--color-text-secondary); font-weight: 700; }

    /* Board — full-bleed. Break out of the .marena side padding so the board
       spans edge-to-edge. .game-board-container padding is MEASURED by
       boardSizeChrome(), so zeroing it here is safe. Height-capped so the
       board + two cards + action bar fit one phone screen. */
    .marena-board { margin: 0 -8px; }
    .marena .game-board-container { padding: 0; border: none; }
    .marena #board-container {
        max-width: min(100vw, calc(100dvh - 220px));
        margin: 0 auto;
    }

    /* Status line under the board (turn / engine-booting text) */
    .marena-status {
        min-height: 20px;
        text-align: center;
        font-size: 0.85rem;
    }

    /* Offer/notice banners — sit directly above the action bar (empty on computer) */
    .marena-banners:empty { display: none; }
    .marena-banner {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border-radius: 12px;
        background: var(--glass-bg-heavy);
        border: 1px solid var(--glass-border);
        font-size: 0.85rem;
        color: var(--color-text-primary);
    }
    .marena-banner-text { margin-right: auto; min-width: 0; }
    .marena-banner-actions { display: flex; gap: 6px; flex-shrink: 0; }

    /* Sticky action bar — pinned to the bottom, safe-area aware */
    .marena-actionbar {
        position: sticky;
        bottom: 0;
        z-index: 50;
        display: flex;
        gap: 6px;
        margin: 0 -8px;
        padding: 8px 8px calc(8px + var(--safe-bottom, 0px));
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--glass-border);
    }
    /* Icon-over-label buttons — 48px min touch target */
    .marena-abtn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px;
        border-radius: 12px;
        border: 1px solid var(--glass-border);
        background: var(--color-bg-tertiary);
        color: var(--color-text-primary);
        font-size: 11px;
        font-weight: 600;
        line-height: 1;
        text-decoration: none;
        cursor: pointer;
        transition: background .15s ease, opacity .15s ease;
    }
    .marena-abtn svg { width: 20px; height: 20px; flex-shrink: 0; }
    .marena-abtn:active { background: var(--color-bg-hover); }
    .marena-abtn:disabled { opacity: .4; cursor: not-allowed; }
    .marena-abtn.is-danger { color: var(--color-error); }
    .marena-abtn.is-primary { color: var(--color-accent); }
    .marena-abtn-label {
        display: block;
        max-width: 100%;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* Below-board scroll region: move list + review nav + engine panel */
    .marena-below {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .marena-below .moves-list { max-height: 28vh; }
    /* App-like full-width move list (mobile polish #5) — phone marena blade.
       .marena-below is phone-only (class never rendered on desktop blades). */
    .marena-below .move-row {
        display: grid;
        grid-template-columns: 28px 1fr 1fr;
        align-items: stretch;
        column-gap: 4px;
        padding: 2px 4px;
        border-radius: 8px;
    }
    .marena-below .move-row:nth-of-type(even) { background: var(--color-input-bg); }
    .marena-below .move-number {
        display: flex;
        align-items: center;
        justify-content: center;
        width: auto;
    }
    .marena-below .moves-list .move-san {   /* 0,3,0 beats app.css .moves-list .move-san (0,2,0) */
        width: auto;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-height: 40px;
        padding: 6px 10px;
        gap: 8px;
        font-size: 14px;
        text-align: left;
    }
    .marena-below .moves-list .am-san {     /* squeezed cell truncates SAN instead of spilling */
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .marena-below .moves-list .am-time {
        flex-direction: row;
        margin-top: 0;
        padding: 1px 6px;
        border-radius: 6px;
        font-size: 11px;
        background: var(--glass-bg-heavy);
        flex-shrink: 0;
    }
    /* .move-san.active already = accent-muted pill (app.css) → current-move highlight preserved */
    .marena-engine { border-radius: 12px; overflow: hidden; }
    .marena-engine > summary {
        cursor: pointer;
        padding: 10px 12px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--color-text-primary);
        list-style: none;
    }
    .marena-engine[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .marena-engine > summary::-webkit-details-marker { display: none; }

    /* --- Guest/member additions (Task 7): pinned bottom block, offer banners,
           banner action buttons and the chat drawer. All still under .marena. --- */

    /* Sticky bottom block: banners + action bar pin together so an incoming
       offer banner is visible without scrolling. Wraps the (already sticky)
       .marena-actionbar; the wrapper does the pinning, so the bar goes static. */
    .marena-bottom {
        position: sticky;
        bottom: 0;
        z-index: 50;
        margin: 0 -8px;
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    .marena-bottom .marena-banners {
        display: flex;
        flex-direction: column;
        margin: 0 8px;
    }
    .marena-bottom .marena-banner { margin-bottom: 8px; }
    .marena-bottom .marena-actionbar {
        position: static;
        margin: 0;
        z-index: auto;
    }

    /* Offer banner accents (left border cues) — theme vars only */
    .marena-banner.is-draw { border-left: 3px solid var(--color-info); }
    .marena-banner.is-rematch { border-left: 3px solid var(--color-accent); }
    .marena-banner.is-leave { border-left: 3px solid var(--color-success); }
    .marena-banner.is-notice { border-left: 3px solid var(--color-warning); }

    /* Accept/decline button pair inside .marena-banner-actions */
    .marena-banner-btn {
        padding: 6px 14px;
        border-radius: 8px;
        border: 1px solid var(--glass-border);
        background: var(--color-bg-tertiary);
        color: var(--color-text-primary);
        font-size: 0.82rem;
        font-weight: 600;
        line-height: 1;
        cursor: pointer;
        transition: opacity .15s ease, background .15s ease;
    }
    .marena-banner-btn:active { opacity: .85; }
    .marena-banner-btn.is-accept {
        background: var(--color-success);
        color: #fff;
        border-color: transparent;
    }
    .marena-banner-btn.is-decline {
        background: transparent;
        color: var(--color-text-muted);
    }

    /* Waiting state for an offer button (draw/rematch already sent) */
    .marena-abtn.is-waiting { opacity: .6; }

    /* Chat drawer — slides up from the bottom; open-state lives in the Alpine
       store $store.marenaChat (registered per blade), not a nested x-data, so the
       gameApp/guestGame chatContainer ref stays on the root component. Fixed
       positioning overlays the whole viewport regardless of DOM depth. */
    .marena-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 60;
        background: rgba(0, 0, 0, 0.45);
    }
    .marena-drawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 61;
        display: flex;
        flex-direction: column;
        max-height: 72dvh;
        background: var(--color-bg-secondary);
        border-top: 1px solid var(--glass-border);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
        padding-bottom: var(--safe-bottom, 0px);
    }
    .marena-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
        padding: 12px 16px;
        border-bottom: 1px solid var(--color-border);
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--color-text-primary);
    }
    .marena-drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        border: none;
        border-radius: 8px;
        background: none;
        color: var(--color-text-muted);
        font-size: 1.6rem;
        line-height: 1;
        cursor: pointer;
    }
    .marena-drawer-close:active { background: var(--color-bg-hover); }
    .marena-drawer-body {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    .marena-drawer-body .game-chat-messages {
        flex: 1;
        min-height: 140px;
        overflow-y: auto;
    }
    /* Slide-up / fade transitions (mirrors the guest-match-overlay pattern) */
    .mdrawer-anim-enter { transition: transform .22s ease-out; }
    .mdrawer-anim-leave { transition: transform .18s ease-in; }
    .mdrawer-from { transform: translateY(100%); }
    .mdrawer-to { transform: translateY(0); }

    /* Unread-chat dot on the member action-bar chat button (chatNotify) */
    .marena-abtn-badge {
        position: absolute;
        top: 6px;
        right: 50%;
        margin-right: -14px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--color-error);
        box-shadow: 0 0 0 2px var(--color-bg-tertiary);
    }

    /* =================================================================
       WEB-BLADE MOBILE IMPROVEMENT LAYER  (bumped with ?v=20260706m5)
       Applies ONLY to the three .game-grid web arenas at phone widths —
       served when the admin "arena mobile blades" toggle is OFF, or on
       tablets. The marena-* mobile blades are not .game-grid /
       .game-control-buttons / .game-btn-tip, so nothing here reaches them.
       Desktop (>=1024px) never enters this block → zero desktop regression.
       (Section order lives in the earlier max-width:1023px block: board 1,
        chat 2 = clocks+controls+banners, moves 3.)
       ================================================================= */
    @media (max-width: 1023px) {
        /* Tall scroll panels eat the phone viewport — cap them so the board
           and the actions beneath it stay reachable. Scoped to .game-grid so
           the higher-specificity marena move-strip / chat-drawer caps win. */
        .game-grid .moves-list {
            max-height: 180px;
        }
        /* App-like full-width move list (mobile polish #5) — .game-grid web blade at phone widths */
        .game-grid .move-row {
            display: grid;
            grid-template-columns: 28px 1fr 1fr;
            align-items: stretch;
            column-gap: 4px;
            padding: 2px 4px;
            border-radius: 8px;
        }
        .game-grid .move-row:nth-of-type(even) { background: var(--color-input-bg); }
        .game-grid .move-number {
            display: flex;
            align-items: center;
            justify-content: center;
            width: auto;
        }
        .game-grid .moves-list .move-san {   /* 0,3,0 beats app.css .moves-list .move-san (0,2,0) */
            width: auto;
            min-width: 0;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            min-height: 40px;
            padding: 6px 10px;
            gap: 8px;
            font-size: 14px;
            text-align: left;
        }
        .game-grid .moves-list .am-san {     /* squeezed cell truncates SAN instead of spilling */
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .game-grid .moves-list .am-time {
            flex-direction: row;
            margin-top: 0;
            padding: 1px 6px;
            border-radius: 6px;
            font-size: 11px;
            background: var(--glass-bg-heavy);
            flex-shrink: 0;
        }
        .game-grid .game-chat-messages {
            max-height: 180px;
        }

        /* Touch has no hover, so the icon-only control buttons were unlabelled
           (the .game-btn-tip::after tooltip only appears on :hover). Render the
           EXISTING data-tooltip text as a STATIC label under each icon — no
           markup change. !important on position/transform is needed to beat the
           computer arena's inline below-button tooltip override
           (.chat-section .game-control-buttons .game-btn-tip::after, spec 0,3,1,
            declared after this stylesheet in source). */
        .game-control-buttons {
            flex-wrap: wrap;
            align-items: flex-start;
            row-gap: 10px;
        }
        .game-control-buttons .game-btn-tip {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }
        .game-control-buttons .game-btn-tip::after {
            position: static !important;
            transform: none !important;
            top: auto !important;
            bottom: auto !important;
            left: auto !important;
            display: block;
            opacity: .85;
            padding: 0;
            margin: 0;
            font-size: 10px;
            line-height: 1.1;
            font-weight: 500;
            white-space: normal;
            max-width: 72px;
            text-align: center;
            color: var(--color-text-muted);
            background: none;
            border: none;
            border-radius: 0;
            box-shadow: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }
        /* The hover arrow makes no sense beneath a static label. */
        .game-control-buttons .game-btn-tip::before {
            display: none;
        }
    }
