:root {
    --rngw-ink: #122033;
    --rngw-ink-2: #1b2f49;
    --rngw-gold: #c7a56a;
    --rngw-gold-light: #e8d4a9;
    --rngw-ivory: #f8f4ec;
    --rngw-paper: #fffdf9;
    --rngw-muted: #677386;
    --rngw-line: #e7dfd2;
    --rngw-success: #2f6f5e;
    --rngw-shadow: 0 26px 70px rgba(20, 31, 49, .14);
}

.rngw-app,
.rngw-result-host {
    font-family: inherit;
    color: var(--rngw-ink);
}

.rngw-app *,
.rngw-result-host * {
    box-sizing: border-box;
}

.rngw-app {
    width: 100%;
    margin: 0 auto;
}

.rngw-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: clamp(22px, 3vw, 42px);
    padding: clamp(18px, 2.6vw, 34px);
    border: 1px solid var(--rngw-line);
    border-radius: 28px;
    background:
        radial-gradient(circle at 10% 0%, rgba(199, 165, 106, .13), transparent 30%),
        linear-gradient(145deg, #fffefa 0%, #f7f2e8 100%);
    box-shadow: var(--rngw-shadow);
    overflow: hidden;
}

.rngw-wheel-zone {
    min-width: 0;
    padding: clamp(18px, 2vw, 28px);
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 25%, rgba(79, 107, 143, .26), transparent 34%),
        linear-gradient(155deg, #0d1726 0%, #13233a 54%, #0b1421 100%);
    border: 1px solid rgba(232, 212, 169, .2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 18px 40px rgba(9, 18, 31, .22);
    color: #fff;
}

.rngw-wheel-topline,
.rngw-favorites-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.rngw-kicker {
    display: inline-block;
    margin-bottom: 5px;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--rngw-gold);
}

.rngw-wheel-title,
.rngw-panel-head h3,
.rngw-favorites-head h3 {
    margin: 0;
    line-height: 1.15;
}

.rngw-wheel-title {
    max-width: 580px;
    font-size: clamp(24px, 3vw, 38px);
    color: #fff;
    letter-spacing: -.025em;
}

.rngw-ready-badge {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 999px;
    border: 1px solid rgba(232, 212, 169, .28);
    background: rgba(255,255,255,.055);
    color: #dce6f2;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.rngw-wheel-stage-wrap {
    display: flex;
    justify-content: center;
    padding: clamp(18px, 2.4vw, 34px) 0 20px;
}

