/**
 * Fantasy oily gem buttons — match reference (gold frame, teal→blue, stars, swirl, flare)
 * Used under icons: hero, services, account review summary
 */

.ot-fan-btn,
.ot-hero-btn > span:not(.ot-icon-bubble),
.ot-svc-label,
.ot-review-label {
    --fan-gold-a: #ffe9a3;
    --fan-gold-b: #f5d76e;
    --fan-gold-c: #c9a227;
    position: relative !important;
    z-index: 2;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 1.55rem;
    height: auto;
    padding: 2px !important;
    margin: 0.1rem 0 0;
    flex-wrap: nowrap !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: linear-gradient(
        135deg,
        #fff6d0 0%,
        #ffe9a3 18%,
        #f5d76e 42%,
        #d4af37 68%,
        #a16207 100%
    ) !important;
    clip-path: polygon(
        8px 0,
        calc(100% - 8px) 0,
        100% 8px,
        100% calc(100% - 8px),
        calc(100% - 8px) 100%,
        8px 100%,
        0 calc(100% - 8px),
        0 8px
    );
    box-shadow:
        0 0 0 1px rgba(161, 98, 7, 0.55),
        0 0 10px rgba(250, 204, 21, 0.45),
        0 5px 14px rgba(8, 47, 73, 0.28) !important;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4)) !important;
    overflow: visible !important;
    isolation: isolate;
    text-decoration: none !important;
    cursor: default;
}

/* Inner gem fill */
.ot-fan-btn__face,
.ot-hero-btn > span:not(.ot-icon-bubble)::before,
.ot-svc-label::before,
.ot-review-label::before {
    content: '';
    position: absolute;
    inset: 2px;
    z-index: 0;
    background:
        /* top-right flare */
        radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.95) 0%, rgba(186, 230, 253, 0.55) 18%, transparent 42%),
        /* left seafoam sheen */
        radial-gradient(ellipse 70% 140% at 8% 50%, rgba(167, 243, 208, 0.65) 0%, transparent 50%),
        /* glossy band */
        linear-gradient(
            118deg,
            rgba(255, 255, 255, 0.55) 0%,
            rgba(255, 255, 255, 0.12) 22%,
            transparent 38%,
            rgba(125, 211, 252, 0.2) 55%,
            transparent 68%,
            rgba(255, 255, 255, 0.28) 100%
        ),
        /* base oil gradient teal → cobalt */
        linear-gradient(
            95deg,
            #99f6e4 0%,
            #5eead4 12%,
            #2dd4bf 28%,
            #22d3ee 48%,
            #0ea5e9 68%,
            #2563eb 88%,
            #1e3a8a 100%
        ) !important;
    clip-path: polygon(
        6px 0,
        calc(100% - 6px) 0,
        100% 6px,
        100% calc(100% - 6px),
        calc(100% - 6px) 100%,
        6px 100%,
        0 calc(100% - 6px),
        0 6px
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.65),
        inset 0 -3px 10px rgba(15, 23, 42, 0.4),
        inset 0 0 0 1px rgba(254, 243, 199, 0.45);
    pointer-events: none;
}

/* When structure has .ot-fan-btn__face from JS, hide raw ::before fill */
.ot-fan-btn.ot-fan-ready::before,
.ot-hero-btn > span.ot-fan-ready:not(.ot-icon-bubble)::before,
.ot-svc-label.ot-fan-ready::before,
.ot-review-label.ot-fan-ready::before {
    content: none !important;
    display: none !important;
}

.ot-fan-btn__face {
    content: none;
    display: block;
}

