:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #ec4899;
    --danger: #ef4444;
    --success: #10b981;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-main: #0f172a;
    --text-muted: #475569;
}

body.theme-cofrade {
    --primary: #7e22ce;
    --secondary: #9333ea;
    background-color: #1e1b4b;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #0f172a;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    overflow-x: hidden;
    position: relative;
}

.background-blobs {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
}

.blob {
    position: absolute; width: 600px; height: 600px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    filter: blur(80px); border-radius: 50%; opacity: 0.4;
    animation: moveBlob 20s infinite alternate;
}
.blob-1 { top: -10%; left: -10%; background: #4f46e5; }
.blob-2 { bottom: -10%; right: -10%; background: #9333ea; animation-delay: -5s; }
.blob-3 { top: 40%; right: 30%; background: #ec4899; width: 400px; height: 400px; animation-delay: -10s; }

@keyframes moveBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 50px) scale(1.1); }
}

.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    max-width: 1000px;
    width: 100%;
    position: relative;
}

header { margin-bottom: 1.5rem; text-align: center; }
h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.05em; color: #1e293b; }
h1 span { color: var(--primary); }
.subtitle { color: var(--text-muted); font-size: 1rem; font-weight: 500; }

/* Toolbar */
.controls-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    gap: 1rem;
}

.main-actions { display: flex; gap: 8px; flex: 1; }
.secondary-actions { display: flex; gap: 8px; align-items: center; }

button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.95); }

.btn-primary { background: var(--text-main); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: #fbbf24; color: #1e293b; }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-icon {
    width: 38px; height: 38px; padding: 0; justify-content: center;
    background: white; border: 1px solid #e2e8f0; font-size: 1.1rem;
}

/* Settings Menu */
.settings-dropdown { position: relative; }
.dropdown-content {
    display: none; position: absolute; right: 0; top: calc(100% + 10px);
    background: white; min-width: 200px; border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 1000;
    padding: 1rem; border: 1px solid #e2e8f0; flex-direction: column; gap: 10px;
}
.dropdown-content.show { display: flex; }
.menu-item { display: flex; flex-direction: column; gap: 4px; }
.menu-item label { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; }
#game-mode { padding: 6px; border-radius: 8px; border: 1px solid #e2e8f0; font-weight: 600; }
.dropdown-content button { width: 100%; justify-content: flex-start; background: #f8fafc; }

/* Status */
.marker { padding: 6px 16px; border-radius: 100px; font-weight: 800; font-size: 0.75rem; text-transform: uppercase; }
.marker.inactive { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.marker.active { background: var(--success); color: white; animation: bounce 0.5s; }

@keyframes bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Game Area */
.game-area { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 800px) { .game-area { grid-template-columns: 300px 1fr; } }

.main-display { display: flex; flex-direction: column; gap: 1.5rem; }
.current-emoji-container { background: #fff; padding: 1.5rem; border-radius: 32px; text-align: center; }
#current-emoji { font-size: 6rem; font-weight: 900; }
.slot-machine { height: 140px; background: #f1f5f9; border-radius: 24px; display: flex; justify-content: center; align-items: center; }

.last-ball-container { background: #fff; padding: 1rem; border-radius: 24px; text-align: center; }
.last-ball-container h3 { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.5rem; }
#last-ball { font-size: 3rem; width: 80px; height: 80px; margin: 0 auto; background: radial-gradient(circle at 30% 30%, #ffffff, var(--primary)); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; }

/* History */
.history { background: rgba(255, 255, 255, 0.3); border-radius: 32px; padding: 1.5rem; }
#history-label { font-weight: 800; font-size: 1rem; margin-bottom: 1rem; }
.decades-grid { display: flex; flex-direction: column; gap: 1rem; }
.decade-items { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; justify-items: center; }

.history-item {
    font-size: 0.9rem; background: rgba(255, 255, 255, 0.2);
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px dashed rgba(0,0,0,0.1); font-weight: 700;
    color: rgba(15, 23, 42, 0.2); transition: all 0.3s ease;
}
.history-item.drawn {
    background: radial-gradient(circle at 30% 30%, #ffffff, #e2e8f0);
    border: 2px solid #cbd5e1; color: var(--text-main);
}
.history-item.active-last {
    border-color: var(--primary); transform: scale(1.1);
    background: radial-gradient(circle at 30% 30%, #ffffff, var(--primary)); color: white;
}

.spinning { animation: spinModern 0.12s infinite linear; }
@keyframes spinModern {
    0% { transform: translateY(-20px); opacity: 0; filter: blur(5px); }
    50% { transform: translateY(0); opacity: 1; filter: blur(0); }
    100% { transform: translateY(20px); opacity: 0; filter: blur(5px); }
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .glass-panel { padding: 1rem; border-radius: 24px; }
    h1 { font-size: 1.75rem; }
    .controls-toolbar { padding: 0.4rem; gap: 4px; }
    button { padding: 0.4rem 0.6rem; font-size: 0.75rem; }
    #draw-btn { flex: 2; }
    #line-btn, #bingo-btn { width: 36px; height: 36px; font-size: 0; padding: 0; justify-content: center; }
    #line-btn::before { content: 'L'; font-size: 0.9rem; font-weight: 900; }
    #bingo-btn::before { content: 'B'; font-size: 0.9rem; font-weight: 900; }
    .btn-icon { width: 36px; height: 36px; }
    .history-item { width: 26px; height: 26px; font-size: 0.7rem; }
    .decade-items { gap: 2px; }
}
