/* chess_grid.css — chess on the Autocomputing Gridtop (2026-09-29: on the grid itself, controls in the left pane).
   The layer covers exactly the grid (chess_grid.js placeSurface); the board is a square of the grid's height, so its
   squares sit on the grid's own cells, and the columns either side are dimmed. It sits below windows, menus and chats.
   Buttons/selects reuse .poc-settings-* from desktop_poc.css. */

.chess-surface {
    position: fixed;
    z-index: 60;
    background: rgba(43, 44, 59, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Afacad', sans-serif;
    color: #EEEEEE;
    user-select: none;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 1px;
    background: #44465E;
    box-shadow: 0 0 0 2px #44465E, 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* ---- the Chess panel in the left pane ---- */
.chess-left-panel { border-top: 1px solid rgba(68, 70, 94, 0.3); }
/* Stacks with Autocoding and the Directorium: one push to the bottom for the whole stack, so closed headers sit together
   bottom-up rather than one floating mid-pane. */
#poc-left-pane #chess-left-panel { margin-top: auto; }
#poc-left-pane #chess-left-panel ~ .file-explorer-panel { margin-top: 0; }
/* Open but sharing the pane: the captured pieces give way first, the game controls always fit. */
#poc-left-pane #chess-left-panel:not(.collapsed) { min-height: 215px; }
#poc-left-pane #chess-left-panel > .chess-lp-body { overflow: hidden; }
.chess-left-panel .chess-lp-icon { width: 16px; height: 16px; display: block; }
.chess-lp-body { display: flex; flex-direction: column; gap: 10px; }
.chess-cap { flex: 1 1 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 2px; min-height: 0; overflow: hidden; }
.chess-cap-top { align-content: flex-start; }
.chess-cap-bot { align-content: flex-end; }
.chess-cap-piece { width: 26px; height: 26px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.chess-lp-mid { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-top: 1px solid rgba(68, 70, 94, .25); border-bottom: 1px solid rgba(68, 70, 94, .25); }
.chess-lp-opp { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; opacity: .6; }
.chess-status { font-size: 14px; color: #44465E; min-height: 18px; }
.chess-lp-btns { display: flex; gap: 6px; }
.chess-lp-btns .poc-settings-save { flex: 1 1 0; }

.chess-sq {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: url('sprites/cursor_point.ico'), pointer;
}

.chess-sq.light { background: #F8F7F2; }
.chess-sq.dark { background: #C9C3DA; }   /* deeper than the grid's own lavender, so pieces stand out (2026-09-30) */

.chess-piece {
    width: 82%;
    height: 82%;
    pointer-events: none;
    /* A fine dark rim round every piece, then its shadow: gold and violet read on light and dark squares alike. */
    filter: drop-shadow(0 0 1px rgba(29, 7, 14, 0.95)) drop-shadow(0 0 1px rgba(29, 7, 14, 0.6)) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
    transition: transform 0.12s ease-out;
}
.chess-sq:hover .chess-piece { transform: scale(1.08); }

.chess-sq.lastfrom { background: rgba(255, 236, 100, 0.28); }
.chess-sq.lastfrom.dark { background: rgba(220, 200, 90, 0.32); }
.chess-sq.lastto { background: rgba(255, 236, 100, 0.45); }
.chess-sq.lastto.dark { background: rgba(220, 200, 90, 0.5); }

.chess-sq.sel { outline: 3px solid rgba(170, 163, 72, 0.95); outline-offset: -3px; }

.chess-sq.target::after {
    content: '';
    position: absolute;
    width: 26%;
    height: 26%;
    border-radius: 50%;
    background: rgba(68, 70, 94, 0.45);
    pointer-events: none;
}
.chess-sq.target { outline: 2px solid rgba(68, 70, 94, 0.25); outline-offset: -2px; }

.chess-sq.incheck {
    background: radial-gradient(circle, rgba(184, 27, 27, 0.7), rgba(184, 27, 27, 0.25) 70%) !important;
}

.chess-diff {
    display: flex;
    align-items: center;
    gap: 7px;
}
.chess-diff-label {
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.6;
}
.chess-diff .poc-settings-select { flex: 1 1 auto; min-width: 0; }

.chess-exit-btn:hover { background: #8a1f1f; color: #EEEEEE; }

/* ---- overlays (promotion chooser + game-over banner) ---- */
.chess-modal {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(29, 7, 14, 0.45);
    z-index: 5;
}
.chess-card {
    background: #44465E;
    border: 2px solid #1D070E;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    padding: 18px 22px;
    min-width: 240px;
    text-align: center;
}
.chess-card-title {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #EEEEEE;
    opacity: 0.85;
    margin-bottom: 12px;
}
.chess-promo-row { display: flex; gap: 8px; justify-content: center; }
.chess-promo-btn {
    width: 56px;
    height: 56px;
    background: #EEEEEE;
    border: 1px solid #1D070E;
    border-radius: 2px;
    cursor: url('sprites/cursor_point.ico'), pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chess-promo-btn:hover { background: #FFEC64; }
.chess-promo-btn img { width: 40px; height: 40px; pointer-events: none; }

.chess-banner-msg {
    font-size: 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #FFEC64;
    margin-bottom: 4px;
}
.chess-banner-sub {
    font-size: 14px;
    color: #EEEEEE;
    opacity: 0.85;
    margin-bottom: 16px;
}
.chess-banner-row { display: flex; gap: 10px; justify-content: center; }

/* ---- right-click context menu (Set Difficulty) ---- */
.chess-ctxmenu {
    position: absolute;
    z-index: 8;
    min-width: 160px;
    background: #44465E;
    border: 1px solid #1D070E;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    padding: 4px 0;
    font-size: 13px;
}
.chess-ctx-head {
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.55;
    padding: 5px 14px 4px;
}
.chess-ctx-item {
    padding: 6px 14px;
    color: #EEEEEE;
    cursor: url('sprites/cursor_point.ico'), pointer;
}
.chess-ctx-item:hover { background: #AAA348; color: #1D070E; }
.chess-ctx-item.active { color: #FFEC64; }
.chess-ctx-sep { height: 1px; background: rgba(238, 238, 238, 0.15); margin: 4px 0; }
