:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #f59e0b; /* Premium Amber */
    --accent-hover: #d97706;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background gradient blobs */
.glass-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    background: 
        radial-gradient(circle at 10% 40%, rgba(245, 158, 11, 0.12), transparent 30%),
        radial-gradient(circle at 90% 60%, rgba(56, 189, 248, 0.08), transparent 30%);
    filter: blur(80px);
}

.app-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    padding: 2.5rem 2rem;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 3rem;
    background: rgba(2, 6, 23, 0.5);
    backdrop-filter: blur(10px);
}


/* --- Premium Logo AVIX HOME --- */
.logo {
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo-avix {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #463223; /* Bronce Oscuro */
    line-height: 0.9;
    letter-spacing: 2px;
    display: block;
}

.logo-divider {
    width: 100%;
    border: 0;
    border-top: 1.5px solid #D59F80; /* Cobre */
    margin: 0.3rem 0;
    opacity: 1;
}

.logo-home {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: #D59F80; /* Cobre */
    letter-spacing: 0.6rem;
    margin-right: -0.6rem; /* Ajuste por letter-spacing */
    text-transform: uppercase;
    display: block;
}

/* Ajustes específicos para footer o sidebar */
footer .logo-avix { color: #ffffff; }
footer .logo-home, footer .logo-divider { color: #ffffff; border-color: rgba(255,255,255,0.4); }
.sidebar .logo { margin-bottom: 2rem; }

/* Language Selector */
.lang-selector-wrapper {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.lang-selector {
    position: relative;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.lang-dropdown {
    position: absolute;
    bottom: 110%;
    left: 0;
    width: 220px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2000;
}

/* Bridge the gap for hover (above) */
.lang-selector::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: 1.5rem; /* Increased bridge height */
    background: transparent;
    display: none;
    z-index: 10;
}

.lang-selector:hover .lang-dropdown,
.lang-selector:hover::before {
    display: flex;
}

.lang-option {
    padding: 1rem 1.2rem;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    cursor: pointer;
}

.lang-option:hover {
    background: var(--accent);
    color: #fff;
}


.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-links li {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.nav-links li:hover {
    background: rgba(255,255,255,0.05);
}

.nav-links li.active {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    color: var(--accent);
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 3.5rem 4rem;
    overflow-y: auto;
}

.tab-content {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.tab-content.hidden {
    display: none;
}

header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text; /* Added standard property */
    -webkit-text-fill-color: transparent;
}
header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    font-weight: 300;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2), 0 8px 10px -6px rgba(0,0,0,0.1);
}

/* Buttons & Inputs */
.input-group {
    display: flex;
    gap: 0.8rem;
    width: 100%;
}

input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.9rem 1.8rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 10px -1px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 0.9rem 1.8rem;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}
.btn-outline:hover {
    background: var(--accent);
    color: #fff;
}

/* Specific Layouts */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2.5rem;
}

.item-list {
    list-style: none;
    margin-top: 1.5rem;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 0.5rem;
}
/* Scrollbar custom */
.item-list::-webkit-scrollbar { width: 6px; }
.item-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.item-list li {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease;
}

.preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 1.5rem;
}
.label-viz {
    width: 150px;
    height: 85px;
    background: #f8fafc;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #e2e8f0;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}
.label-viz::after {
    content: '';
    position: absolute;
    top: 5px; left: 5px; right: 5px; bottom: 5px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    pointer-events: none;
}

.challenge-toolbar {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.challenge-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

#challenge-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #fbbf24);
    border-radius: 99px;
    transition: width 0.4s ease;
}

#challenge-progress-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--accent);
    min-width: 2.5rem;
    text-align: center;
}

.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.8rem;
}

.day-card {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: transform 0.3s ease;
}
.day-card.unlocked:hover {
    transform: translateY(-5px);
}
.day-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(100%);
}
.day-card.locked .btn-day {
    visibility: hidden;
}
.day-card.completed {
    border-color: rgba(16, 185, 129, 0.4);
}
.day-card.completed h3 {
    color: #10b981;
}
.day-card.completed .btn-day {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.08);
    cursor: default;
}
.btn-day:disabled {
    pointer-events: none;
}
.day-card h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
}

.form-container {
    max-width: 550px;
}

