/* Roulette / Wheel of Fortune */
.roulette-page {
    max-width: 1100px;
    margin: 0 auto;
}

.roulette-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
}

/* ══════════════════════════════════════════
   WHEEL SECTION
   ══════════════════════════════════════════ */
.roulette-wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.roulette-wheel-wrap {
    position: relative;
    width: 420px;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#wheel-canvas {
    display: block;
    min-width: 0;
    max-width: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 0 6px rgba(52, 211, 153, 0.15),
        0 0 0 12px rgba(52, 211, 153, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.4);
}

.roulette-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 40px;
    z-index: 5;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
}

.roulette-pointer svg {
    width: 100%;
    height: 100%;
}

/* Spin button */
.roulette-spin-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 48px;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: #fff;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 6px 24px rgba(5, 150, 105, 0.35);
}

.roulette-spin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 32px rgba(5, 150, 105, 0.45);
}

.roulette-spin-btn:active {
    transform: translateY(0) scale(0.97);
}

.roulette-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Result */
.roulette-result {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 25, 20, 0.85);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    animation: resultPop 0.4s cubic-bezier(.4,0,.2,1);
}

@keyframes resultPop {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.roulette-result-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.roulette-result-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--emerald-light);
    margin-bottom: 16px;
    word-break: break-word;
}

.roulette-result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* History */
.roulette-history {
    width: 100%;
    max-width: 420px;
}

.roulette-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.roulette-link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0;
}

.roulette-link-btn:hover {
    color: var(--emerald-light);
}

.roulette-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.roulette-history-list li {
    padding: 6px 14px;
    background: rgba(15, 25, 20, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.roulette-history-list li:first-child {
    border-color: var(--emerald-light);
    color: var(--emerald-light);
}

/* ══════════════════════════════════════════
   CONTROLS SECTION
   ══════════════════════════════════════════ */
.roulette-controls-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.roulette-panel {
    padding: 20px !important;
    border-radius: 20px !important;
}

.roulette-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.roulette-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.roulette-count {
    background: rgba(52, 211, 153, 0.12);
    color: var(--emerald-light);
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

/* Add row */
.roulette-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.roulette-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(15, 25, 20, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.roulette-input:focus {
    border-color: var(--emerald-light);
}

.roulette-input::placeholder {
    color: var(--text-muted);
}

.roulette-add-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.roulette-add-btn:hover {
    transform: scale(1.05);
}

.roulette-add-btn:active {
    transform: scale(0.95);
}

/* Items list */
.roulette-items-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(52,211,153,0.2) transparent;
}

.roulette-items-list::-webkit-scrollbar {
    width: 4px;
}

.roulette-items-list::-webkit-scrollbar-thumb {
    background: rgba(52,211,153,0.2);
    border-radius: 4px;
}

.roulette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background 0.15s;
}

.roulette-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.roulette-item-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.roulette-item-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roulette-item-del {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
    padding: 0;
}

.roulette-item-del:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

/* Bulk actions */
.roulette-bulk-actions {
    display: flex;
    gap: 8px;
}

.roulette-small-btn {
    padding: 8px 16px;
    background: rgba(15, 25, 20, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.roulette-small-btn:hover {
    background: var(--glass-hover);
    border-color: var(--emerald-light);
    color: var(--text-primary);
}

.roulette-wide-btn {
    width: 100%;
    text-align: center;
}

/* Textarea */
.roulette-textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(15, 25, 20, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.roulette-textarea:focus {
    border-color: var(--emerald-light);
}

.roulette-textarea::placeholder {
    color: var(--text-muted);
}

/* Saved lists */
.roulette-saved-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.roulette-saved-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.roulette-saved-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.roulette-saved-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roulette-saved-count {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.roulette-saved-del {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    transition: all 0.15s;
}

.roulette-saved-del:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

/* Settings */
.roulette-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    gap: 12px;
}

.roulette-setting + .roulette-setting {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.roulette-select {
    padding: 7px 12px;
    background-color: #0f1914;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    color-scheme: dark;
}

.roulette-select:hover {
    border-color: var(--emerald);
}

.roulette-select:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.15);
}

.roulette-select option {
    background-color: #0f1914;
    color: #e2e8f0;
    padding: 8px 12px;
}

.roulette-select option:checked {
    background-color: #1a2e24;
    color: #34d399;
}

.roulette-check-setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--emerald-light);
    cursor: pointer;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 992px) {
    .roulette-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .roulette-wheel-section {
        order: 1;
        gap: 24px;
        margin-bottom: 8px;
    }

    .roulette-controls-section {
        order: 2;
    }
}

@media (max-width: 768px) {
    .roulette-wheel-wrap {
        width: min(360px, calc(100vw - 48px));
        height: min(360px, calc(100vw - 48px));
    }

    .roulette-wheel-section {
        gap: 20px;
        margin-bottom: 12px;
    }

    .roulette-result,
    .roulette-history {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .roulette-wheel-wrap {
        width: min(300px, calc(100vw - 40px));
        height: min(300px, calc(100vw - 40px));
    }

    .roulette-pointer {
        width: 22px;
        height: 32px;
        top: -4px;
    }

    .roulette-spin-btn {
        padding: 14px 36px;
        font-size: 16px;
        border-radius: 14px;
    }

    .roulette-result-value {
        font-size: 22px;
    }

    .roulette-panel {
        padding: 16px !important;
        border-radius: 16px !important;
    }

    .roulette-items-list {
        max-height: 200px;
    }
}

@media (max-width: 360px) {
    .roulette-wheel-wrap {
        width: min(260px, calc(100vw - 32px));
        height: min(260px, calc(100vw - 32px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .roulette-result {
        animation: none;
    }
}
