/* 4diceRow - premium board game look, no external assets.
 * Wood, felt, ivory and brass are all gradients; chips and dice are drawn with
 * CSS so the game looks finished before a single image exists. Optional
 * textures can be dropped in later (see ASSETS.md) - they layer on top of
 * these gradients rather than replacing them.
 */

:root {
    --wood-deep: #21150c;
    --wood: #462c19;
    --wood-mid: #5d3a20;
    --wood-light: #7d5230;
    --felt: #144a31;
    --felt-dark: #175e3e;
    --felt-mid: #218055;
    --brass: #c9a227;
    --brass-light: #f0d472;
    --brass-dim: #8a6f1c;
    --ivory: #f5eee1;
    --ivory-dim: #cdc3b1;
    --charcoal: #1d2024;
    --charcoal-light: #3a4048;
    --ink: #f1e9dc;
    --ink-soft: #b7a892;
    --danger: #b4472f;

    --cell: clamp(26px, 4.1vw, 52px);
    --gap: calc(var(--cell) * 0.16);
    --step: calc(var(--cell) + var(--gap));

    --font-ui: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
    --font-num: Georgia, "Times New Roman", serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font-ui);
    color: var(--ink);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 226, 170, 0.10), transparent 60%),
        linear-gradient(170deg, #241812 0%, #170f0a 55%, #0d0907 100%);
    background-attachment: fixed;
    padding: clamp(10px, 2vw, 28px);
}

#app {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 1.6vw, 20px);
}

/* ------------------------------------------------------------------- topbar */

#topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 6px;
    letter-spacing: 0.02em;
}

.brand-mark {
    font-family: var(--font-num);
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(180deg, var(--brass-light), var(--brass-dim));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--ink);
}

#scoreboard {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.25));
    border: 1px solid rgba(201, 162, 39, 0.28);
}

.score-side {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-name {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-soft);
}

.score-value {
    font-family: var(--font-num);
    font-size: 1.3rem;
    min-width: 1ch;
    text-align: center;
}

.score-sep {
    color: var(--ink-soft);
}

.score-chip {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
}

/* How many re-rolls that colour is holding. Hidden entirely at zero, so the
 * scoreboard looks untouched until the mechanic is in play.
 */
.score-rerolls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--brass-light);
    background: rgba(240, 212, 114, 0.14);
    border: 1px solid rgba(240, 212, 114, 0.42);
}

.score-rerolls[hidden] {
    display: none;
}

/* Lights up while it is that colour's turn and the tokens can actually be
 * spent, which is the only moment the number matters.
 */
.score-rerolls.active {
    color: #2a1e05;
    background: linear-gradient(180deg, var(--brass-light), var(--brass));
    border-color: rgba(255, 240, 190, 0.6);
    box-shadow: 0 0 12px rgba(240, 212, 114, 0.45);
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

/* ------------------------------------------------------------------ buttons */

.btn {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 18px;
    border: 1px solid transparent;
    transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    cursor: default;
    opacity: 0.45;
}

.btn-primary {
    color: #2a1e05;
    background: linear-gradient(180deg, var(--brass-light), var(--brass) 55%, var(--brass-dim));
    border-color: rgba(255, 240, 190, 0.5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
}

.btn-ghost {
    color: var(--ink-soft);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--ink);
    border-color: rgba(201, 162, 39, 0.45);
}

.btn-ghost.is-open {
    color: var(--brass-light);
    background: rgba(240, 212, 114, 0.16);
    border-color: rgba(240, 212, 114, 0.55);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: 8px;
}

/* ----------------------------------------------------------------- settings */

#settings {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 16px 20px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

/* The display above would otherwise win over the hidden attribute, which left
 * the panel permanently open however often the button was pressed.
 */
#settings[hidden] {
    display: none;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.field select,
.field input[type="range"] {
    font: inherit;
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ink);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 7px 10px;
    min-width: 190px;
}

.field select option {
    background: #1a1410;
}

/* -------------------------------------------------------------------- table */

#table {
    display: flex;
    gap: clamp(14px, 2vw, 28px);
    align-items: flex-start;
}

