/* Belief Corner — chess board + lobby styling. Inherits brand tokens from belief.css. */

.bc-chess-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 300px;
    gap: 1.25rem;
    align-items: start;
}
.bc-chess-side-left, .bc-chess-side-right {
    display: flex;
    flex-direction: column;
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border-soft);
    border-top: 3px solid var(--bc-navy);
    border-radius: var(--bc-radius);
    overflow: hidden;
    box-shadow: var(--bc-shadow);
}

.bc-chess-board-wrap {
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border);
    border-top: 3px solid var(--bc-gold-bright);
    border-radius: var(--bc-radius);
    padding: 1rem;
    box-shadow: var(--bc-shadow);
}
#bc-chess-board { width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 1 / 1; }
#bc-chess-board .board { border-radius: 4px; overflow: hidden; }

/* chessground container — fixed aspect ratio + explicit dimensions */
#bc-chess-board {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    position: relative;
}
/* Light brand-aligned tints over the default brown theme */
#bc-chess-board .last-move { background: rgba(184, 134, 11, .32) !important; }
#bc-chess-board square.selected { background-color: rgba(184, 134, 11, .35) !important; }
#bc-chess-board square.check { background: radial-gradient(rgba(139, 44, 44, .85) 22%, transparent 60%) !important; }

/* Promotion dialog */
.bc-promo-overlay {
    position: fixed; inset: 0; background: rgba(10, 20, 40, .55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.bc-promo-box {
    background: var(--bc-bg-elev);
    border: 2px solid var(--bc-gold-bright);
    border-radius: var(--bc-radius-lg);
    padding: .85rem;
    display: flex; gap: .35rem;
    box-shadow: var(--bc-shadow-lg);
}
.bc-promo-btn {
    background: var(--bc-bg-quiet);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius);
    width: 64px; height: 64px;
    font-size: 2.5rem; line-height: 1;
    cursor: pointer;
    color: var(--bc-text);
    transition: background .12s, transform .08s;
}
.bc-promo-btn:hover { background: var(--bc-gold-bright); color: var(--bc-navy-deep); transform: scale(1.06); }

.bc-chess-side {
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* Legacy single-player block kept for fallback */
.bc-chess-player {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .75rem;
    align-items: center;
    padding: .85rem 1rem;
    background: var(--bc-bg-quiet);
}
.bc-chess-player-info { display: flex; flex-direction: column; min-width: 0; }

/* Players column — stacked vertically; sticky inside the left sidebar */
.bc-chess-players {
    display: flex;
    flex-direction: column;
    background: var(--bc-bg-elev);
    border-bottom: 1px solid var(--bc-border-soft);
}
.bc-chess-half {
    padding: .65rem .85rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}
.bc-chess-half + .bc-chess-half { border-top: 1px solid var(--bc-border-soft); }
.bc-chess-half-row {
    display: contents;
}
.bc-chess-half-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.bc-chess-half .bc-chess-name {
    font-family: var(--bc-font-display);
    font-weight: 600;
    color: var(--bc-navy);
    font-size: 1.02rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-theme="dark"] .bc-chess-half .bc-chess-name { color: var(--bc-text); }
.bc-chess-half .bc-chess-color { font-size: .72rem; color: var(--bc-text-muted); }
.bc-chess-half .bc-chess-clock {
    font-size: 1.3rem;
    justify-self: end;
    min-width: 5rem;
}
.bc-chess-half .bc-chess-captured {
    grid-column: 1 / -1;
    justify-content: flex-start;
    min-height: 1.25rem;
}
.bc-chess-name {
    font-family: var(--bc-font-display);
    font-weight: 600;
    color: var(--bc-navy);
    font-size: 1.02rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-theme="dark"] .bc-chess-name { color: var(--bc-text); }
.bc-chess-name.bc-muted { color: var(--bc-text-muted); font-style: italic; }
.bc-chess-color { font-size: .78rem; color: var(--bc-text-muted); font-family: var(--bc-font-ui); }

.bc-chess-clock {
    font-family: var(--bc-font-mono);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--bc-text);
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border);
    padding: .35rem .65rem;
    border-radius: var(--bc-radius-sm);
    min-width: 5rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.bc-chess-clock.is-active { background: var(--bc-navy); color: var(--bc-gold-light); border-color: var(--bc-navy); }
.bc-chess-clock.is-low.is-active { background: var(--bc-red); color: #fff; border-color: var(--bc-red); }

.bc-chess-status {
    padding: .55rem 1rem;
    text-align: center;
    background: transparent;
    border-top: 1px solid var(--bc-border-soft);
    border-bottom: 1px solid var(--bc-border-soft);
    font-family: var(--bc-font-sc);
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--bc-gold);
    font-weight: 600;
}

.bc-chess-moves {
    list-style: none; padding: .75rem 1rem; margin: 0;
    height: 18rem;
    overflow-y: auto;
    background: transparent;
    border-top: 1px solid var(--bc-border-soft);
    font-family: var(--bc-font-mono);
    font-size: .88rem;
    line-height: 1.85;
    scrollbar-width: thin;
    scrollbar-color: var(--bc-border) transparent;
}
.bc-chess-movepair {
    display: flex; gap: .5rem; align-items: baseline;
    padding-bottom: .15rem;
}
.bc-chess-movenum { color: var(--bc-text-faint); font-weight: 500; min-width: 1.8rem; }
.bc-chess-san { color: var(--bc-text); flex: 1 1 0; }
.bc-chess-san + .bc-chess-san { flex: 1 1 0; }

.bc-chess-actions {
    padding: .85rem 1rem;
    background: transparent;
    border-top: 1px solid var(--bc-border-soft);
    display: flex; flex-direction: column; gap: .5rem;
}
.bc-chess-buttonrow { display: flex; gap: .35rem; flex-wrap: wrap; }
.bc-chess-buttonrow form { flex: 1 1 auto; }
.bc-chess-buttonrow .bc-btn { width: 100%; }

.bc-chess-drawbox {
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-gold-bright);
    border-radius: var(--bc-radius);
    padding: .65rem .85rem;
    text-align: center;
}
.bc-chess-drawbox p { margin: 0 0 .5rem; font-size: .9rem; }
.bc-chess-drawbox form { display: inline-block; margin: 0 .15rem; }

