/* ============================================================
   My Spin Wheel — Frontend styles
   ============================================================ */

.msw-wrap {
    --msw-text:   #1f2330;
    --msw-muted:  #6b7280;
    --msw-bg:     #ffffff;
    --msw-border: #e5e7eb;
    --msw-radius: 16px;
    --msw-accent: #6366f1;
    --msw-accent-dark: #4f46e5;

    box-sizing: border-box;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    border-radius: var(--msw-radius);
    color: var(--msw-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    position: relative;
    overflow: hidden;

    /* Mesh-gradient background */
    background:
        radial-gradient(circle at 12% 18%, rgba(236, 72, 153, 0.22), transparent 42%),
        radial-gradient(circle at 88% 22%, rgba(99, 102, 241, 0.22), transparent 42%),
        radial-gradient(circle at 78% 82%, rgba(20, 184, 166, 0.22), transparent 42%),
        radial-gradient(circle at 18% 78%, rgba(245, 158, 11, 0.20), transparent 42%),
        linear-gradient(135deg, #fafafa 0%, #f5f3ff 50%, #fdf4ff 100%);
}

.msw-wrap *,
.msw-wrap *::before,
.msw-wrap *::after {
    box-sizing: border-box;
}

.msw-title {
    margin: 0 0 24px;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    color: var(--msw-text);
    letter-spacing: -0.01em;
}

/* ----- Layout: lotto | wheel | input ----- */
.msw-layout {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1000px) {
    .msw-layout {
        grid-template-columns: 1fr 300px;
    }
    .msw-lotto {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media (max-width: 700px) {
    .msw-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .msw-lotto {
        order: 3;
    }
}

/* ----- Canvas / wheel ----- */
.msw-canvas-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.msw-canvas-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
}

.msw-canvas-container.msw-shake {
    animation: msw-shake 0.45s ease-in-out;
}

@keyframes msw-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.msw-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    border-radius: 50%;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.18));
}

/* ----- Overlay text on wheel ("Click to spin" / "or press ctrl+enter") ----- */
.msw-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 22% 0;
    z-index: 2;
    transition: opacity 0.25s ease;
    opacity: 0; /* hidden until JS sets it */
}

.msw-overlay-top,
.msw-overlay-bottom {
    color: #ffffff;
    font-weight: 800;
    font-size: clamp(20px, 4vw, 30px);
    letter-spacing: 0.5px;
    text-shadow:
        -1px -1px 0 rgba(0,0,0,0.4),
        1px -1px 0 rgba(0,0,0,0.4),
        -1px 1px 0 rgba(0,0,0,0.4),
        1px 1px 0 rgba(0,0,0,0.4),
        0 4px 8px rgba(0,0,0,0.35);
}

.msw-canvas-container.is-spinning .msw-overlay {
    opacity: 0;
}

/* ----- Pointer ----- */
.msw-pointer {
    position: absolute;
    top: 50%;
    right: -2px;
    width: 0;
    height: 0;
    transform: translateY(-50%);
    border-top: 18px solid transparent;
    border-bottom: 18px solid transparent;
    border-right: 32px solid #1f2937;
    filter: drop-shadow(-2px 2px 4px rgba(0, 0, 0, 0.35));
    pointer-events: none;
    z-index: 3;
}

/* ----- Center button ----- */
.msw-center-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    background: var(--msw-accent);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
    cursor: pointer;
    font-weight: 800;
    font-size: 16px;
    z-index: 4;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.msw-center-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
    background: var(--msw-accent-dark);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.55);
}

.msw-center-btn:active {
    transform: translate(-50%, -50%) scale(0.96);
}

/* Hide the SPIN button and pointer when the wheel has no entries —
   keeps the empty-state placeholder text fully visible. */
.msw-canvas-container.is-empty .msw-center-btn,
.msw-canvas-container.is-empty .msw-pointer,
.msw-canvas-container.is-empty .msw-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.msw-hint {
    margin: 16px 0 0;
    font-size: 13px;
    color: var(--msw-muted);
    text-align: center;
}

.msw-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
}

/* ----- Input area ----- */
.msw-input-area {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--msw-radius);
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.msw-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--msw-text);
    margin-bottom: 8px;
}

.msw-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--msw-text);
    background: #ffffff;
    border: 1px solid var(--msw-border);
    border-radius: 10px;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.msw-textarea:focus {
    outline: none;
    border-color: var(--msw-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.msw-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.msw-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    gap: 12px;
}

.msw-counter {
    font-size: 13px;
    color: var(--msw-muted);
}

.msw-count {
    font-weight: 700;
    color: var(--msw-text);
}

/* Reset button — text style with a refresh icon, less prominent than primary actions */
.msw-reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
}

.msw-reset:hover .msw-reset-icon {
    transform: rotate(-180deg);
}

.msw-reset-icon {
    transition: transform 0.4s ease;
}

/* Shuffle button */
.msw-shuffle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
}

.msw-shuffle:not(:disabled):hover .msw-shuffle-icon {
    transform: scale(1.2);
}

.msw-shuffle-icon {
    transition: transform 0.3s ease;
}