#boardArea {
    flex: 1 1 auto;
    min-width: 0;
}

/* The wooden surround, with the felt playing surface inlaid into it. */
#boardFrame {
    display: grid;
    grid-template-columns: auto auto auto;
    grid-template-rows: auto auto;
    gap: calc(var(--cell) * 0.16);
    padding: calc(var(--cell) * 0.34);
    border-radius: 18px;
    /* img/wood.jpg is optional: a missing background layer is skipped by the
     * browser, so the gradient underneath keeps the frame looking finished.
     */
    background:
        url("../img/wood.jpg") center / 520px repeat,
        repeating-linear-gradient(93deg, rgba(0, 0, 0, 0.10) 0 3px, rgba(255, 255, 255, 0.03) 3px 7px),
        linear-gradient(160deg, var(--wood-light), var(--wood) 45%, var(--wood-deep));
    background-blend-mode: soft-light, normal, normal;
    box-shadow:
        0 22px 45px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 220, 170, 0.22),
        inset 0 -2px 6px rgba(0, 0, 0, 0.5);
}

.frame-label {
    display: grid;
    font-family: var(--font-num);
    font-size: calc(var(--cell) * 0.36);
    color: var(--brass-light);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7);
}

.frame-top {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(11, var(--cell));
    gap: var(--gap);
    text-align: center;
}

.frame-left,
.frame-right {
    grid-row: 2;
    grid-template-rows: repeat(6, var(--cell));
    gap: var(--gap);
    align-items: center;
    padding: 0 calc(var(--cell) * 0.08);
}

.frame-left {
    grid-column: 1;
    text-align: right;
}

.frame-right {
    grid-column: 3;
    text-align: left;
}

.frame-label span {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* Highlights the column or row an option would use. */
.frame-label span.lit {
    color: #fff6d8;
    text-shadow: 0 0 10px rgba(240, 212, 114, 0.9);
}

#board {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    padding: var(--gap);
    border-radius: 10px;
    /* img/felt.jpg is optional in the same way. */
    background:
        url("../img/felt.jpg") center / 340px repeat,
        radial-gradient(ellipse at 50% 22%, rgba(255, 255, 255, 0.08), transparent 65%),
        linear-gradient(175deg, var(--felt-mid), #103a26 40%, var(--felt-dark));
    background-blend-mode: soft-light, normal, normal;
    background-color: #123f2a;
    box-shadow:
        inset 0 3px 12px rgba(0, 0, 0, 0.65),
        inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

#holes {
    display: grid;
    grid-template-columns: repeat(11, var(--cell));
    grid-template-rows: repeat(6, var(--cell));
    gap: var(--gap);
}

/* Each cell is a faint ring stitched into the felt. */
.hole {
    position: relative;
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.28),
        inset 0 1px 2px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at 50% 40%, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.05) 70%);
}

.hole.landing {
    box-shadow:
        inset 0 0 0 2px rgba(240, 212, 114, 0.75),
        0 0 12px rgba(240, 212, 114, 0.35);
}

#overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* -------------------------------------------------------------------- chips */

.chip {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    will-change: transform;
}

.chip-black,
.chip.black {
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.06) 38%, transparent 60%),
        radial-gradient(circle at 50% 120%, #4a5259, #14171a 70%);
    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.14),
        inset 0 -3px 6px rgba(0, 0, 0, 0.6);
}

.chip-white,
.chip.white {
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.25) 40%, transparent 62%),
        radial-gradient(circle at 50% 120%, #cdbfa6, #f7f1e4 70%);
    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(120, 100, 70, 0.35),
        inset 0 -3px 6px rgba(120, 100, 70, 0.28);
}

.chip.settling {
    animation: chip-settle 220ms ease-out;
}

@keyframes chip-settle {
    0% {
        transform: scaleY(0.84) scaleX(1.1);
    }
    55% {
        transform: scaleY(1.06) scaleX(0.96);
    }
    100% {
        transform: scaleY(1) scaleX(1);
    }
}

.chip.winner {
    animation: chip-glow 1.1s ease-in-out infinite alternate;
    z-index: 3;
}