.text-center { text-align: center; margin: 0 auto; }
.icon-bulb { font-size: 3.5rem; margin-bottom: 1.5rem; filter: drop-shadow(0 0 15px rgba(245,158,11,0.5));}
.success-text { color: #10b981; margin-top: 1.5rem; font-weight: 500; padding: 1rem; background: rgba(16,185,129,0.1); border-radius: 8px; border: 1px solid rgba(16,185,129,0.3); }


/* --- Authentication Styles --- */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4), var(--bg-darker));
    backdrop-filter: blur(8px);
    animation: fadeIn 0.8s ease;
}

.auth-card {
    max-width: 420px;
    width: 90%;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.2);
    padding: 0.4rem;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 0.7rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.auth-form-content h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.auth-form-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 300;
}

.input-field {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 0.2rem;
}

.error-text {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 1rem;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.hidden {
    display: none !important;
}

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

/* ==================== Módulos nuevos ==================== */

select {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
}

/* Chips (selectores de opción) */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.chip {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 0.9rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s;
}
.chip:hover { background: rgba(255,255,255,0.1); }
.chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.chip.static { cursor: default; }
.chip.static.ok { border-color: rgba(16,185,129,0.5); color: #10b981; }
.chip.static.warn { border-color: rgba(245,158,11,0.6); color: var(--accent); }
.option-block label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.label-options { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.2rem; }

/* Dashboard (Inicio) */
.home-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.8rem;
}
.game-level-row { display: flex; justify-content: space-between; align-items: flex-start; }
.game-level-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.game-card h3 { font-family: 'Outfit', sans-serif; color: var(--accent); font-size: 1.5rem; }
.game-points { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 700; }
.game-points small { font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }
.game-next { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
#game-bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent), #fbbf24);
    border-radius: 99px;
    transition: width 0.4s ease;
}
.badges-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1rem; }
.badge {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    width: 72px; text-align: center;
    font-size: 1.6rem;
    opacity: 0.25; filter: grayscale(100%);
    transition: all 0.3s;
}
.badge small { font-size: 0.6rem; color: var(--text-muted); line-height: 1.2; }
.badge.owned { opacity: 1; filter: none; }
.tip-card h3 { font-family: 'Outfit', sans-serif; }
.tip-arch { color: var(--accent); font-weight: 600; }
.status-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.home-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    margin: 2.5rem 0 1.2rem;
}
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.module-card {
    padding: 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s;
}
.module-card:hover { transform: translateY(-3px); border-color: var(--accent); }

