:root {
        --board-max: 500px;
        /* single source of truth for width */
}
button {
        cursor: pointer;
}
.game-container {
        display: flex;
        flex-direction: column;
        /* align-items: stretch; */
        gap: 10px;
        /* spacing between status bars and board */
        width: min(95vw, var(--board-max));
        /* container width */
        margin: 0 auto;
        flex: 1 1 auto;          /* take the leftover height */
        min-height: 0;           /* allow flex children to size properly */
}
.game-controls {
        display: flex;
        width: 100%;
        justify-content: space-between; /* Push items to edges */
        padding: 10px 10px 1px 10px;
        border-radius: 8px;
        text-align: center;
        background: #f0f0f0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
}


.player-status {
        display: flex;
        width: 100%;
        /* always match game-container width */
        max-width: none;
        /* remove old cap */
        padding: 10px;
        border-radius: 8px;
        text-align: center;
        background: #f0f0f0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
}

.player1 {
        background: #e0f7ff;
        /* light blue for Player 1 */
}

.player2 {
        background: #ffe0e0;
        /* light red for Player 2 */
}


body {
        font-family: sans-serif;
        text-align: center;
        background: #f4f4f4;
        margin: 0;
        padding: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
}

.status-info {
        width: 100%;
        display: flex;
        /* lay out color picker and score nicely */
        align-items: center;
        justify-content: space-between;
        font-weight: 600;
}

#board-container {
        margin: 0;
        /* avoid centering offsets */
        display: block;
        background-color: #ffffff;
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
        /* match player-status */
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        flex: 1 1 auto;
        min-height: 85%;
        display: flex;           /* so the SVG can fill it */
}

/* Pieces */
.piece {
        cursor: pointer;
        transition: stroke-width 120ms ease;
}

.selected {
        /* stroke color comes from the CSS variable; fallback to semi-transparent black */
        stroke: var(--selected-stroke, rgba(0, 0, 0, 0.45));
        stroke-width: 14px;
        /* keep your large hit/visual stroke */
        vector-effect: non-scaling-stroke;
        transform: scale(1);
}

@media (max-width: 480px) {
        #board {
                max-width: 100%;
                height: auto;
        }
}

/* Optional: make all elements border-box */
*,
*::before,
*::after {
        box-sizing: border-box;
}

/* Optional: small tweaks to the label */
.color-picker {
        position: relative;
        display: inline-block;
        /* override previous inline-flex */
        width: 20px;
        height: 20px;
        border-radius: 50%;
        padding: 3px;
        /* ring thickness */
        background: conic-gradient(#ff5f6d, #ffc371, #f9f871, #a1ffce, #64b3f4, #c2e9fb, #b19cd9, #ff5f6d);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
        transition: transform .15s ease, box-shadow .15s ease;
}

.color-picker:hover {
        transform: translateY(-1px) scale(1.03);
}

.color-picker:active {
        transform: scale(0.98);
}

.color-picker input[type="color"] {
        position: absolute;
        inset: 4px;
        /* reveal gradient ring */
        width: auto;
        height: auto;
        border: none;
        padding: 0;
        border-radius: 50%;
        background: none;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
        cursor: pointer;
}

/* Make the inner swatch perfectly round across engines */
.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
        padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
        border: none;
        border-radius: 50%;
}

.color-picker input[type="color"]::-moz-color-swatch {
        border: none;
        border-radius: 50%;
}

/* Board background controls */
.board-style-controls {
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 8px 10px;
        background: #fafafa;
        border-radius: 8px;
        border: 1px solid #e9e9e9;
}

.icon-control,
.icon-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 10px;
        border: 1px solid #ddd;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        cursor: pointer;
        transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
}

.icon-control:hover,
.icon-button:hover {
        background: #f7f7f7;
        transform: translateY(-1px);
}

.icon-control:active,
.icon-button:active {
        transform: translateY(0);
}

.icon {
        width: 22px;
        height: 22px;
        fill: #333;
}

.visually-hidden-input {
        position: absolute !important;
        opacity: 0 !important;
        width: 1px !important;
        height: 1px !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        white-space: nowrap !important;
        pointer-events: none !important;
}

/* URL input with leading icon */
.url-control {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 6px 8px;
        border: 1px solid #ddd;
        border-radius: 10px;
        background: #fff;
        flex: 1;
        min-width: 0;
}

.url-control .icon {
        width: 18px;
        height: 18px;
        fill: #666;
}

.url-control input[type="url"] {
        border: none;
        outline: none;
        min-width: 140px;
        width: 100%;
        font: inherit;
}

/* Screen-reader only text */
.sr-only {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 1px, 1px);
        white-space: nowrap;
        border: 0;
}


/* ========= Active player highlight (minimal additions) ========= */

.player-status {
        /* allow an overridable player color from JS or color input */
        --player-color: #ff4d4f;
        --player-glow-rgba: rgba(255, 77, 79, 0.18);
        position: relative;
        transition: box-shadow .18s ease, transform .12s ease;
}

/* sensible defaults for each player (no JS needed) */
.player1 { --player-color: #ff4d4f; --player-glow-rgba: rgba(255, 77, 79, 0.18); }
.player2 { --player-color: #3f79ff; --player-glow-rgba: rgba(63, 121, 255, 0.18); }

/* active card: glow + slight lift */
.player-status.active {
        box-shadow: 0 8px 30px var(--player-glow-rgba), 0 2px 8px rgba(0,0,0,0.06);
        transform: translateY(-4px);
        z-index: 5;
}

/* turn badge: hidden by default, shown when active */
.player-status .turn-badge {
        position: absolute;
        left: 50%;               /* center horizontally */
        transform: translateX(-50%);  /* account for element width */
        top: -15px;              /* position above the player status bar */
        padding: 6px 10px;
        border-radius: 999px;
        font-weight: 700;
        font-size: 30;
        color: #04243a;
        display: none;
        background: rgba(255,255,255,0.9);
        border: 1px solid rgba(0,0,0,0.06);
        box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* show badge and style when active */
.player-status.active .turn-badge {
        display: inline-block;
        background: linear-gradient(90deg, var(--player-color), color-mix(in srgb, var(--player-color) 70%, white));
        color: #fff;
        border: none;
        box-shadow: 0 6px 24px rgba(0,0,0,0.12);
}

/* pulse animation for the chip */
.player-status .chip {
        transition: box-shadow .18s ease, transform .18s ease;
}

/* active chip pulses slightly */
.player-status.active .chip {
        animation: chip-pulse 1200ms infinite;
}

@keyframes chip-pulse {
        0%   { box-shadow: 0 6px 14px rgba(0,0,0,0.08), 0 0 0 0 var(--player-glow-rgba); transform: scale(1); }
        50%  { box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 0 12px var(--player-glow-rgba); transform: scale(1.05); }
        100% { box-shadow: 0 6px 14px rgba(0,0,0,0.08), 0 0 0 0 var(--player-glow-rgba); transform: scale(1); }
}

/* accessible small-screen tweak for badge */
@media (max-width: 420px) {
        .player-status .turn-badge {
                right: 8px;
                top: 8px;
                padding: 5px 8px;
                font-size: 11px;
        }
}

/* Fill viewport height and let game-container use all available space below the <h1> */
html, body { height: 100%; }
