:root {
    --bg: #05050a;
    --card: #0b0b14;
    --purple: #8b5cf6;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card-gradient: linear-gradient(135deg, #0b0b14, #05050a);
}

body.light {
    --bg: #f8fafc;
    --card: #ffffff;
    --purple: #7c3aed;
    --text: #020617;
    --muted: #475569;
    --card-gradient: linear-gradient(135deg, #ffffff, #f1f5f9);
}

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

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* NAVBAR */
.navbar {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid #1f1f2e;
}

.logo span {
    font-weight: bold;
}

.logo small {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
}

.nav-icons button {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.nav-icons button:hover {
    color: var(--purple);
}


/* VIEWS */
.view {
    display: none;
    padding: 3rem 2rem;
    max-width: 900px;
    margin: auto;
    width: 100%;
}


.view.active {
    display: block;
}

/* CARDS */
.card {
    background: var(--card-gradient);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid #1f1f2e;
    margin-bottom: 2.5rem;
}



/* PLAYER */
.player-top {
    display: flex;
    justify-content: space-between;
}

.player-card {
    margin-bottom: 3rem;
}

.player-top {
    margin-bottom: 1rem;
}

.xp-bar {
    height: 8px;
    background: #1f1f2e;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.xp-fill {
    height: 100%;
    width: 40%;
    background: var(--purple);
}

/* MISSION */
.mission-card {
    text-align: center;
    border: 1px dashed var(--purple);
    padding: 3rem 2rem;
    /* más grande */
    margin-bottom: 3rem;
}

.mission-card h2 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.mission-card p {
    margin-bottom: 2rem;
    color: var(--muted);
}


.mission-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.primary {
    background: var(--purple);
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    color: white;
    margin-top: 1rem;
}

.task-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.task-form input {
    width: 100%;
    max-width: 420px;
    /* ancho elegante */
    padding: 0.7rem 1rem;
    border-radius: 999px;
    /* pill shape */
    border: 1px solid #1f1f2e;
    background: #05050a;
    color: var(--text);
    text-align: center;
    /* texto centrado */
    font-size: 0.95rem;
}

.task-form button {
    width: fit-content;
    padding: 0.7rem 1.8rem;
}

.tasks ul {
    list-style: none;
    margin-top: 1rem;
}

.tasks li {
    background: var(--card);
    padding: 0.8rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tasks li.completed span {
    text-decoration: line-through;
    opacity: 0.5;
}

.tasks li {
    transition: transform 0.2s, background 0.2s;
}

.tasks li.completed {
    background: linear-gradient(135deg, #1a1a2e, #0b0b14);
    transform: scale(1.02);
}

/* HISTORY */
.history {
    margin-top: 3rem;
}

.history h3 {
    margin-bottom: 1.5rem;
}

.history-item {
    background: var(--card);
    padding: 1.2rem 1.5rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-item.fail strong {
    color: #ef4444;
}

.history-item.success strong {
    color: #22c55e;
}


/* USER */
.user-header {
    text-align: center;
    margin-bottom: 3rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

/* ACHIEVEMENTS */
.achievement {
    background: var(--card);
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    transition: all 0.3s ease;
}

.achievement.locked {
    opacity: 0.4;
}

.achievements h3 {
    margin-bottom: 1.5rem;
}

.achievement.unlocked {
    opacity: 1;
    border: 2px solid var(--purple);
    background: rgba(139, 92, 246, 0.15);
    font-weight: 600;
}

body.light .achievement.unlocked {
    background: rgba(124, 58, 237, 0.1);
}

.summary {
    margin-bottom: 4rem;
}

/* ALERTS */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #0b0b14;
    border: 1px solid #8b5cf6;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    opacity: 1;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

/* FOOTER */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: auto;
    color: var(--muted);
    font-size: 0.8rem;
}

/* INPUT ESTILIZADO */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.input-error {
    animation: shake 0.3s;
    border-color: #ef4444;
}

/* MODAL ELIMINACION */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-box {
    background: var(--card);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    max-width: 320px;
    width: 90%;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.modal-actions button {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
}

.modal-actions .danger {
    background: #ef4444;
    color: white;
}

.difficulty-select {
    width: 100%;
    max-width: 220px;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    border: 1px solid #1f1f2e;
    background: var(--card);
    color: var(--text);
    text-align: center;
    font-size: 0.9rem;
}

.tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.tag.easy {
    background: #22c55e;
}

.tag.medium {
    background: #eab308;
}

.tag.hard {
    background: #ef4444;
}

.task-filters {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.task-filters button {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid #1f1f2e;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
}

.task-filters button.active {
    background: var(--purple);
    color: white;
}

.achievement.hidden {
    display: none;
}

/* AVATAR DE USUARIO */
.avatar {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.avatar.level-up {
    transform: scale(1.3);
}

button:disabled,
input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}