/* ---------- Design tokens ---------- */
:root {
    /* Colores (guía educativa) */
    --primary-600: #2563EB;
    --primary-700: #1D4ED8;
    --primary-100: #DBEAFE;
    --primary-50: #EFF6FF;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --text: #0F172A;
    --text-2: #475569;
    --border: #E2E8F0;
    --success: #22C55E;
    --success-bg: #DCFCE7;
    --error: #EF4444;
    --error-bg: #FEE2E2;
    --hint: #FEF3C7;

    /* Radius / Shadow */
    --radius-lg: 16px;
    --radius-md: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-focus: 0 0 0 3px var(--primary-50);

    /* Spacing (8pt grid) */
    --s-1: 8px;
    --s-1_5: 12px;
    --s-2: 16px;
    --s-3: 24px;
    --s-4: 32px;

    /* Level cards: psicología del color (acentos suaves) */
    --level-mandatory: #22C55E;
    --level-mandatory-soft: rgba(34, 197, 94, 0.15);
    --level-mandatory-border: rgba(34, 197, 94, 0.4);
    --level-medium: #D97706;
    --level-medium-soft: rgba(217, 119, 6, 0.12);
    --level-medium-border: rgba(217, 119, 6, 0.35);
    --level-hard: #DC2626;
    --level-hard-soft: rgba(220, 38, 38, 0.12);
    --level-hard-border: rgba(220, 38, 38, 0.4);

    /* Altura del header compacto */
    --hero-h: 64px;
}

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

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: #F1F5F9;
    min-height: 100dvh;
    overflow: hidden;
}

.hidden {
    display: none;
}

/* ---------- PWA: tarjeta instalar (estilo level-card Obligatoria, más delgada) ---------- */
.pwa-install-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    padding: var(--s-2);
    padding-bottom: max(var(--s-2), env(safe-area-inset-bottom, 16px));
    pointer-events: none;
}

.pwa-install-card {
    pointer-events: auto;
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 14px 14px;
    font-family: inherit;
    text-align: left;
    background: linear-gradient(135deg, #fff 0%, rgba(240, 253, 244, 0.6) 100%);
    border: 2px solid rgba(46, 204, 113, 0.4);
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(46, 204, 113, 0.08),
        0 -2px 20px rgba(15, 23, 42, 0.06);
}

.pwa-install-card__row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.pwa-install-card__icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 12px;
}

.pwa-install-card__copy {
    min-width: 0;
}

.pwa-install-card__headline {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}

.pwa-install-card__sub {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-2);
}

.pwa-install-card__cta {
    display: block;
    width: 100%;
    margin-top: 2px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: var(--primary-600);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
    transition: background 0.2s ease, transform 0.15s ease;
}

.pwa-install-card__cta:hover {
    background: var(--primary-700);
}

.pwa-install-card__cta:active {
    transform: scale(0.98);
}

.pwa-install-card__cta:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.pwa-install-card__cta--ios {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.pwa-install-card__dismiss {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.pwa-install-card__dismiss:hover {
    color: var(--text);
    background: rgba(15, 23, 42, 0.04);
}

#app {
    height: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- Header (solo branding) ---------- */
.hero {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    padding: 12px var(--s-2);
    padding-bottom: 20px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.2);
}

.hero .header-inner {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 var(--s-2);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 40px;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hero-brand__logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
}

.hero-brand__text {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
}

/* Bloque Practice: título, meta (Set/Verb), barra de progreso */
.hero-practice {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 var(--s-2);
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: var(--s-2);
}

.hero-title-row {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
}

.hero-title-row .hero-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    min-width: 0;
}

.hero-title-row .hero-change-level {
    flex-shrink: 0;
}

.hero-meta-row {
    margin-top: var(--s-1_5);
}

.hero-meta-row .hero-set {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    color: #fff;
    white-space: nowrap;
}

.hero-progress-outer {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    margin-top: var(--s-2);
    
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto;
    align-items: center;
    gap: var(--s-1);
    overflow: visible;
}

/* Contenedor de la barra (track): columna 1, siempre con ancho y altura visibles */
#progressBar.hero-progress-wrap,
.hero-progress-outer #progressBar,
.hero-progress-wrap {
    width: 100%;
    min-width: 0;
    height: 10px;
    min-height: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    overflow: hidden;
}

/* Fill: ancho lo controla el JS (%), altura 100% del track */
#progressFill,
.hero-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    min-height: 100%;
    background: #fff;
    border-radius: 999px;
    transition: width 250ms ease;
}

.hero-progress-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    min-width: 2.5rem;
    text-align: right;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: center;
}

.hero-progress-text:empty {
    display: none;
}

/* Bloque de Practice dentro del hero (mismo hero, solo visible en vista Practice) */
#heroPracticeBlock {
   
    color: #fff;
}