@keyframes chip-glow {
    from {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(240, 212, 114, 0.5);
    }
    to {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 22px 6px rgba(240, 212, 114, 0.75);
    }
}

/* Chips a power move is about to take off the board. */
.chip.doomed {
    animation: chip-doomed 0.9s ease-in-out infinite alternate;
    z-index: 2;
}

@keyframes chip-doomed {
    from {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(180, 71, 47, 0.65);
    }
    to {
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), 0 0 16px 3px rgba(180, 71, 47, 0.85);
    }
}

.chip.vanishing {
    animation: chip-vanish 420ms cubic-bezier(0.5, 0, 0.75, 0) forwards;
    z-index: 2;
}

@keyframes chip-vanish {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    35% {
        transform: scale(1.18);
        opacity: 1;
    }
    100% {
        transform: scale(0.1) rotate(20deg);
        opacity: 0;
    }
}

/* Preview of where a chip would land. */
.ghost {
    position: absolute;
    inset: 12%;
    border-radius: 50%;
    border: 2px dashed rgba(240, 212, 114, 0.85);
    background: rgba(240, 212, 114, 0.12);
    animation: ghost-pulse 1.3s ease-in-out infinite;
}

.ghost.second::after {
    content: "2";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-num);
    font-size: calc(var(--cell) * 0.4);
    color: rgba(255, 246, 216, 0.9);
}

@keyframes ghost-pulse {
    0%, 100% {
        opacity: 0.55;
    }
    50% {
        opacity: 1;
    }
}

#winLine {
    position: absolute;
    height: calc(var(--cell) * 0.16);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(240, 212, 114, 0.1), var(--brass-light), rgba(240, 212, 114, 0.1));
    box-shadow: 0 0 18px rgba(240, 212, 114, 0.8);
    transform-origin: 0 50%;
    z-index: 4;
}

#boardHint {
    margin: 12px 2px 0;
    min-height: 1.4em;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

/* ------------------------------------------------------------- action guide
 * A reminder strip under the board. Each card draws the board in miniature
 * with arrows where a chip can enter it, because direction and reach are the
 * parts of an action that are hardest to hold in your head.
 */

#actionGuide {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.guide-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 9px 6px 8px;
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.26));
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.guide-head {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
}

.guide-die {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 21px;
    height: 21px;
    padding: 3px;
    border-radius: 5px;
    background: linear-gradient(150deg, #fffdf6, var(--ivory) 48%, #ded2bc);
    box-shadow: inset 0 0 0 1px rgba(120, 100, 70, 0.32);
}

.guide-die i {
    align-self: center;
    justify-self: center;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #23272b;
}

.guide-badge {
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 999px;
    background: var(--brass);
    color: #2a1e05;
}

.guide-svg {
    width: 100%;
    max-width: 78px;
    height: auto;
}

.guide-board {
    fill: rgba(16, 58, 38, 0.85);
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 0.8;
}

.guide-cell {
    fill: rgba(255, 255, 255, 0.16);
}

.guide-arrow {
    fill: none;
    stroke: var(--brass-light);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.guide-caption {
    font-size: 0.66rem;
    line-height: 1.25;
    text-align: center;
    color: var(--ink-soft);
    letter-spacing: 0.01em;
}

/* Once the dice are on the table the strip doubles as a read-out: the three
 * values you rolled come forward, the one you took lights up, the rest fade.
 * Every state is a plain class on the card itself rather than a :has() on the
 * strip, because the game is meant to open from a file:// with no build step
 * and nothing here needs a selector newer than the rest of the sheet.
 */
.guide-card.dim {
    opacity: 0.3;
}

.guide-card.rolled {
    border-color: rgba(240, 212, 114, 0.36);
    background: linear-gradient(180deg, rgba(240, 212, 114, 0.09), rgba(0, 0, 0, 0.26));
}

.guide-card.chosen {
    border-color: var(--brass-light);
    background: linear-gradient(180deg, rgba(240, 212, 114, 0.2), rgba(0, 0, 0, 0.24));
    box-shadow: 0 0 16px rgba(240, 212, 114, 0.3);
}

.guide-card.chosen .guide-caption {
    color: var(--ink);
}

/* -------------------------------------------------------------------- panel */

#panel {
    flex: 0 0 clamp(260px, 26vw, 330px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.3));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

#turnBanner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.turn-chip {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex: 0 0 auto;
    transition: box-shadow 0.3s ease;
}

