/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700&display=swap');

/* ── Reset & Bootstrap Overrides ───────────────────────── */

.chess-app *,
.chess-app *::before,
.chess-app *::after {
    box-sizing: border-box;
}

.chess-app h1,
.chess-app h2,
.chess-app h3,
.chess-app p {
    font-family: 'Raleway', sans-serif !important;
    margin: 0;
}

.chess-app button {
    font-family: 'Raleway', sans-serif !important;
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    color: inherit;
    padding: 0;
    line-height: inherit;
}

.chess-app button:focus-visible {
    outline: 2px solid #d4a843;
    outline-offset: 2px;
}

.chess-app input {
    font-family: 'Raleway', sans-serif !important;
    outline: none;
}

.chess-app input:focus {
    border-color: #d4a843 !important;
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.25);
}

/* ── App Container ─────────────────────────────────────── */

.chess-app {
    font-family: 'Raleway', sans-serif !important;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;
    min-height: calc(100vh - 56px) !important;
    color: #e0e0e0;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    overflow-x: hidden !important;
}

.chess-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* ── Loading State ─────────────────────────────────────── */

.loading-state {
    text-align: center;
    padding: 80px 0;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #d4a843;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #999;
    font-size: 0.85rem;
}

/* ── Header ────────────────────────────────────────────── */

.chess-header {
    text-align: center;
    margin-bottom: 24px;
}

.chess-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #d4a843;
    text-shadow: 0 0 20px rgba(212, 168, 67, 0.4);
    margin: 0 0 8px;
}

.player-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #aaa;
}

.btn-icon {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

@media (hover: hover) {
    .btn-icon:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.08);
    }
}

/* ── Buttons ───────────────────────────────────────────── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(45deg, #d4a843, #c49632);
    color: #fff;
    box-shadow: 0 4px 15px rgba(212, 168, 67, 0.3);
    transition: all 0.25s ease;
    cursor: pointer;
}

@media (hover: hover) {
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(212, 168, 67, 0.4);
    }
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(212, 168, 67, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    transition: all 0.25s ease;
    cursor: pointer;
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.14);
        transform: translateY(-1px);
    }
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(192, 57, 43, 0.8);
    color: #fff;
    transition: all 0.25s ease;
    cursor: pointer;
}

@media (hover: hover) {
    .btn-danger:hover {
        background: rgba(192, 57, 43, 1);
        transform: translateY(-1px);
    }
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 7px 16px;
    font-size: 0.82rem;
}

.btn-text {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 0;
    transition: color 0.2s;
}

@media (hover: hover) {
    .btn-text:hover {
        color: #fff;
    }
}

.btn-back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ── Dashboard ─────────────────────────────────────────── */

.dashboard-actions {
    text-align: center;
    margin: 24px 0 32px;
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 48px 0;
    font-size: 0.95rem;
}

.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: #999;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.games-section {
    margin-bottom: 28px;
}

.games-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (hover: hover) {
    .game-card:hover {
        background: rgba(255, 255, 255, 0.09);
        border-color: rgba(255, 255, 255, 0.12);
        border-left-color: rgba(255, 255, 255, 0.12);
        transform: translateY(-1px);
    }
}

.game-card.your-turn {
    border-left-color: #4CAF50;
}

.game-card-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.game-card-players {
    font-size: 0.88rem;
    font-weight: 500;
    color: #ddd;
}

.game-card-meta {
    font-size: 0.72rem;
    color: #999;
}

.game-card-status {
    font-size: 0.75rem;
    padding: 3px 12px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.status-your-turn {
    background: rgba(76, 175, 80, 0.15);
    color: #66BB6A;
}

.status-their-turn {
    background: rgba(255, 255, 255, 0.04);
    color: #999;
}

.status-waiting {
    background: rgba(212, 168, 67, 0.12);
    color: #d4a843;
}

.status-ended {
    background: rgba(255, 255, 255, 0.04);
    color: #999;
}

/* ── Invite Panel ──────────────────────────────────────── */

.invite-panel {
    text-align: center;
    max-width: 480px;
    margin: 32px auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 32px 28px;
}

.invite-panel h2 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 8px;
}

.invite-panel p {
    color: #999;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.invite-link-box {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.invite-link-box .btn-primary {
    flex-shrink: 0;
}

.invite-link-box input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    padding: 10px 14px;
    font-size: 0.82rem;
    font-family: 'Courier New', monospace;
}

.waiting-text {
    color: #d4a843;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 20px;
}

.invite-panel .btn-secondary {
    display: block;
    margin: 0 auto 10px;
}

.invite-panel .btn-text {
    display: block;
    margin: 0 auto;
}

/* ── Game View ─────────────────────────────────────────── */

.game-header {
    position: relative;
    padding: 0 0 16px;
}

.game-status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 4px;
}

.player-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #bbb;
    max-width: 160px;
    overflow: hidden;
}

