/* ==========================================================================
   Tema global: colores, tipografía y componentes compartidos
   ========================================================================== */

:root {
    color-scheme: light;

    --font-sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;

    /* Superficies y texto */
    --bg: #f3f6fc;
    --surface: #ffffff;
    --surface-2: #edf2fb;
    --text: #0e1b36;
    --text-muted: #5a6a8a;
    --border: #dbe3f1;
    --glow-1: rgba(42, 91, 215, 0.16);
    --glow-2: rgba(229, 72, 77, 0.08);

    /* Azul principal (bleu de France) */
    --primary: #2a5bd7;
    --primary-hover: #1f48b5;
    --primary-soft: #e3ebff;
    --primary-text: #2a5bd7;
    --primary-contrast: #ffffff;

    /* Estados */
    --rouge: #e5484d;
    --success: #15a35b;
    --danger: #e5484d;

    /* Tonos por grupo (tiempos verbales, secciones) */
    --tone-present: #2a5bd7;
    --tone-past: #7c4ddb;
    --tone-future: #0f9d8a;
    --tone-other: #e5484d;

    /* Forma */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 2px rgba(14, 27, 54, 0.05), 0 1px 3px rgba(14, 27, 54, 0.07);
    --shadow: 0 4px 14px rgba(14, 27, 54, 0.08), 0 2px 4px rgba(14, 27, 54, 0.04);
    --shadow-lg: 0 22px 44px -16px rgba(23, 52, 120, 0.3), 0 4px 10px rgba(14, 27, 54, 0.05);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

    --nav-h: 64px;
    --page-w: 1040px;
}

/* Modo oscuro: elegido manualmente o por preferencia del sistema */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a1226;
    --surface: #111b33;
    --surface-2: #172341;
    --text: #e7edfb;
    --text-muted: #96a5c6;
    --border: #24324f;
    --glow-1: rgba(91, 140, 255, 0.18);
    --glow-2: rgba(229, 72, 77, 0.07);
    --primary: #3f6fe8;
    --primary-hover: #5682f5;
    --primary-soft: rgba(91, 140, 255, 0.16);
    --primary-text: #8fb0ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 22px 44px -16px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.25);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0a1226;
        --surface: #111b33;
        --surface-2: #172341;
        --text: #e7edfb;
        --text-muted: #96a5c6;
        --border: #24324f;
        --glow-1: rgba(91, 140, 255, 0.18);
        --glow-2: rgba(229, 72, 77, 0.07);
        --primary: #3f6fe8;
        --primary-hover: #5682f5;
        --primary-soft: rgba(91, 140, 255, 0.16);
        --primary-text: #8fb0ff;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 22px 44px -16px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.25);
    }
}

/* ---------- Base ---------- */

*, *::before, *::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 420px at 10% -10%, var(--glow-1), transparent 70%),
        radial-gradient(700px 380px at 100% 0%, var(--glow-2), transparent 70%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    line-height: 1.15;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
    outline-offset: 2px;
}

::selection {
    background: color-mix(in srgb, var(--primary) 30%, transparent);
}

.page {
    width: 100%;
    max-width: calc(var(--page-w) + 40px);
    margin-inline: auto;
    padding: 28px 20px 64px;
}

/* ---------- Barra de navegación ---------- */

site-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-nav {
    height: var(--nav-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding-inline: max(20px, calc((100% - var(--page-w)) / 2));
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #2a5bd7 0 33.4%, #ffffff 33.4% 66.6%, #e5484d 66.6%);
    box-shadow: inset 0 0 0 1px rgba(14, 27, 54, 0.12), var(--shadow-sm);
}

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-link[aria-current="page"] {
    background: var(--primary-soft);
    color: var(--primary-text);
}

.nav-link svg,
.theme-toggle svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, transform 0.3s var(--ease);
}

.theme-toggle:hover {
    color: var(--primary-text);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    transform: rotate(-15deg);
}

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 860px) {
    .site-nav { gap: 8px; }
    .nav-links { gap: 2px; }
    .nav-link {
        flex-direction: column;
        gap: 2px;
        padding: 6px 10px;
        border-radius: 12px;
        font-size: 0.72rem;
    }
}

@media (max-width: 640px) {
    .brand-name { display: none; }
}

/* En pantallas estrechas solo iconos (el nombre queda en aria-label y title) */
@media (max-width: 560px) {
    .nav-link {
        padding: 10px 12px;
    }
    .nav-link span { display: none; }
    .nav-link svg {
        width: 21px;
        height: 21px;
    }
}

