.cn-josephus-game {
    --josephus-node-size: 40px;
    --josephus-ring-max: 780px;
    min-height: 70svh;
    border-radius: 1.25rem;
    color: #e8eefc;
    background: #0b0f17;
    color-scheme: dark;
    isolation: isolate;
}

.cn-josephus-game .josephus-card {
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 1.125rem;
    background: rgb(255 255 255 / 4.5%);
}

.cn-josephus-game .josephus-muted {
    color: rgb(232 238 252 / 72%);
}

.cn-josephus-game .josephus-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.cn-josephus-game .form-label,
.cn-josephus-game .form-check-label {
    color: #fff;
}

.cn-josephus-game .form-control,
.cn-josephus-game .form-select {
    border-color: rgb(255 255 255 / 15%);
    color: #fff;
    background-color: rgb(255 255 255 / 6%);
}

.cn-josephus-game .form-control:focus,
.cn-josephus-game .form-select:focus {
    border-color: rgb(99 165 255 / 65%);
    color: #fff;
    background-color: rgb(255 255 255 / 8%);
    box-shadow: 0 0 0 0.25rem rgb(99 165 255 / 15%);
}

.cn-josephus-game .form-control[readonly] {
    color: #dce8ff;
    background-color: rgb(255 255 255 / 4%);
}

.cn-josephus-game .form-select option {
    color: #111827;
    background: #fff;
}

.cn-josephus-game .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.cn-josephus-game .btn:focus-visible,
.cn-josephus-game .form-control:focus-visible,
.cn-josephus-game .form-select:focus-visible,
.cn-josephus-game .form-check-input:focus-visible,
.cn-josephus-game .josephus-person:focus-visible,
.cn-josephus-game .josephus-big-tip__close:focus-visible {
    outline: 3px solid #91c4ff;
    outline-offset: 3px;
}

.cn-josephus-game .josephus-warning {
    padding: 0.65rem 0.75rem;
    border: 1px solid rgb(241 196 15 / 35%);
    border-radius: 0.875rem;
    color: rgb(255 238 180 / 95%);
    background: rgb(241 196 15 / 12%);
    overflow-wrap: anywhere;
}

.cn-josephus-game .josephus-permalink {
    padding: 0.75rem;
    border: 1px solid rgb(99 165 255 / 28%);
    border-radius: 0.875rem;
    background: rgb(99 165 255 / 8%);
}

.cn-josephus-game .josephus-legend-dot {
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.5rem;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    vertical-align: -0.125rem;
}

.cn-josephus-game .josephus-legend-dot.is-alive {
    background: rgb(255 255 255 / 8%);
}

.cn-josephus-game .josephus-legend-dot.is-loser {
    border-color: rgb(231 76 60 / 55%);
    background: rgb(231 76 60 / 22%);
}

.cn-josephus-game .josephus-legend-dot.is-winner {
    border-color: rgb(46 204 113 / 55%);
    background: rgb(46 204 113 / 25%);
}

.cn-josephus-game .josephus-scrollbox {
    min-height: 2.75rem;
    max-height: 13.75rem;
    padding: 0.625rem 0.75rem;
    overflow: auto;
    border: 1px solid rgb(255 255 255 / 8%);
    border-radius: 0.875rem;
    color: #fff;
    background: rgb(255 255 255 / 3%);
}

.cn-josephus-game .josephus-ring-wrap {
    position: relative;
    width: min(100%, var(--josephus-ring-max));
    margin: 0.375rem auto 0;
    aspect-ratio: 1;
}

.cn-josephus-game .josephus-ring {
    position: absolute;
    inset: 0;
    border: 2px dashed rgb(232 238 252 / 18%);
    border-radius: 50%;
    background: radial-gradient(circle at center, rgb(255 255 255 / 6%), transparent 60%);
    box-shadow: 0 0 0 10px rgb(255 255 255 / 2%) inset;
}

.cn-josephus-game .josephus-people {
    position: absolute;
    inset: 0;
}

.cn-josephus-game .josephus-pointer {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 0;
    opacity: 0.95;
    pointer-events: none;
    transform-origin: 0 50%;
    transition: transform 120ms linear;
}