.bc-chess-savebox { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--bc-border); }

/* ---- Observers strip ---- */
.bc-chess-observers {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .55rem .85rem;
    background: transparent;
    border-bottom: 1px solid var(--bc-border-soft);
    font-size: .82rem;
    color: var(--bc-text-muted);
}
.bc-chess-eye { font-size: 1rem; line-height: 1; opacity: .8; }
.bc-chess-obs-label {
    font-family: var(--bc-font-sc);
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--bc-gold);
    font-weight: 600;
    margin-right: .15rem;
}
.bc-chess-obs-list { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.bc-chess-obs-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .15rem .55rem .15rem .15rem;
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border-soft);
    border-radius: var(--bc-radius-pill);
    color: var(--bc-text);
    font-size: .8rem; font-weight: 500;
    max-width: 11rem; overflow: hidden;
}
.bc-chess-obs-chip:hover { border-color: var(--bc-gold-bright); text-decoration: none; }
.bc-chess-obs-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-chess-obs-chip .bc-avatar-xs { width: 20px; height: 20px; font-size: .65rem; }
.bc-chess-obs-more, .bc-chess-obs-guests {
    font-style: italic;
    color: var(--bc-text-faint);
    font-size: .78rem;
}

/* ---- In-game chat — modern stack, no harsh borders ---- */
.bc-chess-chat {
    display: flex; flex-direction: column;
    border-top: 1px solid var(--bc-border-soft);
    background: transparent;
}
.bc-chess-chat-list {
    list-style: none; padding: .5rem .35rem; margin: 0;
    height: 18rem;
    overflow-y: auto;
    overflow-anchor: none;
    scrollbar-width: thin;
    scrollbar-color: var(--bc-border) transparent;
}
.bc-chess-chat-list::-webkit-scrollbar { width: 6px; }
.bc-chess-chat-list::-webkit-scrollbar-thumb { background: var(--bc-border); border-radius: 3px; }

.bc-chess-chat-msg {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: .55rem;
    padding: .4rem .65rem;
    border-radius: var(--bc-radius);
    transition: background .12s;
}
.bc-chess-chat-msg:hover { background: var(--bc-bg-quiet); }
.bc-chess-chat-msg .bc-avatar-sm { width: 32px; height: 32px; font-size: .9rem; align-self: start; }

.bc-chess-chat-content { min-width: 0; }
.bc-chess-chat-head {
    display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap;
    margin-bottom: .05rem;
    line-height: 1.2;
}
.bc-chess-chat-author {
    font-family: var(--bc-font-display);
    font-weight: 600;
    font-size: .95rem;
    color: var(--bc-navy);
}
[data-theme="dark"] .bc-chess-chat-author { color: var(--bc-text); }
.bc-chess-chat-author:hover { color: var(--bc-gold); text-decoration: none; }
.bc-chess-chat-author.is-admin { color: var(--bc-red); }
.bc-chess-chat-author.is-mod   { color: var(--bc-sage); }