.player-tag span:not(.color-dot) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.color-dot.white {
    background: #f0d9b5;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.color-dot.black {
    background: #4a3728;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.turn-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ccc;
    padding: 5px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.07);
    letter-spacing: 0.02em;
}

.turn-indicator.active-turn {
    background: rgba(76, 175, 80, 0.2);
    color: #66BB6A;
}

.game-layout {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

/* ── Chess Board ───────────────────────────────────────── */

.board-wrapper {
    flex-shrink: 0;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    width: min(560px, calc(100vw - 32px));
    aspect-ratio: 1;
    border: 3px solid rgba(0, 0, 0, 0.5);
    border-radius: 0;
    overflow: hidden;
    user-select: none;
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
}

.square {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: default;
    aspect-ratio: 1;
}

.square.selectable {
    cursor: pointer;
}

.square.legal-move,
.square.legal-capture {
    cursor: pointer;
}

/* ── Pieces ────────────────────────────────────────────── */

.square .piece {
    font-size: min(3.6rem, 8.5vw);
    line-height: 1;
    pointer-events: none;
}

.square .piece.white-piece {
    color: #fff;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.4),
        0 0 1px rgba(0, 0, 0, 0.6);
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.4);
    paint-order: stroke fill;
}

.square .piece.black-piece {
    color: #1a1a1a;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.3);
    -webkit-text-stroke: 0.3px rgba(0, 0, 0, 0.2);
}

/* ── Square Colors ─────────────────────────────────────── */

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square.selected.light {
    background: #dce775;
}

.square.selected.dark {
    background: #b0b338;
}

.square.last-move.light {
    background: #cdd26a;
}

.square.last-move.dark {
    background: #aaa23a;
}

.square.in-check.light,
.square.in-check.dark {
    background: radial-gradient(ellipse at center, rgba(231, 76, 60, 0.9) 0%, rgba(192, 57, 43, 0.7) 30%, transparent 68%);
}

/* Legal move indicator: small dot */
.square.legal-move::after {
    content: '';
    position: absolute;
    width: 26%;
    height: 26%;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    pointer-events: none;
}

/* Legal capture indicator: ring */
.square.legal-capture::after {
    content: '';
    position: absolute;
    width: 82%;
    height: 82%;
    border: 3.5px solid rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
}

/* Move flash (opponent's move arriving) */
@keyframes moveFlash {
    0% { filter: brightness(1.5); }
    100% { filter: brightness(1); }
}

.square.move-flash {
    animation: moveFlash 0.5s ease-out;
}

/* ── Coordinate Labels ─────────────────────────────────── */

.coord {
    position: absolute;
    font-size: 0.58rem;
    font-weight: 700;
    pointer-events: none;
    opacity: 0.75;
    font-family: 'Raleway', sans-serif;
}

.rank-coord {
    top: 2px;
    left: 3px;
}

.file-coord {
    bottom: 1px;
    right: 3px;
}

.square.light .coord {
    color: #b58863;
}

.square.dark .coord {
    color: #f0d9b5;
}

/* ── Sidebar ───────────────────────────────────────────── */

.game-sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.move-history-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    flex: 1;
}

.move-history-panel h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: #999;
    margin: 0 0 8px;
}

.move-list {
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #ccc;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.move-list::-webkit-scrollbar {
    width: 5px;
}

.move-list::-webkit-scrollbar-track {
    background: transparent;
}

.move-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.move-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.move-row {
    display: flex;
    gap: 4px;
    padding: 2px 0;
}

.move-number {
    color: #999;
    min-width: 28px;
    text-align: right;
}

.move-white,
.move-black {
    min-width: 56px;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: default;
}