.ot-fan-btn__text,
.ot-hero-btn > span:not(.ot-icon-bubble),
.ot-svc-label,
.ot-review-label {
    font-size: clamp(0.42rem, 2.4vw, 0.5rem) !important;
    font-weight: 900 !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
    line-height: 1 !important;
    text-align: center;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ot-fan-btn__text {
    position: relative;
    z-index: 4;
    display: block;
    flex: 0 1 auto;
    max-width: calc(100% - 0.2rem);
    padding: 0.28rem 0.5rem;
    color: #ffffff !important;
    -webkit-text-stroke: 0.35px rgba(8, 47, 73, 0.55);
    text-shadow:
        0 0 1px #082f49,
        0 1px 0 #0c4a6e,
        0 1px 2px rgba(0, 0, 0, 0.75),
        0 0 8px rgba(255, 255, 255, 0.85),
        0 0 14px rgba(125, 211, 252, 1),
        0 0 20px rgba(56, 189, 248, 0.85) !important;
}

/* Fallback text styles when JS not yet enhanced */
.ot-hero-btn > span:not(.ot-icon-bubble):not(.ot-fan-ready),
.ot-svc-label:not(.ot-fan-ready),
.ot-review-label:not(.ot-fan-ready) {
    color: #ffffff !important;
    padding: 0.28rem 0.55rem !important;
    -webkit-text-stroke: 0.4px rgba(8, 47, 73, 0.55);
    text-shadow:
        0 0 1px #082f49,
        0 1px 0 #0c4a6e,
        0 1px 2px rgba(0, 0, 0, 0.75),
        0 0 8px rgba(255, 255, 255, 0.85),
        0 0 14px rgba(125, 211, 252, 1) !important;
}

/* Side 4-point stars */
.ot-fan-btn__star {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 10px;
    height: 10px;
    transform: translateY(-50%);
    background: radial-gradient(circle at 35% 35%, #fffce8 0%, #ffe9a3 40%, #f59e0b 75%, #b45309 100%);
    clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
    box-shadow: 0 0 8px rgba(250, 204, 21, 1), 0 0 14px rgba(251, 191, 36, 0.8);
    pointer-events: none;
}

.ot-fan-btn__star--l { left: -3px; }
.ot-fan-btn__star--r { right: -3px; }

/* Fallback stars via ::after (only left is hard with one pseudo) — JS adds both */

/* Wind swirl ring */
.ot-fan-btn__swirl {
    position: absolute;
    inset: -6px -4px;
    z-index: 1;
    border-radius: 40%;
    border: 1.5px solid rgba(224, 242, 254, 0.55);
    border-left-color: transparent;
    border-bottom-color: rgba(186, 230, 253, 0.35);
    box-shadow:
        inset 0 0 8px rgba(255, 255, 255, 0.25),
        0 0 10px rgba(125, 211, 252, 0.35);
    opacity: 0.85;
    pointer-events: none;
    animation: otFanSwirl 3.2s linear infinite;
}

.ot-fan-btn__swirl::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 45%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-right-color: transparent;
    animation: otFanSwirl 2.4s linear infinite reverse;
}

@keyframes otFanSwirl {
    to { transform: rotate(360deg); }
}

/* Top-right ray flare */
.ot-fan-btn__shine {
    position: absolute;
    top: -2px;
    right: 4px;
    z-index: 3;
    width: 18px;
    height: 18px;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(186, 230, 253, 0.5) 35%, transparent 70%);
    filter: blur(0.2px);
    pointer-events: none;
}

.ot-fan-btn__shine::before,
.ot-fan-btn__shine::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
    transform: translate(-50%, -50%);
}

.ot-fan-btn__shine::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.ot-hero-btn:hover > span:not(.ot-icon-bubble),
.ot-svc-item:hover .ot-svc-label,
.ot-review-tile:hover .ot-review-label,
.ot-fan-btn:hover {
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.65)) brightness(1.07) !important;
}

body.rx-body .ot-hero-btn > span:not(.ot-icon-bubble),
body.rx-body .ot-svc-label,
body.rx-body .ot-review-label,
body.rx-body .ot-fan-btn {
    background: linear-gradient(
        135deg,
        #fff6d0 0%,
        #ffe9a3 18%,
        #f5d76e 42%,
        #d4af37 68%,
        #a16207 100%
    ) !important;
    color: #ffffff !important;
}

body.rx-body .ot-fan-btn__text {
    color: #ffffff !important;
}

body.rx-body .ot-hero-btn > span:not(.ot-icon-bubble):not(.ot-fan-ready),
body.rx-body .ot-svc-label:not(.ot-fan-ready),
body.rx-body .ot-review-label:not(.ot-fan-ready) {
    color: #ffffff !important;
    text-shadow:
        0 0 1px #082f49,
        0 1px 2px rgba(0, 0, 0, 0.8),
        0 0 12px rgba(125, 211, 252, 1) !important;
}

/* ── CTA fantasy gems (Join / Submit / Buy / Collect…) ── */
.ot-fan-btn--cta,
.gx-bubble-btn.ot-fan-btn,
.ot-submit.ot-fan-btn,
.ot-deposit-submit.ot-fan-btn,
.rx-auth-submit.ot-fan-btn,
.shop-buy-btn.ot-fan-btn,
.ot-pwa-banner-btn.ot-fan-btn,
.ot-mine-collect.ot-fan-btn,
.ot-btn.ot-fan-btn,
.rx-btn.ot-fan-btn,
button[type="submit"].ot-fan-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.45rem;
    width: auto !important;
    max-width: 100%;
    min-width: 10rem;
    min-height: 3.1rem !important;
    margin: 0.85rem auto 0 !important;
    padding: 3px !important;
    cursor: pointer !important;
    font-size: 0.82rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    clip-path: polygon(
        12px 0,
        calc(100% - 12px) 0,
        100% 12px,
        100% calc(100% - 12px),
        calc(100% - 12px) 100%,
        12px 100%,
        0 calc(100% - 12px),
        0 12px
    ) !important;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow:
        0 0 0 1px rgba(161, 98, 7, 0.55),
        0 0 14px rgba(250, 204, 21, 0.45),
        0 10px 22px rgba(8, 47, 73, 0.32) !important;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.4)) !important;
}

