/* ============================================================
   RANDOM NAME WHEEL v4
   Hero layout: full-height wheel center | 380px sidebar right
   History: horizontal bar below wheel
   Dark purple — matches Spin Numbers hero tool
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

/* ── Design tokens ───────────────────────────────────────── */
:root {
    --bg:          #1E123C;
    --panel:       #160e30;
    --card:        #2a1f4e;
    --border:      rgba(255,255,255,0.08);
    --text:        #ffffff;
    --muted:       rgba(255,255,255,0.45);
    --red:         #D70932;
    --red-h:       #960019;
    --green:       #27ae60;
    --green-h:     #219e50;
    --blue:        #3498db;
    --purple:      #8b5cf6;
    --purple-h:    #7c3aed;
    --accent:      #ff6b6b;
    --sidebar-w:   380px;
    --radius:      12px;
    --tr:          all 0.22s ease;
    --shadow:      0 8px 32px rgba(0,0,0,0.5);
    --font:        'Outfit', sans-serif;
    --mono:        'Space Mono', monospace;
}


/* Light mode — purple family, no black */
body:not(.dark-mode) {
    --bg:           #f0eeff;
    --panel:        #e8e0ff;
    --panel-border: rgba(80,40,180,0.12);
    --card:         #f8f9fa;
    --border :      #c8b8f5;
    --text:         #2a1060;
    --muted:        rgba(42,16,96,0.55);
    --wheel-bg:     radial-gradient(circle at 50% 50%, #ffffff 0%, #ffffff 100%);
    --shadow:       0 8px 32px rgba(80,40,200,0.15);
    --shadow-inner: inset 0 0 60px rgba(80,40,200,0.1);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Shell: wheel+history | sidebar ─────────────────────── */
.rnw-shell {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    background: var(--bg);
    font-family: var(--font);
    color: var(--text);
    position: relative;
    overflow: hidden;
}

/* ── Main column (wheel + history bar) ──────────────────── */
.rnw-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ── Stage: fills all height minus history bar ───────────── */
.rnw-stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 24px 12px;
    gap: 16px;
    position: relative;
}

/* ── Wheel wrapper ───────────────────────────────────────── */
.rnw-wheel-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* fills 78% of viewport height, capped to fit horizontally too */
    width:  min(78vh, calc(100vw - var(--sidebar-w) - 80px));
    height: min(78vh, calc(100vw - var(--sidebar-w) - 80px));
}

#rnwCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.06),
        0 24px 70px rgba(0,0,0,0.6),
        inset 0 0 80px rgba(0,0,0,0.35);
    display: block;
}

/* ── SPIN button ─────────────────────────────────────────── */
.rnw-spin-btn {
    position: absolute;
    inset: 0;
    width: 96px;
    height: 96px;
    min-width: 96px;
    min-height: 96px;
    margin: auto;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    border: none;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 5;
    box-shadow:
        0 0 0 7px rgba(215,9,50,0.18),
        0 8px 24px rgba(215,9,50,0.55);
    transition: box-shadow 0.2s, transform 0.15s, background 0.2s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.rnw-spin-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50% 0 50% 50%;
    transform: rotate(-45deg);
    background: rgba(255,255,255,0.12);
    pointer-events: none;
}

.rnw-spin-btn:hover:not(:disabled) {
    background: var(--red-h);
    box-shadow:
        0 0 0 12px rgba(215,9,50,0.12),
        0 10px 30px rgba(215,9,50,0.6);
}

.rnw-spin-btn:active:not(:disabled) { transform: scale(0.95); }

.rnw-spin-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

/* ── Arrow ───────────────────────────────────────────────── */
.rnw-arrow-wrap {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 58px;
    pointer-events: none;
    filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.55));
    z-index: 6;
}

.rnw-arrow-wrap svg { width: 100%; height: 100%; }

/* ── Result tray ─────────────────────────────────────────── */
.rnw-result-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    width: 100%;
    max-width: 600px;
    padding: 0 8px;
}

.rnw-result-badge {
    padding: 9px 20px;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transform: scale(0);
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s ease;
}

.rnw-result-badge.show { transform: scale(1); opacity: 1; }

/* ── History bar ─────────────────────────────────────────── */
.rnw-history-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 10px 20px;
    min-height: 54px;
}

.rnw-history-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.rnw-history-scroll {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0;
}

.rnw-history-scroll::-webkit-scrollbar { display: none; }

.rnw-history-empty {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.rnw-hist-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.rnw-hist-num {
    font-size: 10px;
    opacity: 0.7;
    font-family: var(--mono);
}

.rnw-history-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── RIGHT SIDEBAR ───────────────────────────────────────── */
.rnw-sidebar {
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--panel);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.rnw-sidebar::-webkit-scrollbar { width: 4px; }
.rnw-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ── Sidebar sections ────────────────────────────────────── */
.rnw-sb-section {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.rnw-sb-section:last-child { border-bottom: none; }

.rnw-sb-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
}

/* ── Field row ───────────────────────────────────────────── */
.rnw-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.rnw-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rnw-field-end {
    justify-content: flex-end;
}

.rnw-field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.rnw-field input[type="number"] {
    width: 100%;
    height: 68px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    transition: var(--tr);
    -moz-appearance: textfield;
}

.rnw-field input[type="number"]::-webkit-inner-spin-button,
.rnw-field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.rnw-field input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,107,107,0.15);
}

.rnw-count-box {
    height: 68px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
}

/* ── Probability ─────────────────────────────────────────── */
.rnw-prob {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
    padding: 4px 0 2px;
}

