:root {
    --bg-dark: #f0f9ff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #ec4899;
    --success: #22c55e;
    --error: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background animated orbs for premium feel */
.background-orbs {
    position: absolute;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #fef08a;
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #bfdbfe;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: #fbcfe8;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

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

/* Glassmorphism Container */
.container {
    width: 100%;
    max-width: 500px;
    height: 90vh;
    max-height: 800px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

.screen.hidden {
    display: none;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #1e293b, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Number Grid */
.numbers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: auto;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Scrollbar for Grid */
.numbers-grid::-webkit-scrollbar {
    width: 6px;
}
.numbers-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.num-btn {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 600;
    padding: 20px 0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.num-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.num-btn.selected {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: transparent;
    box-shadow: 0 10px 20px -10px var(--accent-secondary);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 18px 24px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -10px var(--accent-primary);
}

.primary-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: not-allowed;
}

.icon-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.icon-btn:hover {
    background: #f1f5f9;
}

/* Game Screen */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.score {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.streak {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
    animation: pulse-streak 1s infinite alternate;
    transition: all 0.3s ease;
}

.streak.hidden {
    display: none;
}

@keyframes pulse-streak {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* Confetti */
#confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #f00;
    animation: fall linear forwards;
    border-radius: 2px;
}

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* Golden Glow for high streak */
body.golden-glow .container {
    border-color: #fbbf24;
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.5);
    transition: all 0.5s ease;
}

.main-interaction {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.question-container {
    text-align: center;
    margin-bottom: 30px;
    z-index: 2;
}

#question-text {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.answer-container {
    height: 50px;
    margin-bottom: 40px;
    z-index: 2;
}

#recognized-text {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Mic Button & Pulse */
.mic-status {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.mic-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 3;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5);
}

.mic-btn.active {
    background: var(--accent-secondary);
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.5);
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-secondary);
    z-index: 1;
    animation: pulse 2s infinite;
    opacity: 0;
}

.mic-btn.active + .pulse-ring, 
.mic-status:has(.mic-btn.active) .pulse-ring {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

.message-area {
    text-align: center;
    margin-top: auto;
    padding-top: 20px;
}

#status-message {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Feedback Glow overlay for correct/incorrect */
.feedback-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.feedback-correct {
    background: var(--success);
    opacity: 0.3;
}

.feedback-incorrect {
    background: var(--error);
    opacity: 0.3;
}

/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: #ffffff;
    padding: 40px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

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

.modal-content h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

/* Premium Welcome Screen Styles */
.welcome-icon {
    font-size: 4rem;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin: 0 auto 30px auto;
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.4);
    border: 4px solid rgba(255, 255, 255, 0.2);
}

.welcome-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(to right, #2563eb, #db2777);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.welcome-subtitle {
    font-size: 1.4rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 20px;
}

/* Floating Score Animation */
.floating-score {
    position: absolute;
    color: var(--success);
    font-size: 3rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 1000;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

@keyframes floatUp {
    0% { transform: translate(-50%, 0) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -100px) scale(1.5); opacity: 0; }
}