#heroPracticeBlock.hidden {
    display: none;
}

.hero-change-level {
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.hero-change-level:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hero-change-level:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.app-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
}

/* Vista: ocupa espacio disponible */
.view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.view.hidden {
    display: none;
}

/* Practice view: cuando está visible, permite scroll interno */
#practice.view {
    overflow: auto;
}

/* Verbs list view: scroll solo dentro del tableWrap */
#verbsList.view {
    overflow: hidden;
}

.verbs-list-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.verbs-list-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
}

.verbs-list-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.verbs-list-back {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--primary-600);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: 999px;
    cursor: pointer;
}

.verbs-list-back:hover {
    background: var(--primary-100);
}

.verbs-list-tableWrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

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

.verbs-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    color: var(--text-2);
}

.verbs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 14px;
    color: var(--text);
}

.verbs-table th:first-child,
.verbs-table td:first-child {
    font-weight: 600;
}

/* ---------- Level Select: full-height, centrado ---------- */
#levelSelect.view {
    align-items: center;
}

.level-screen {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(8px, 1.5vh, 12px);
    gap: clamp(8px, 1.5vh, 12px);
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

/* Bloque motivacional minimal */
.level-hero {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: var(--s-1_5);
    padding: var(--s-1_5) var(--s-2);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

.level-hero__icon {
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.level-hero__content {
    min-width: 0;
}

.level-hero__headline {
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}

.level-hero__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-2);
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.level-hero__btn:hover {
    background: rgba(15, 23, 42, 0.1);
    border-color: rgba(15, 23, 42, 0.15);
}

.level-hero__btn:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.level-intro {
    flex-shrink: 0;
}

.level-intro-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

/* Contenedor de cards: reparte el alto restante entre las 3 + stagger */
.level-cards {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2vh, 16px);
}

/* Card: profundidad visual + animación entrada */
.level-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    padding: clamp(12px, 2vh, 16px);
    font-family: inherit;
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
    animation: levelCardFadeIn 0.4s ease backwards;
}

.level-card:nth-child(1) { animation-delay: 0.05s; }
.level-card:nth-child(2) { animation-delay: 0.15s; }
.level-card:nth-child(3) { animation-delay: 0.25s; }

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

/* Icono gigante difuminado de fondo */
.level-card__bg-icon {
    position: absolute;
    right: 8%;
    top: 50%;
    transform: translateY(-50%);
    font-size: 5rem;
    line-height: 1;
    opacity: 0.05;
    pointer-events: none;
}

