/* Connect 4 board (Pages/Connect4/_Connect4Board.cshtml + wwwroot/js/connect4.js). Our own art: a blue frame with
   round holes, red and yellow discs, all CSS. Sizes are set in px by setConnect4BoardSize(); everything inside the
   board is positioned in % of it (a cell is 1/7 wide and 1/6 tall, so cells are square). */

.c4-whole-board {
    position: relative;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    line-height: 1;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

    .c4-whole-board.c4-can-drop {
        cursor: pointer;
    }

/* The strip above the board that holds the hover disc (desktop). Hidden on static boards. */
.c4-ghost-row {
    position: relative;
    box-sizing: border-box;
    height: 50px;
}

.c4-ghost-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.c4-ghost-disc {
    position: absolute;
    top: 0;
    width: calc(100% / 7);
    height: 100%;
    opacity: 0;
    transition: left 0.08s ease-out, opacity 0.12s ease;
    pointer-events: none;
}

    .c4-ghost-disc.c4-visible {
        opacity: 0.85;
    }

    .c4-ghost-disc::before {
        content: '';
        position: absolute;
        inset: 10%;
        border-radius: 50%;
    }

    .c4-ghost-disc.c4-red::before {
        background: radial-gradient(circle at 36% 32%, #ff8a8a 0%, #e0303f 45%, #a8152a 100%);
        box-shadow: inset 0 0 0 3px rgba(120, 10, 25, 0.35);
    }

    .c4-ghost-disc.c4-yellow::before {
        background: radial-gradient(circle at 36% 32%, #fff6a8 0%, #f8cc1e 45%, #c99a06 100%);
        box-shadow: inset 0 0 0 3px rgba(140, 100, 0, 0.35);
    }

.c4-static .c4-ghost-row {
    display: none;
}

/* Touch screens have no hover, so the strip would only be empty space. */
@media (hover: none) {
    .c4-ghost-row {
        display: none;
    }
}

/* The frame: deep blue, a little lighter at the top. Padding is set by setConnect4BoardSize(). */
.c4-outer-board {
    padding: 14px;
    background: linear-gradient(170deg, #2f63d8 0%, #1f4cb8 45%, #173c96 100%);
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(10, 18, 40, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.18);
}

.c4-board {
    position: relative;
    width: 420px;
    height: 360px;
    user-select: none;
    -webkit-user-select: none;
}

/* Behind the holes: the "air" you see through an empty hole. */
.c4-discs {
    position: absolute;
    inset: 0;
    background: #d9e3f2;
    border-radius: 4px;
}

/* The blue panel with 42 round holes, drawn in front of the discs so dropping discs fall behind it. */
.c4-grid {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background-image: radial-gradient(circle closest-side, transparent 0, transparent 80%, rgba(8, 22, 70, 0.55) 81%, #2456c9 88%, #2253c4 100%);
    background-size: calc(100% / 7) calc(100% / 6);
}

.c4-marks {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

.c4-disc,
.c4-mark {
    position: absolute;
    width: calc(100% / 7);
    height: calc(100% / 6);
}

.c4-disc {
    z-index: 1;
}

    /* The disc itself: a little larger than the hole, so no gap shows. */
    .c4-disc::before {
        content: '';
        position: absolute;
        inset: 9%;
        border-radius: 50%;
    }

.c4-red::before {
    background: radial-gradient(circle at 36% 32%, #ff7d7d 0%, #e0303f 42%, #b0182d 78%, #8c1022 100%);
    box-shadow: inset 0 0 0 0.25em rgba(120, 10, 25, 0.28), inset 0 -0.15em 0.3em rgba(0, 0, 0, 0.25);
}

.c4-yellow::before {
    background: radial-gradient(circle at 36% 32%, #fff4a0 0%, #fbd226 42%, #e2ad0b 78%, #b98900 100%);
    box-shadow: inset 0 0 0 0.25em rgba(150, 105, 0, 0.25), inset 0 -0.15em 0.3em rgba(0, 0, 0, 0.2);
}

/* A short squash when a disc lands. */
.c4-landed::before {
    animation: c4-land 0.24s ease-out;
}

@keyframes c4-land {
    0% { transform: scale(1, 1); }
    40% { transform: translateY(4%) scale(1.06, 0.9); }
    100% { transform: scale(1, 1); }
}

/* Where the hover disc would land. */
.c4-preview::after {
    content: '';
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.75);
}

/* The last disc played: a small white dot in its middle. */
.c4-last::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16%;
    height: 16%;
    margin: -8% 0 0 -8%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

/* The winning four: a bright pulsing ring on each disc. */
.c4-win::after {
    content: '';
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    border: 0.3em solid #ffffff;
    box-shadow: 0 0 0.6em 0.15em rgba(255, 255, 255, 0.85), inset 0 0 0.4em rgba(255, 255, 255, 0.6);
    animation: c4-win 1.1s ease-in-out infinite;
}

@keyframes c4-win {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.9); opacity: 0.7; }
}

/* A whole column (Clue). */
.c4-column-mark {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(100% / 7);
    border-radius: 8px;
}

.c4-clue {
    background: rgba(63, 214, 200, 0.28);
    box-shadow: inset 0 0 0 3px rgba(150, 255, 245, 0.9), 0 0 14px 2px rgba(63, 214, 200, 0.65);
    animation: c4-clue 1.4s ease-in-out infinite;
}

@keyframes c4-clue {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* A column picked out by the Learn page. */
.c4-note {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 3px rgba(255, 233, 140, 0.95);
}

/* A cell picked out by the Learn page: a Red or Yellow threat (an empty hole that would make four). */
.c4-threat-r::after,
.c4-threat-y::after {
    content: '';
    position: absolute;
    inset: 13%;
    border-radius: 50%;
    border: 0.25em dashed #d7263d;
    background: rgba(215, 38, 61, 0.12);
}

.c4-threat-y::after {
    border-color: #c08f00;
    background: rgba(240, 190, 20, 0.16);
}

@media (prefers-reduced-motion: reduce) {
    .c4-win::after,
    .c4-clue,
    .c4-landed::before {
        animation: none;
    }
}

.c4-win-popup {
    background-color: var(--bs-gray-900);
    z-index: 10000;
}

/* Puzzle page */
.daily-header {
    background-color: var(--bs-gray-900);
}

.c4-header {
    min-height: 0;
    padding: 8px 20px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

    .c4-header p {
        font-size: 1.3rem;
    }

/* Refresh and Next are boxes with a cut-out icon: match them to the royal Clue / Skip / Share icons. */
.c4-footer .refresh-box,
.c4-footer .next-svg-container {
    background: var(--royal) !important;
}

    .c4-footer .refresh-box path,
    .c4-footer .next-svg-container path {
        fill: var(--bs-gray-900);
    }

.c4-no-puzzles {
    max-width: 600px;
    margin: 80px auto;
    border-radius: 5px;
}

/* The side to move's disc colour, next to the task text in the footer. */
.c4-turn-disc {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-right: 0.35em;
    border-radius: 50%;
    vertical-align: -0.05em;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
}

    .c4-turn-disc.c4-red {
        background: radial-gradient(circle at 36% 32%, #ff7d7d 0%, #e0303f 50%, #a8152a 100%);
    }

    .c4-turn-disc.c4-yellow {
        background: radial-gradient(circle at 36% 32%, #fff4a0 0%, #fbd226 50%, #c99a06 100%);
    }

.c4-show-line {
    display: inline-block;
    padding: 6px 16px;
    border: 2px solid var(--royal);
    border-radius: 20px;
    background: transparent;
    color: var(--royal);
    font-family: Hamlin, sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
}

    .c4-show-line:hover,
    .c4-show-line:focus-visible {
        background: var(--royal);
        color: var(--bs-gray-900);
    }

    .c4-show-line:disabled {
        opacity: 0.5;
        cursor: default;
    }

.c4-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.c4-tag {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--royal);
    border-radius: 12px;
    color: var(--royal);
    font-family: Hamlin, sans-serif;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: nowrap;
    cursor: help;
}

/* Footer under the puzzle board: let it grow when the text and buttons wrap on phones. */
.c4-footer {
    height: auto !important;
    min-height: 98px;
}

@media screen and (max-width: 800px) {
    .c4-footer {
        padding: 18px 10px 22px;
    }

        .c4-footer .button-spacing {
            gap: 14px 35px;
        }

        .c4-footer .colour {
            flex-basis: 100%;
            white-space: normal;
            text-align: center;
            line-height: 1.3;
            font-size: clamp(17px, 5.2vw, 25px) !important;
        }

        .c4-footer .share-row-container {
            width: 40px;
            flex-shrink: 0;
        }
}
