/* =========================================================
   OKGames Lucky Wheel V5
   File: /web/home.css
   Layout: 35% Wheel | 65% Content
   Max-width: 1200px
   Canvas: 270px (desktop)
========================================================= */

/* 1. Section */
.okg-lucky-wheel-section {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(5, 100, 200, 0.10);
    border-radius: 12px;
    background:
        radial-gradient(circle at 12% 20%, rgba(5, 100, 200, 0.06), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(5, 100, 200, 0.04), transparent 32%),
        linear-gradient(135deg, #f8fbff 0%, #edf5fd 48%, #f8fbff 100%);
    box-shadow: 0 4px 20px rgba(23, 58, 94, 0.06);
    color: #173a5e;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.okg-lucky-wheel-section::before,
.okg-lucky-wheel-section::after {
    display: none;
}

/* 2. Inner grid - 35% / 65% */
.okg-lucky-wheel-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 16px;
    width: 100%;
    min-height: 300px;
    align-items: stretch;
}

/* 3. Wheel column */
.okg-wheel-stage {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 300px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid rgba(5, 100, 200, 0.06);
    border-radius: 10px;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.98) 0%, rgba(231, 242, 253, 0.92) 52%, rgba(217, 233, 250, 0.88) 100%);
}

.okg-wheel-stage::before {
    display: none;
}

/* 4. Canvas wrap */
.okg-wheel-canvas-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    max-width: 270px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    margin: 0 auto;
}

.okg-wheel-canvas-title {
    margin: 0 0 3px;
    color: #0564c8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.okg-wheel-canvas-wrap::before {
    display: none;
}

#okgLuckyWheelCanvas {
    display: block;
    width: 270px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#okgLuckyWheelCanvas:hover {
    filter: none;
}

.okg-wheel-canvas-button {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    outline: 0;
    background: transparent !important;
    color: transparent;
    font-size: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.okg-wheel-canvas-button:hover,
.okg-wheel-canvas-button:active,
.okg-wheel-canvas-button:focus {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.okg-wheel-canvas-button:focus-visible {
    outline: 2px solid rgba(5, 100, 200, 0.4);
    outline-offset: 4px;
}

.okg-wheel-canvas-button:disabled {
    cursor: not-allowed;
}

.okg-lucky-wheel-section.is-spinning .okg-wheel-canvas-button {
    cursor: wait;
}

.okg-lucky-wheel-section.has-spun-today .okg-wheel-canvas-button {
    cursor: not-allowed;
}

/* 5. Content column - 65% */
.okg-wheel-content {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 300px;
    flex-direction: column;
    justify-content: center;
    padding: 12px 18px;
    box-sizing: border-box;
    border: 1px solid rgba(5, 100, 200, 0.06);
    border-radius: 10px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 254, 0.96));
}

.okg-wheel-content::before {
    display: none;
}

.okg-wheel-content-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* 6. Badge */
.okg-wheel-badge {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 3px 12px;
    box-sizing: border-box;
    border: 1px solid rgba(5, 100, 200, 0.12);
    border-radius: 6px;
    background: #d9e9fa;
    color: #034e9d;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.okg-wheel-badge::before {
    display: block;
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    border-radius: 50%;
    background: #0564c8;
    box-shadow: 0 0 0 3px rgba(5, 100, 200, 0.08);
    content: "";
}

/* 7. Title */
.okg-wheel-title {
    margin: 0;
    color: #173a5e;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.3px;
}

.okg-wheel-title span {
    display: block;
    margin-top: 2px;
    color: #0564c8;
}

/* 8. Description */
.okg-wheel-description {
    max-width: 100%;
    margin: 0;
    color: #4c6782;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.6;
}

/* 9. Actions */
.okg-wheel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-top: 2px;
}

