/* CLEAN MODERN GAMING THEME - LUCKY WHEEL */
.wheel-page {
    --primary: var(--primary-color, #dc2626);
    --primary-light: rgba(220, 38, 38, 0.12);
    --primary-hover: #b91c1c;
    --bg-body: transparent;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-subtle: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.wheel-page * {
    box-sizing: border-box;
}

[data-theme="dark"] .wheel-page {
    --primary: #f87171; 
    --primary-light: rgba(248, 113, 113, 0.15);
    --primary-hover: #ef4444; 
    --bg-body: transparent;
    --bg-card: #171717;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --danger: #ef4444;
}

body {
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
}

/* Page Header */
.wheel-header-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--border-subtle);
    border-bottom: 4px solid var(--primary);
    width: 100%;
    max-width: 100%;
}

.wheel-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-main);
    margin-bottom: 8px;
}

.wheel-header-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.wheel-header-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
    word-break: break-word;
}

.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Layout */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (min-width: 992px) {
    .layout-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.left-panel-stack,
.right-panel-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Left Panel */
.main-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 30px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* Wheel Arena */
.wheel-arena-wrapper {
    position: relative;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1;
    margin: 8px auto 26px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.wheel-arena-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed var(--border-subtle);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

.wheel-arena-wrapper::after {
    content: '';
    position: absolute;
    inset: 12px;
    border: 1px solid var(--primary-light);
    border-radius: 50%;
    z-index: 0;
    background: var(--bg-body, #f8f9fa);
    pointer-events: none;
}

.wheel-image-container {
    position: absolute;
    inset: 20px;
    z-index: 1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    contain: paint;
}

.wheel-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transition: transform 5s cubic-bezier(0.2, 0.8, 0.3, 1);
    backface-visibility: hidden;
}

.wheel-pointer {
    position: absolute;
    top: 6px;
    left: 50%;
    z-index: 12;
    transform: translateX(-50%);
    pointer-events: none;
}

.wheel-pointer-image {
    width: 64px;
    height: 80px;
    object-fit: contain;
}

.wheel-pointer-default {
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-top: 58px solid #ef4444;
    filter: drop-shadow(0 4px 3px rgba(0, 0, 0, .35));
}

.wheel-pointer-default::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    top: -12px;
    left: -12px;
    border-radius: 50%;
    background: #fbbf24;
    border: 4px solid #fff;
}

.center-pointer-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    z-index: 10;
    cursor: pointer;
}

/* Action Controls (Bottom of wheel) */
.action-controls {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    box-sizing: border-box;
}

.price-display {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    padding: 10px 24px;
    background: rgba(220, 38, 38, 0.06);
    border: 2px solid rgba(220, 38, 38, 0.25);
    border-radius: 30px;
    text-align: center;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.1);
}

.discount-input-group {
    display: flex;
    background: var(--bg-body);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    overflow: hidden;
    height: 48px;
    max-width: 100%;
    box-sizing: border-box;
}

