/* ═══════════════════════════════════════════════
   Roulette Maker — style.css
   Prefix: rl-
   ═══════════════════════════════════════════════ */
.rl-container {
    max-width: 640px;
    margin: 0 auto;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    color: #1a1a2e;
}

/* ── Tabs ── */
.rl-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    scrollbar-width: none;
}

.rl-tabs::-webkit-scrollbar {
    display: none;
}

.rl-tab {
    flex: 1;
    padding: 10px 6px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    text-align: center;
}

.rl-tab:hover {
    color: #7c3aed;
}

.rl-tab.active {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* ── Tab Panels ── */
.rl-tab-panel {
    display: none;
    padding: 16px;
    background: #f8f9fb;
    border: 1.5px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 14px 14px;
}

.rl-tab-panel.active {
    display: block;
}

/* ── Labels ── */
.rl-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Repeater Input Row ── */
.rl-add-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    align-items: center;
}

.rl-add-row input {
    flex: 1;
    padding: 9px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
}

.rl-add-row input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.rl-add-row input::placeholder {
    color: #9ca3af;
}

.rl-weight-input {
    width: 70px !important;
    flex: none !important;
    text-align: center;
}

.rl-btn-add {
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    background: #7c3aed;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.rl-btn-add:hover {
    background: #6d28d9;
}

.rl-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 0 0 8px;
    line-height: 1.4;
}

/* ── Presets ── */
.rl-preset-section {
    margin-bottom: 10px;
}

.rl-preset-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    margin: 0 0 6px;
}

.rl-preset-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rl-preset-btn {
    padding: 5px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    font-size: 11px;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    white-space: nowrap;
}

.rl-preset-btn:hover {
    border-color: #c4b5fd;
    color: #7c3aed;
    background: #faf5ff;
}

/* ── Item Chips / List ── */
.rl-items-wrap {
    min-height: 32px;
}

.rl-item-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 0 4px 4px 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.rl-item-chip:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.rl-item-chip-weight {
    font-size: 11px;
    background: #f3f0ff;
    color: #7c3aed;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.rl-item-chip-del {
    border: none;
    background: none;
    color: #d1d5db;
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.rl-item-chip-del:hover {
    color: #ef4444;
}

.rl-items-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 8px;
}

/* ── Theme Buttons ── */
.rl-theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.rl-theme-btn {
    padding: 7px 0;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-align: center;
}

.rl-theme-btn:hover {
    border-color: #c4b5fd;
    color: #7c3aed;
}

.rl-theme-btn.active {
    border-color: #7c3aed;
    background: #f5f3ff;
    color: #7c3aed;
}

/* ── Toggle Switches ── */
.rl-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.rl-toggle-row:last-of-type {
    border-bottom: none;
}

.rl-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.rl-toggle-sub {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.rl-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.rl-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.rl-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 22px;
    transition: 0.2s;
}

.rl-switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.rl-switch input:checked+.rl-switch-slider {
    background: #7c3aed;
}

.rl-switch input:checked+.rl-switch-slider::before {
    transform: translateX(18px);
}

/* ── Buttons ── */
.rl-btn-secondary {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: transparent;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    box-sizing: border-box;
    margin-top: 8px;
}

.rl-btn-secondary:hover {
    border-color: #c4b5fd;
    color: #7c3aed;
}

/* ── Wheel Area ── */
.rl-wheel-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.rl-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 1;
}

.rl-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ── Pointer ── */
.rl-pointer {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-top: 28px solid #7c3aed;
    filter: drop-shadow(0 3px 6px rgba(124, 58, 237, 0.4));
    z-index: 10;
    transition: transform 0.05s;
}

.rl-pointer.bounce {
    transform: translateX(-50%) scaleY(0.85);
}

/* ── Spin Button ── */
.rl-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.15s;
    letter-spacing: 1px;
}

.rl-spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.6);
}

.rl-spin-btn:active {
    transform: translate(-50%, -50%) scale(0.94);
}

