:root {
    --board-gap: 8px;
    --board-max-size: min(720px, 100%);
    --line-move: #2563EB;
    --line-up: #22C55E;
    --line-down: #EF4444;
}

.board-wrap {
    display: flex;
    justify-content: center;
    padding: 0;
}

.board-hull {
    --board-cell-size: calc((var(--board-max-size) - (8 * var(--board-gap))) / 9);
    --board-padding: 18px;
    position: relative;
    isolation: isolate;
    z-index: 0;
    padding: var(--board-padding);
    border-radius: 20px;
    overflow: hidden;
    border: 0px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 0 20px rgba(255, 255, 255, 0.04);
    display: inline-flex;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.board-hull::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(6px 6px at 12% 18%, rgba(255, 220, 160, 0.16), transparent 60%),
        radial-gradient(5px 5px at 83% 42%, rgba(255, 220, 160, 0.12), transparent 60%),
        radial-gradient(4px 4px at 36% 77%, rgba(255, 220, 160, 0.1), transparent 60%),
        linear-gradient(to bottom, rgba(8, 12, 22, 0.12), rgba(8, 12, 22, 0.2)),
        url("../img/leela-bg.jpg") center/cover no-repeat;
    filter: saturate(108%) contrast(103%) brightness(1.03);
    opacity: 0.96;
}

.board-hull::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.3), inset 0 0 260px rgba(0, 0, 0, 0.18);
}

.board-hull > * {
    position: relative;
    z-index: 1;
}

.board {
    display: grid;
    gap: 10px 5px;
    grid-template-columns: repeat(9, minmax(0, var(--board-cell-size)));
    width: min(100%, var(--board-max-size));
}

.board-hull {
    --board-gap: 6px;
    --board-padding: 14px;
    padding: var(--board-padding);
    overflow: visible;
}

.board-hull::before,
.board-hull::after {
    border-radius: inherit;
    pointer-events: none;
}

.board-arrows {
    position: absolute;
    inset: var(--board-padding, 0px);
    pointer-events: none;
    z-index: 2;
    width: calc(100% - (2 * var(--board-padding, 0px)));
    height: calc(100% - (2 * var(--board-padding, 0px)));
    overflow: visible;
}

.arrow-path {
    fill: none;
    stroke-linecap: round;
    stroke-width: 2;
}

.arrow-shadow {
    stroke: #000;
    opacity: 0.25;
}

.board-arrows .arrow-path[marker-end*="leelaArrowMove"] {
    stroke: var(--line-move);
}

.board-arrows .arrow-path[marker-end*="leelaArrowUp"] {
    stroke: var(--line-up);
}

.board-arrows .arrow-path[marker-end*="leelaArrowDown"] {
    stroke: var(--line-down);
}

.cell {
    position: relative;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(32, 38, 58, 0.78), rgba(16, 20, 30, 0.72));
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 0 32px rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(2.5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

/*.cell:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.55),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 0 36px rgba(255, 255, 255, 0.08);
}*/

.cell::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    pointer-events: none;
    background: radial-gradient(80% 70% at 50% 30%, rgba(255, 255, 255, 0.06), transparent 60%);
}

.cell .n {
    position: absolute;
    top: 6px;
    left: 0px;
    right: 0px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.8), 0 1px 0 rgba(0, 0, 0, 0.6);
}