.level-card--mandatory .level-card__bg-icon { color: #16a34a; }
.level-card--medium .level-card__bg-icon { color: #d97706; }
.level-card--hard .level-card__bg-icon { color: #dc2626; }

.level-card:hover {
    transform: scale(1.01) translateY(-2px);
}

.level-card:active {
    transform: scale(0.99) translateY(0);
}

.level-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-50);
}

/* Fondos con gradiente sutil por nivel */
.level-card--mandatory {
    background: linear-gradient(135deg, #fff 0%, rgba(240, 253, 244, 0.6) 100%);
    border-color: rgba(46, 204, 113, 0.4);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(46, 204, 113, 0.08);
}
.level-card--mandatory:hover {
    border-color: rgba(46, 204, 113, 0.55);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1), 0 0 24px rgba(46, 204, 113, 0.12);
}

.level-card--medium {
    background: linear-gradient(135deg, #fff 0%, rgba(255, 251, 235, 0.6) 100%);
    border-color: rgba(243, 156, 18, 0.4);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(243, 156, 18, 0.08);
}
.level-card--medium:hover {
    border-color: rgba(243, 156, 18, 0.55);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1), 0 0 24px rgba(243, 156, 18, 0.12);
}

.level-card--hard {
    background: linear-gradient(135deg, #fff 0%, rgba(254, 242, 242, 0.5) 100%);
    border-color: rgba(231, 76, 60, 0.4);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(231, 76, 60, 0.08);
}
.level-card--hard:hover {
    border-color: rgba(231, 76, 60, 0.55);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1), 0 0 24px rgba(231, 76, 60, 0.12);
}

/* Header en fila: icono + título a la izquierda, badge a la derecha */
.level-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.level-card__titleGroup {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.level-card__icon {
    font-size: 24px;
    line-height: 1;
}

.level-card__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.level-badge {
    margin: 0;
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.level-card__body {
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.level-card__header {
    position: relative;
    z-index: 1;
}

.level-card__count {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    color: var(--text);
}

.level-card__metric {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.35;
    opacity: 0.85;
    color: var(--text-2);
}

.level-card__cta {
    margin: 8px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    opacity: 0.75;
}

.level-card--mandatory .level-badge {
    background: rgba(46, 204, 113, 0.14);
    color: #1e874f;
}

.level-card--medium .level-badge {
    background: rgba(243, 156, 18, 0.14);
    color: #a86100;
}

.level-card--hard .level-badge {
    background: rgba(231, 76, 60, 0.14);
    color: #b73b30;
}

/* Pantallas muy estrechas: título puede partir línea */
@media (max-width: 360px) {
    .level-card__header {
        align-items: flex-start;
    }
    .level-card__title {
        white-space: normal;
    }
}

/* Pantallas con poco alto (móvil): reducir tipografías y evitar corte */
@media (max-height: 700px) {
    .level-hero__headline {
        font-size: 0.8125rem;
    }
    .level-intro-title {
        font-size: 1.2rem;
    }
    .level-card__title {
        font-size: 1.25rem;
    }
    .level-card__metric {
        display: none;
    }
    .level-screen {
        padding: 12px;
    }
    .level-card {
        padding: 12px;
    }
}

/* ---------- Componentes reutilizables ---------- */
.card {
    background: var(--surface);
    border: none;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transition: opacity 150ms ease, transform 150ms ease;
}

.input {
    height: 52px;
    margin-top: 0;
    margin-bottom: 0;
    padding: 14px var(--s-2);
    font-size: 18px;
    font-family: inherit;
    color: var(--text);
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input::placeholder {
    color: var(--text-2);
}

.input:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input.is-success {
    border-color: var(--success);
    background: var(--success-bg);
}

.input.is-error {
    border-color: var(--error);
    background: var(--error-bg);
}

.input.is-hint {
    background: var(--hint);
}

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

.btn-primary {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 0 var(--s-3);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border: none;
    border-radius: 16px;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.97);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.btn-primary:disabled {
    opacity: 0.6;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-secondary {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 0 var(--s-3);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-2);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-50);
    border-color: var(--primary-100);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

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

.btn-link {
    padding: var(--s-1) var(--s-1_5);
    min-height: 44px;
    min-width: 44px;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--primary-600);
    background: none;
    border: none;
    cursor: pointer;
}

.btn-link:hover:not(:disabled) {
    color: var(--primary-700);
    text-decoration: underline;
}

.btn-link:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

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

/* Ghost small (Show meaning — sobre fondo claro) */
.btn-ghost-small {
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--primary-600);
    background: transparent;
    color: var(--primary-600);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost-small::before {
    content: "👁 ";
    font-style: normal;
}

.btn-ghost-small:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.btn-ghost-small:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-ghost-small:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.btn-ghost-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Meaning toggle: solo ícono (ojito), sin texto */
.practice-meaning-toggle.meaning-toggle-icon {
    padding: 8px;
    min-width: 40px;
}

.practice-meaning-toggle.meaning-toggle-icon::before {
    content: none;
}

.practice-meaning-toggle.meaning-toggle-icon svg {
    display: block;
}

.progress-track {
    height: 6px;
    background: var(--primary-100);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-600);
    border-radius: 999px;
    transition: width 250ms ease;
}

/* ---------- Micro-animaciones ---------- */
@keyframes popSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shakeX {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); }
}

.success-animate {
    animation: popSuccess 200ms ease;
}

.error-animate {
    animation: shakeX 250ms ease;
}

.fade-out {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 150ms ease, transform 150ms ease;
}

/* Feedback / estados de mensaje */
.feedback-success {
    color: var(--success);
    font-weight: 500;
}

.feedback-error {
    color: var(--error);
    font-weight: 500;
}

/* ---------- Practice feature ---------- */
.practice {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* Base: solo móvil visible; desktop oculto y sin espacio residual */
.practice-mobile {
    display: block;
}
.practice-desktop {
    display: none;
}

.practice-input.input {
    scroll-margin-bottom: 80px;
}

.practice-card.card {
    margin-bottom: var(--s-2);
}


.verb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-2);
}

.practice-card-value {
    margin: 0;
    font-size: 40px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.practice-meaning-toggle.btn-ghost-small {
    flex-shrink: 0;
}

.practice-meaning-container {
    margin-top: var(--s-1);
    font-size: 13px;
    color: var(--text-2);
}

.practice-input.input.hint-active,
.practice-input.input.hint-active:focus {
    background: var(--success-bg);
    border-color: var(--success);
    transition: background 0.2s, border-color 0.2s;
}

.practice-inputs {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: var(--s-3);
}

.practice-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-top: 0;
    margin-bottom: 8px;
}

.practice-inputs .practice-input + .practice-label {
    margin-top: 4px;
}

.practice-actions {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
}

.practice-feedback {
    min-height: 2rem;
    padding: var(--s-1) 0;
    font-size: 13px;
    color: var(--text-2);
}

/* Pantalla final del set */
/* Set complete — premium */
.practice-summary {
    padding: var(--s-2) var(--s-2) max(var(--s-4), env(safe-area-inset-bottom, 24px));
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
}