#turnBanner.black .turn-chip {
    background: radial-gradient(circle at 34% 28%, #5a636b, #14171a 70%);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18), 0 0 14px rgba(90, 99, 107, 0.6);
}

#turnBanner.white .turn-chip {
    background: radial-gradient(circle at 34% 28%, #fff, #cdbfa6 75%);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25), 0 0 14px rgba(245, 238, 225, 0.6);
}

/* --------------------------------------------------------------------- dice */

#diceTray {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 1.4vw, 16px);
    padding: 14px 8px 18px;
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(0, 0, 0, 0.35), transparent 70%),
        linear-gradient(180deg, #133f2b, #0b2b1d);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
    min-height: calc(var(--cell) * 1.9);
}

.die-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.14s ease;
}

/* A die that is still selectable lifts a little under the cursor, so it reads as
 * "click me to use this one instead" while another die is already chosen.
 */
.die-slot.pickable:not(.chosen):hover {
    transform: translateY(-3px);
}

.die-slot.pickable:not(.chosen):hover .cube {
    box-shadow: 0 0 0 2px rgba(240, 212, 114, 0.55);
    border-radius: 16%;
}

.die {
    --die: clamp(38px, 5.4vw, 58px);
    width: var(--die);
    height: var(--die);
    perspective: 520px;
    cursor: default;
    background: none;
    border: 0;
    padding: 0;
}

.die-slot.pickable .die {
    cursor: pointer;
}

.cube {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.22, 0.9, 0.25, 1);
}

.face {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 14%;
    border-radius: 16%;
    background: linear-gradient(150deg, #fffdf6, var(--ivory) 45%, #ded2bc);
    box-shadow: inset 0 0 0 1px rgba(120, 100, 70, 0.3);
    backface-visibility: hidden;
}

.pip {
    align-self: center;
    justify-self: center;
    width: 60%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 32%, #5c5750, #14171a 70%);
    box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.25);
}

.die-slot.chosen .cube {
    box-shadow: 0 0 0 3px var(--brass-light), 0 0 26px rgba(240, 212, 114, 0.7);
    border-radius: 16%;
}

.die-slot.chosen {
    transform: translateY(-6px);
}

/* Dims the die itself rather than the whole slot: opacity on the slot would
 * take the re-roll button down with it, and a die you cannot use as the action
 * die is precisely the one you want to throw again.
 */
.die-slot.dimmed .die,
.die-slot.dimmed .die-badge {
    opacity: 0.4;
    filter: saturate(0.5);
}

.die-badge {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
    min-height: 1em;
}

.die-slot.chosen .die-badge {
    color: var(--brass-light);
}

.die-slot .die-role {
    position: absolute;
    top: -8px;
    right: -4px;
    font-size: 0.62rem;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--brass);
    color: #2a1e05;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.die-slot.chosen .die-role {
    opacity: 1;
}

/* ------------------------------------------------------------------ rerolls */

.die-reroll {
    font: inherit;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--brass-light);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(240, 212, 114, 0.45);
    transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.die-reroll[hidden] {
    display: none;
}

.die-reroll:hover:not(:disabled) {
    color: #2a1e05;
    background: linear-gradient(180deg, var(--brass-light), var(--brass));
    box-shadow: 0 0 14px rgba(240, 212, 114, 0.5);
}

.die-reroll:active:not(:disabled) {
    transform: translateY(1px);
}

.die-reroll:disabled {
    cursor: default;
    opacity: 0.3;
}

/* A throw the double has already paid for. Filled gold against the outlined
 * token button, because spending a token on a die you could have thrown for
 * nothing is the one mistake this interface can actually prevent.
 */
