/* ============================================================
   wc-board — game board screen
   ============================================================ */

wc-board .board-frame {
    display: flex;
    flex-direction: column;
    min-height: var(--frame-min-h);
}

@media (min-width: 640px) {
    wc-board .board-frame {
        min-height: 0;
        height: var(--frame-fixed-h);
        max-height: var(--frame-fixed-max-h);
    }
}

wc-board .board-topbar {
    display: flex;
    align-items: center;
    padding-top: var(--space-1);
    padding-bottom: var(--space-6);
    gap: var(--space-2);
}

wc-board .turn-counter {
    font-size: 12px;
    opacity: 0.5;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

wc-board .board-spacer {
    flex: 1;
}

wc-board .board-corner-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 var(--space-3);
    padding-top: var(--space-2);
    gap: var(--space-2);
    min-height: 56px;
}

wc-board .board-corner-row--bottom {
    align-items: flex-end;
    padding-top: var(--space-3);
    padding-bottom: var(--space-2);
}

wc-board .board-corner-row > div:empty {
    display: none;
}

wc-board .board-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    padding-bottom: 0;
    padding-top: var(--space-3);
}

wc-board .board-wrap {
    position: relative;
    width: 100%;
}

wc-board .board-grid {
    display: grid;
    grid-template-rows: repeat(5, 1fr);
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border-radius: var(--radius-lg);
    aspect-ratio: 1 / 1;
    width: 100%;
    box-shadow:
        0 14px 40px -10px rgba(31, 27, 20, 0.22),
        0 2px 6px rgba(31, 27, 20, 0.06),
        inset 0 0 0 1px rgba(31, 27, 20, 0.06);
    /* Intentionally NOT overflow:hidden — tokens use animate-bounce
       (translateY -20%) and drop-shadow on the edge cells (e.g. m11)
       that need to render beyond the board's bounding box. The home
       quads supply their own corner radii. */
}

/* ----- Home quadrants ----- */

wc-board .home-quad {
    grid-row: span 2;
    grid-column: span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

wc-board .home-quad--tl { border-top-left-radius: var(--radius-lg); }
wc-board .home-quad--tr { border-top-right-radius: var(--radius-lg); }
wc-board .home-quad--bl { border-bottom-left-radius: var(--radius-lg); }
wc-board .home-quad--br { border-bottom-right-radius: var(--radius-lg); }

wc-board .home-quad-slots {
    width: 66.6667%;
    height: 66.6667%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid color-mix(in srgb, var(--color-board-border) 30%, transparent);
}

wc-board .home-slot-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

wc-board .home-slot-dot {
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: var(--color-bg);
    border-width: 2px;
    border-style: solid;
}

/* Home quadrant solid backgrounds gain subtle radial highlight */
wc-board .home-quad.player-bg-0,
wc-board .home-quad.player-bg-1,
wc-board .home-quad.player-bg-2,
wc-board .home-quad.player-bg-3 {
    background-image: radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0%, transparent 65%);
}

/* ----- Path arms (the cross arms of the board) ----- */

wc-board .path-arm-v {
    grid-row: span 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(6, 1fr);
    min-width: 0;
    min-height: 0;
}

wc-board .path-arm-h {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(3, 1fr);
    min-width: 0;
    min-height: 0;
}

wc-board .path-arm-h > .path-cell,
wc-board .path-arm-v > .path-cell {
    outline: 1px solid color-mix(in srgb, var(--color-board-border) 40%, transparent);
    outline-offset: -1px;
}

/* Layout-only rule keeps full specificity (every cell is positioned).
   `min-width: 0; min-height: 0` overrides the default `min-content`
   floor for grid items so token children (intrinsic 1:1 via SVG
   viewBox) don't stretch their row/column track. Without this, rows
   that contain a token grow taller than rows that don't, breaking
   board uniformity. */
wc-board .path-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
}

/* Default background uses :where() so the wc-board prefix doesn't
   raise specificity above the global .player-bg-path-N helpers
   (base.css). Without this, tinted home-stretch cells render as
   board-cell color. */
wc-board :where(.path-cell) {
    background-color: var(--color-board-cell);
}

/* Player-tinted path cells gain a subtle directional gloss. */
wc-board .path-cell.player-bg-path-0,
wc-board .path-cell.player-bg-path-1,
wc-board .path-cell.player-bg-path-2,
wc-board .path-cell.player-bg-path-3 {
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent);
}

/* Safe cells (m8, m21, m34, m47) keep the plain board-cell background
   inherited from `:where(.path-cell)` and signal "safe" purely through
   the player-colored star SVG drawn inside. Don't add a background
   tint here — see test/e2e/board-styles.spec.js. */
wc-board .path-cell--safe {
    display: flex;
    align-items: center;
    justify-content: center;
}

wc-board .path-cell--entry {
    display: flex;
    align-items: center;
    justify-content: center;
}

wc-board .path-cell-entry-svg {
    width: 68%;
    height: 68%;
    pointer-events: none;
    position: absolute;
    inset: 0;
    margin: auto;
    opacity: 0.7;
}

wc-board .path-cell-safe-svg {
    width: 72%;
    height: 72%;
    pointer-events: none;
    position: absolute;
    inset: 0;
    margin: auto;
}

wc-board .path-cell-safe-svg path {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
    opacity: 0.85;
}

/* ----- Center finish zone (4 triangles meeting at center) ----- */

wc-board .finish-zone {
    position: relative;
    overflow: clip;
    background: var(--color-board-cell);
    min-width: 0;
    min-height: 0;
}

wc-board .finish-tri {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0.9;
}

wc-board .finish-tri--tl { clip-path: polygon(0 0, 0 100%, 50% 50%); }
wc-board .finish-tri--tr { clip-path: polygon(0 0, 100% 0, 50% 50%); }
wc-board .finish-tri--br { clip-path: polygon(0 100%, 100% 100%, 50% 50%); }
wc-board .finish-tri--bl { clip-path: polygon(100% 0, 100% 100%, 50% 50%); }

/* ----- Dice in dice-home (hidden parent before corner pickup) ----- */

wc-board #dice-home.hidden {
    display: none;
}

/* ----- Dice container inside the dark-mode game (cosmetic) ----- */

.dark #dice {
    background: linear-gradient(145deg, #3a3835, #2d2b28) !important;
    box-shadow:
        3px 3px 8px rgba(0, 0, 0, 0.5),
        -1px -1px 3px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

.dark #dice .dice-dot {
    background: radial-gradient(circle at 40% 35%, #eee, #bbb) !important;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        0 0.5px 0 rgba(0, 0, 0, 0.3) !important;
}

/* ----- Stack badge for >4 tokens on a cell ----- */

wc-board .stack-badge {
    position: absolute;
    bottom: -6%;
    right: -6%;
    min-width: 46%;
    height: 46%;
    padding: 0 4px;
    border-radius: 50%;
    background: var(--color-fg);
    color: var(--color-bg);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 3;
}