.bc-chess-chat-trad {
    font-family: var(--bc-font-sc);
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--bc-gold);
    font-weight: 600;
    padding: 0 .35rem;
    border: 1px solid currentColor;
    border-radius: var(--bc-radius-pill);
    line-height: 1.4;
    opacity: .9;
}

.bc-chess-chat-when {
    color: var(--bc-text-faint);
    font-size: .7rem;
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.bc-chess-chat-body {
    color: var(--bc-text);
    font-size: .92rem;
    line-height: 1.42;
    font-family: var(--bc-font-body);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.bc-chess-chat-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--bc-text-muted);
    font-family: var(--bc-font-body);
    font-style: italic;
    font-size: .9rem;
}
.bc-chess-chat-empty span { display: block; color: var(--bc-text-faint); font-size: .82rem; margin-top: .15rem; }

/* Input: single pill with inline send arrow */
.bc-chess-chat-form {
    display: flex; align-items: center;
    margin: .35rem .65rem .75rem;
    padding: .25rem .35rem .25rem 1rem;
    background: var(--bc-bg-input);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius-pill);
    transition: border-color .15s, box-shadow .15s;
}
.bc-chess-chat-form:focus-within { border-color: var(--bc-gold-bright); box-shadow: 0 0 0 3px rgba(184, 134, 11, .14); }
.bc-chess-chat-form input[name="body"] {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--bc-text);
    font: inherit;
    font-family: var(--bc-font-body);
    font-size: .94rem;
    padding: .45rem 0;
    min-width: 0;
}
.bc-chess-chat-form input[name="body"]:focus { outline: 0; }
.bc-chess-chat-send {
    flex-shrink: 0;
    background: var(--bc-gold-bright);
    color: var(--bc-navy-deep);
    border: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .08s;
}
.bc-chess-chat-send:hover { background: var(--bc-gold-light); }
.bc-chess-chat-send:active { transform: scale(.92); }
.bc-chess-chat-send svg { display: block; transform: translateX(1px); }

.bc-chess-chat-locked {
    margin: 0;
    padding: 1rem;
    text-align: center;
    color: var(--bc-text-muted);
    font-size: .88rem;
    background: var(--bc-bg-quiet);
    font-style: italic;
}
.bc-chess-pgn { background: var(--bc-bg-elev); border-radius: var(--bc-radius); padding: .5rem .75rem; }

/* ---- Captured pieces tray ---- */
.bc-chess-captured {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: .1rem;
    margin-top: .2rem; min-height: 16px;
    font-size: 1rem; line-height: 1;
}
.bc-cap-piece { color: var(--bc-text-muted); opacity: .85; }
.bc-cap-w { color: var(--bc-text-muted); }
.bc-cap-b { color: var(--bc-text); }
[data-theme="dark"] .bc-cap-w { color: var(--bc-text-faint); }
[data-theme="dark"] .bc-cap-b { color: var(--bc-text); }
.bc-cap-adv { color: var(--bc-gold); font-family: var(--bc-font-ui); font-size: .72rem; font-weight: 700; margin-left: .35rem; }

/* Bot avatar */
.bc-avatar-bot {
    background: linear-gradient(135deg, var(--bc-navy-deep), var(--bc-navy-mid));
    color: var(--bc-gold-light);
    font-family: var(--bc-font-ui);
    font-size: 1rem;
}
.bc-bot-select {
    padding: .55rem .75rem;
    border: 1px solid var(--bc-border);
    background: var(--bc-bg-input);
    color: var(--bc-text);
    border-radius: var(--bc-radius);
    font: inherit;
    width: 100%;
}

/* ---- Opening name ---- */
.bc-chess-opening {
    margin: 0;
    padding: .4rem 1rem;
    text-align: center;
    background: var(--bc-bg-quiet);
    border-bottom: 1px solid var(--bc-border-soft);
    color: var(--bc-gold);
    font-family: var(--bc-font-sc);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ---- Preview-mode banner ---- */
.bc-chess-preview-banner {
    display: flex; justify-content: space-between; align-items: center;
    gap: .65rem;
    padding: .5rem .85rem;
    background: rgba(184, 134, 11, .12);
    border-top: 1px solid var(--bc-gold-bright);
    border-bottom: 1px solid var(--bc-gold-bright);
    font-size: .85rem;
    color: var(--bc-text);
    font-style: italic;
}
.bc-btn-sm { padding: .3rem .65rem; font-size: .82rem; }

/* ---- Move list interaction ---- */
.bc-chess-san { cursor: pointer; padding: 0 .15rem; border-radius: 3px; transition: background .12s, color .12s; }
.bc-chess-san:hover { background: var(--bc-bg-quiet); color: var(--bc-gold); }
.bc-chess-san.is-active { background: var(--bc-gold-bright); color: var(--bc-navy-deep); font-weight: 700; }

/* ---- Exporters ---- */
.bc-chess-exporters { display: flex; gap: .35rem; margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--bc-border); }
.bc-chess-exporters .bc-btn { flex: 1; }

