/* chess-play.css — chess module's per-state play surface styling.
   Loaded via App.razor as _content/Haxahedron.Modules.Chess/css/chess-play.css.
   chessground itself ships its own assets/chessground.base.css + brown + cburnett (vendored
   under Haxahedron.Web/wwwroot/lib/chessground/); this file adds layout chrome around the
   board, action affordances, and per-state framing. */

.chess-challenge-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.chess-headline {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Event banner — operator design 2026-05-22. Two-line title + subtitle (discipline on
   top, event name underneath in smaller muted text). See cubing-play.css for the full
   rationale; same pattern across all four modules. */
.chess-event-banner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mud-palette-text-secondary);
    font-weight: 600;
}

.chess-event-banner::before {
    content: '';
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background-image: url('/icons/disciplines/icon-chess-default.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.chess-event-banner-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.chess-event-banner-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.chess-event-banner-subtitle {
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.85;
}

.chess-voice-line {
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.72);
    font-style: italic;
}

/* Board wrapper. chessground sizes itself to the parent's width; this container caps the
   board size to keep it readable on desktop while allowing it to fill mobile widths. */
.chess-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
}

.chess-board {
    width: 100%;
    height: 100%;
}

/* Static-snapshot board for the Resolved state — pure CSS grid + Unicode glyphs, no chessground
   JS init. Mirrors chessground's cburnett cream + tan square palette so the snapshot reads as
   the same board the players just played on. Sized via aspect-ratio so it scales with the
   parent column the same way chess-board-wrapper does. */
.chess-static-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    container-type: inline-size;
    border-radius: 4px;
    overflow: hidden;
}

.chess-static-square {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chess-static-square--light {
    background-color: #f0d9b5;
}

.chess-static-square--dark {
    background-color: #b58863;
}

/* Container-query font sizing so pieces stay proportional to the board width regardless of
   viewport. 10cqi ≈ 80% of a square's width, which leaves a small margin around each glyph. */
.chess-static-piece {
    font-size: 10cqi;
    font-family: "Segoe UI Symbol", "DejaVu Sans", "Arial Unicode MS", sans-serif;
}

/* Unicode chess glyphs are "filled" silhouettes; coloring decides whether they read as
   white-piece or black-piece. White gets near-white fill + thin black outline for contrast on
   the cream squares; black gets near-black fill. Matches the Cburnett SVG palette closely. */
.chess-static-piece--white {
    color: #ffffff;
    text-shadow:
        -1px -1px 0 #1a1a1a,
        1px -1px 0 #1a1a1a,
        -1px 1px 0 #1a1a1a,
        1px 1px 0 #1a1a1a;
}

.chess-static-piece--black {
    color: #1a1a1a;
}

/* MudBlazor.min.css ships utility classes `.white { ... !important }` and `.black { color:#212121 }`
   that match chessground's piece classes (each piece div carries `pawn white` / `bishop black`
   etc.). MudBlazor's `!important` paints the piece bg with a solid color, masking the cburnett
   SVG and producing the white-band-behind-white-pieces + black-band-behind-black-pieces look
   from the walk-through screenshot. Override with !important so the piece divs stay transparent
   and the SVG background-image is the only visual. Scoped to .cg-wrap so we don't leak the
   override outside the board. */
.cg-wrap piece.white,
.cg-wrap piece.black {
    background-color: transparent !important;
}

/* Black-piece visibility lift against the dark site framing.
   Cburnett black pieces are pure-black silhouettes (pawn especially is a single solid path with
   stroke="#000" and default-black fill — no visible outline). On Lichess's pages the cream + tan
   brown squares give enough contrast; against our darker app surround the same pieces read as a
   black band. A subtle white drop-shadow restores readability without changing the piece SVGs. */
.cg-wrap piece.black {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9))
            drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
}

/* Move list panel below the board. Collapsible toggle header + two-column SAN grid body
   ("1. e4 e5" / "2. Nf3 Nc6" etc.). Long games can run 60+ moves so the panel collapses
   with a chevron — header reads "Moves" when expanded, "View moves" when collapsed. */
.chess-move-list {
    margin-top: 12px;
    background-color: var(--hax-surface-page, #022C22);
    border-radius: 8px;
    padding: 4px 12px 8px 12px;
}

.chess-move-list-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.92);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.chess-move-list-toggle:hover {
    color: var(--hax-accent-lime, #A3E635);
}

.chess-move-list-toggle:focus-visible {
    outline: 2px solid var(--hax-accent-lime, #A3E635);
    outline-offset: 2px;
    border-radius: 4px;
}

.chess-move-list-toggle-label {
    /* Pair the chevron with a text label per the brand sheet's color-never-sole-indicator rule —
       the chevron alone shouldn't carry the open/closed signal. */
    flex: 1 1 auto;
}

.chess-move-list-body {
    max-height: 220px;
    overflow-y: auto;
    padding-top: 4px;
}

.chess-move-list-empty {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.chess-move-list-grid {
    display: grid;
    grid-template-columns: 32px 1fr 1fr;
    column-gap: 8px;
    row-gap: 2px;
    font-family: ui-monospace, "JetBrains Mono", monospace;
    font-size: 0.95rem;
}

.chess-move-list-grid .move-number {
    color: rgba(255, 255, 255, 0.5);
}

.chess-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chess-state-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background-color: rgba(163, 230, 53, 0.15); /* lime-400 @ 15% */
    color: var(--hax-accent-lime, #A3E635);
    font-weight: 600;
    font-size: 0.85rem;
    align-self: flex-start;
}

.chess-state-pill--waiting {
    background-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.72);
}

.chess-state-pill--resolved-won {
    background-color: rgba(163, 230, 53, 0.18);
    color: var(--hax-accent-lime, #A3E635);
}

.chess-state-pill--resolved-lost {
    background-color: rgba(248, 113, 113, 0.18); /* red-400 @ 18% */
    color: #F87171;
}

.chess-draw-offer-banner {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: rgba(251, 191, 36, 0.15); /* amber-400 @ 15% */
    border-left: 3px solid var(--hax-status-pending, #FBBF24);
    color: rgba(255, 255, 255, 0.92);
}

.chess-game-ordinal {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-left: 8px;
}

/* Pre-acceptance state (Initiated): no board, just a framing card with accept/decline. */
.chess-pre-acceptance {
    background-color: var(--hax-surface-page, #022C22);
    border-radius: 8px;
    padding: 20px;
}

.chess-color-note {
    margin: 12px 0;
    color: rgba(255, 255, 255, 0.78);
}

/* Force End panel (Dev/Staging-only per design §14.1). Visually distinct from the production
   action affordances so testers can't mistake it for end-user UI. */
.chess-force-end-panel {
    margin-top: 16px;
    padding: 12px;
    border: 1px dashed rgba(251, 191, 36, 0.4); /* amber-400 @ 40% */
    border-radius: 8px;
    background-color: rgba(251, 191, 36, 0.05);
}

.chess-force-end-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.chess-force-end-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background-color: rgba(251, 191, 36, 0.18);
    color: var(--hax-status-pending, #FBBF24);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chess-force-end-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
}

.chess-force-end-group {
    margin-bottom: 10px;
}

.chess-force-end-group:last-child {
    margin-bottom: 0;
}

.chess-force-end-group-title {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chess-force-end-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
