:root {
    /* Light Theme as default variables */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-secondary: #0ea5e9;
    --accent-success: #10b981;
    --accent-danger: #ef4444;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-secondary: #38bdf8;
    --accent-success: #34d399;
    --accent-danger: #f87171;
    
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

.font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* Dashboard Container */
.dashboard-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 1rem;
    z-index: 10;
    /* Glassmorphism */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: color-mix(in srgb, var(--bg-card) 85%, transparent);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

#app-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-center {
    display: flex;
    gap: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--bg-main);
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    font-size: 1.125rem;
    font-weight: 600;
}

.stat-icon {
    width: 20px;
    height: 20px;
}

.text-accent {
    color: var(--accent-secondary);
}

.text-primary {
    color: var(--accent-primary);
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--transition);
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
}

.icon-btn:hover {
    background-color: var(--border-color);
    transform: translateY(-2px);
}

.icon-btn span {
    font-weight: 700;
    font-size: 0.9rem;
}

/* Theme Toggle Icons */
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }

/* Grid Layout */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Game Card */
.game-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
}

.game-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.cipher-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.math-icon {
    background: linear-gradient(135deg, var(--accent-secondary), #0284c7);
}

.pattern-icon {
    background: linear-gradient(135deg, var(--accent-success), #059669);
}

.game-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.game-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex-grow: 1;
}

.game-instruction {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* UI Elements */
.cipher-mystery-box, .math-problem-box, .pattern-sequence-box {
    background-color: var(--bg-main);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-large {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

.cipher-mystery-box p {
    font-style: italic;
    font-size: 0.95rem;
}

.cipher-suspects {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-suspect {
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    flex: 1 1 calc(33.333% - 0.75rem);
    min-width: 100px;
}

.btn-suspect:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.input-group {
    display: flex;
    gap: 0.75rem;
}

.input-field {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-primary) 20%, transparent);
}

.btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.feedback-msg {
    min-height: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    opacity: 0;
    transform: translateY(5px);
    transition: var(--transition);
}

.feedback-msg.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-success {
    background-color: color-mix(in srgb, var(--accent-success) 15%, transparent);
    color: var(--accent-success);
}

.feedback-error {
    background-color: color-mix(in srgb, var(--accent-danger) 15%, transparent);
    color: var(--accent-danger);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-center {
        width: 100%;
        justify-content: center;
    }
    
    .header-right {
        width: 100%;
        justify-content: center;
    }
    
    body {
        padding: 1rem;
    }
}