.die-reroll.free {
    color: #2a1e05;
    background: linear-gradient(180deg, var(--brass-light), var(--brass));
    border-color: rgba(255, 240, 190, 0.7);
    box-shadow: 0 0 12px rgba(240, 212, 114, 0.45);
    animation: free-throw 1.6s ease-in-out infinite;
}

.die-reroll.free:hover:not(:disabled) {
    filter: brightness(1.1);
}

.die-reroll-tag {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.die-reroll-tag:not(:empty) {
    margin-left: 4px;
}

@keyframes free-throw {
    0%, 100% {
        box-shadow: 0 0 12px rgba(240, 212, 114, 0.45);
    }
    50% {
        box-shadow: 0 0 20px rgba(240, 212, 114, 0.75);
    }
}

#passBtn[hidden] {
    display: none;
}

.rolling .cube {
    transition: transform 1.05s cubic-bezier(0.18, 0.72, 0.24, 1);
}

/* ------------------------------------------------------------------ options */

#actionInfo {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#actionHelp {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--ink);
    padding: 10px 12px;
    border-left: 3px solid var(--brass);
    background: rgba(240, 212, 114, 0.08);
    border-radius: 0 8px 8px 0;
}

#optionList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    font: inherit;
    color: var(--ink);
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}

.option:hover:not(:disabled),
.option:focus-visible {
    background: rgba(240, 212, 114, 0.14);
    border-color: rgba(240, 212, 114, 0.6);
    outline: none;
}

.option:active:not(:disabled) {
    transform: translateY(1px);
}

.option-icon {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.35);
    color: var(--brass-light);
}

.option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.option-label {
    font-weight: 600;
    font-size: 0.94rem;
}

.option-detail {
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.option.two-chips .option-label::after {
    content: "2 chips";
    margin-left: 8px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--brass);
    color: #2a1e05;
    vertical-align: middle;
}

/* A triple turns up about once every fourteen games for a given player, so
 * when one is on offer it should be unmistakable in the list.
 */
.option.triple {
    border-color: rgba(240, 212, 114, 0.55);
    background: linear-gradient(90deg, rgba(240, 212, 114, 0.16), rgba(240, 212, 114, 0.05));
}

.option.triple:hover:not(:disabled),
.option.triple:focus-visible {
    background: linear-gradient(90deg, rgba(240, 212, 114, 0.26), rgba(240, 212, 114, 0.1));
    border-color: var(--brass-light);
}

.option.triple .option-icon {
    background: var(--brass);
    color: #2a1e05;
}

.option.triple .option-label {
    color: var(--brass-light);
}

.option:disabled {
    cursor: default;
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.2);
    border-style: dashed;
}

.option:disabled .option-icon {
    color: var(--danger);
}

/* ------------------------------------------------------------------ message */

#message {
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
    background: rgba(240, 212, 114, 0.14);
    border: 1px solid rgba(240, 212, 114, 0.45);
}

#message.bad {
    background: rgba(180, 71, 47, 0.18);
    border-color: rgba(180, 71, 47, 0.55);
}

#message .message-sub {
    display: block;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

/* ----------------------------------------------------------------- rulesbar */

#rulesbar {
    font-size: 0.9rem;
    color: var(--ink-soft);
}

#rulesbar summary {
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: fit-content;
    font-weight: 600;
    color: var(--ink);
}

.rules-body {
    padding: 4px 16px 0;
    line-height: 1.6;
    max-width: 70ch;
}

.rules-body strong {
    color: var(--ink);
}

#rulesList {
    padding-left: 20px;
}

#rulesList li {
    margin: 4px 0;
}

#rulesList b {
    font-family: var(--font-num);
    color: var(--brass-light);
    font-size: 1.05em;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 860px) {
    #table {
        flex-direction: column;
    }

    #panel {
        flex: 1 1 auto;
        width: 100%;
    }

    #boardFrame {
        overflow-x: auto;
    }
}

@media (max-width: 620px) {
    #actionGuide {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .cube,
    .chip {
        transition-duration: 1ms !important;
    }

    .chip.settling,
    .ghost,
    .chip.winner,
    .chip.doomed,
    .chip.vanishing,
    .die-reroll.free {
        animation: none;
    }
}