.rl-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Result Modal ── */
.rl-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.rl-result-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.rl-result-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.rl-result-overlay.show .rl-result-card {
    transform: scale(1);
}

.rl-result-emoji {
    font-size: 48px;
    margin-bottom: 12px;
}

.rl-result-label {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.rl-result-name {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 24px;
    word-break: break-word;
}

.rl-result-close {
    padding: 10px 32px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.rl-result-close:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

/* ── History ── */
.rl-history {
    width: 100%;
}

.rl-history-title {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 8px;
}

.rl-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
}

.rl-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    font-size: 13px;
    color: #374151;
    border-radius: 8px;
    margin-bottom: 3px;
    background: #f8f9fb;
    border: 1px solid #f3f4f6;
}

.rl-history-num {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    min-width: 24px;
}

.rl-history-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.rl-history-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rl-history-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 10px;
}

/* ── Save ── */
.rl-save-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
}

.rl-save-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: #374151;
    border-radius: 8px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s;
}

.rl-save-item:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.rl-save-item-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rl-save-item-count {
    font-size: 11px;
    color: #9ca3af;
}

.rl-save-item-del {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
}

.rl-save-item-del:hover {
    color: #ef4444;
}

.rl-save-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 8px;
}

.rl-save-input-row {
    display: flex;
    gap: 6px;
}

.rl-save-input {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}

.rl-save-input:focus {
    outline: none;
    border-color: #7c3aed;
}

.rl-save-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: #7c3aed;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

/* ── Share ── */
.rl-share-row {
    margin-top: 8px;
}

.rl-share-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 11px;
    font-family: monospace;
    color: #6b7280;
    background: #f9fafb;
    box-sizing: border-box;
}

/* ── Confetti ── */
.rl-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
}

/* ── Security ── */
.rl-security-banner {
    display: flex;
    gap: 16px;
    margin: 20px 0 0;
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    flex-wrap: wrap;
}

.rl-security-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1 1 140px;
    min-width: 0;
}

.rl-security-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.rl-security-item strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #166534;
}

.rl-security-item p {
    margin: 2px 0 0;
    font-size: 11px;
    color: #4ade80;
    line-height: 1.3;
}

/* ═══ Theater ═══ */
.rl-theater-exit {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 90010;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.rl-theater-exit:hover {
    background: rgba(255, 255, 255, 0.25);
}

body.rl-theater-active {
    overflow: hidden !important;
}

body.rl-theater-active .rl-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    background: #0d0d0d;
    z-index: 90000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

body.rl-theater-active .rl-tabs,
body.rl-theater-active .rl-tab-panel,
body.rl-theater-active .rl-history,
body.rl-theater-active .rl-security-banner,
body.rl-theater-active .textContent {
    display: none !important;
}

body.rl-theater-active .rl-wheel-area {
    margin-top: 0;
}

body.rl-theater-active .rl-canvas-wrap {
    max-width: 80vh;
}

body.rl-theater-active .rl-canvas-wrap canvas {
    filter: drop-shadow(0 0 40px rgba(124, 58, 237, 0.3));
}

body.rl-theater-active .rl-theater-exit {
    display: flex;
}

/* ── Responsive ── */
@media (max-width: 500px) {
    .rl-canvas-wrap {
        max-width: 340px;
    }

    .rl-spin-btn {
        width: 60px;
        height: 60px;
        font-size: 12px;
    }

    .rl-result-card {
        padding: 32px 24px;
    }

    .rl-result-name {
        font-size: 22px;
    }

    .rl-theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rl-security-banner {
        flex-direction: column;
    }

    .rl-tab {
        font-size: 11px;
        padding: 8px 4px;
    }

    .rl-pointer {
        border-left-width: 12px;
        border-right-width: 12px;
        border-top-width: 22px;
    }

    .rl-add-row {
        flex-wrap: wrap;
    }

    .rl-add-row input:first-child {
        flex: 1 1 100%;
    }
}