/* static/css/styles.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --secondary: #ec4899; /* Pink */
    --accent: #14b8a6; /* Teal */
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e1b4b 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism Header */
header {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-emoji {
    -webkit-text-fill-color: initial;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav ul li a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 10%;
    background: var(--secondary);
    transition: width 0.3s ease;
}

nav ul li a:hover::after {
    width: 80%;
}

nav ul li a:hover {
    color: var(--secondary);
}

/* Main Content Area */
main {
    flex: 1;
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
    width: 100%;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeInDown 0.8s ease-out;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-main) 20%, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Game Cards Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.game-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.game-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    transition: transform 0.5s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.2) rotate(10deg);
}

.game-card h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.game-card p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    flex-grow: 1;
}

.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #be185d);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #0f766e);
    box-shadow: 0 4px 15px rgba(20, 184, 166, 0.4);
}

.btn-accent:hover {
    box-shadow: 0 8px 25px rgba(20, 184, 166, 0.6);
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

footer p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Utility Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
    
    nav {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    nav ul {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .game-card {
        padding: 2rem 1.5rem;
    }
}
/* --- ESTILS PER A LOGIN I REGISTRE --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-box {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.auth-box h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.flash-messages {
    list-style: none;
    padding: 1rem;
    background: rgba(236, 72, 153, 0.15); /* Fons secundari (rosa) transparent */
    border-left: 4px solid var(--secondary);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    text-align: left;
    font-size: 0.9rem;
}

.auth-link {
    margin-top: 2rem;
    color: var(--text-muted);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link a:hover {
    color: var(--secondary);
}

/* --- MOUSE GAME --- */
.mouse-game-shell {
    max-width: 820px;
    text-align: left;
}

.mouse-game-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.mouse-game-target {
    max-width: 540px;
}

.mouse-game-score {
    min-width: 140px;
    text-align: right;
}

.mouse-game-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 118px));
    justify-content: center;
    gap: 1rem;
    margin: 1.75rem 0 0;
}

.mouse-figure {
    width: 118px;
    height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.mouse-figure::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 60%);
    opacity: 0.9;
}

.mouse-figure:hover {
    transform: translateY(-6px) scale(1.03);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
}

.mouse-figure-icon {
    font-size: 3.3rem;
    position: relative;
    z-index: 1;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.mouse-figure:hover .mouse-figure-icon {
    transform: scale(1.08);
}

.mouse-figure-star .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.35));
}

.mouse-figure-heart .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(96, 165, 250, 0.35));
}

.mouse-figure-flower .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(253, 224, 71, 0.28));
}

.mouse-figure-diamond .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(125, 211, 252, 0.35));
}

.mouse-figure-sun .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.35));
}

.mouse-figure-moon .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(196, 181, 253, 0.35));
}

.mouse-figure-cloud .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(226, 232, 240, 0.35));
}

.mouse-figure-lightning .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.35));
}

.mouse-figure-snow .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(191, 219, 254, 0.35));
}

.mouse-figure-leaf .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(74, 222, 128, 0.35));
}

.mouse-figure-fire .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(251, 146, 60, 0.35));
}

.mouse-figure-circle .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(251, 146, 60, 0.35));
}

.mouse-figure-triangle .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(248, 113, 113, 0.35));
}

.mouse-figure-square .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(96, 165, 250, 0.35));
}

.mouse-figure-hexagon .mouse-figure-icon {
    filter: drop-shadow(0 0 16px rgba(192, 132, 252, 0.35));
}

.mouse-game-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .mouse-game-score {
        text-align: left;
    }

    .mouse-game-board {
        grid-template-columns: repeat(4, minmax(0, 100px));
    }

    .mouse-figure {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .mouse-game-board {
        grid-template-columns: repeat(3, minmax(0, 84px));
        gap: 0.75rem;
    }

    .mouse-figure {
        width: 84px;
        height: 84px;
        border-radius: 18px;
    }

    .mouse-figure-icon {
        font-size: 2.45rem;
    }
}

/* --- ESTILS PER AL JOC DE MECANOGRAFIA --- */
.game-board {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
    animation: fadeInUp 0.8s ease-out; /* Aprofitem l'animació que ja tens */
}

/* Caixa on surt la frase a copiar */
.phrase-display {
    font-size: 1.4rem;
    letter-spacing: 1px;
    margin: 2rem 0 1.5rem 0;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.6); /* El mateix fons fosc que els teus inputs */
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    line-height: 1.6;
    text-align: left;
    user-select: none; /* Evita que l'usuari pugui fer "copiar i enganxar" per fer trampes */
}

/* Input on l'usuari escriu */
.typing-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6); /* El mateix fons fosc que els teus inputs */
    color: var(--text-main);
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.typing-input:focus {
    border-color: var(--accent); /* Fem servir el teu color Teal per indicar que està actiu */
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.3);
}

.typing-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Colors dinàmics que afegirà el JavaScript lletra a lletra */
.lletra-correcta {
    color: var(--accent); /* Color Teal per a lletres correctes */
    text-shadow: 0 0 5px rgba(20, 184, 166, 0.4); /* Petit efecte neó (opcional, li dona un toc xulo) */
}

.lletra-incorrecta {
    color: var(--secondary); /* Fem servir el teu color Pink per a les errades */
    background-color: rgba(236, 72, 153, 0.2); /* Fons rosat suau per ressaltar l'error */
    border-radius: 3px;
    padding: 0 2px;
}

/* --- RANKING --- */
.ranking-hero {
    margin-bottom: 2.5rem;
}

.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

.ranking-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
}

.ranking-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ranking-card-header h2 {
    font-size: 1.8rem;
    margin-top: 0.25rem;
}

.ranking-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ranking-badge {
    min-width: 52px;
    text-align: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(20, 184, 166, 0.18);
    color: var(--accent);
    font-weight: 700;
}

.ranking-placeholder-note {
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.ranking-table-wrapper {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    padding: 0.9rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ranking-table th {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ranking-table tbody tr:last-child td {
    border-bottom: none;
}

.ranking-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.ranking-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.08);
}

.ranking-position-1 {
    background: rgba(250, 204, 21, 0.2);
    color: #facc15;
}

.ranking-position-2 {
    background: rgba(226, 232, 240, 0.2);
    color: #e2e8f0;
}

.ranking-position-3 {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.ranking-position-other {
    color: var(--text-main);
}

.ranking-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 1.25rem 0.75rem;
}

@media (max-width: 768px) {
    .ranking-card {
        padding: 1.5rem;
    }

    .ranking-card-header {
        flex-direction: column;
    }
}