@media (hover: hover) {
    .move-white:hover,
    .move-black:hover {
        background: rgba(255, 255, 255, 0.06);
    }
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.invite-share {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-label {
    font-size: 0.72rem;
    color: #999;
    font-weight: 500;
}

.share-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ccc;
    padding: 8px 10px;
    font-size: 0.72rem;
    font-family: 'Courier New', monospace;
    width: 100%;
    box-sizing: border-box;
}

/* ── Game Over Banner ──────────────────────────────────── */

.game-over-banner {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 16px;
    backdrop-filter: blur(4px);
}

.game-over-banner h2 {
    color: #fff;
    margin: 0 0 4px;
    font-size: 1.15rem;
    font-weight: 700;
}

.game-over-banner p {
    color: #999;
    margin: 0 0 16px;
    font-size: 0.88rem;
}

.game-over-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ── Modals ────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: #1a2638;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 28px 32px;
    text-align: center;
    min-width: 280px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    color: #fff;
    margin: 0 0 20px;
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-content input[type="text"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    padding: 10px 14px;
    font-size: 0.95rem;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.promotion-choices .promo-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.promo-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-btn .piece {
    font-size: 2.4rem;
    line-height: 1;
}

@media (hover: hover) {
    .promo-btn:hover {
        background: rgba(255, 255, 255, 0.14);
        border-color: #d4a843 !important;
        transform: translateY(-2px);
    }
}

.promo-btn:active {
    transform: translateY(0);
}

/* ── Modal Close Button ───────────────────────────────── */

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.15rem;
    color: #999;
    transition: color 0.2s, background 0.2s;
    line-height: 1;
}

@media (hover: hover) {
    .modal-close:hover {
        color: #fff;
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ── Button States ────────────────────────────────────── */

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-danger:disabled,
.btn-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ── Chat Send Button ─────────────────────────────────── */

.btn-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(212, 168, 67, 0.18);
    color: #d4a843;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

@media (hover: hover) {
    .btn-send:hover {
        background: rgba(212, 168, 67, 0.3);
    }
}

.btn-send:active {
    background: rgba(212, 168, 67, 0.22);
}

/* ── Empty Hint ───────────────────────────────────────── */

.empty-hint {
    color: #999;
    font-size: 0.8rem;
    font-style: italic;
}

/* ── Chat Panel ────────────────────────────────────────── */

.chat-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-panel h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: #999;
    margin: 0 0 8px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    min-height: 80px;
    font-size: 0.8rem;
    color: #ccc;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    margin-bottom: 8px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-message {
    padding: 3px 0;
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-message .chat-nick {
    font-weight: 600;
    color: #d4a843;
    margin-right: 6px;
    font-size: 0.78rem;
}

.chat-message .chat-text {
    color: #ccc;
}

.chat-input-row {
    display: flex;
    gap: 6px;
}

.chat-input-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    padding: 8px 10px;
    font-size: 0.8rem;
    min-width: 0;
}

/* ── Spectator Request Panel ──────────────────────────── */

.spectator-request-panel {
    text-align: center;
    max-width: 480px;
    margin: 32px auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 32px 28px;
}

.spectator-request-panel h2 {
    color: #fff;
    font-weight: 600;
    margin-bottom: 8px;
}

.spectator-request-panel p {
    color: #999;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.spectator-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.spectator-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: #ccc;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: background 0.2s;
}

@media (hover: hover) {
    .spectator-options label:hover {
        background: rgba(255, 255, 255, 0.08);
    }
}

.spectator-options input[type="radio"] {
    accent-color: #d4a843;
}

.spectator-request-panel .btn-primary {
    display: block;
    margin: 0 auto 12px;
}

.spectator-request-panel .btn-text {
    display: block;
    margin: 0 auto;
}

.denied-text {
    color: #e74c3c;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 12px;
}

/* ── Spectator Badge ──────────────────────────────────── */

.spectator-badge {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(212, 168, 67, 0.15);
    color: #d4a843;
    font-weight: 600;
    transition: background 0.2s;
}

@media (hover: hover) {
    .spectator-badge:hover {
        background: rgba(212, 168, 67, 0.25);
    }
}

/* ── Spectator Request Item (Modal) ───────────────────── */

#spectatorModal .modal-content {
    min-width: 400px;
    max-width: 520px;
}

.spectator-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
}

.spectator-request-item:last-child {
    border-bottom: none;
}

.spectator-request-info {
    flex: 1;
    min-width: 0;
}

.spectator-request-name {
    font-weight: 600;
    color: #ddd;
    font-size: 0.88rem;
}

.spectator-request-perm {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

.spectator-request-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.spectator-request-actions select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #ccc;
    padding: 4px 6px;
    font-size: 0.78rem;
    font-family: 'Raleway', sans-serif;
}

.spectator-no-requests {
    color: #999;
    font-size: 0.88rem;
    padding: 16px 0;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
    .chess-container {
        padding: 12px 8px;
    }

    .game-layout {
        flex-direction: column;
        align-items: center;
    }

    .game-sidebar {
        width: 100%;
        max-width: 560px;
    }

    .game-sidebar .chat-panel {
        order: -1;
    }

    .chess-board {
        width: calc(100vw - 16px);
    }

    .btn-back {
        position: static;
        transform: none;
        display: block;
        margin-bottom: 8px;
    }

    .spectator-badge {
        position: static;
        transform: none;
        display: inline-flex;
        margin-bottom: 8px;
    }

    .game-status-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .move-list {
        max-height: 160px;
    }

    .chat-messages {
        max-height: 150px;
    }

    #spectatorModal .modal-content {
        min-width: auto;
        width: calc(100vw - 32px);
    }

    .spectator-request-actions {
        flex-wrap: wrap;
    }

    .chess-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 400px) {
    .chess-title {
        font-size: 1.5rem;
    }

    .square .piece {
        font-size: min(2.8rem, 10vw);
    }

    .promo-btn {
        width: 50px;
        height: 50px;
    }

    .promo-btn .piece {
        font-size: 2rem;
    }
}