/* ---- Share button ---- */
.bc-chess-share { position: relative; }
.bc-chess-share summary { cursor: pointer; list-style: none; }
.bc-chess-share summary::-webkit-details-marker { display: none; }
.bc-chess-share-menu {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-top: .4rem;
    padding: .65rem;
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border);
    border-radius: var(--bc-radius);
    box-shadow: var(--bc-shadow);
}
.bc-chess-share-menu .bc-btn { justify-content: flex-start; gap: .55rem; }
.bc-chess-pgn summary { cursor: pointer; color: var(--bc-text-muted); font-size: .88rem; }
.bc-chess-pgn pre { font-family: var(--bc-font-mono); font-size: .8rem; margin: .5rem 0 0; white-space: pre-wrap; word-break: break-word; }

/* ---- Lobby ---- */
.bc-chess-gamelist { list-style: none; padding: 0; margin: 0; }
.bc-chess-gamerow { display: flex; align-items: stretch; gap: .5rem; margin-bottom: .5rem; }
.bc-chess-gamerow .bc-chess-row { flex: 1; margin-bottom: 0; }
.bc-chess-row-del button {
    height: 100%;
    padding: 0 .85rem;
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border-soft);
    border-radius: var(--bc-radius);
    color: var(--bc-text-faint);
    cursor: pointer;
    font-size: 1rem;
    transition: border-color .15s, color .15s, background .15s;
}
.bc-chess-row-del button:hover { color: var(--bc-red); border-color: var(--bc-red); background: rgba(139, 44, 44, .06); }

.bc-chess-row {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .85rem 1rem;
    background: var(--bc-bg-elev);
    border: 1px solid var(--bc-border-soft);
    border-left: 3px solid transparent;
    border-radius: var(--bc-radius);
    margin-bottom: .5rem;
    color: var(--bc-text);
    transition: border-color .15s, box-shadow .15s;
}
.bc-chess-row:hover { border-left-color: var(--bc-gold-bright); box-shadow: var(--bc-shadow); text-decoration: none; }
.bc-chess-vs { display: flex; align-items: center; gap: .5rem; font-family: var(--bc-font-display); }
.bc-chess-score { font-family: var(--bc-font-mono); color: var(--bc-gold); margin: 0 .25rem; }
.bc-chess-meta { color: var(--bc-text-muted); font-size: .85rem; }

/* ---- New game form ---- */
.bc-tc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .5rem;
}
.bc-side-grid { grid-template-columns: repeat(3, 1fr); }
.bc-tc-option { cursor: pointer; }
.bc-tc-option input { position: absolute; opacity: 0; pointer-events: none; }
.bc-tc-label {
    display: flex; flex-direction: column; gap: .15rem;
    padding: .75rem .85rem;
    border: 1px solid var(--bc-border);
    background: var(--bc-bg-elev);
    border-radius: var(--bc-radius);
    transition: border-color .15s, background .15s;
}
.bc-tc-label strong { font-family: var(--bc-font-display); font-size: 1.02rem; color: var(--bc-navy); }
[data-theme="dark"] .bc-tc-label strong { color: var(--bc-text); }
.bc-tc-label span { font-size: .82rem; color: var(--bc-text-muted); }
.bc-tc-option input:checked + .bc-tc-label {
    border-color: var(--bc-gold-bright);
    background: var(--bc-bg-quiet);
    box-shadow: 0 0 0 2px rgba(184, 134, 11, .15) inset;
}

@media (max-width: 1100px) {
    .bc-chess-shell { grid-template-columns: 260px minmax(0, 1fr); }
    .bc-chess-side-right { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 760px) {
    .bc-chess-shell { grid-template-columns: 1fr; }
    .bc-chess-side-left  { order: 1; }
    .bc-chess-board-wrap { order: 2; }
    .bc-chess-side-right { order: 3; }
    .bc-chess-players { position: static; }
}
