/* chess_grid.css — real chess game overlay for the Autocomputing Gridtop.
   A self-contained takeover surface (does not mutate the Gridtop DOM). Firm palette,
   square corners, gold/purple sprites. Buttons/selects reuse .poc-settings-* from
   desktop_poc.css. */

body.chess-mode-active { overflow: hidden; }

.chess-surface {
    position: fixed;
    inset: 0;
    /* Above the Gridtop floats (9900-9999) so it's a clean takeover even when an
       Agent launches it from its floating chatbox. */
    z-index: 10000;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(133, 126, 182, 0.18), transparent 60%),
        #2b2c3b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Afacad', sans-serif;
    color: #EEEEEE;
    user-select: none;
}

.chess-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.chess-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    width: 100%;
    max-width: min(80vmin, 640px);
    padding: 2px 2px 0;
}

.chess-title {
    font-size: 22px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #FFEC64;
}

.chess-status {
    font-size: 15px;
    letter-spacing: 0.5px;
    color: #EEEEEE;
    margin-left: auto;
    min-height: 18px;
}

.chess-board {
    width: min(80vmin, 640px);
    height: min(80vmin, 640px);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 3px solid #1D070E;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.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: #E2DFEB; }

.chess-piece {
    width: 82%;
    height: 82%;
    pointer-events: none;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.28));
    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-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: min(80vmin, 640px);
}

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

.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; }