.cell .label {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #fff;
    letter-spacing: 0.2px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(8, 12, 22, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
    text-align: center;
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

.cell.current {
    outline: 2px solid rgba(245, 196, 107, 0.9);
    animation: cellPulse 2s infinite;
}

@keyframes cellPulse {
    0% {
        box-shadow: 0 0 0 4px rgba(245, 196, 107, 0.2), 0 0 40px rgba(245, 196, 107, 0.28), inset 0 0 34px rgba(245, 196, 107, 0.14);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(245, 196, 107, 0), 0 0 40px rgba(245, 196, 107, 0), inset 0 0 34px rgba(245, 196, 107, 0.14);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(245, 196, 107, 0.2), 0 0 40px rgba(245, 196, 107, 0.28), inset 0 0 34px rgba(245, 196, 107, 0.14);
    }
}

.cell.dest {
    animation: destGlow 1.5s ease-out forwards;
}

@keyframes destGlow {
    0% {
        box-shadow: 0 0 0 4px rgba(122, 167, 255, 0.7), 0 0 20px rgba(122, 167, 255, 0.6);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(122, 167, 255, 0), 0 0 40px rgba(122, 167, 255, 0);
    }
}

.tokens {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px;
}

.tok {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #60a5fa;
    position: relative;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28) inset, 0 4px 10px rgba(0, 0, 0, 0.45), 0 0 18px rgba(107, 183, 255, 0.55);
}

.tok::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    box-shadow: 0 0 22px currentColor;
    opacity: 0.35;
    pointer-events: none;
}

.cell.ladder {
    box-shadow: inset 0 0 0 1px rgba(122, 167, 255, 0.5), inset 0 0 28px rgba(122, 167, 255, 0.16);
}

.cell.snake {
    box-shadow: inset 0 0 0 1px rgba(230, 139, 119, 0.5), inset 0 0 28px rgba(230, 139, 119, 0.16);
}

.rules {
    margin-top: 10px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.transition-legend {
    margin: 8px 0;
    display: flex;
    justify-content: center;
    gap: 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.transition-legend .leg {
    display: flex;
    align-items: center;
    gap: 6px;
}

.transition-legend .leg .line {
    display: inline-block;
    width: 24px;
    height: 0;
    border-top: 2px solid var(--line-up);
    opacity: 0.7;
}

.transition-legend .leg.down .line {
    border-top: 2px dashed var(--line-down);
}


.history-roll {
    position: absolute;
    z-index: 1;
    background: #1e293b;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    top: 74px;
    left: -40px;
    font-size: 12px;
    box-shadow: 0 0 3px #000 inset;
}
.history-roll.history-roll-ladder::before {
     position: absolute;
     content: "";
     width: 10px;
     height: 60px;
     top: -19px;
     left: 7px;
     z-index: -1;
     background: linear-gradient(0deg, #1e293b, #3abdf8);
 }

.history-roll.history-roll-snake::before {
     position: absolute;
     content: "";
     width: 10px;
     height: 60px;
     top: -19px;
     left: 7px;
     z-index: -1;
     background: linear-gradient(0deg, #1e293b, #fb7085);
 }

.history-roll.history-roll-ladder .history-roll-circle {
    background: #35a5d9;
    color: #010d15;
    border-radius: 50%;
    font-size: 11px;
    height: 24px;
    width: 24px;
    text-align: center;
    line-height: 24px;
    margin-top: -6px;
    margin-left: -1px;
    background: linear-gradient(180deg, #349bcc, #296486);
}

.history-roll.history-roll-snake .history-roll-circle {
    background: #fb7085;
    color: #010d15;
    border-radius: 50%;
    font-size: 11px;
    height: 24px;
    width: 24px;
    text-align: center;
    line-height: 24px;
    margin-top: -6px;
    margin-left: -1px;
    background: linear-gradient(180deg, #c86074, #764559);
}

li .history-roll-step {
    height: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;
    justify-content: flex-start;
}

.history-roll-span {
    display: block;
    margin-top: 1px;
    float: left;
    margin-right: 5px;
}

.history-roll-cell-name {
    text-transform: lowercase;
    display: inline-block;
    margin-top: 29px;
}
.history-roll-cell-name::first-letter {
    text-transform: uppercase !important;
}


.card.bg-base-100.bg-purple-100\/5.shadow-md:last-child {
    margin-bottom: -8px !important;
}

.card-footer {
    border-radius: 0 0 16px 16px;
}
