.rj-nabe-roulette {
    --rjnr-border: #d7e0e8;
    --rjnr-border-strong: #b8c8d8;
    --rjnr-bg: #f7fafc;
    --rjnr-panel: #ffffff;
    --rjnr-text: #243342;
    --rjnr-muted: #5d6b78;
    --rjnr-primary: #246b8f;
    --rjnr-primary-dark: #185472;
    --rjnr-accent: #b8562f;
    --rjnr-accent-dark: #934221;
    --rjnr-danger: #a83b3b;
    --rjnr-warning: #875a16;
    color: var(--rjnr-text);
    font-size: 16px;
    line-height: 1.7;
}

.rj-nabe-roulette *,
.rj-nabe-roulette *::before,
.rj-nabe-roulette *::after {
    box-sizing: border-box;
}

.rj-nabe-roulette button,
.rj-nabe-roulette input,
.rj-nabe-roulette select {
    font: inherit;
}

.rjnr-guide,
.rjnr-panel,
.rjnr-section,
.rjnr-notes {
    margin: 0 0 22px;
    border: 1px solid var(--rjnr-border);
    border-radius: 14px;
    background: var(--rjnr-panel);
    box-shadow: 0 4px 18px rgba(42, 68, 86, 0.06);
}

.rjnr-guide details {
    padding: 16px 18px;
}

.rjnr-guide summary {
    cursor: pointer;
    font-weight: 700;
}

.rjnr-guide ol {
    margin: 14px 0 8px 1.4em;
}

.rjnr-guide p,
.rjnr-panel p,
.rjnr-section p,
.rjnr-notes p {
    margin: 7px 0 0;
}

.rjnr-panel,
.rjnr-section {
    padding: 20px;
}

.rjnr-panel h3,
.rjnr-section h3 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.4;
}

.rjnr-section-title {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.4;
}

.rjnr-section-description {
    display: block;
    margin-top: 4px;
    color: var(--rjnr-muted);
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.55;
}

.rjnr-panel-head,
.rjnr-section-head,
.rjnr-section-toolbar,
.rjnr-group-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.rjnr-section-head > div > p,
.rjnr-panel-head > div > p {
    color: var(--rjnr-muted);
    font-size: 0.92rem;
}

.rjnr-section-collapse {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.rjnr-section-collapse:hover .rjnr-section-title,
.rjnr-section-collapse:focus-visible .rjnr-section-title {
    color: var(--rjnr-primary);
}

.rjnr-section-collapse:focus-visible {
    outline: 3px solid rgba(36, 107, 143, 0.18);
    outline-offset: 5px;
    border-radius: 5px;
}

.rjnr-section-arrow {
    flex: 0 0 auto;
    width: 1em;
    margin-top: 0.15em;
    color: var(--rjnr-primary);
    font-weight: 900;
}

.rjnr-section-heading-text {
    min-width: 0;
}

.rjnr-section-body[hidden] {
    display: none;
}

.rjnr-section.is-disabled .rjnr-candidate-area,
.rjnr-section.is-disabled .rjnr-section-toolbar {
    opacity: 0.58;
}

.rjnr-section-toggle,
.rjnr-check-line,
.rjnr-fixed-choice,
.rjnr-candidate-choice,
.rjnr-allergen-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.rjnr-section-toggle {
    flex: 0 0 auto;
    font-weight: 700;
}

.rjnr-section-toggle input,
.rjnr-check-line input,
.rjnr-fixed-choice input,
.rjnr-candidate-choice input,
.rjnr-allergen-option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--rjnr-primary);
}

.rjnr-preset-row,
.rjnr-custom-grid {
    display: grid;
    gap: 12px;
    align-items: end;
}

.rjnr-preset-row {
    grid-template-columns: minmax(210px, 1fr) auto auto auto;
}

.rjnr-custom-grid {
    grid-template-columns: minmax(140px, 0.75fr) minmax(190px, 1fr) minmax(240px, 1.35fr) auto;
}

.rjnr-preset-row label,
.rjnr-custom-grid label,
.rjnr-count-field {
    display: grid;
    gap: 5px;
    font-weight: 700;
}

.rjnr-preset-row select,
.rjnr-custom-grid select,
.rjnr-custom-grid input,
.rjnr-count-field select {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--rjnr-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--rjnr-text);
}

.rjnr-custom-name-field {
    min-width: 240px;
}