/* ── Remove toggle ───────────────────────────────────────── */
.rnw-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0 2px;
    user-select: none;
}

.rnw-track {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255,255,255,0.12);
    position: relative;
    transition: background 0.25s;
    flex-shrink: 0;
}

.rnw-toggle-row.on .rnw-track { background: var(--accent); }

.rnw-knob {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.25s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

.rnw-toggle-row.on .rnw-knob { transform: translateX(18px); }

.rnw-toggle-txt {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* ── Add row ─────────────────────────────────────────────── */
.rnw-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.rnw-add-row input[type="text"] {
    flex: 1;
    height: 46px;
    padding: 0 14px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    transition: var(--tr);
}

.rnw-add-row input[type="text"]::placeholder { color: var(--muted); }

.rnw-add-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,107,107,0.12);
}

/* ── Bulk import ─────────────────────────────────────────── */
.rnw-bulk {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.rnw-bulk summary {
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    transition: color 0.2s;
}

.rnw-bulk summary:hover { color: var(--text); }
.rnw-bulk[open] summary {
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.rnw-bulk textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--card);
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    line-height: 1.65;
    resize: vertical;
    min-height: 110px;
}

.rnw-bulk textarea::placeholder { color: var(--muted); }
.rnw-bulk textarea:focus { outline: none; }

.rnw-bulk-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--card);
}

/* ── Name list ───────────────────────────────────────────── */
.rnw-list-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 280px;
}

.rnw-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.rnw-name-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 2px;
}

.rnw-name-list::-webkit-scrollbar { width: 3px; }
.rnw-name-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.rnw-name-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: var(--tr);
    flex-shrink: 0;
}

.rnw-name-list li:hover { border-color: rgba(255,255,255,0.18); }

.rnw-badge {
    padding: 3px 11px;
    border-radius: 5px;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.rnw-rm-btn {
    background: rgba(215,9,50,0.12);
    color: #e74c3c;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tr);
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.rnw-rm-btn:hover { background: #e74c3c; color: #fff; }

/* ── Sound row ───────────────────────────────────────────── */
.rnw-sound-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
}

.rnw-sound-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ── Button system ───────────────────────────────────────── */
.rnw-red-btn {
    height: 46px;
    padding: 0 20px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: var(--tr);
    white-space: nowrap;
}

.rnw-red-btn:hover { background: var(--red-h); transform: translateY(-1px); }

.rnw-outline-btn {
    height: 42px;
    padding: 0 18px;
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tr);
    white-space: nowrap;
}

.rnw-outline-btn:hover { border-color: var(--accent); color: var(--accent); }

.rnw-ghost-btn {
    height: 32px;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--tr);
}

.rnw-ghost-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }

.rnw-ghost-btn.rnw-sm { height: 26px; font-size: 0.74rem; }

.rnw-purple-btn {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--tr);
}

.rnw-purple-btn:hover { background: var(--purple-h); transform: translateY(-1px); }

/* ── Modals ──────────────────────────────────────────────── */
.rnw-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,6,30,0.78);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.rnw-modal.open { display: flex; }

.rnw-modal-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 28px 80px rgba(0,0,0,0.6);
    padding: 44px 36px 36px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    position: relative;
    z-index: 2;
    animation: modalIn 0.3s cubic-bezier(0.34,1.2,0.64,1);
}

.rnw-teams-card { max-width: 600px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(22px) scale(0.95); }
    to   { opacity: 1; transform: none; }
}

.rnw-modal-x {
    position: absolute;
    top: 14px;
    right: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--tr);
    padding: 0;
    line-height: 1;
}

.rnw-modal-x:hover { transform: scale(1.1); }

.rnw-modal-emoji { font-size: 2.6rem; margin-bottom: 8px; }

.rnw-modal-h {
    font-family: var(--font);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 22px;
}

.rnw-winners {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 26px;
}

.rnw-winner-row {
    padding: 15px 22px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    animation: winnerPop 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
}

@keyframes winnerPop {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}

.rnw-modal-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Teams grid ──────────────────────────────────────────── */
.rnw-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
    max-height: 380px;
    overflow-y: auto;
    padding: 4px 2px;
}

.rnw-team-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 14px 10px;
    text-align: left;
}

.rnw-team-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 10px;
}

.rnw-team-member {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.rnw-team-member:last-child { border-bottom: none; }

.rnw-team-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Confetti ────────────────────────────────────────────── */
.rnw-confetti {
    position: fixed;
    pointer-events: none;
    inset: 0;
    overflow: hidden;
    z-index: 1;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

/* Tablet: stack wheel above sidebar */
@media (max-width: 960px) {
    .rnw-shell {
        flex-direction: column;
        min-height: auto;
    }

    .rnw-sidebar {
        width: 100%;
        min-width: 0;
        flex: none;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: none;
        overflow-y: visible;
    }

    .rnw-wheel-wrap {
        width:  min(82vw, 500px);
        height: min(82vw, 500px);
    }

    .rnw-stage { padding: 20px 20px 10px; }

    .rnw-list-wrap { max-height: 200px; }
}

/* Mobile */
@media (max-width: 540px) {
    .rnw-spin-btn {
        width: 74px;
        height: 74px;
        font-size: 13px;
    }

    .rnw-wheel-wrap {
        width:  min(86vw, 380px);
        height: min(86vw, 380px);
    }

    .rnw-sb-section { padding: 16px 16px; }

    .rnw-field-row { grid-template-columns: 1fr 1fr; }

    .rnw-modal-card { padding: 36px 22px 28px; }
}