@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    /* New Core Colors - Softer & More Traditional */
    --primary: #852c37; /* Softer, elegant wine red */
    --primary-light: #9c3b48;
    --secondary: #dfceaa; /* Muted, elegant gold/sand */
    --dark: #1f2326; /* Softer charcoal instead of pure black/blue */
    --text-main: #30343a;
    --text-muted: #636b72;
    --bg-main: #fcfaf7;
    --bg-card: #ffffff;
    
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, rgba(252,250,247,0.9) 0%, rgba(223,206,170,0.3) 100%);
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, #681d26 100%);
    
    /* Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Original Game Colors (Kept for compatibility) */
    --primary-gradient: linear-gradient(135deg, #ffd6e8 0%, #c9a0dc 100%);
    --secondary-gradient: linear-gradient(135deg, #ffc4d6 0%, #ffb5c5 100%);
    --success-gradient: linear-gradient(135deg, #a8e6cf 0%, #88d8b0 100%);
    --card-bg: #ffffff;
    --pastel-purple: #e8d5f2;
    --pastel-pink: #ffd6e8;
    --shadow-glow: 0 0 20px rgba(255, 182, 193, 0.3);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    color: var(--dark);
    line-height: 1.2;
}

/* ==================================
   NAVIGATION
   ================================== */
.main-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    padding: 15px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-logo img {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 1.05rem;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* ==================================
   HERO SECTION
   ================================== */
.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    gap: 50px;
}

.hero-content {
    flex: 1;
}

.hero-subtitle {
    display: inline-block;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.hero h1 {
    font-size: 4.5rem;
    margin-bottom: 25px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 500px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.hero-image::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--secondary);
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
    opacity: 0.5;
}

.hero-image img {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
    animation: float 6s ease-in-out infinite;
}

/* ==================================
   BUTTONS
   ================================== */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 35px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 10px 20px -10px rgba(155, 34, 38, 0.5);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -10px rgba(155, 34, 38, 0.6);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

/* ==================================
   SECTIONS
   ================================== */
.section {
    padding: 100px 20px;
}

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

.section h2 {
    font-size: 2.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.divider {
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    margin: 0 auto 40px;
    border-radius: 2px;
}

.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }

.historia-text {
    max-width: 800px;
    margin: 0 auto 50px;
    text-align: center;
    font-size: 1.15rem;
    color: var(--text-muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 20px;
}

/* Personatges Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.character-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.character-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.card-img-wrapper {
    height: 350px;
    background: var(--gradient-hero);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px;
}

.card-img-wrapper img {
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1));
}

.card-content {
    padding: 30px;
    text-align: center;
}

.card-content h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--primary);
}

/* Recursos Action Cards */
.recursos-section {
    background: white;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.action-card {
    background: var(--bg-main);
    padding: 40px;
    border-radius: 24px;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.action-card:hover {
    border-color: var(--secondary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
    background: rgba(155, 34, 38, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
}

.action-card h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.action-link {
    margin-top: auto;
    padding-top: 20px;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Footer */
footer {
    background: var(--dark);
    color: rgba(255,255,255,0.7);
    padding: 60px 20px;
    text-align: center;
    margin-top: auto;
}

.footer-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
}

.footer-logo img {
    height: 40px;
    filter: brightness(0) invert(1);
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ==================================
   ORIGINAL GAME STYLES (Adapted)
   ================================== */
.game-container-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(155, 34, 38, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(233, 216, 166, 0.1) 0%, transparent 50%);
}

.game-container-wrapper .container {
    max-width: 900px;
    width: 100%;
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-item {
    background: var(--card-bg);
    padding: 15px 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
    border: 2px solid var(--pastel-purple);
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.btn-reset, .btn-print {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 12px 35px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-print { background: var(--secondary-gradient); }
.btn-reset:hover, .btn-print:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    perspective: 1000px;
}

.card {
    aspect-ratio: 3/4;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card.flipped { transform: rotateY(180deg); }
.card.matched { pointer-events: none; opacity: 0.8; }

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-back {
    background: var(--card-bg);
    background-image: var(--primary-gradient);
    border: 3px solid var(--pastel-purple);
}

.card-back img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.card-front {
    background: var(--card-bg);
    transform: rotateY(180deg);
    padding: 15px;
    border: 3px solid var(--pastel-pink);
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.victory-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.victory-modal.show { display: flex; }

.modal-content {
    background: var(--card-bg);
    padding: 50px 60px;
    border-radius: 30px;
    text-align: center;
    border: 3px solid var(--pastel-pink);
    max-width: 500px;
    width: 90%;
}

.trophy-icon { font-size: 5rem; margin-bottom: 20px; }
.modal-content h2 { font-size: 2.5rem; margin-bottom: 15px; color: #a8e6cf; }
.final-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 35px; }
.btn-play-again {
    background: var(--secondary-gradient);
    color: white; border: none; padding: 15px 40px;
    border-radius: 25px; font-size: 1.1rem; cursor: pointer;
}

@media (max-width: 768px) {
    .hero { flex-direction: column; text-align: center; padding-top: 60px; }
    .hero h1 { font-size: 3.5rem; }
    .hero-buttons { justify-content: center; }
    .hero-image::before { width: 300px; height: 300px; }
    
    .nav-container { flex-wrap: wrap; justify-content: space-between; align-items: center; }
    .nav-links { display: none; width: 100%; flex-direction: column; text-align: center; gap: 15px; font-size: 1.1rem; margin-top: 15px; }
    .nav-links.active { display: flex; }
    
    .game-board { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
    .hero h1 { font-size: 2.5rem; }
    .game-board { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* Accessibility & Mobile Menu */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 10000;
    transition: top 0.3s;
}
.skip-link:focus {
    top: 0;
}

*:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
}