/* ---------- Botones ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.12s var(--ease);
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

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

.btn-primary {
    background: var(--primary);
    color: var(--primary-contrast);
    box-shadow:
        0 8px 18px -8px color-mix(in srgb, var(--primary) 80%, transparent),
        inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    color: var(--primary-text);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--danger) 85%, #000000);
}

.btn-lg {
    padding: 14px 26px;
    font-size: 1.05rem;
    border-radius: 14px;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.9rem;
    border-radius: 10px;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Botón de dos estados (aria-pressed) */
.toggle-btn[aria-pressed="true"] {
    background: var(--primary-soft);
    color: var(--primary-text);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.btn-google {
    background: #ffffff;
    color: #1f2937;
    border-color: #dadce0;
    box-shadow: var(--shadow-sm);
}

.btn-google:hover {
    background: #f6f8fc;
}

.btn-google svg {
    width: 18px;
    height: 18px;
}

/* ---------- Elementos comunes ---------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: -8px;
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.back-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.back-link svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s var(--ease);
}

.back-link:hover svg {
    transform: translateX(-3px);
}

.page-header {
    margin: 14px 0 28px;
}

.page-header h1 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 2.75rem);
    letter-spacing: -0.02em;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tone, var(--primary)) 14%, transparent);
    color: color-mix(in srgb, var(--tone, var(--primary)) 72%, var(--text));
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tone-present { --tone: var(--tone-present); }
.tone-past { --tone: var(--tone-past); }
.tone-future { --tone: var(--tone-future); }
.tone-other { --tone: var(--tone-other); }

kbd {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    background: var(--surface);
    font-family: var(--font-sans);
    font-size: 0.85em;
    font-weight: 700;
}

.empty-state {
    grid-column: 1 / -1;
    margin: 0;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

/* ---------- Tarjetas de opción (menús) ---------- */

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

/* Azul por defecto con especificidad 0: las clases .tone-* lo sustituyen */
:where(.option-card, .feature-card) {
    --tone: var(--primary);
}

.option-card,
.feature-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
    /* "backwards" para que la animación no bloquee el transform del hover al terminar */
    animation: rise 0.5s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 50ms);
}

.option-card:hover,
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--tone) 45%, var(--border));
}

.option-card h2 {
    margin: 6px 0 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
}

.option-example {
    margin: 0;
    font-family: var(--font-display);
    font-style: italic;
    color: color-mix(in srgb, var(--tone) 72%, var(--text));
}

.option-desc {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.option-arrow {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 20px;
    height: 20px;
    color: color-mix(in srgb, var(--tone) 72%, var(--text));
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s, transform 0.25s var(--ease);
}

.option-card:hover .option-arrow {
    opacity: 1;
    transform: none;
}

/* Secciones de una página de menú */
.page-section + .page-section {
    margin-top: 44px;
}

.section-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
}

.section-desc {
    margin: 4px 0 16px;
    color: var(--text-muted);
}

.option-count {
    margin: auto 0 0;
    padding-top: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.option-count:empty {
    display: none;
}

/* Tarjetas con varias acciones (Aprender / Practicar) */
.option-card:has(.option-actions) {
    cursor: default;
}

.option-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
}

.option-actions .btn {
    flex: 1;
    white-space: nowrap;
}

/* Botón principal del color del grupo, algo oscurecido para que el texto blanco contraste */
.option-card .btn-primary {
    background: color-mix(in srgb, var(--tone) 82%, #000000);
    box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--tone) 80%, transparent), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.option-card .btn-primary:hover {
    background: color-mix(in srgb, var(--tone) 70%, #000000);
}

/* Acceso destacado (p. ej. "Antes de empezar") */
.intro-card {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
    background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 12%, var(--surface)), var(--surface) 70%);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    animation: rise 0.5s var(--ease) backwards;
}

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

.intro-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 16px;
    background: var(--primary);
    color: #ffffff;
}

.intro-icon svg {
    width: 26px;
    height: 26px;
}

.intro-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.intro-kicker {
    color: var(--primary-text);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.intro-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.45rem;
    line-height: 1.2;
}

.intro-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.intro-arrow {
    margin-left: auto;
    color: var(--primary-text);
    font-size: 1.5rem;
    font-weight: 800;
    transition: transform 0.25s var(--ease);
}

.intro-card:hover .intro-arrow {
    transform: translateX(4px);
}

.option-card.is-disabled {
    cursor: default;
    opacity: 0.6;
    border-style: dashed;
    box-shadow: none;
    pointer-events: none;
}

/* ---------- Formularios ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    font-weight: 700;
}

.input,
.field input,
.field select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--surface-2);
    font-size: 1rem;
    font-weight: 600;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.input:focus,
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input::placeholder,
.field input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* ---------- Ventanas modales ---------- */
/* Se muestran desde JS con style.display = "flex" */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 15, 33, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fade 0.2s ease both;
}