.rjnr-custom-grid select:disabled,
.rjnr-custom-grid label.is-not-applicable select {
    background: #f1f3f4;
    color: var(--rjnr-muted);
    cursor: not-allowed;
}

.rjnr-button {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--rjnr-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--rjnr-text);
    cursor: pointer;
    font-weight: 700;
    line-height: 1.35;
}

.rjnr-button:hover:not(:disabled),
.rjnr-button:focus-visible:not(:disabled) {
    border-color: var(--rjnr-primary);
    box-shadow: 0 0 0 3px rgba(36, 107, 143, 0.13);
}

.rjnr-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rjnr-button-primary {
    border-color: var(--rjnr-primary);
    background: var(--rjnr-primary);
    color: #fff;
}

.rjnr-button-primary:hover:not(:disabled),
.rjnr-button-primary:focus-visible:not(:disabled) {
    border-color: var(--rjnr-primary-dark);
    background: var(--rjnr-primary-dark);
}

.rjnr-button-accent {
    border-color: var(--rjnr-accent);
    background: var(--rjnr-accent);
    color: #fff;
}

.rjnr-button-accent:hover:not(:disabled),
.rjnr-button-accent:focus-visible:not(:disabled) {
    border-color: var(--rjnr-accent-dark);
    background: var(--rjnr-accent-dark);
}

.rjnr-button-secondary {
    border-color: #7796a9;
    background: #edf5f8;
    color: #244c62;
}

.rjnr-button-danger {
    border-color: #d7aaaa;
    color: var(--rjnr-danger);
}

.rjnr-button-quiet {
    background: var(--rjnr-bg);
}

.rjnr-button-small {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.rjnr-button-tiny {
    min-height: 31px;
    padding: 4px 8px;
    font-size: 0.78rem;
}

.rjnr-button-large {
    min-height: 50px;
    padding: 11px 19px;
}

.rjnr-note,
.rjnr-status-line {
    color: var(--rjnr-muted);
    font-size: 0.9rem;
}

.rjnr-status-line[data-status-type="error"] {
    color: #a52525;
    font-weight: 700;
}

.rjnr-status-line[data-status-type="warning"] {
    color: var(--rjnr-warning);
    font-weight: 700;
}

.rjnr-status-line[data-status-type="success"] {
    color: #256b45;
    font-weight: 700;
}

.rjnr-allergen-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 14px;
    margin-top: 14px;
}

.rjnr-allergen-option {
    min-height: 34px;
}

.rjnr-info-box,
.rjnr-warning {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 9px;
    overflow-wrap: anywhere;
}

.rjnr-info-box {
    border: 1px solid #b9d4e5;
    background: #edf7fc;
}

.rjnr-warning-stack {
    margin-bottom: 22px;
}

.rjnr-warning {
    border: 1px solid #e2c782;
    background: #fff9e8;
}

.rjnr-warning-allergen {
    border-color: #dfb5b5;
    background: #fff2f2;
}

.rjnr-warning-spicy {
    border-color: #e0b276;
    background: #fff4e4;
}

.rjnr-warning-caution {
    border-color: #d6a35f;
    background: #fff7e8;
}

.rjnr-warning-custom {
    border-color: #b8c7df;
    background: #f3f6fc;
}

.rjnr-warning > strong:first-child {
    display: block;
    margin-bottom: 5px;
}

.rjnr-warning-summary-line {
    margin: 3px 0;
}

.rjnr-warning-details {
    margin-top: 10px;
}

.rjnr-warning-details > summary {
    width: fit-content;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rjnr-warning-details-scroll {
    max-height: 380px;
    margin-top: 9px;
    padding: 10px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(83, 72, 72, 0.22);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.64);
}

.rjnr-warning-details-scroll-compact {
    max-height: 220px;
}

.rjnr-warning-detail-group + .rjnr-warning-detail-group {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(83, 72, 72, 0.24);
}

.rjnr-warning-detail-group p,
.rjnr-warning-details-scroll > p {
    margin: 4px 0 0;
}

.rjnr-warning-settings-button {
    margin-top: 10px;
}

.rjnr-section-toolbar {
    align-items: end;
    margin-top: 17px;
    padding: 13px;
    border-radius: 10px;
    background: var(--rjnr-bg);
}

.rjnr-count-field {
    min-width: 160px;
}

.rjnr-toolbar-buttons,
.rjnr-group-controls,
.rjnr-run-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rjnr-candidate-area {
    margin-top: 16px;
}