.ot-fan-btn--cta .ot-fan-btn__face,
.gx-bubble-btn.ot-fan-btn::before,
.ot-submit.ot-fan-btn::before,
.ot-deposit-submit.ot-fan-btn::before,
.rx-auth-submit.ot-fan-btn::before,
.shop-buy-btn.ot-fan-btn::before,
button[type="submit"].ot-fan-btn::before {
    clip-path: polygon(
        10px 0,
        calc(100% - 10px) 0,
        100% 10px,
        100% calc(100% - 10px),
        calc(100% - 10px) 100%,
        10px 100%,
        0 calc(100% - 10px),
        0 10px
    );
}

.ot-fan-btn--cta.ot-fan-ready::before {
    content: none !important;
    display: none !important;
}

.ot-fan-btn--cta > *:not(.ot-fan-btn__face):not(.ot-fan-btn__shine):not(.ot-fan-btn__swirl):not(.ot-fan-btn__star) {
    position: relative;
    z-index: 4;
}

.ot-fan-btn--cta .ot-fan-btn__text,
.ot-fan-btn--cta .gx-bubble-btn__label {
    position: relative;
    z-index: 4;
    flex: 1 1 auto;
    padding: 0.55rem 0.9rem !important;
    font-size: 0.82rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    text-align: center;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-shadow:
        0 0 1px #082f49,
        0 1px 2px rgba(0, 0, 0, 0.75),
        0 0 10px rgba(125, 211, 252, 0.95),
        0 0 16px rgba(56, 189, 248, 0.75) !important;
    -webkit-text-stroke: 0.35px rgba(8, 47, 73, 0.45);
}

.ot-fan-btn--cta .gx-bubble-btn__icon {
    position: relative;
    z-index: 4;
    flex-shrink: 0;
    width: 2rem !important;
    height: 2rem !important;
    margin: 0 0 0 0.45rem !important;
    border-radius: 0.45rem !important;
    display: grid !important;
    place-items: center;
    background: linear-gradient(180deg, #fffef5, #fbbf24) !important;
    color: #92400e !important;
    font-size: 0.85rem !important;
    box-shadow: 0 0 0 1px rgba(161, 98, 7, 0.45), 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

.ot-fan-btn--cta .gx-bubble-btn__icon::after {
    display: none !important;
}

.ot-fan-btn--cta .ot-fan-btn__star {
    width: 12px;
    height: 12px;
}

.ot-fan-btn--cta:hover,
.ot-fan-btn--cta:active {
    filter: drop-shadow(0 0 14px rgba(56, 189, 248, 0.7)) brightness(1.06) !important;
    transform: translateY(1px);
}

body.rx-body .ot-fan-btn--cta,
body.rx-body .gx-bubble-btn.ot-fan-btn,
body.rx-body .ot-submit.ot-fan-btn,
body.rx-body .ot-deposit-submit.ot-fan-btn,
body.rx-body .rx-auth-submit.ot-fan-btn,
body.rx-body .shop-buy-btn.ot-fan-btn,
body.rx-body button[type="submit"].ot-fan-btn {
    background: linear-gradient(
        135deg,
        #fff6d0 0%,
        #ffe9a3 18%,
        #f5d76e 42%,
        #d4af37 68%,
        #a16207 100%
    ) !important;
    color: #ffffff !important;
    box-shadow:
        0 0 0 1px rgba(161, 98, 7, 0.55),
        0 0 14px rgba(250, 204, 21, 0.45),
        0 10px 22px rgba(8, 47, 73, 0.32) !important;
}

/* Auth / shop pages without rx-body */
.rx-auth-modern .ot-fan-btn--cta,
.gx-app .ot-fan-btn--cta {
    background: linear-gradient(
        135deg,
        #fff6d0 0%,
        #ffe9a3 18%,
        #f5d76e 42%,
        #d4af37 68%,
        #a16207 100%
    ) !important;
}

/* Review value on gem cards */
.ot-review-value {
    margin-top: 0.15rem;
    font-size: 0.72rem !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.45),
        0 0 10px rgba(125, 211, 252, 0.55) !important;
}

@media (prefers-reduced-motion: reduce) {
    .ot-fan-btn__swirl,
    .ot-fan-btn__swirl::before {
        animation: none !important;
    }
}
