.psw-casino-wrapper,
.psw-casino-wrapper * {
    box-sizing: border-box;
}

.psw-casino-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: clamp(24px, 4vw, 50px);
    padding: clamp(20px, 4vw, 50px) clamp(14px, 3vw, 28px);
    background: radial-gradient(circle at 30% 30%, var(--psw-bg-1), var(--psw-bg-2));
    border-radius: clamp(16px, 3vw, 28px);
    color: var(--psw-text);
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.75), inset 0 0 80px rgba(255, 215, 0, 0.08);
    overflow: hidden;
}

#psw-confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
}

/* เวทีโมเดลวงล้อ 3 มิติ (Three.js) รองรับทุกขนาดหน้าจอไม่ล้นขอบ */
.psw-wheel-stage.psw-3d-stage {
    position: relative;
    flex: 1 1 320px;
    width: 100%;
    max-width: min(500px, 100%);
    aspect-ratio: 1 / 1.12;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.psw-3d-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.65));
}

.psw-3d-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    outline: none;
}

/* กล่องควบคุมการหมุน Responsive */
.psw-control-panel {
    flex: 1 1 300px;
    background: var(--psw-card-bg);
    border: 1px solid rgba(255, 215, 0, 0.25);
    padding: clamp(22px, 4vw, 36px) clamp(18px, 3.5vw, 32px);
    border-radius: 24px;
    width: 100%;
    max-width: min(410px, 100%);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.55);
}

.psw-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--psw-title);
    color: var(--psw-title);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.psw-panel-header h2 {
    margin: 0 0 8px;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 800;
    color: var(--psw-title);
    text-shadow: 0 2px 12px rgba(255, 215, 0, 0.35);
    word-wrap: break-word;
}

.psw-panel-header p {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.85;
}

.psw-field {
    margin-bottom: 16px;
}

.psw-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.psw-field input {
    width: 100%;
    max-width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.35);
    color: #ffffff;
    font-size: 15px;
}

.psw-field input:focus {
    outline: none;
    border-color: var(--psw-title);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.psw-casino-btn {
    position: relative;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--psw-btn-1), var(--psw-btn-2));
    color: var(--psw-btn-txt);
    font-size: clamp(16px, 2.5vw, 18px);
    font-weight: 800;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s, filter 0.2s;
}

.psw-casino-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.psw-casino-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.psw-btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    transform: skewX(-25deg);
    animation: pswShine 3s infinite;
}

@keyframes pswShine {
    0% { left: -100%; }
    40% { left: 150%; }
    100% { left: 150%; }
}

.psw-alert {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid #ef4444;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 16px;
    word-wrap: break-word;
}

.psw-sound-toggle {
    margin-top: 14px;
    text-align: center;
    font-size: 13px;
    opacity: 0.85;
}

/* Modal รางวัล */
.psw-modal {
    position: fixed;
    inset: 0;
    padding: 16px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.psw-modal-box {
    position: relative;
    background: linear-gradient(180deg, #1e1b4b 0%, #090414 100%);
    border: 3px solid var(--psw-rim-1);
    border-radius: 24px;
    padding: 32px 22px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.5);
    animation: pswModalBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.psw-modal-box.lose-mode {
    border-color: #64748b;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

@keyframes pswModalBounce {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.psw-rays {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    margin: -300px 0 0 -300px;
    background: repeating-conic-gradient(from 0deg, rgba(255,215,0,0.08) 0deg 15deg, transparent 15deg 30deg);
    animation: pswRotateRays 14s linear infinite;
    pointer-events: none;
}

@keyframes pswRotateRays {
    100% { transform: rotate(360deg); }
}

.psw-modal-inner { position: relative; z-index: 2; }
.psw-trophy { font-size: 54px; margin-bottom: 6px; }
.psw-win-tag { color: var(--psw-rim-1); font-size: 13px; font-weight: 800; letter-spacing: 2px; }
.psw-modal-inner h3 { color: #fff; margin: 6px 0 14px; font-size: 19px; }

#psw-prize-result-img img {
    max-width: 120px;
    max-height: 120px;
    border-radius: 16px;
    margin: 8px auto;
    box-shadow: 0 8px 25px rgba(0,0,0,0.6);
}

.psw-prize-banner {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--psw-rim-1);
    color: var(--psw-rim-1);
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 800;
    padding: 12px 16px;
    border-radius: 14px;
    margin: 14px 0 22px;
    word-wrap: break-word;
}

.psw-modal-box.lose-mode .psw-prize-banner {
    background: rgba(148, 163, 184, 0.12);
    border-color: #64748b;
    color: #cbd5e1;
}

.psw-modal-close {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--psw-rim-1), var(--psw-rim-2));
    color: #111;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 768px) {
    .psw-casino-wrapper {
        flex-direction: column;
        padding: 20px 14px;
        gap: 20px;
    }
    .psw-wheel-stage.psw-3d-stage {
        max-width: min(380px, 92vw);
    }
    .psw-control-panel {
        max-width: 100%;
    }
}

/* Language Switcher (EN / TH) */
.psw-panel-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.psw-panel-top-row .psw-badge {
    margin-bottom: 0;
}

.psw-lang-switcher {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}

.psw-lang-btn {
    border: none;
    background: transparent;
    color: var(--psw-text);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    opacity: 0.75;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.psw-lang-btn:hover {
    opacity: 1;
}

.psw-lang-btn.active {
    background: linear-gradient(135deg, var(--psw-rim-1), var(--psw-rim-2));
    color: #111827;
    opacity: 1;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.35);
}