.rjnr-candidate-group + .rjnr-candidate-group {
    margin-top: 18px;
}

.rjnr-group-head {
    align-items: center;
    margin-bottom: 8px;
}

.rjnr-group-title {
    font-weight: 800;
}

.rjnr-spicy-group {
    padding: 13px;
    border: 1px solid #e1b880;
    border-radius: 10px;
    background: #fffaf0;
}

.rjnr-premium-group {
    padding: 13px;
    border: 1px solid #c7b27a;
    border-radius: 10px;
    background: #fffdf3;
}

.rjnr-candidate-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--rjnr-border);
}

.rjnr-candidate-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 10px 8px;
    border-bottom: 1px solid var(--rjnr-border);
}

.rjnr-candidate-row:nth-child(odd) {
    border-right: 1px solid var(--rjnr-border);
}

.rjnr-candidate-row.is-fixed {
    background: #f1f7fa;
}

.rjnr-candidate-row.is-excluded {
    background: #f4f4f4;
    color: #747d85;
}

.rjnr-candidate-main {
    min-width: 0;
}

.rjnr-candidate-choice {
    font-weight: 700;
}

.rjnr-candidate-name {
    overflow-wrap: anywhere;
}

.rjnr-candidate-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
    padding-left: 26px;
}

.rjnr-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #e9eef3;
    color: #405260;
    font-size: 0.72rem;
    line-height: 1.2;
}

.rjnr-badge-allergen {
    background: #f9e5e5;
    color: #8c3030;
}

.rjnr-badge-note {
    background: #fff0cf;
    color: #785316;
}

.rjnr-badge-spicy {
    background: #fbdcc2;
    color: #8b3f12;
}

.rjnr-badge-premium {
    background: #efe5c5;
    color: #6d5313;
}

.rjnr-badge-caution {
    background: #ffe4bc;
    color: #7a4300;
}

.rjnr-badge-excluded {
    background: #e1e1e1;
    color: #555;
}

.rjnr-candidate-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 7px;
}

.rjnr-fixed-choice {
    font-size: 0.85rem;
    white-space: nowrap;
}

.rjnr-fixed-choice input {
    width: 16px;
    height: 16px;
}

.rjnr-icon-button {
    min-height: 30px;
    padding: 3px 7px;
    border: 1px solid #d4aaaa;
    border-radius: 6px;
    background: #fff;
    color: var(--rjnr-danger);
    cursor: pointer;
    font-size: 0.78rem;
}

.rjnr-roulette-layout {
    display: grid;
    grid-template-columns: minmax(300px, 560px) minmax(230px, 1fr);
    gap: 28px;
    align-items: center;
    margin-top: 16px;
}

.rjnr-wheel-wrap {
    position: relative;
    width: min(100%, 560px);
    aspect-ratio: 1;
    margin-inline: auto;
    overflow: hidden;
    border-radius: 50%;
    filter: drop-shadow(0 7px 15px rgba(44, 62, 80, 0.16));
}

.rjnr-wheel-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform-origin: 50% 50%;
}

.rjnr-pointer {
    position: absolute;
    z-index: 4;
    top: -1px;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 0;
    border-bottom: 34px solid #b13b3b;
    transform: translateX(-50%) rotate(180deg);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}

.rjnr-wheel-center {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 31%;
    min-width: 105px;
    aspect-ratio: 1;
    padding: 9px;
    transform: translate(-50%, -50%);
    border: 4px solid #d6dee8;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.12);
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
}

.rjnr-progress {
    margin-bottom: 14px !important;
    font-weight: 800;
}

.rjnr-roulette-options {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.rjnr-skip-line,
.rjnr-duplicate-line {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--rjnr-bg);
}

.rjnr-run-actions {
    flex-direction: column;
    align-items: stretch;
}

.rjnr-draw-summary-panel h3 {
    margin-bottom: 14px;
}

.rjnr-draw-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--rjnr-border-strong);
    border-radius: 10px;
    background: var(--rjnr-bg);
}

.rjnr-draw-summary-item {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 12px 10px;
    text-align: center;
}

.rjnr-draw-summary-item + .rjnr-draw-summary-item {
    border-left: 1px solid var(--rjnr-border);
}

.rjnr-draw-summary-label {
    color: var(--rjnr-muted);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.4;
}