.okg-wheel-button {
    display: inline-flex;
    min-width: 120px;
    min-height: 34px;
    flex: 1 1 130px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
    padding: 6px 16px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 6px;
    outline: 0;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.okg-wheel-button:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.okg-wheel-button:active {
    transform: translateY(0);
}

.okg-wheel-button:focus-visible {
    outline: 2px solid rgba(5, 100, 200, 0.3);
    outline-offset: 2px;
}

.okg-wheel-button--primary {
    border-color: #0564c8;
    background: linear-gradient(135deg, #0876e8, #0564c8 54%, #034e9d);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(5, 100, 200, 0.14);
}

.okg-wheel-button--primary:hover {
    border-color: #034e9d;
    background: linear-gradient(135deg, #0564c8, #034e9d);
    box-shadow: 0 4px 14px rgba(5, 100, 200, 0.18);
}

.okg-wheel-button--secondary {
    border-color: rgba(5, 100, 200, 0.14);
    background: #ffffff;
    color: #0564c8;
}

.okg-wheel-button--secondary:hover {
    border-color: #0564c8;
    background: #edf5fd;
    color: #034e9d;
}

.okg-wheel-button:disabled,
.okg-wheel-button[aria-disabled="true"] {
    border-color: #bed3e8;
    background: #dce8f3;
    color: #71869a;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.78;
    transform: none;
}

/* 10. Status */
.okg-wheel-status {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 32px;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 10px;
    box-sizing: border-box;
    border: 1px solid rgba(5, 100, 200, 0.06);
    border-radius: 6px;
    background: #edf5fd;
    color: #496783;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.okg-wheel-status::before {
    display: block;
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    border-radius: 50%;
    background: #7da9d2;
    box-shadow: 0 0 0 3px rgba(125, 169, 210, 0.08);
    content: "";
}

.okg-wheel-status[data-state="ready"] {
    border-color: rgba(5, 100, 200, 0.06);
    background: #edf5fd;
    color: #496783;
}

.okg-wheel-status[data-state="ready"]::before {
    background: #0564c8;
    box-shadow: 0 0 0 3px rgba(5, 100, 200, 0.08);
}

.okg-wheel-status[data-state="spinning"] {
    border-color: rgba(5, 100, 200, 0.14);
    background: #dceefe;
    color: #034e9d;
}

.okg-wheel-status[data-state="spinning"]::before {
    background: #0564c8;
    box-shadow: 0 0 0 3px rgba(5, 100, 200, 0.08);
    animation: okgWheelStatusPulse 0.75s ease-in-out infinite;
}

.okg-wheel-status[data-state="result"] {
    border-color: rgba(28, 148, 91, 0.16);
    background: #eaf8f1;
    color: #167448;
}

.okg-wheel-status[data-state="result"]::before {
    background: #1c945b;
    box-shadow: 0 0 0 3px rgba(28, 148, 91, 0.08);
}

.okg-wheel-status[data-state="locked"] {
    border-color: rgba(117, 133, 149, 0.14);
    background: #eef2f5;
    color: #65798c;
}

.okg-wheel-status[data-state="locked"]::before {
    background: #7c8c9b;
    box-shadow: 0 0 0 3px rgba(124, 140, 155, 0.08);
}

/* 11. Utilities */
.okg-wheel-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* =========================================================
   12. Popup - FIXED CENTERED
========================================================= */

.okg-wheel-popup[hidden] {
    display: none !important;
}

.okg-wheel-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    margin: 0 !important;
    background: rgba(0, 0, 0, 0.50) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.25s ease, visibility 0.25s ease !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 100% !important;
}

.okg-wheel-popup.is-open {
    opacity: 1 !important;
    visibility: visible !important;
}

html.okg-wheel-popup-open,
html.okg-wheel-popup-open body {
    overflow: hidden !important;
}

.okg-wheel-popup__dialog {
    position: relative !important;
    width: 100% !important;
    max-width: 380px !important;
    max-height: 90vh !important;
    margin: auto !important;
    padding: 32px 24px 24px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18) !important;
    text-align: center !important;
    transform: translateY(16px) scale(0.95) !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    overflow-y: auto !important;
}

.okg-wheel-popup.is-open .okg-wheel-popup__dialog {
    transform: translateY(0) scale(1) !important;
}

.okg-wheel-popup__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #8a9aa8;
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.okg-wheel-popup__close:hover {
    background: #f0f4f8;
    color: #173a5e;
}

.okg-wheel-popup__close:focus-visible {
    outline: 2px solid #0564c8;
    outline-offset: 2px;
}

.okg-wheel-popup__content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.okg-wheel-popup__icon {
    display: flex;
    width: 52px;
    height: 52px;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5b81b, #f0a500);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(240, 165, 0, 0.22);
}

.okg-wheel-popup__eyebrow {
    margin: 0 0 2px;
    color: #8a9aa8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.okg-wheel-popup__title {
    margin: 0 0 4px;
    color: #173a5e;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

.okg-wheel-popup__prize-label {
    margin: 0 0 2px;
    color: #8a9aa8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.okg-wheel-popup__prize {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2px 16px;
    color: #0564c8;
    font-size: 38px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.okg-wheel-popup__message {
    max-width: 280px;
    margin: 4px auto 0;
    color: #5a7288;
    font-size: 13px;
    line-height: 1.5;
}

.okg-wheel-popup__actions {
    display: flex;
    width: 100%;
    gap: 8px;
    margin-top: 16px;
}

.okg-wheel-popup__button {
    display: inline-flex;
    flex: 1;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.okg-wheel-popup__button:hover {
    transform: translateY(-1px);
}

.okg-wheel-popup__button:active {
    transform: translateY(0);
}

.okg-wheel-popup__button:focus-visible {
    outline: 2px solid #0564c8;
    outline-offset: 2px;
}

.okg-wheel-popup__button--claim {
    background: #0564c8;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(5, 100, 200, 0.22);
}

.okg-wheel-popup__button--claim:hover {
    background: #034e9d;
    box-shadow: 0 4px 14px rgba(5, 100, 200, 0.26);
}

.okg-wheel-popup__button--close {
    background: #f0f4f8;
    color: #4a657a;
}

.okg-wheel-popup__button--close:hover {
    background: #e4eaef;
    color: #173a5e;
}

/* 13. Animations */
@keyframes okgWheelStatusPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.75);
    }
}

/* 14. Responsive - Tablet (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .okg-lucky-wheel-section {
        padding: 14px;
    }

    .okg-lucky-wheel-inner {
        grid-template-columns: 38% 62%;
        min-height: 260px;
        gap: 14px;
    }

    .okg-wheel-stage,
    .okg-wheel-content {
        min-height: 260px;
    }

    .okg-wheel-canvas-wrap {
        max-width: 220px;
    }

    #okgLuckyWheelCanvas {
        width: 220px;
    }

    .okg-wheel-content {
        padding: 10px 14px;
    }

    .okg-wheel-title {
        font-size: 24px;
    }

    .okg-wheel-description {
        font-size: 12px;
    }

    .okg-wheel-button {
        min-height: 30px;
        font-size: 11px;
        padding: 5px 12px;
        min-width: 90px;
    }

    .okg-wheel-status {
        min-height: 28px;
        font-size: 10px;
        padding: 3px 8px;
    }

    .okg-wheel-badge {
        font-size: 9px;
        min-height: 20px;
        padding: 2px 10px;
    }

    .okg-wheel-popup__dialog {
        max-width: 340px !important;
    }
}

/* 15. Responsive - Mobile (< 768px) */
@media (max-width: 768px) {
    .okg-lucky-wheel-section {
        max-width: 100%;
        padding: 10px;
        margin: 10px 8px 0;
        border-radius: 8px;
    }

    .okg-lucky-wheel-inner {
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: 0;
    }

    .okg-wheel-stage,
    .okg-wheel-content {
        min-height: 0;
    }

    .okg-wheel-stage {
        padding: 10px;
    }

    .okg-wheel-canvas-wrap {
        max-width: 200px;
    }

    #okgLuckyWheelCanvas {
        width: 200px;
    }

    .okg-wheel-canvas-title {
        font-size: 10px;
    }

    .okg-wheel-content {
        padding: 10px 12px;
    }

    .okg-wheel-content-main {
        gap: 6px;
    }

    .okg-wheel-badge {
        font-size: 9px;
        min-height: 20px;
        padding: 2px 10px;
    }

    .okg-wheel-title {
        font-size: 22px;
    }

    .okg-wheel-description {
        font-size: 12px;
        line-height: 1.5;
    }

    .okg-wheel-actions {
        flex-direction: column;
        gap: 5px;
    }

    .okg-wheel-button {
        width: 100%;
        min-width: 0;
        min-height: 30px;
        flex: none;
        font-size: 11px;
        padding: 5px 12px;
    }

    .okg-wheel-status {
        min-height: 26px;
        font-size: 10px;
        padding: 3px 8px;
    }

    .okg-wheel-popup {
        padding: 12px !important;
    }

    .okg-wheel-popup__dialog {
        padding: 24px 16px 18px !important;
        max-width: 320px !important;
    }

    .okg-wheel-popup__icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .okg-wheel-popup__title {
        font-size: 18px;
    }

    .okg-wheel-popup__prize {
        font-size: 30px;
    }

    .okg-wheel-popup__message {
        font-size: 12px;
    }

    .okg-wheel-popup__actions {
        flex-direction: column;
        gap: 6px;
        margin-top: 12px;
    }

    .okg-wheel-popup__button {
        min-height: 34px;
        font-size: 11px;
    }
}