.modal-content {
    width: min(100%, 420px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 26px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.3s var(--ease) both;
}

.modal-content h2 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.6rem;
}

.modal-text {
    margin: 0 0 18px;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions--stack {
    flex-direction: column;
}

.modal-actions--stack .btn {
    width: 100%;
}

/* ---------- Botón de escuchar (pronunciación) ---------- */

.speak-btn {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    padding: 0;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--tone, var(--primary)) 30%, var(--border));
    background: color-mix(in srgb, var(--tone, var(--primary)) 10%, var(--surface));
    color: color-mix(in srgb, var(--tone, var(--primary)) 75%, var(--text));
    cursor: pointer;
    transition: transform 0.15s var(--ease), background-color 0.2s, border-color 0.2s;
}

.speak-btn:hover {
    border-color: var(--tone, var(--primary));
    transform: scale(1.06);
}

.speak-btn svg {
    width: 18px;
    height: 18px;
}

.speak-btn.is-speaking {
    animation: speaking 0.9s ease-in-out infinite;
}

/* Sobre fondos de color (reverso de tarjetas) */
.speak-btn--light {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.speak-btn--light:hover {
    border-color: #ffffff;
}

.no-speech .speak-btn {
    display: none !important;
}

@keyframes speaking {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone, var(--primary)) 40%, transparent); }
    50% { box-shadow: 0 0 0 7px transparent; }
}

/* ---------- Teclado de acentos ---------- */

accent-keys {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.2s;
}

.accent-key {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.accent-key:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--primary-soft);
    color: var(--primary-text);
}

.accent-key:active {
    transform: translateY(1px) scale(0.94);
}

/* ---------- Avisos (toasts) ---------- */

.toast-region {
    position: fixed;
    left: 50%;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(calc(100% - 32px), 420px);
    transform: translateX(-50%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--text);
    color: var(--bg);
    box-shadow: var(--shadow-lg);
    font-weight: 700;
    pointer-events: auto;
    animation: toast-in 0.35s var(--ease) both;
}

.toast::before {
    content: "i";
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
}

.toast--success::before {
    content: "✓";
    background: var(--success);
}

.toast--error::before {
    content: "!";
    background: var(--danger);
}

.toast.is-leaving {
    animation: toast-out 0.3s ease both;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ---------- Confeti ---------- */

.confetti {
    position: fixed;
    inset: 0;
    z-index: 350;
    overflow: hidden;
    pointer-events: none;
}

.confetti i {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    animation: confetti-burst 1.4s cubic-bezier(0.2, 0.7, 0.4, 1) both;
}

@keyframes confetti-burst {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(0);
    }
    35% {
        opacity: 1;
        transform: translate(calc(var(--dx) * 0.7), var(--dy)) rotate(calc(var(--r) * 0.4));
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx), calc(var(--dy) + 320px)) rotate(var(--r));
    }
}

/* ---------- Transiciones entre páginas (View Transitions) ---------- */
/* Chrome, Edge y Safari animan el cambio de página; el resto navega como siempre */

@view-transition {
    navigation: auto;
}

/* La barra de navegación se queda fija durante la transición */
site-nav {
    view-transition-name: site-nav;
}

::view-transition-old(root) {
    animation: page-out 0.16s ease-in both;
}

::view-transition-new(root) {
    animation: page-in 0.32s var(--ease) both;
}

@keyframes page-out {
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

/* ---------- Esqueletos de carga ---------- */

.skeleton,
.verb:empty::before,
.translation:empty::before,
.card-text:empty::before {
    background: linear-gradient(90deg,
        var(--surface-2) 25%,
        color-mix(in srgb, var(--surface-2) 35%, var(--surface)) 50%,
        var(--surface-2) 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: shimmer 1.3s ease-in-out infinite;
}

.skeleton {
    display: block;
    color: transparent;
}

.skeleton-line {
    height: 14px;
    margin: 10px 0;
}

.skeleton-card {
    min-height: 120px;
    border-radius: var(--radius);
}

/* Palabras que aún no han cargado */
.verb:empty::before,
.card-text:empty::before {
    content: "";
    display: inline-block;
    width: 6.5ch;
    height: 0.8em;
    vertical-align: middle;
}

.translation:empty::before {
    content: "";
    display: inline-block;
    width: 9ch;
    height: 0.9em;
}

/* Sobre el reverso azul del mazo */
.card-back .card-text:empty::before {
    background: rgba(255, 255, 255, 0.18);
    animation: none;
}

@keyframes shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* ---------- Animaciones ---------- */

@keyframes fade {
    from { opacity: 0; }
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