.rngw-wheel-stage {
    position: relative;
    width: min(620px, 100%);
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.rngw-wheel-frame {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: clamp(9px, 1.2vw, 14px);
    background:
        linear-gradient(145deg, #ead7ad, #a9844c 38%, #f2dfb5 60%, #95713d 100%);
    box-shadow:
        0 0 0 1px rgba(255,255,255,.28),
        0 22px 50px rgba(0,0,0,.38),
        inset 0 0 0 2px rgba(61,45,22,.25);
}

.rngw-wheel-frame::before,
.rngw-wheel-frame::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.rngw-wheel-frame::before {
    inset: 7px;
    border: 1px solid rgba(255,255,255,.48);
    z-index: 4;
}

.rngw-wheel-frame::after {
    inset: 17px;
    border: 1px solid rgba(20, 28, 39, .38);
    z-index: 4;
}

.rngw-wheel-rotor {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #17283f;
    box-shadow: inset 0 0 42px rgba(0,0,0,.32);
    will-change: transform;
    transform: rotate(0deg);
}

.rngw-wheel-canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.rngw-pointer {
    position: absolute;
    top: -4px;
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 42px solid #f0d49c;
    filter: drop-shadow(0 5px 4px rgba(0,0,0,.36));
    z-index: 8;
    transform-origin: 50% 4px;
}

.rngw-pointer::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    left: -6px;
    top: -40px;
    border-radius: 50%;
    background: #5e4525;
    box-shadow: inset 0 0 0 3px #e7ca91;
}

.rngw-hub-button {
    position: relative;
    z-index: 10;
    width: clamp(86px, 14%, 112px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 5px solid #f1ddb5;
    background:
        radial-gradient(circle at 35% 28%, #f6e7c9 0%, #d7b574 46%, #a67f42 100%);
    color: #18253a;
    box-shadow:
        0 8px 26px rgba(0,0,0,.38),
        inset 0 2px 2px rgba(255,255,255,.62),
        inset 0 -5px 12px rgba(85,59,24,.26);
    cursor: pointer;
    font-size: clamp(13px, 2vw, 17px);
    font-weight: 900;
    letter-spacing: .08em;
    transition: transform .2s ease, filter .2s ease;
}

.rngw-hub-button:hover {
    transform: scale(1.045);
    filter: brightness(1.04);
}

.rngw-hub-button:active {
    transform: scale(.98);
}

.rngw-hub-button:focus-visible,
.rngw-icon-btn:focus-visible,
.rngw-primary-btn:focus-visible,
.rngw-secondary-btn:focus-visible,
.rngw-count-control button:focus-visible,
.rngw-result-actions button:focus-visible,
.rngw-text-btn:focus-visible,
.rngw-editor summary:focus-visible {
    outline: 3px solid rgba(232, 212, 169, .58);
    outline-offset: 3px;
}

.rngw-app.is-spinning .rngw-hub-button,
.rngw-app.is-spinning .rngw-primary-btn,
.rngw-app.is-spinning .rngw-icon-btn,
.rngw-app.is-spinning .rngw-count-control button,
.rngw-app.is-spinning .rngw-count-control input,
.rngw-app.is-spinning .rngw-editor {
    pointer-events: none;
    opacity: .6;
}

.rngw-app.is-spinning .rngw-pointer {
    animation: rngw-pointer-tick .12s ease-in-out infinite alternate;
}

@keyframes rngw-pointer-tick {
    from { transform: translateX(-50%) rotate(-2deg); }
    to { transform: translateX(-50%) rotate(2deg); }
}

.rngw-wheel-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rngw-icon-btn {
    appearance: none;
    border: 1px solid rgba(232, 212, 169, .18);
    background: rgba(255,255,255,.055);
    color: #e5edf6;
    border-radius: 999px;
    padding: 9px 13px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.rngw-icon-btn:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(232, 212, 169, .4);
    transform: translateY(-1px);
}

.rngw-control-panel {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: clamp(22px, 2.2vw, 32px);
    border-radius: 22px;
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(218, 207, 190, .9);
    box-shadow: 0 16px 34px rgba(45, 37, 27, .07);
    backdrop-filter: blur(8px);
}

.rngw-panel-head h3 {
    font-size: clamp(23px, 2vw, 30px);
    letter-spacing: -.02em;
}

.rngw-panel-head p {
    margin: 9px 0 24px;
    color: var(--rngw-muted);
    line-height: 1.65;
    font-size: 14px;
}

.rngw-field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.rngw-field-row > label {
    font-size: 14px;
    font-weight: 800;
}

.rngw-count-control {
    display: grid;
    grid-template-columns: 38px 52px 38px;
    border: 1px solid #d9d0c2;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.rngw-count-control button,
.rngw-count-control input {
    height: 40px;
    border: 0;
    background: #fff;
    color: var(--rngw-ink);
    text-align: center;
    font: inherit;
}

.rngw-count-control button {
    cursor: pointer;
    font-size: 21px;
    line-height: 1;
}

.rngw-count-control button:hover {
    background: var(--rngw-ivory);
}

.rngw-count-control input {
    width: 52px;
    appearance: textfield;
    border-left: 1px solid #e5ddd1;
    border-right: 1px solid #e5ddd1;
    font-size: 14px;
    font-weight: 800;
}

.rngw-count-control input::-webkit-outer-spin-button,
.rngw-count-control input::-webkit-inner-spin-button {
    appearance: none;
    margin: 0;
}

.rngw-primary-btn,
.rngw-secondary-btn {
    width: 100%;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.rngw-primary-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 52px;
    padding: 0 18px;
    border: 1px solid #1a2b43;
    background: linear-gradient(135deg, #122033, #203854);
    color: #fff;
    box-shadow: 0 10px 22px rgba(18, 32, 51, .16);
}

.rngw-primary-btn:hover,
.rngw-secondary-btn:hover {
    transform: translateY(-1px);
}

.rngw-primary-btn:hover {
    box-shadow: 0 13px 28px rgba(18, 32, 51, .22);
}

.rngw-secondary-btn {
    min-height: 44px;
    padding: 0 15px;
    border: 1px solid #d9d0c2;
    background: #fff;
    color: var(--rngw-ink);
}

.rngw-panel-divider {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 22px 0 14px;
    color: #8a8f98;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.rngw-panel-divider::before,
.rngw-panel-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e5ddd1;
}

.rngw-editor {
    border: 1px solid #e1d8cb;
    border-radius: 13px;
    background: #fff;
    overflow: hidden;
}

.rngw-editor summary {
    cursor: pointer;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 800;
    list-style: none;
}

.rngw-editor summary::-webkit-details-marker {
    display: none;
}

.rngw-editor summary::after {
    content: "+";
    float: right;
    color: var(--rngw-gold);
    font-size: 20px;
    line-height: 1;
}

.rngw-editor[open] summary::after {
    content: "−";
}

.rngw-editor-body {
    padding: 0 14px 14px;
}

.rngw-editor textarea {
    width: 100%;
    min-height: 188px;
    resize: vertical;
    padding: 12px;
    border: 1px solid #dcd3c6;
    border-radius: 10px;
    background: #fffdf9;
    color: var(--rngw-ink);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}

.rngw-editor textarea:focus {
    outline: 0;
    border-color: var(--rngw-gold);
    box-shadow: 0 0 0 3px rgba(199, 165, 106, .16);
}

.rngw-help {
    margin: 8px 0 12px;
    color: var(--rngw-muted);
    font-size: 12px;
}

.rngw-privacy-note {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-top: auto;
    padding-top: 20px;
    color: #748092;
    font-size: 11px;
    line-height: 1.5;
}

.rngw-privacy-note > span:first-child {
    color: var(--rngw-gold);
    font-size: 15px;
}

.rngw-inline-message {
    min-height: 20px;
    margin-top: 8px;
    color: var(--rngw-success);
    font-size: 12px;
    font-weight: 700;
}

.rngw-result-host {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.rngw-winner-card,
.rngw-favorites-card {
    border: 1px solid var(--rngw-line);
    border-radius: 20px;
    background:
        radial-gradient(circle at 90% 0%, rgba(199,165,106,.13), transparent 30%),
        var(--rngw-paper);
    padding: clamp(20px, 2.3vw, 30px);
}

.rngw-result-label {
    margin: 2px 0 0;
    color: var(--rngw-muted);
    font-size: 13px;
    font-weight: 700;
}

.rngw-winner-name {
    margin: 8px 0 5px;
    color: var(--rngw-ink);
    font-size: clamp(31px, 4vw, 52px);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

.rngw-winner-card.is-winner .rngw-winner-name {
    animation: rngw-winner-pop .42s cubic-bezier(.2,.8,.2,1);
}

@keyframes rngw-winner-pop {
    0% { transform: scale(.94); opacity: .45; }
    70% { transform: scale(1.025); }
    100% { transform: scale(1); opacity: 1; }
}

.rngw-result-note {
    margin: 0;
    color: var(--rngw-muted);
    font-size: 13px;
}

.rngw-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.rngw-result-actions[hidden] {
    display: none;
}

.rngw-result-actions button,
.rngw-text-btn {
    appearance: none;
    border: 1px solid #ddd4c8;
    background: #fff;
    color: var(--rngw-ink);
    border-radius: 999px;
    padding: 9px 13px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.rngw-result-actions button:first-child {
    background: var(--rngw-ink);
    color: #fff;
    border-color: var(--rngw-ink);
}

.rngw-text-btn {
    background: transparent;
    border-color: transparent;
    padding: 6px 0;
    color: var(--rngw-muted);
}

.rngw-favorites-head h3 {
    font-size: 22px;
}

.rngw-favorites-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.rngw-favorite-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border-radius: 999px;
    border: 1px solid #ddd4c8;
    background: #fff;
    color: var(--rngw-ink);
    font-size: 12px;
    font-weight: 700;
}

.rngw-favorite-pill button {
    border: 0;
    padding: 0;
    background: transparent;
    color: #8a8f98;
    cursor: pointer;
    font-size: 13px;
}

.rngw-confetti {
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    overflow: hidden;
}

.rngw-confetti i {
    position: absolute;
    top: -18px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    animation: rngw-confetti-fall var(--fall, 1.8s) cubic-bezier(.2,.75,.3,1) forwards;
    transform: translate3d(0,0,0) rotate(0deg);
}

@keyframes rngw-confetti-fall {
    to {
        transform: translate3d(var(--drift, 0px), 105vh, 0) rotate(var(--spin, 720deg));
        opacity: .2;
    }
}

.rngw-app:fullscreen {
    width: 100vw;
    height: 100vh;
    padding: 18px;
    overflow: auto;
    background: #0b1421;
}

.rngw-app:fullscreen .rngw-shell {
    min-height: calc(100vh - 36px);
    max-width: 1500px;
    margin: 0 auto;
    align-items: center;
}

.rngw-app:fullscreen .rngw-wheel-stage {
    width: min(72vh, 760px, 100%);
}

/* The current cloned GeneratePress element wraps the shortcode in a second card.
   Neutralize only that known legacy wrapper while this compatibility phase is active. */
.rngw-generator-page .gb-element-8190f48f:has(.rngw-app) {
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

@media (max-width: 980px) {
    .rngw-shell {
        grid-template-columns: 1fr;
    }

    .rngw-control-panel {
        min-height: auto;
    }

    .rngw-privacy-note {
        margin-top: 6px;
    }
}

@media (max-width: 640px) {
    .rngw-shell {
        padding: 10px;
        border-radius: 20px;
        gap: 12px;
    }

    .rngw-wheel-zone,
    .rngw-control-panel {
        border-radius: 16px;
        padding: 16px;
    }

    .rngw-wheel-topline {
        flex-direction: column;
        gap: 10px;
    }

    .rngw-ready-badge {
        white-space: normal;
    }

    .rngw-wheel-stage {
        width: min(92vw, 520px);
    }

    .rngw-pointer {
        border-left-width: 13px;
        border-right-width: 13px;
        border-top-width: 32px;
    }

    .rngw-wheel-actions {
        gap: 6px;
    }

    .rngw-icon-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    .rngw-field-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .rngw-count-control {
        width: 100%;
        grid-template-columns: 44px 1fr 44px;
    }

    .rngw-count-control input {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rngw-app *,
    .rngw-result-host * {
        scroll-behavior: auto !important;
    }

    .rngw-app.is-spinning .rngw-pointer,
    .rngw-winner-card.is-winner .rngw-winner-name {
        animation: none !important;
    }

    .rngw-icon-btn,
    .rngw-primary-btn,
    .rngw-secondary-btn,
    .rngw-hub-button {
        transition: none !important;
    }
}

/* =========================================================
   Phase 1.1 polish: integrated result + legacy template cleanup
   ========================================================= */

.rngw-hub-button {
    width: clamp(100px, 15.5%, 122px);
    padding: 0 !important;
    display: grid;
    place-items: center;
    line-height: 1;
    white-space: nowrap;
}

.rngw-hub-button span {
    display: block;
    white-space: nowrap;
    font-size: clamp(14px, 1.8vw, 18px);
    line-height: 1;
    letter-spacing: .11em;
    transform: translateX(.055em);
}

.rngw-wheel-frame {
    box-shadow:
        0 0 0 1px rgba(255,255,255,.32),
        0 0 0 5px rgba(103,76,38,.16),
        0 24px 54px rgba(0,0,0,.4),
        inset 0 0 0 2px rgba(61,45,22,.26);
}

.rngw-control-panel {
    align-self: start;
}

.rngw-inline-result {
    display: block;
    margin-top: 18px;
}

.rngw-inline-result .rngw-winner-card,
.rngw-inline-result .rngw-favorites-card {
    padding: 18px;
    border-radius: 16px;
    box-shadow: none;
}

.rngw-inline-result .rngw-winner-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 88% 0%, rgba(199,165,106,.14), transparent 34%),
        linear-gradient(145deg, #fffefb 0%, #fbf7ef 100%);
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease, background .25s ease;
}

.rngw-inline-result .rngw-winner-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--rngw-gold-light), var(--rngw-gold));
    opacity: .68;
}

.rngw-result-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rngw-result-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 9px;
    border: 1px solid #ddd4c6;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    color: var(--rngw-muted);
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.rngw-inline-result .rngw-result-label {
    margin-top: 8px;
}

.rngw-inline-result .rngw-winner-name {
    margin: 5px 0 6px;
    font-size: clamp(25px, 2.7vw, 38px);
    line-height: 1.05;
}

.rngw-inline-result .rngw-result-note {
    line-height: 1.45;
}

.rngw-inline-result .rngw-result-actions {
    gap: 7px;
    margin-top: 14px;
}

.rngw-inline-result .rngw-result-actions button {
    padding: 8px 11px;
    font-size: 11px;
}

.rngw-app.has-winner .rngw-inline-result .rngw-winner-card {
    border-color: rgba(199,165,106,.72);
    background:
        radial-gradient(circle at 88% 0%, rgba(232,212,169,.34), transparent 38%),
        linear-gradient(145deg, #fffef9 0%, #f8eedc 100%);
    box-shadow: 0 14px 30px rgba(67,49,22,.09);
    transform: translateY(-1px);
}

.rngw-app.has-winner .rngw-result-state {
    border-color: rgba(199,165,106,.5);
    background: #f4e7cc;
    color: #755522;
}

.rngw-inline-result .rngw-favorites-card {
    margin-top: 10px;
    background: #fff;
}

.rngw-inline-result .rngw-favorites-head h3 {
    font-size: 18px;
}

.rngw-inline-result .rngw-favorites-list {
    margin-top: 10px;
}

.rngw-privacy-note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eee7dc;
}

/* The cloned GeneratePress Tool Block prints the linked post title again in
   its social row. Keep sharing for now, but remove the duplicate title. */
.rngw-generator-page .gb-element-3c18e26b .wp-block-post-title {
    display: none !important;
}

.rngw-generator-page .gb-element-3c18e26b .ah-tool-share {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 10px 12px !important;
}

.rngw-generator-page .gb-element-3c18e26b .gb-text-7f5d03ec {
    padding-left: 0 !important;
    margin: 0 !important;
}

/* Remove the legacy shortcode card frame: the new component owns its frame. */
.rngw-generator-page .gb-element-8190f48f {
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.rngw-generator-page .gb-element-8190f48f > p {
    margin: 0 !important;
}

/* The result now lives inside .rngw-control-panel. Hide the obsolete
   GeneratePress Output Result wrapper completely during the compatibility phase. */
.rngw-generator-page .gb-element-4e710fb1 {
    display: none !important;
}

/* Keep the article body, but remove the cloned dark "Description" card style.
   Phase 2 will replace this legacy element with a proper Generator template. */
.rngw-generator-page .gb-element-d7f0e5a0 {
    margin-top: clamp(34px, 5vw, 64px) !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: inherit !important;
}

.rngw-generator-page .gb-element-d7f0e5a0 > .gb-text-041fa2ac {
    display: none !important;
}

@media (max-width: 980px) {
    .rngw-control-panel {
        align-self: stretch;
    }
}

@media (max-width: 640px) {
    .rngw-hub-button {
        width: clamp(86px, 19%, 102px);
        border-width: 4px;
    }

    .rngw-hub-button span {
        font-size: 13px;
    }

    .rngw-inline-result {
        margin-top: 14px;
    }

    .rngw-inline-result .rngw-winner-card,
    .rngw-inline-result .rngw-favorites-card {
        padding: 16px;
    }

    .rngw-inline-result .rngw-winner-name {
        font-size: clamp(26px, 9vw, 36px);
    }

    .rngw-generator-page .gb-element-3c18e26b {
        padding-bottom: 18px !important;
    }
}