.rjnr-draw-summary-value {
    color: var(--rjnr-text);
    font-size: 1.05rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.rjnr-draw-summary-value.is-complete {
    color: var(--rjnr-primary-dark);
}

.rjnr-results {
    margin-top: 14px;
}

.rjnr-result-group + .rjnr-result-group {
    margin-top: 18px;
}

.rjnr-result-group h4 {
    margin: 0 0 7px;
}

.rjnr-result-group ol {
    margin: 0;
    padding-left: 1.8em;
}

.rjnr-result-group li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--rjnr-border);
}

.rjnr-result-content {
    flex: 1 1 auto;
    min-width: 0;
}

.rjnr-result-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.rjnr-result-name {
    font-weight: 700;
}

.rjnr-result-allergen-info {
    margin: 3px 0 0;
    color: var(--rjnr-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.rjnr-empty {
    color: var(--rjnr-muted);
}

.rjnr-notes {
    padding: 16px 18px;
    background: var(--rjnr-bg);
    color: var(--rjnr-muted);
    font-size: 0.9rem;
}

.rj-nabe-roulette-page-copy {
    margin-bottom: 24px;
}

@media (max-width: 920px) {
    .rjnr-preset-row,
    .rjnr-custom-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rjnr-custom-name-field {
        min-width: 0;
    }

    .rjnr-allergen-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rjnr-roulette-layout {
        grid-template-columns: 1fr;
    }

    .rjnr-run-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .rjnr-panel,
    .rjnr-section {
        padding: 16px;
    }

    .rjnr-panel-head,
    .rjnr-section-head,
    .rjnr-section-toolbar,
    .rjnr-group-head {
        flex-direction: column;
        align-items: stretch;
    }

    .rjnr-preset-row,
    .rjnr-custom-grid,
    .rjnr-run-actions {
        grid-template-columns: 1fr;
    }

    .rjnr-toolbar-buttons,
    .rjnr-group-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rjnr-candidate-list {
        grid-template-columns: 1fr;
    }

    .rjnr-candidate-row:nth-child(odd) {
        border-right: 0;
    }

    .rjnr-allergen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rjnr-draw-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rjnr-draw-summary-item + .rjnr-draw-summary-item {
        border-left: 0;
    }

    .rjnr-draw-summary-item:nth-child(even) {
        border-left: 1px solid var(--rjnr-border);
    }

    .rjnr-draw-summary-item:nth-child(n + 3) {
        border-top: 1px solid var(--rjnr-border);
    }

    .rjnr-result-group li {
        flex-wrap: wrap;
    }

    .rjnr-warning-details-scroll {
        max-height: 300px;
    }

    .rjnr-result-content {
        flex-basis: 100%;
    }
}

@media (max-width: 430px) {
    .rjnr-toolbar-buttons,
    .rjnr-group-controls,
    .rjnr-allergen-grid {
        grid-template-columns: 1fr;
    }

    .rjnr-candidate-row {
        flex-direction: column;
    }

    .rjnr-candidate-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .rjnr-wheel-center {
        min-width: 88px;
        font-size: 0.84rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rj-nabe-roulette *,
    .rj-nabe-roulette *::before,
    .rj-nabe-roulette *::after {
        scroll-behavior: auto !important;
    }
}

.rjnr-candidate-group[open] > .rjnr-group-summary {
    margin-bottom: 10px;
}

.rjnr-group-summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid var(--rjnr-border);
    border-radius: 9px;
    background: var(--rjnr-bg);
    cursor: pointer;
    list-style-position: inside;
}

.rjnr-group-summary:hover,
.rjnr-group-summary:focus-visible {
    border-color: var(--rjnr-primary);
}

.rjnr-candidate-group > .rjnr-group-controls {
    margin: 0 0 9px;
    padding: 9px;
    border-radius: 8px;
    background: var(--rjnr-bg);
}

.rjnr-spicy-group > .rjnr-group-summary {
    border-color: #e1b880;
    background: #fff5e6;
}

.rjnr-premium-group > .rjnr-group-summary {
    border-color: #c7b27a;
    background: #fff9df;
}

.rjnr-allergen-details {
    margin-top: 14px;
}

.rjnr-allergen-details > summary {
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid var(--rjnr-border);
    border-radius: 9px;
    background: var(--rjnr-bg);
    cursor: pointer;
    font-weight: 800;
}

.rjnr-allergen-details[open] > summary {
    margin-bottom: 10px;
}