/* Group the right-side meta buttons */
.msw-meta-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ----- Buttons ----- */
.msw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 11px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.msw-btn:active {
    transform: translateY(1px);
}

.msw-btn-primary {
    background: var(--msw-accent);
    color: #ffffff;
}

.msw-btn-primary:hover {
    background: var(--msw-accent-dark);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.msw-btn-secondary {
    background: #f3f4f6;
    color: var(--msw-text);
}

.msw-btn-secondary:hover {
    background: #e5e7eb;
}

.msw-btn-text {
    background: transparent;
    color: var(--msw-muted);
    flex: 0 0 auto;
}

.msw-btn-text:hover {
    color: var(--msw-text);
    background: #f3f4f6;
}

/* ----- Modal ----- */
.msw-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.msw-modal.is-open {
    display: flex;
    animation: msw-fadein 0.25s ease-out;
}

@keyframes msw-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.msw-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.msw-modal-card {
    position: relative;
    width: 90%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: msw-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msw-pop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.msw-modal-header {
    background: #10B981;
    color: #ffffff;
    padding: 16px 22px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.2px;
}

.msw-modal-body {
    padding: 40px 22px;
    text-align: center;
}

.msw-winner-name {
    font-size: 34px;
    font-weight: 700;
    color: var(--msw-text);
    word-break: break-word;
    letter-spacing: -0.01em;
}

.msw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid var(--msw-border);
    background: #fafbfc;
}

.msw-modal-footer .msw-btn {
    flex: 0 0 auto;
    min-width: 92px;
}

/* ----- Confetti ----- */
.msw-confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
}

/* ============================================================
/* ============================================================
   Lucky Number Picker (left column, vertical)
   ============================================================ */

.msw-lotto {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: var(--msw-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.msw-lotto-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
}

.msw-lotto-icon { font-size: 20px; line-height: 1; }

.msw-lotto-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.msw-lotto-section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--msw-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.msw-lotto-ranges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.msw-lotto-range {
    padding: 5px 11px;
    border-radius: 20px;
    border: 2px solid var(--msw-border);
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: var(--msw-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.msw-lotto-range:hover { border-color: #6366f1; color: #6366f1; }
.msw-lotto-range.msw-lotto-range-active { background: #6366f1; border-color: #6366f1; color: #fff; }

/* Removable number chips */
.msw-lotto-removable {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 130px;
    overflow-y: auto;
    padding: 2px;
}

.msw-lotto-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px 3px 10px;
    border-radius: 20px;
    background: #f3f4f6;
    border: 1px solid var(--msw-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--msw-text);
    cursor: default;
}

.msw-lotto-chip.is-removed {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    text-decoration: line-through;
    opacity: 0.6;
}

.msw-lotto-chip-remove {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.msw-lotto-chip-remove:hover { color: #ef4444; }

.msw-lotto-count-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.msw-lotto-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--msw-muted);
    white-space: nowrap;
}

.msw-lotto-count-ctrl {
    display: flex;
    align-items: center;
    border: 1px solid var(--msw-border);
    border-radius: 8px;
    overflow: hidden;
}

.msw-lotto-count-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #f3f4f6;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    color: var(--msw-text);
    transition: background 0.15s;
    line-height: 1;
}

.msw-lotto-count-btn:hover { background: #e5e7eb; }

.msw-lotto-count-val {
    min-width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--msw-text);
    padding: 0 4px;
}

.msw-lotto-load {
    width: 100%;
    text-align: center;
    padding: 9px 0 !important;
    font-size: 13px !important;
}

.msw-lotto-reset {
    width: 100%;
    text-align: center;
    padding: 7px 0 !important;
    font-size: 12px !important;
}

/* Results */
.msw-lotto-results {
    border-top: 1px solid var(--msw-border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msw-lotto-results-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--msw-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.msw-lotto-balls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.msw-lotto-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(99,102,241,0.35);
    animation: msw-ball-pop 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes msw-ball-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.msw-lotto-status {
    font-size: 12px;
    color: var(--msw-muted);
    font-style: italic;
    line-height: 1.4;
}

.msw-lotto-done .msw-lotto-status {
    color: #10b981;
    font-style: normal;
    font-weight: 600;
}

/* ============================================================
   Get Answers link + popup
   ============================================================ */

.msw-get-answers-row {
    margin-bottom: 10px;
}

.msw-get-answers-link {
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.msw-get-answers-link:hover { color: #4f46e5; text-decoration: underline; }

/* Answers modal */
.msw-answers-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.msw-answers-modal.is-open {
    display: flex;
}

.msw-answers-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
}

.msw-answers-card {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    padding: 32px 36px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: msw-modal-in 0.25s ease;
}

.msw-answers-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
    padding: 4px;
    transition: color 0.15s;
}

.msw-answers-close:hover { color: #374151; }

.msw-answers-title {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--msw-text);
}

.msw-answers-list {
    margin: 0;
    padding: 0 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.msw-answers-list li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--msw-text);
}

.msw-answers-list li strong {
    color: #6366f1;
    display: block;
    margin-bottom: 2px;
}

.msw-answers-list li em {
    color: var(--msw-muted);
    font-size: 13px;
}