/* Waitlist */
.waitlist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.waitlist-card h3 { font-family: 'Outfit', sans-serif; margin-top: 0.5rem; }
.waitlist-emoji { font-size: 2rem; }
.waitlist-date { color: var(--accent); font-size: 0.85rem; margin: 0.3rem 0 1rem; }
.waitlist-btn.done { background: rgba(16,185,129,0.15); border-color: #10b981; color: #10b981; box-shadow: none; }

/* Etiquetas: plantillas y tamaños */
.label-viz.size-s { width: 110px; height: 55px; font-size: 0.75rem; }
.label-viz.size-l { width: 175px; height: 118px; font-size: 1.15rem; }
.label-viz.tpl-chalk { background: #1e293b; color: #f8fafc; border-color: #0f172a; }
.label-viz.tpl-chalk::after { border-style: dashed; border-color: rgba(248,250,252,0.5); }
.label-viz.tpl-kraft { background: #c9a876; color: #3d2b1f; border-color: #a5825a; }
.label-viz.tpl-kraft::after { border-color: rgba(61,43,31,0.45); }

/* Quiz */
.quiz-step { color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.quiz-q { font-family: 'Outfit', sans-serif; font-size: 1.4rem; margin: 1rem 0 1.5rem; }
.quiz-options { display: flex; flex-direction: column; gap: 0.8rem; }
.quiz-option {
    text-align: left;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 1rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s;
}
.quiz-option:hover { border-color: var(--accent); background: rgba(245,158,11,0.08); transform: translateX(4px); }
.quiz-result { text-align: center; }
.quiz-emoji { font-size: 3.5rem; margin: 0.8rem 0; filter: drop-shadow(0 0 15px rgba(245,158,11,0.4)); }
.quiz-result h2 { font-family: 'Outfit', sans-serif; color: var(--accent); }
.quiz-cta { color: var(--text-muted); font-style: italic; }

/* Guía Avix */
.guide-chapters { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.guide-chapter {
    display: flex; gap: 1rem; align-items: flex-start;
    padding: 1.2rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
}
.guide-chapter h4 { font-family: 'Outfit', sans-serif; }
.guide-chapter.locked { opacity: 0.45; }
.guide-chapter small { color: var(--text-muted); }
.guide-lock { font-size: 1.3rem; }
.guide-body { margin-top: 1rem; line-height: 1.7; color: var(--text-muted); }

/* Despensa */
.pantry-list li { align-items: center; }
.pantry-status { font-size: 0.75rem; padding: 0.25rem 0.6rem; border-radius: 99px; white-space: nowrap; }
.pantry-status.ok { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.pantry-status.warn { background: rgba(245,158,11,0.15); color: var(--accent); }
.pantry-status.expired { background: rgba(239,68,68,0.15); color: #ef4444; }
#pantry-video { width: 100%; border-radius: 12px; margin-top: 1rem; }
.pantry-form input[type="text"] { width: 100%; }
.pantry-form input[type="date"] { flex: 1; }

/* Asistente IA */
.ai-photo-drop {
    display: flex; align-items: center; justify-content: center;
    min-height: 110px; margin-top: 0.6rem;
    border: 1.5px dashed var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 2rem;
    overflow: hidden;
    transition: border-color 0.3s;
}
.ai-photo-drop:hover { border-color: var(--accent); }
.ai-photo-drop .photo-preview { max-height: 220px; width: 100%; object-fit: cover; }
.ai-plan { margin-top: 1.2rem; line-height: 1.8; color: var(--text-main); }
.ai-plan p { margin-bottom: 1rem; }
.ai-plan ul { margin: 0 0 1rem 1.2rem; }
.ai-plan li { margin-bottom: 0.5rem; }
.ai-plan strong { color: var(--accent); }

/* Antes y Después */
.photos-card { margin-top: 2.5rem; }
.photos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 1.5rem; }
.photo-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 140px;
    border: 1.5px dashed var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s;
}
.photo-drop:hover { border-color: var(--accent); }
.photo-slot-label { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; z-index: 2; }
.photo-slot-label.has-photo {
    position: absolute; top: 8px; left: 8px;
    background: rgba(15,23,42,0.75);
    padding: 0.3rem 0.7rem; border-radius: 8px;
    font-size: 0.7rem;
}
.photo-preview { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-drop .photo-preview { position: absolute; }
.photo-compare { margin-top: 1.8rem; text-align: center; }
.compare-frame {
    position: relative; overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 16 / 10;
}
.compare-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
#compare-after-wrap {
    position: absolute; inset: 0; width: 50%;
    overflow: hidden;
}
#compare-after-wrap img { width: 100%; height: 100%; object-fit: cover; position: absolute; left: 0; top: 0; }
#compare-handle {
    position: absolute; top: 0; bottom: 0; left: 50%;
    width: 3px; background: var(--accent);
    box-shadow: 0 0 12px rgba(245,158,11,0.8);
}
#compare-range { width: 100%; margin-top: 1rem; accent-color: var(--accent); }

/* Garantía */
.warranty-cert { text-align: center; border-color: rgba(213,159,128,0.5); }
.warranty-cert h2 { font-family: 'Outfit', sans-serif; color: #10b981; }
.cert-shield { font-size: 3.5rem; margin-bottom: 1rem; filter: drop-shadow(0 0 18px rgba(16,185,129,0.4)); }

/* Toast de gamificación */
.avix-toast {
    position: fixed;
    bottom: 2rem; left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--accent);
    color: var(--text-main);
    padding: 0.9rem 1.6rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 3000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(245,158,11,0.2);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Responsive Optimization (Total Adaptability) --- */

@media (max-width: 1024px) {
    .content-area { padding: 3rem; }
    header h1 { font-size: 2.22rem; }
}

@media (max-width: 900px) {
    .app-container { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        border-right: none; 
        border-bottom: 1px solid var(--glass-border); 
        padding: 1.2rem; 
        gap: 1.2rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(2, 6, 23, 0.9);
        backdrop-filter: blur(20px);
    }
    
    .sidebar .logo { margin-bottom: 0; }
    .sidebar .logo-avix { font-size: 1.4rem; }
    .sidebar .logo-home, .sidebar .logo-divider { display: none; }

    .nav-links {
        flex-direction: row;
        gap: 0.5rem;
        margin: 0;
        flex: 1;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .home-grid { grid-template-columns: 1fr; }
    .photos-grid { grid-template-columns: 1fr; }
    .back-home-link { display: none; }
    
    .nav-links li { 
        padding: 0.6rem 0.8rem; 
        font-size: 0.8rem;
        white-space: nowrap; 
    }
    
    .lang-selector-wrapper { 
        margin-top: 0; 
        padding-top: 0; 
        border-top: none; 
    }
    
    .lang-dropdown {
        bottom: auto;
        top: 110%;
        right: 0;
        left: auto;
    }

    .content-area { padding: 2rem 1.2rem; }
    .split-view { grid-template-columns: 1fr; gap: 1.5rem; }
    
    header h1 { font-size: 1.8rem; }
    .glass-card { padding: 1.5rem; }
    
    .challenge-grid { grid-template-columns: 1fr; }
}

/* Mobile Standard (iPhone/Android Modern) */
@media (max-width: 768px) {
    .sidebar { padding: 0.8rem 1rem; }
    .nav-links li { padding: 0.5rem 0.7rem; }
    .logo-avix { font-size: 1.2rem; }
}

/* Mobile Small (iPhone SE / Older Androids) (< 480px) */
@media (max-width: 480px) {
    .sidebar { 
        padding: 0.7rem;
        justify-content: space-around;
        height: 65px;
    }
    .nav-links { gap: 0.2rem; }
    .nav-links li { 
        padding: 0.4rem 0.6rem; 
        font-size: 0.75rem;
        border-radius: 8px;
    }
    
    .content-area { padding: 1.5rem 1rem; }
    .auth-card { 
        padding: 1.5rem; 
        width: 92vw;
        max-width: none;
    }
    .auth-form-content h3 { font-size: 1.2rem; }
    
    .input-group { flex-direction: column; }
    .btn-primary { width: 100%; }
    
    .label-viz { width: 110px; height: 65px; font-size: 0.8rem; }
}

/* Extra Small (320px - iPhone SE) */
@media (max-width: 320px) {
    .sidebar { padding: 0.5rem; }
    .nav-links li { padding: 0.3rem 0.4rem; font-size: 0.65rem; }
    .sidebar .logo-avix { font-size: 1rem; }

    header h1 { font-size: 1.6rem; }
    .auth-card { padding: 1.2rem 1rem; }
}

/* ==================== Optimización móvil total ==================== */
/* Barra de navegación inferior estilo app nativa + ergonomía táctil.
   Va al final del archivo para ganar la cascada a las reglas anteriores. */
@media (max-width: 900px) {

    /* iOS hace zoom al enfocar inputs con fuente < 16px: lo evitamos */
    input, select, textarea { font-size: 16px; }

    /* Respuesta táctil inmediata, sin doble-tap-zoom ni flash gris */
    button, .chip, .nav-links li, .module-card, .quiz-option, .photo-drop {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Objetivos táctiles ≥ 44px */
    .btn-primary, .btn-secondary, .btn-outline { min-height: 46px; }
    .chip { padding: 0.62rem 1rem; }
    .quiz-option { padding: 1.1rem 1.2rem; min-height: 52px; }

    /* Barra superior mínima: solo logo + idioma.
       Sin backdrop-filter: crearía un containing block y el position:fixed
       de la navegación inferior (hija del sidebar) dejaría de ser relativo
       al viewport. Fondo casi opaco en su lugar. */
    .sidebar {
        height: auto;
        padding: 0.6rem 1rem;
        padding-top: calc(0.6rem + env(safe-area-inset-top));
        justify-content: space-between;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(2, 6, 23, 0.97);
    }

    /* Navegación inferior fija (estilo app nativa) */
    .nav-links {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 500;
        display: flex;
        flex-direction: row;
        gap: 0.1rem;
        margin: 0;
        padding: 0.4rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
        background: rgba(2, 6, 23, 0.94);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-top: 1px solid var(--glass-border);
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links li {
        flex: 1 0 64px;
        max-width: 92px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.5rem 0.3rem;
        min-height: 52px;
        font-size: 0.6rem;
        border-radius: 12px;
        white-space: nowrap;
        border: none;
    }
    .nav-links li .nav-ico { font-size: 1.35rem; line-height: 1; }
    .nav-links li .nav-txt {
        font-size: 0.58rem;
        color: var(--text-muted);
        letter-spacing: 0.2px;
        max-width: 82px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .nav-links li.active {
        background: rgba(245, 158, 11, 0.14);
        border: none;
        box-shadow: none;
    }
    .nav-links li.active .nav-ico { transform: translateY(-1px); }
    .nav-links li.active .nav-txt { color: var(--accent); font-weight: 700; }

    /* El contenido no debe quedar oculto tras la barra inferior */
    .content-area {
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
        padding-left: max(1.2rem, env(safe-area-inset-left));
        padding-right: max(1.2rem, env(safe-area-inset-right));
    }

    /* El toast sube por encima de la barra */
    .avix-toast {
        bottom: calc(88px + env(safe-area-inset-bottom));
        max-width: 92vw;
        text-align: center;
    }

    /* Rendimiento: blur más barato en pantallas pequeñas */
    .glass-card { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
    .glass-bg { filter: blur(50px); }

    /* Grids compactas de móvil */
    .modules-grid { grid-template-columns: 1fr 1fr; }
    .module-card { padding: 1rem; font-size: 0.85rem; min-height: 58px; }
    .photos-grid { grid-template-columns: 1fr 1fr; }
    .compare-frame { aspect-ratio: 4 / 3; }
    .badges-row { justify-content: space-between; }
    .badge { width: 64px; font-size: 1.4rem; }
    .challenge-toolbar { flex-wrap: wrap; }
    .challenge-toolbar .challenge-bar { flex-basis: 100%; order: -1; }

    header h1 { font-size: 1.7rem; }
    header p { font-size: 0.95rem; margin-bottom: 1.8rem; }
    .home-section-title { font-size: 1.1rem; margin: 2rem 0 1rem; }
}

/* ==================== Tablet vertical (640–900px) ==================== */
/* Mantiene la barra inferior de app nativa pero aprovecha el ancho extra */
@media (min-width: 640px) and (max-width: 900px) {
    .content-area {
        padding: 2.8rem 2.2rem calc(100px + env(safe-area-inset-bottom));
    }
    header h1 { font-size: 2.1rem; }

    .home-grid { grid-template-columns: 1.2fr 1fr; }
    .modules-grid { grid-template-columns: repeat(3, 1fr); }
    .waitlist-grid { grid-template-columns: 1fr 1fr; }
    .challenge-grid { grid-template-columns: 1fr 1fr; }
    .split-view { grid-template-columns: 1fr 1fr; }
    .compare-frame { aspect-ratio: 16 / 10; }

    /* Las 9 pestañas caben: centradas y equidistantes, sin scroll */
    .nav-links { justify-content: center; gap: 0.2rem; }
    .nav-links li { flex: 0 1 84px; max-width: 84px; }
}

/* ==================== Móvil apaisado (pantalla baja) ==================== */
/* Con poca altura, la barra inferior pasa a solo-iconos para ceder espacio */
@media (max-width: 900px) and (max-height: 480px) {
    .sidebar {
        padding-top: calc(0.35rem + env(safe-area-inset-top));
        padding-bottom: 0.35rem;
    }
    .sidebar .logo-avix { font-size: 1.1rem; }
    .nav-links { padding: 0.25rem 0.4rem calc(0.25rem + env(safe-area-inset-bottom)); }
    .nav-links li { min-height: 42px; padding: 0.35rem 0.3rem; gap: 0; }
    .nav-links li .nav-txt { display: none; }
    .nav-links li .nav-ico { font-size: 1.25rem; }
    .content-area { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
    .avix-toast { bottom: calc(60px + env(safe-area-inset-bottom)); }
    header h1 { font-size: 1.4rem; }
    header p { margin-bottom: 1.2rem; }
}
