:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gold: #fbbf24;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at top, var(--bg-secondary), var(--bg-primary));
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 1200px;
    position: relative;
    height: 100vh;
    padding: 2rem;
}

.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    animation: fadeIn 0.5s ease-out;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

h1, h2 {
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #e2e8f0 0%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 999px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    margin-top: 1rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Loader */
.loader {
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.state-msg {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Game Grid */
header {
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 2rem;
}

.stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    display: inline-block;
    border: 1px solid var(--glass-border);
}

.stats strong {
    color: var(--gold);
}

.grid-container {
    display: flex;
    justify-content: center;
}

.boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.boxes.single-mode {
    display: flex;
    justify-content: center;
    align-items: center;
}

.boxes.single-mode .box {
    width: 250px;
    height: 250px;
}

.boxes.single-mode .box-face {
    font-size: 8rem;
    border-radius: 40px;
}

.box-wrapper {
    perspective: 1000px;
    cursor: pointer;
}

.box {
    width: 120px;
    height: 120px;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.box-wrapper:hover .box {
    transform: translateY(-10px) rotateX(10deg) rotateY(10deg);
}

.box.opening {
    animation: shake 0.5s ease-in-out;
}

.box.opened {
    transform: rotateY(180deg);
    pointer-events: none;
}

.box-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.box-front {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: 2px solid rgba(255,255,255,0.2);
}

.box-front::after {
    content: '?';
    color: white;
    font-weight: 800;
    text-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.box-back {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid var(--gold);
    transform: rotateY(180deg);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px) rotate(-5deg); }
    40%, 80% { transform: translateX(10px) rotate(5deg); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.visible {
    display: flex;
    opacity: 1;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.prize-icon {
    font-size: 5rem;
    margin: 1.5rem 0;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Demo Panel */
.demo-admin-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 1rem;
    border-radius: 12px;
    text-align: left;
    z-index: 10;
    font-size: 0.9rem;
}

.demo-admin-panel h4 {
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.demo-admin-panel label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.demo-admin-panel select {
    background: var(--bg-primary);
    color: white;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-family: inherit;
    margin-left: 0.5rem;
}