.discount-input-group input {
    border: none;
    background: transparent;
    padding: 0 16px;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.discount-input-group button {
    background: var(--brand-gradient, linear-gradient(135deg, #ef4444 0%, #dc2626 100%));
    color: white;
    border: none;
    padding: 0 20px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.discount-input-group button:hover {
    opacity: 0.9;
}

.spin-select {
    height: 48px;
    padding: 0 20px;
    border: 2px solid var(--border-subtle);
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    background: var(--bg-card);
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    text-align-last: center;
    transition: border-color 0.2s;
}

.spin-select:focus {
    border-color: var(--primary);
}

.action-buttons-group {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
    box-sizing: border-box;
}

.btn-white {
    height: 48px;
    padding: 0 28px;
    border: 2px solid var(--border-subtle);
    background: transparent;
    color: var(--text-main);
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-white:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-blue {
    height: 48px;
    padding: 0 28px;
    border: none;
    background: var(--brand-gradient, linear-gradient(135deg, #ef4444 0%, #dc2626 100%));
    color: white;
    font-weight: 800;
    letter-spacing: 0.3px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
    white-space: nowrap;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-blue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
    opacity: 0.96;
}

.btn-blue:disabled,
.btn-white:disabled {
    cursor: wait;
    opacity: .6;
    transform: none;
}

/* Comment Section */
.comment-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.comment-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-main);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.comment-item {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
}

.comment-text {
    font-size: 0.9rem;
    margin-top: 4px;
    color: var(--text-main);
    word-break: break-word;
}

.comment-actions {
    display: flex;
    gap: 15px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.comment-actions span {
    cursor: pointer;
}

.comment-input-wrapper {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 20px;
}

.comment-textarea {
    flex: 1;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    height: 50px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.comment-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Inventory Box */
.inventory-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.inventory-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.inventory-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(37, 99, 235, 0.2);
    flex-shrink: 0;
}

.inventory-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inventory-amount {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.inventory-unit {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    font-style: italic;
}

.inventory-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-history, .btn-withdraw {
    flex: 1;
    height: 42px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

.btn-history {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.btn-history:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-withdraw {
    background: var(--brand-gradient, linear-gradient(135deg, #ef4444 0%, #dc2626 100%));
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

.btn-withdraw:hover {
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
    opacity: 0.95;
    color: white;
}

/* History Box */
.history-box {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 4px;
}

.btn-top-quay {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@keyframes historySlideIn {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--bg-card);
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.history-card-new {
    animation: historySlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-color: rgba(59, 130, 246, 0.4);
}

@keyframes balancePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); color: var(--primary); }
    100% { transform: scale(1); }
}

.user-balance.balance-updated {
    animation: balancePulse 0.45s ease-out;
    display: inline-block;
}

.history-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.history-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-reward {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--success);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Modal Result */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.result-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-subtle);
    box-sizing: border-box;
}

.result-modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--bg-body);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.result-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 20px;
}

.result-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-main);
    margin-bottom: 10px;
}

.result-desc {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.result-reward {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    padding: 15px;
    background: var(--primary-light);
    border-radius: 12px;
    margin-bottom: 25px;
}

/* =========================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================= */
@media (max-width: 991px) {
    .main-card {
        padding: 24px 18px;
    }
    .wheel-arena-wrapper {
        max-width: 420px;
    }
}

@media (max-width: 768px) {
    .wheel-page .container {
        padding-top: 14px !important;
        padding-bottom: 30px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .wheel-header-box {
        padding: 16px 14px;
        margin-bottom: 16px;
        border-radius: 16px;
    }

    .wheel-header-title {
        font-size: 1.2rem;
    }

    .wheel-header-desc {
        font-size: 0.82rem;
        margin-bottom: 12px;
    }

    .main-card {
        padding: 20px 14px;
        border-radius: 20px;
    }

    .wheel-arena-wrapper {
        width: 100%;
        max-width: min(100%, 360px);
        margin: 6px auto 20px auto;
    }

    .wheel-arena-wrapper::before {
        inset: 0;
    }

    .wheel-arena-wrapper::after {
        inset: 8px;
    }

    .wheel-image-container {
        inset: 14px;
    }

    .wheel-pointer-image {
        width: 52px;
        height: 68px;
    }

    .action-controls {
        gap: 12px;
        padding-top: 16px;
        flex-direction: column;
        width: 100%;
    }

    .price-display {
        font-size: 1.3rem;
        padding: 8px 24px;
        align-self: center;
    }

    .discount-input-group {
        width: 100%;
        max-width: 320px;
        height: 44px;
    }

    .spin-select {
        width: 100%;
        max-width: 320px;
        height: 44px;
        font-size: 0.82rem;
    }

    .action-buttons-group {
        width: 100%;
        max-width: 320px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .btn-white,
    .btn-blue {
        width: 100%;
        height: 44px;
        padding: 0 12px;
        font-size: 0.85rem;
    }

    .inventory-box,
    .history-box {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .inventory-amount {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .wheel-page .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .main-card {
        padding: 16px 10px;
        border-radius: 16px;
    }

    .wheel-arena-wrapper {
        max-width: min(100%, 320px);
        margin: 4px auto 16px auto;
    }

    .wheel-arena-wrapper::before {
        inset: 0;
    }

    .wheel-arena-wrapper::after {
        inset: 6px;
    }

    .wheel-image-container {
        inset: 12px;
    }

    .wheel-pointer {
        top: 4px;
    }

    .wheel-pointer-default {
        border-left: 18px solid transparent;
        border-right: 18px solid transparent;
        border-top: 48px solid #ef4444;
    }

    .wheel-pointer-default::before {
        width: 20px;
        height: 20px;
        top: -10px;
        left: -10px;
        border: 3px solid #fff;
    }

    .discount-input-group,
    .spin-select,
    .action-buttons-group {
        max-width: 100%;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wheel-image {
        transition: none;
    }

    .online-dot {
        animation: none;
    }

    .result-modal,
    .modal-content {
        transition: none;
    }
}
