:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray: #6b7280;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ==================== HEADER ==================== */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.logo:hover {
    color: var(--primary-hover);
}

.logo-icon {
    font-size: 1.5rem;
}

.menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    padding: 0.5rem;
}

.nav-menu {
    position: fixed;
    top: 66px;
    right: -300px;
    width: 280px;
    height: calc(100vh - 66px);
    background: var(--white);
    flex-direction: column;
    padding: 1rem;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-menu.open {
    right: 0;
}

.nav-menu a {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
}

.nav-menu a:hover, .nav-menu a.active {
    background: var(--primary);
    color: var(--white);
}

/* ==================== FOOTER ==================== */
.site-footer {
    background: var(--dark);
    color: var(--white);
    padding: 2rem 1rem;
    text-align: center;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-copy {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* ==================== ADSENSE PLACEHOLDER ==================== */
.ad-container {
    background: #f3f4f6;
    border: 1px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.ad-container.leaderboard {
    height: 90px;
    width: 100%;
}

.ad-container.mpu {
    height: 250px;
    width: 300px;
}

/* ==================== UTILITIES ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
}

.btn-secondary:hover {
    background: #d97706;
}

.tool-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.tool-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.tool-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-box, .problema-box {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.answer-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1.1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    text-align: center;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary);
}

.feedback {
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 600;
    margin-top: 1rem;
}

.feedback.correcto {
    background: #d1fae5;
    color: #065f46;
}

.feedback.incorrecto {
    background: #fee2e2;
    color: #991b1b;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    z-index: 1000;
    animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

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

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}