.summary-badge {
    display: inline-block;
    margin-bottom: var(--s-2);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.summary-card {
    padding: var(--s-3);
    text-align: center;
}

.summary-title {
    margin: 0 0 var(--s-1);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.summary-subtitle {
    margin: 0 0 var(--s-3);
    font-size: 0.9375rem;
    color: var(--text-2);
}

.summary-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
    margin-bottom: var(--s-3);
}

.summary-stat-chip {
    padding: var(--s-2);
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.summary-stat-chip-full {
    grid-column: 1 / -1;
}

.summary-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.summary-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    margin-top: 2px;
}

.summary-hints-section {
    margin-bottom: var(--s-3);
    text-align: left;
}

.summary-hints-title {
    margin: 0 0 var(--s-1);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.summary-hints-list {
    max-height: 180px;
    overflow-y: auto;
    padding: var(--s-1) 0;
}

.summary-hints-row {
    padding: 6px 0;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.summary-hints-row:last-child {
    border-bottom: none;
}

.summary-hints-empty {
    font-size: 14px;
    color: var(--text-2);
    font-style: italic;
    max-height: none;
}

.summary-actions {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.summary-btn {
    width: 100%;
    min-height: 52px;
}

.summary-btn-repeat {
    order: -1;
}

/* ---------- Login modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-2);
    background: rgba(15, 23, 42, 0.4);
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    width: 92%;
    max-width: 420px;
    padding: var(--s-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm), 0 10px 40px rgba(0, 0, 0, 0.1);
}

.modal-title {
    margin: 0 0 var(--s-1);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.modal-description {
    margin: 0 0 var(--s-2);
    font-size: 0.9375rem;
    color: var(--text-2);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

.modal-label {
    display: block;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.modal-input {
    height: 52px;
    padding: 14px var(--s-2);
    font-size: 18px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: var(--shadow-focus);
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    margin-top: var(--s-1);
}

.modal-btn {
    min-height: 52px;
    padding: 0 var(--s-3);
    font-size: 1rem;
    font-family: inherit;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
}

.modal-btn:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.modal-btn-primary {
    background: var(--primary-600);
    color: #fff;
    font-weight: 600;
}

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

.modal-btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.modal-btn-secondary:hover {
    background: var(--primary-50);
    border-color: var(--primary-100);
}

/* ---------- Practice: desktop (≥1024px) ---------- */
@media (min-width: 1024px) {
    .hero .header-inner,
    .hero-practice,
    .hero-progress-outer {
        max-width: 1200px;
    }

    .practice-mobile {
        display: none;
    }

    .practice-desktop {
        display: block;
        width: 100%;
    }

    .practice {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 var(--s-2);
    }

    .practice-desktop-inner {
        width: 100%;
        background: var(--surface);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: 1px solid var(--border);
    }

    .practice-desk-table {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .practice-desk-row {
        display: grid;
        grid-template-columns: minmax(120px, 1fr) minmax(140px, 1.2fr) minmax(160px, 1.4fr) minmax(240px, 240px);
        gap: var(--s-2);
        align-items: center;
        padding: var(--s-1_5) var(--s-2);
        border-bottom: 1px solid var(--border);
        min-height: 56px;
        box-sizing: border-box;
    }

    .practice-desk-row:last-child {
        border-bottom: none;
    }

    .practice-desk-row--head {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-2);
        background: var(--bg);
        border-bottom: 2px solid var(--border);
        padding: var(--s-2);
    }

    .practice-desk-row--done .practice-desk-past-input,
    .practice-desk-row--done .practice-desk-pp-input {
        background: var(--success-bg);
        border-color: var(--success);
    }

    .practice-desk-row--error .practice-desk-past-input.is-error,
    .practice-desk-row--error .practice-desk-pp-input.is-error {
        border-color: var(--error);
        background: var(--error-bg);
    }

    .practice-desk-cell {
        min-width: 0;
    }

    .practice-desk-base {
        font-weight: 600;
        font-size: 15px;
        color: var(--text);
    }

    .practice-desk-cell--input {
        display: flex;
    }

    .practice-desk-cell--input .practice-input {
        width: 100%;
        min-width: 0;
        height: 44px;
        padding: 0 var(--s-1_5);
        font-size: 14px;
    }

    .practice-desk-cell--actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: var(--s-1);
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .practice-desk-cell--actions .practice-btn {
        width: auto;
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .practice-desk-feedback {
        flex: 1 1 100%;
        font-size: 12px;
        min-height: 1.25rem;
        text-align: right;
        box-sizing: border-box;
    }

    .practice-desk-feedback.feedback-success {
        color: var(--success);
        font-weight: 500;
    }

    .practice-desk-feedback.feedback-error {
        color: var(--error);
        font-weight: 500;
    }
}