/* 16. Responsive - Small Mobile (< 400px) */
@media (max-width: 400px) {
    .okg-lucky-wheel-section {
        padding: 6px;
        margin: 6px 4px 0;
    }

    .okg-wheel-canvas-wrap {
        max-width: 160px;
    }

    #okgLuckyWheelCanvas {
        width: 160px;
    }

    .okg-wheel-content {
        padding: 8px 8px;
    }

    .okg-wheel-title {
        font-size: 18px;
    }

    .okg-wheel-description {
        font-size: 11px;
    }

    .okg-wheel-button {
        font-size: 10px;
        min-height: 26px;
        padding: 4px 10px;
    }

    .okg-wheel-status {
        font-size: 9px;
        min-height: 22px;
        padding: 2px 6px;
    }

    .okg-wheel-popup__dialog {
        padding: 18px 12px 14px !important;
        max-width: 280px !important;
    }

    .okg-wheel-popup__prize {
        font-size: 26px;
    }
}

/* 17. Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .okg-lucky-wheel-section,
    .okg-wheel-button,
    .okg-wheel-popup,
    .okg-wheel-popup__dialog,
    .okg-wheel-popup__button {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .okg-wheel-status[data-state="spinning"]::before {
        animation: none;
    }

    .okg-wheel-button:hover,
    .okg-wheel-popup__button:hover {
        transform: none;
    }
}

/* 18. Forced Colors */
@media (forced-colors: active) {
    .okg-lucky-wheel-section,
    .okg-wheel-stage,
    .okg-wheel-content,
    .okg-wheel-status,
    .okg-wheel-popup__dialog {
        border: 1px solid CanvasText;
    }

    .okg-wheel-button,
    .okg-wheel-popup__button,
    .okg-wheel-popup__close {
        border: 1px solid ButtonText;
    }

    .okg-wheel-canvas-button:focus-visible,
    .okg-wheel-button:focus-visible,
    .okg-wheel-popup__button:focus-visible {
        outline: 3px solid Highlight;
    }
}