.cn-josephus-game .josephus-pointer__line {
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgb(255 255 255 / 55%);
    filter: drop-shadow(0 0 10px rgb(255 255 255 / 16%));
}

.cn-josephus-game .josephus-pointer__head {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: rgb(255 255 255 / 65%);
    transform: rotate(45deg);
}

.cn-josephus-game .josephus-person {
    --josephus-position: translate(-50%, -50%);
    --josephus-scale: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: var(--josephus-node-size);
    height: var(--josephus-node-size);
    padding: 0;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 50%;
    color: rgb(232 238 252 / 92%);
    background: rgb(255 255 255 / 6%);
    box-shadow: 0 10px 18px rgb(0 0 0 / 35%);
    font-size: clamp(0.625rem, calc(var(--josephus-node-size) * 0.3), 0.875rem);
    font-weight: 800;
    line-height: 1;
    transform: var(--josephus-position) scale(var(--josephus-scale));
    transform-origin: center;
    transition: transform 160ms ease, opacity 160ms ease, filter 160ms ease, background 160ms ease, border-color 160ms ease;
    user-select: none;
    appearance: none;
    cursor: pointer;
}

.cn-josephus-game .josephus-person.is-start {
    outline: 2px solid rgb(99 165 255 / 85%);
    outline-offset: 2px;
    filter: drop-shadow(0 0 10px rgb(99 165 255 / 25%));
}

.cn-josephus-game .josephus-person.is-current {
    --josephus-scale: 1.12;
    z-index: 2;
    border-color: rgb(255 255 255 / 55%);
    filter: drop-shadow(0 0 14px rgb(255 255 255 / 24%));
}

.cn-josephus-game .josephus-person.is-winner {
    border-color: rgb(46 204 113 / 60%);
    color: #c8ffd9;
    background: rgb(46 204 113 / 22%);
}

.cn-josephus-game .josephus-person.is-loser {
    border-color: rgb(231 76 60 / 60%);
    color: #ffd0cb;
    background: rgb(231 76 60 / 18%);
    opacity: 0.95;
}

.cn-josephus-game .josephus-person.is-just-eliminated {
    animation: josephus-pop 320ms ease;
}

@keyframes josephus-pop {
    0% {
        box-shadow: 0 0 0 0.75rem rgb(231 76 60 / 28%), 0 10px 18px rgb(0 0 0 / 35%);
    }
    100% {
        box-shadow: 0 0 0 0 rgb(231 76 60 / 0%), 0 10px 18px rgb(0 0 0 / 35%);
    }
}

.cn-josephus-game .josephus-big-tip {
    position: fixed;
    z-index: 1050;
    right: auto;
    bottom: 0.875rem;
    left: 50%;
    width: min(92vw, 35rem);
    padding: 0.75rem 3rem 0.75rem 0.875rem;
    border: 1px solid rgb(255 255 255 / 16%);
    border-radius: 1rem;
    color: #e8eefc;
    background: rgb(0 0 0 / 76%);
    box-shadow: 0 1.25rem 2.5rem rgb(0 0 0 / 40%);
    backdrop-filter: blur(10px);
    transform: translateX(-50%);
}

.cn-josephus-game .josephus-big-tip__number {
    font-size: clamp(1.375rem, 5vw, 2rem);
    font-weight: 900;
    line-height: 1.05;
}

.cn-josephus-game .josephus-big-tip__meta {
    margin-top: 0.25rem;
    color: rgb(232 238 252 / 80%);
    font-size: 0.95rem;
}

.cn-josephus-game .josephus-big-tip__close {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 50%;
    color: #fff;
    background: transparent;
    transform: translateY(-50%);
}

.cn-josephus-game [hidden] {
    display: none !important;
}

@media (max-width: 575.98px) {
    .cn-josephus-game {
        border-radius: 0.875rem;
    }

    .cn-josephus-game .container-xl {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .cn-josephus-game .josephus-card {
        border-radius: 1rem;
    }

    .cn-josephus-game .josephus-scrollbox {
        max-height: 11.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cn-josephus-game .josephus-pointer,
    .cn-josephus-game .josephus-person {
        transition: none;
    }

    .cn-josephus-game .josephus-person.is-just-eliminated {
        animation: none;
    }
}
