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

:root {
    --bg: #0D0D0C;
    --surface: #131312;
    --surface-2: #1A1A18;
    --surface-3: #222220;
    --ink: #F0EDE8;
    --ink-2: #C8C4BC;
    --ink-3: #bbbaba;
    --ink-4: #adadaa;
    --accent: #b18320;
    --accent-2: #ca921a;
    --accent-dim: rgba(192, 64, 42, 0.12);
    --border: #242420;
    --border-2: #2E2E2A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 80px rgba(0, 0, 0, .6);
    --radius: 9px;
    --radius-pill: 20px;

    /* ── Semantic ── */
    --success: #5AB46A;
    --danger: #E07060;
    --warning: #CA921A;

    /* ── Type families ── */
    --font-sans: 'Montserrat', system-ui, sans-serif;
    --font-serif: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* ── Type scale ── */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 20px;
    --text-xl: 23px;
    --text-2xl: 30px;
    --text-3xl: 40px;
    --text-display: 54px;

    /* ── Spacing scale ── */
    --space-1: 4px;
    --space-2: 6px;
    --space-3: 10px;
    --space-4: 14px;
    --space-5: 18px;
    --space-6: 22px;
    --space-7: 28px;
    --space-8: 40px;

    /* ── Tracking ── */
    --tracking-tight: -0.5px;
    --tracking-normal: 0;
    --tracking-wide: 0.3px;
    --tracking-label: 0.8px;
    --tracking-mega: 2px;

    /* ── Leading ── */
    --leading-tight: 1.1;
    --leading-snug: 1.5;
    --leading-body: 1.78;
    --leading-prose: 1.82;

    /* ── Motion ── */
    --ease-snappy: cubic-bezier(.4, 0, .2, 1);
    --t-fast: 0.15s;
    --t-base: 0.18s;
    --t-slow: 0.28s;

    /* ── Z-index ── */
    --z-popover: 50;
    --z-overlay: 60;
    --z-modal: 80;
}

::selection {
    background: rgba(192, 64, 42, 0.3);
    color: var(--ink);
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
}

.main-content {
    flex: 1;
    min-height: calc(100vh - 64px);
}

input::placeholder {
    font-family: 'Montserrat', sans-serif;
    color: var(--ink-4);
}

.logo-mark {
    width: auto;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    padding: 6px 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.18s;
    color: var(--ink-3);
    line-height: 1;
}

.settings-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-2);
    color: var(--ink-2);
}

/* ─── APP HEADER (nueva estructura) ─── */

.app-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-7);
    height: 64px;
    position: sticky;
    top: 0;
    z-index: var(--z-overlay);
}

.app-header__inner {
    max-width: 1060px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-7);
}

.app-header__brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.app-header__nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.app-header__nav .mode-tabs {
    list-style: none;
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
    align-items: center;
    height: 64px;
}

.app-header__nav .mode-tab {
    border: none;
    background: transparent;
    padding: 0 var(--space-4);
    height: 64px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-3);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 400;
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    position: relative;
    transition: color var(--t-base) var(--ease-snappy);
}

.app-header__nav .mode-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--space-4);
    right: var(--space-4);
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--t-base) var(--ease-snappy);
}

.app-header__nav .mode-tab:hover {
    color: var(--ink-2);
    background: transparent;
}

.app-header__nav .mode-tab[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
}

.app-header__nav .mode-tab[aria-current="page"]::after {
    opacity: 1;
}

.mode-tab__icon {
    width: 14px;
    height: 14px;
    color: inherit;
    flex-shrink: 0;
}

.app-header__nav .mode-tab[aria-current="page"] .mode-tab__icon {
    color: var(--accent);
}

.mode-tab__badge {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 1px 6px;
    background: rgba(177, 131, 32, 0.08);
    line-height: 1.4;
}

.mode-tab__meta {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--ink-4);
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ─── SETTINGS PANEL ─── */

.settings-panel {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.settings-panel.open {
    max-height: 500px;
}

.settings-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 22px 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.settings-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.15s;
}

.close-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.config-section {
    margin-bottom: 14px;
}

.config-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
    margin-bottom: 5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.api-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.api-key-input {
    flex: 1;
    min-width: 200px;
    background: var(--bg);
    border: 1px solid var(--border-2);

    padding: 10px 14px;
    color: var(--ink);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.18s;
}

.api-key-input:focus {
    border-color: var(--accent);
    background: var(--surface-2);
}

.save-key-btn {
    background: var(--accent);
    color: var(--ink);
    border: none;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: background 0.18s;
    letter-spacing: 0.2px;
}

.save-key-btn:hover {
    background: var(--accent-2);
}

.clear-key-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    padding: 10px 16px;
    color: var(--ink-3);
    font-size: 13px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.18s;
    margin-left: 1em;
}

.clear-key-btn:hover {
    background: var(--surface-2);
    color: var(--ink-2);
}

.key-status {
    margin-top: 10px;
    font-size: 13px;
    color: #6A9E62;
    font-weight: 500;
}

/* ─── SEARCH AREA ─── */

.search-area {
    max-width: 850px;
    margin: 0 auto;
    padding: 32px 20px 0;
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 6px 6px 6px 18px;
    border: 1px solid var(--border-2);
    transition: border-color var(--t-base) var(--ease-snappy);
}

.input-row:focus-within {
    border-color: var(--ink-4);
}

.input-icon {
    font-size: 16px;
    opacity: 0.4;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.main-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--ink);
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    padding: 11px 4px;
}

a {
    text-decoration: none;
}

.search-btn {
    font-family: var(--font-sans);
    background: var(--accent);
    color: #0D0D0C;
    border: none;
    padding: 11px 22px;
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: background var(--t-base) var(--ease-snappy);
    flex-shrink: 0;

}

.search-btn:hover {
    background: var(--accent-2);
}

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

.examples-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.examples-label {
    font-size: 12px;
    color: var(--ink-4);
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.example-chip {
    background: transparent;
    border: 1px solid var(--border-2);
    padding: 4px 11px;
    color: var(--ink-3);
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.16s;
}

.example-chip:hover {
    background: var(--surface-3);
    border-color: var(--ink-4);
    color: var(--ink);
}

.history-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.history-label {
    font-size: 12px;
    color: var(--ink-4);
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.history-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-item {
    background: transparent;
    border: 1px solid var(--border);
    padding: 2px 9px;
    color: var(--ink-4);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.16s;
}

.history-item:hover {
    color: var(--ink);
    border-color: var(--border-2);
}

/* ─── LOADING ─── */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 72px 20px;
    gap: 18px;
}

.loading-glyph {
    position: relative;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-letter {
    font-family: 'Montserrat', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--ink-2);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-ring {
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-top-color: var(--ink-3);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.loading-text {
    font-size: 14px;
    color: var(--ink-3);
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

.loading-bar {
    width: 160px;
    height: 1px;
    background: var(--border-2);
    border-radius: 1px;
    overflow: hidden;
}

.loading-bar-inner {
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--ink-3), transparent);
    animation: slideBar 1.5s ease-in-out infinite;
}

/* ─── ERROR ─── */

.error-box {
    max-width: 820px;
    margin: 20px auto;
    padding: 13px 18px;
    background: rgba(192, 64, 42, 0.08);
    border: 1px solid rgba(192, 64, 42, 0.25);
    color: #E07060;
    font-size: 15px;
}

/* ─── RESULTS ─── */

.results-area {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

/* ─── WORD HERO ─── */

.word-hero {
    border-left: 3px solid var(--accent);
    padding: 28px 32px 28px calc(32px - 3px);
    margin-bottom: var(--space-5);
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.word-hero__main {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: var(--space-7);
    align-items: flex-start;
}

.word-hero__left {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.word-hero__title-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.word-hero__chips {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-1);
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid var(--border-2);
    padding: 4px 12px;
    font-size: var(--text-sm);
    color: var(--ink-3);
    background: transparent;
}

.hero-chip--accent {
    border-color: var(--accent);
    background: rgba(177, 131, 32, 0.06);
    color: var(--ink);
}

.hero-chip__label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--accent-2);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.word-hero__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-3);
    flex-shrink: 0;
    width: 170px;
}

.btn-save-deck {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: transparent;
    color: var(--ink-3);
    border: 1px solid var(--border-2);
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-base) var(--ease-snappy);
    white-space: nowrap;
    min-width: 162px;
}

.btn-save-deck:hover {
    background: var(--surface-3);
    border-color: var(--ink-4);
    color: var(--ink);
}

.btn-save-deck--saved {
    background: transparent;
    color: var(--ink-3);
    border: 1px solid var(--border-2);
}

.btn-save-deck--saved:hover {
    background: var(--surface-3);
    border-color: var(--ink-4);
    color: var(--ink);
}

.word-hero__secondary {
    display: flex;
    gap: var(--space-2);
}

.word-hero__icon-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--ink-4);
    padding: 7px 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all var(--t-base) var(--ease-snappy);
}

.word-hero__icon-btn:hover {
    background: var(--surface-2);
    color: var(--ink-2);
    border-color: var(--border-2);
}

/* ─── WORD GRID ─── */

.word-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.analysis-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    height: 220px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    animation: fadeInUp 0.25s ease-out forwards;
    transition: border-color var(--t-base) var(--ease-snappy);
}

.analysis-card:hover {
    border-color: var(--border-2);
}

.analysis-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    flex-shrink: 0;
}

.analysis-card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.analysis-card__eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--accent);
    letter-spacing: var(--tracking-wide);
}

.analysis-card__eyebrow-sep,
.analysis-card__eyebrow-label {
    display: none;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--ink-3);
    letter-spacing: var(--tracking-wide);
}

.analysis-card__icon {
    width: 14px;
    height: 14px;
    color: var(--ink-4);
}

.analysis-card__expand {
    width: 13px;
    height: 13px;
    color: var(--accent);
    opacity: 0.6;
    transition: opacity var(--t-base), transform var(--t-base) var(--ease-snappy);
    flex-shrink: 0;
}

.analysis-card:hover .analysis-card__expand {
    opacity: 1;
}

.analysis-card__title {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.1px;
    flex-shrink: 0;
}

.analysis-card__body {
    font-size: var(--text-sm);
    line-height: var(--leading-body);
    color: var(--ink-2);
    font-weight: 300;
    overflow: hidden;
    position: relative;
    flex: 1;
    min-height: 0;
}

/* Gradiente que difumina el texto — señal de "hay más" */
.analysis-card__body::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: linear-gradient(to bottom, transparent, #131312);
    pointer-events: none;
}

/* ── Estado expandido ── */

.analysis-card--expanded {
    order: -1;
    grid-column: 1 / -1;
    height: auto;
    overflow: visible;
    border-color: var(--border-2);
    animation: expandCard 0.50s var(--ease-snappy) forwards;
    cursor: default;
}

.analysis-card--expanded .analysis-card__body {
    overflow: visible;
    flex: unset;
}

.analysis-card--expanded .analysis-card__body::after {
    display: none;
}

.analysis-card--expanded .analysis-card__eyebrow-sep,
.analysis-card--expanded .analysis-card__eyebrow-label {
    display: inline;
}

.analysis-card--expanded .analysis-card__icon {
    display: none;
}

.analysis-card--expanded .analysis-card__title {
    display: none;
}

.analysis-card--expanded .analysis-card__expand {
    opacity: 1;
    transform: rotate(45deg);
}

@keyframes expandCard {
    from {
        opacity: 0.6;
        transform: translateY(-6px) scale(0.998);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modeSlideInRight {
    from {
        opacity: 0;
        transform: translateX(32px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modeSlideInLeft {
    from {
        opacity: 0;
        transform: translateX(-32px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mode-enter-right {
    animation: modeSlideInRight 0.50s var(--ease-snappy) both;
}

.mode-enter-left {
    animation: modeSlideInLeft 0.50s var(--ease-snappy) both;
}

.word-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 54px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.5px;
}

.ipa {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: var(--ink-3);
    background: var(--surface-2);
    padding: 4px 11px;
    border: 1px solid var(--border-2);
}

.pronun {
    margin-top: 10px;
    font-size: 14px;
    color: var(--ink-3);
}

.pronun-label {
    color: var(--ink-4);
    font-weight: 500;
}

.body-text {
    font-size: 16px;
    line-height: 1.82;
    color: var(--ink-2);
    font-weight: 300;
    white-space: pre-wrap;
}

/* ─── EXAMPLES ─── */

.example-item {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 13px 17px;
    margin-bottom: 10px;
}

.ex-russian {
    font-family: 'Cormorant Garamond', monospace;
    font-size: 20px;
    color: var(--ink);
    margin-bottom: 4px;
    font-weight: 500;
}

.ex-spanish {
    font-size: 15px;
    color: var(--ink-3);
    font-style: italic;
    margin-bottom: 6px;
}

.ex-note {
    font-size: 13px;
    color: var(--ink-4);
    line-height: 1.55;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
}

.note-tag {
    color: var(--accent-2);
    font-weight: 600;
    font-size: 11px;
}

/* ─── EMPTY STATE ─── */

.empty-state {
    max-width: 560px;
    margin: 0 auto;
    padding: 50px 20px;
    text-align: center;
}

.empty-glyph {
    width: auto;
    height: 75px;
    margin-bottom: 15px;
    animation: float 5s ease-in-out infinite;
    line-height: 1;
    opacity: 0.2;
}

.empty-text {
    font-size: 15px;
    color: var(--ink-3);
    line-height: 1.78;
    max-width: 420px;
    margin: 0 auto 28px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border-2);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: border-color 0.16s;
}

.feature-card:hover {
    border-color: var(--border-2);
}

.feature-title {
    font-size: 14px;
    color: var(--ink-3);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ─── FOOTER ─── */

.footer {
    margin-top: auto;
    /* ← empuja el footer siempre al fondo */
    text-align: center;
    padding: 28px 20px;
    font-size: 13px;
    color: var(--ink-4);
    letter-spacing: 0.3px;
    border-top: 1px solid var(--border);
}

/* ─── Rich text ─── */

.rt-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin: 18px 0 6px;
    letter-spacing: 0.2px;
}

.rt-heading:first-child {
    margin-top: 0;
}

.rt-list {
    margin: 6px 0 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rt-list li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink-2);
    font-weight: 300;
}

.rt-list li strong {
    color: var(--ink);
    font-weight: 600;
}

/* ─── KEYBOARD TOGGLE BUTTON ─── */
.keyboard-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--ink-4);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.16s;
    flex-shrink: 0;
}

.keyboard-toggle-btn:hover {
    background: var(--surface-2);
    border-color: var(--ink-4);
    color: var(--ink-2);
}

.keyboard-toggle-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent-2);
}

/* ─── CYRILLIC KEYBOARD ─── */
.cyrillic-keyboard {
    background: var(--bg);
    border: 1px solid var(--border-2);
    border-top: none;
    padding: 14px 12px 10px;
    animation: fadeInUp 0.2s ease-out forwards;
}

.kb-row {
    display: flex;
    gap: 5px;
    margin-bottom: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.kb-row--bottom {
    margin-bottom: 0;
    margin-top: 4px;
}

.kb-key {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--ink-2);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 500;
    min-width: 38px;
    height: 40px;
    padding: 0 6px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s, transform 0.06s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.kb-key:hover {
    background: var(--surface-3);
    border-color: var(--ink-4);
    color: var(--ink);
}

.kb-key:active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent-2);
    transform: scale(0.92);
}

.kb-key--wide {
    min-width: 64px;
    font-size: 13px;
}

.kb-key--action {
    min-width: 48px;
    font-size: 17px;
    color: var(--ink-3);
}

.kb-key--enter {
    background: var(--accent-dim);
    border-color: rgba(177, 131, 32, 0.3);
    color: var(--accent-2);
}

.kb-key--enter:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
}

.kb-key--shift {
    color: var(--ink-3);
    font-size: 16px;
}

.kb-key--shift.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent-2);
}

/* ─── DICTIONARY AREA ────────────────────────────────────────── */

.dictionary-area {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.dic-search-wrap {
    margin-bottom: var(--space-4);
}

.dic-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    padding: 6px 16px;
    transition: border-color var(--t-base) var(--ease-snappy);
}

.dic-search-row:focus-within {
    border-color: var(--ink-4);
}

.dic-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--ink);
    font-size: var(--text-md);
    font-family: var(--font-sans);
    font-weight: 400;
    padding: 10px 4px;
}

.dic-hint {
    font-size: 12px;
    color: var(--ink-4);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.dic-status {
    font-size: 14px;
    color: var(--ink-4);
    padding: 10px 2px;
}

/* ─── Entry list ─── */

.dic-results {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dic-entry {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 11px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    flex-wrap: wrap;
}

.dic-entry:hover {
    background: var(--surface-2);
    border-color: var(--border-2);
}

.dic-word {
    font-size: 20px;
    font-weight: 600;
    color: var(--ink-2);
    flex-shrink: 0;
}

.dic-translit {
    font-size: 13px;
    color: var(--ink-4);
    font-style: italic;
    flex-shrink: 0;
}

.dic-pos {
    font-size: 11px;
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    color: var(--accent-2);
    padding: 2px 7px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    font-weight: 500;
}

.dic-def {
    font-size: 14px;
    color: var(--ink-3);
    flex: 1;
    min-width: 0;
}

.dic-empty {
    font-size: 15px;
    color: var(--ink-4);
    padding: 20px 0;
}

/* ─── Pagination ─── */

.dic-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.dic-page-btn {
    background: var(--surface);
    border: 1px solid var(--border-2);
    color: var(--ink-3);
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    padding: 7px 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.dic-page-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.dic-page-info {
    font-size: 13px;
    color: var(--ink-4);
}

/* ─── Detail view ─── */

.dic-detail {
    animation: fadeInUp 0.2s ease-out forwards;
}

.dic-back-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--ink-4);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    padding: 7px 14px;
    cursor: pointer;
    margin-bottom: 18px;
    transition: all 0.15s;
}

.dic-back-btn:hover {
    background: var(--surface-2);
    color: var(--ink-2);
}

.dic-detail-header {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dic-detail-word {
    font-size: 48px;
    font-weight: 700;
    color: var(--ink-2);
    line-height: 1.1;
}

.dic-pos--lg {
    font-size: 13px;
    padding: 3px 10px;
}

.dic-detail-def {
    font-size: 16px;
    color: var(--ink-2);
    line-height: 1.75;
    margin-bottom: 24px;
    font-weight: 300;
}

.dic-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-4);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Timeline */
.dic-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 24px;
    padding-left: 4px;
}

.dic-timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    padding-bottom: 14px;
}

.dic-timeline-step:last-child {
    padding-bottom: 0;
}

.dic-tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-2);
    border: 2px solid var(--surface-3);
    flex-shrink: 0;
    margin-top: 5px;
    position: relative;
    z-index: 1;
}

.dic-tl-dot--last {
    background: var(--accent);
    border-color: var(--accent);
}

.dic-timeline-step:not(:last-child) .dic-tl-dot::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + 4px);
    background: var(--border);
}

.dic-tl-body {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.dic-tl-period {
    font-size: 12px;
    color: var(--ink-4);
    letter-spacing: 0.3px;
    min-width: 130px;
}

.dic-tl-form {
    font-family: 'Cormorant Garamond', serif;
    font-size: 19px;
    color: var(--ink);
    font-weight: 500;
}

.dic-tl-year {
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.2px;
}

/* Cognates */
.dic-cognates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.dic-cognate {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 8px 14px;
    gap: 3px;
}

.dic-cog-lang {
    font-size: 10px;
    color: var(--ink-4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dic-cog-word {
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    color: var(--ink-2);
    font-weight: 500;
}

/* Analyze button */
.dic-analyze-btn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent-2);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 22px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.18s;
    letter-spacing: 0.2px;
}

.dic-analyze-btn:hover {
    background: var(--accent);
    color: var(--ink);
}

/* ─── ALPHA FILTER (Índice de letras) ─── */
.dic-alpha-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 6px;
    /* Espacio para el scroll táctil */
    -webkit-overflow-scrolling: touch;
    /* Scroll suave en iOS */
    scrollbar-width: none;
    /* Oculta la barra en Firefox */
}

.dic-alpha-filter::-webkit-scrollbar {
    display: none;
}

.alpha-btn {
    background: var(--surface);
    border: 1px solid var(--border-2);
    color: var(--ink-3);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    /* Evita que las letras se aplasten */
    min-width: 36px;
    text-align: center;
}

.alpha-btn:hover {
    background: var(--surface-2);
    border-color: var(--ink-4);
    color: var(--ink);
}

.alpha-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent-2);
}

/* ─── ANIMATIONS ─── */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: .4;
    }

    50% {
        opacity: 1;
    }
}

@keyframes slideBar {
    0% {
        transform: translateX(-100%);
    }

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

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── RESPONSIVE ─── */

/* ─── AUTH BUTTON ─── */
.auth-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink-2);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.auth-btn:hover {
    background: var(--surface);
    border-color: var(--accent);
    color: var(--accent);
}

/* ─── LUCIDE ICON HELPERS ─── */
.settings-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.6;
    display: block;
}

.input-icon svg {
    width: 16px;
    height: 16px;
    stroke: var(--ink);
    display: block;
}

/* ─── MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 16px;
    overflow-y: auto;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    min-width: 0;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--ink);
}

.modal-icon {
    font-size: 2.5rem;
    text-align: center;
    font-family: 'Cormorant Garamond', serif;
    color: var(--accent);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
}

.modal-desc {
    font-size: 0.9rem;
    color: var(--ink-3);
    text-align: center;
    line-height: 1.5;
    margin: 0;
}

.modal-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--ink-3);
}

.modal-features li {
    padding-left: 4px;
}

.modal-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.modal-tab {
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-tab.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.authLoginF {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.modal-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 10px 14px;
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-btn-primary {
    width: 100%;
    background: var(--accent);
    border: none;
    padding: 11px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.modal-btn-primary:hover {
    opacity: 0.88;
}

.modal-btn-secondary {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    padding: 10px;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.modal-btn-tertiary {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    padding: 10px;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.modal-btn-tertiary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.modal-btn-google {
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    padding: 10px;
    color: #333;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: box-shadow 0.2s;
}

.modal-btn-google:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-divider {
    text-align: center;
    color: var(--ink-4);
    font-size: 0.8rem;
    position: relative;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.modal-divider::before {
    left: 0;
}

.modal-divider::after {
    right: 0;
}

.modal-error {
    color: #e05c5c;
    font-size: 0.85rem;
    text-align: center;
    margin: 0;
}

.modal-alt {
    font-size: 0.82rem;
    color: var(--ink-4);
    text-align: center;
    margin: 0;
}

.modal-alt a {
    color: var(--accent);
    text-decoration: none;
}

.modal-alt a:hover {
    text-decoration: underline;
}

.modal--user {
    max-width: 320px;
    align-items: center;
    text-align: center;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-email {
    font-size: 0.88rem;
    color: var(--ink-3);
    margin: 0;
}

.sub-status {
    width: 100%;
}

.sub-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.sub-badge--active {
    background: rgba(80, 180, 100, 0.15);
    color: #5ab46a;
    border: 1px solid rgba(80, 180, 100, 0.3);
}

.sub-badge--inactive {
    background: rgba(200, 100, 100, 0.10);
    color: #c87070;
    border: 1px solid rgba(200, 100, 100, 0.2);
}

.modal-free-note {
    background: rgba(177, 131, 32, 0.08);
    border: 1px solid rgba(177, 131, 32, 0.22);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12.5px;
    color: var(--ink-2);
    line-height: 1.5;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-free-badge {
    display: inline-block;
    background: rgba(177, 131, 32, 0.2);
    color: var(--accent-2);
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 8px;
    width: fit-content;
    margin-bottom: 2px;
}

/* ─── FREE WORDS SIDEBAR ─── */
.fw-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 199;
    opacity: 0;
    transition: opacity .25s ease;
}

.fw-backdrop.visible {
    display: block;
    opacity: 1;
}

.fw-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 300px;
    background: var(--surface);
    border-right: 1px solid var(--border-2);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1), box-shadow .28s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
}

.fw-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0, 0, 0, .5);
}

.fw-sidebar-inner {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}

.fw-sidebar-inner::-webkit-scrollbar {
    width: 4px;
}

.fw-sidebar-inner::-webkit-scrollbar-track {
    background: transparent;
}

.fw-sidebar-inner::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 4px;
}

.fw-sidebar-header {
    margin-bottom: 22px;
}

.fw-tab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 201;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-left: none;
    padding: 14px 10px 14px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: var(--ink-3);
    transition: left .28s cubic-bezier(.4, 0, .2, 1), background .15s, color .15s;
}

.fw-tab:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.fw-tab.open {
    left: 300px;
    background: var(--surface-3);
    color: var(--ink-2);
}

.fw-tab-logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.fw-tab-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.fw-tab-count {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent-2);
    font-family: 'Montserrat', sans-serif;
    border-radius: 8px;
    padding: 2px 5px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}

.fw-tab-arrow {
    color: var(--ink-4);
    transition: transform .28s ease;
    flex-shrink: 0;
}

.fw-tab.open .fw-tab-arrow {
    transform: rotate(180deg);
}

.free-badge {
    display: inline-block;
    background: rgba(177, 131, 32, 0.15);
    color: var(--accent-2);
    border: 1px solid rgba(177, 131, 32, 0.3);
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 2px 9px;
    margin-bottom: 9px;
}

.free-words-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
    line-height: 1.25;
}

.free-words-desc {
    font-size: 11.5px;
    color: var(--ink-4);
    line-height: 1.5;
}

.fw-pos-filter {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.fw-pos-btn {
    background: var(--surface-3);
    border: 1px solid var(--border-2);
    color: var(--ink-3);
    font-family: 'Montserrat', sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    padding: 4px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.fw-pos-btn:hover {
    color: var(--ink);
}

.fw-pos-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #F0EDE8;
    font-weight: 600;
}

.free-words-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.fw-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fw-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fw-group-icon {
    width: 13px;
    height: 13px;
    stroke: var(--ink-4);
    stroke-width: 1.6;
    flex-shrink: 0;
    display: block;
}

.fw-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.fw-group-count {
    font-size: 9.5px;
    color: var(--ink-4);
    background: var(--surface-3);
    border-radius: 8px;
    padding: 1px 6px;
    margin-left: 2px;
}

.fw-group-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-left: 18px;
}

.fw-chip {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--ink-2);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 400;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background .12s, color .12s, border-color .12s, transform .1s;
    white-space: nowrap;
}

.fw-chip:hover {
    background: var(--surface-3);
    color: var(--ink);
    border-color: rgba(177, 131, 32, .4);
    transform: translateY(-1px);
}

.fw-empty {
    font-size: 12px;
    color: var(--ink-4);
    padding: 12px 0;
}

/* --- Toast Notificación --- */
.toast-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #2e7d32;
    /* Un verde premium y oscuro */
    color: #ffffff;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    animation: slideInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.toast-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    margin-left: 8px;
    padding: 0;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.settings-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--ink);
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-action-btn:hover {
    background: var(--surface-3);
    border-color: var(--accent);
}

.settings-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

.advanced-config {
    opacity: 0.7;
    /* Menos protagonismo */
    transition: opacity 0.3s;
}

.advanced-config:focus-within,
.advanced-config:hover {
    opacity: 1;
}

.config-subtext {
    font-size: 12px;
    color: var(--ink-4);
    margin-bottom: 8px;
}

.ipa {
    color: var(--ink-4);
    font-size: 0.9rem;
}

/* ─── RESPONSIVE ─── */

/* ═══════════════════════════════════════════════════════
   STUDY DASHBOARD
   ═══════════════════════════════════════════════════════ */
#flashcardArea {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* ─── El modal grande ─── */
.study-dashboard {
    background: var(--bg);
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ─── Header del dashboard ─── */
.study-dashboard-header {
    display: flex;
    align-items: center;
    padding: 0 0 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

/* ─── Tabs de navegación (pill style) ─── */
.study-tabs {
    display: flex;
    gap: 4px;
}

.study-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ink-4);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    letter-spacing: 0.2px;
    border-radius: 6px 6px 0 0;
    position: relative;
    bottom: -1px;
}

.study-tab:hover {
    color: var(--ink-2);
    background: var(--surface-2);
}

.study-tab.active {
    color: var(--accent-2);
    border-bottom-color: var(--accent);
    background: var(--surface-2);
}

/* ─── Paneles ─── */
.study-panel {
    display: none;
    flex-direction: column;
    gap: 24px;
    flex: 1;
    padding: 28px;
}

.study-panel.active {
    display: flex;
}

#sessionConfig {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ─── Secciones internas ─── */
.home-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-section-title,
.study-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.study-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Stat grid ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: border-color 0.18s;
}

.stat-card:hover {
    border-color: var(--border-2);
}

.stat-number {
    font-family: 'Montserrat', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--ink-4);
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ─── Gráfico de barras de niveles ─── */
.level-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.level-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-bar-label {
    font-size: 12px;
    color: var(--ink-4);
    width: 52px;
    flex-shrink: 0;
}

.level-bar-track {
    flex: 1;
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}

.level-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(.4, 0, .2, 1);
}

.level-bar-count {
    font-size: 12px;
    color: var(--ink-3);
    min-width: 24px;
    text-align: right;
    font-weight: 600;
}

/* Colores por nivel */
.level-bar-row[data-level="0"] .level-bar-fill {
    background: #4a4a48;
}

.level-bar-row[data-level="1"] .level-bar-fill {
    background: linear-gradient(90deg, #8b6914, #a07a20);
}

.level-bar-row[data-level="2"] .level-bar-fill {
    background: linear-gradient(90deg, #4a7a8a, #5a9aaa);
}

.level-bar-row[data-level="3"] .level-bar-fill {
    background: linear-gradient(90deg, #3a7a5a, #4a9a6a);
}

.level-bar-row[data-level="4"] .level-bar-fill {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ─── Actividad reciente ─── */
.recent-activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-activity-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-3);
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.recent-empty {
    font-size: 13px;
    color: var(--ink-4);
    font-style: italic;
}

/* ─── Cards seleccionables (source & mode) ─── */
.source-options,
.mode-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.option-card {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border-2);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
}

.option-card:hover {
    background: var(--surface-2);
    border-color: var(--ink-4);
}

.option-card.selected {
    border-color: var(--accent);
    background: var(--surface-2);
}

.option-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    pointer-events: none;
}

.option-card-desc {
    font-size: 11.5px;
    color: var(--ink-4);
    line-height: 1.5;
    pointer-events: none;
}

/* ─── Botón Comenzar sesión ─── */
.start-session-btn {
    background: var(--accent);
    border: none;
    color: #F0EDE8;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600;
    padding: 16px 32px;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.18s, transform 0.12s;
    align-self: flex-start;
}

.start-session-btn:hover {
    background: var(--accent-2);
    transform: translateY(-1px);
}

.start-session-btn:active {
    transform: translateY(0);
}

/* ─── Área de sesión activa ─── */
.session-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

.session-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
}

.session-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--surface-3);
    border-radius: 2px;
    overflow: hidden;
}

.session-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 2px;
    transition: width 0.4s ease;
}

.session-counter {
    font-size: 13px;
    color: var(--ink-4);
    font-weight: 600;
    white-space: nowrap;
}

/* ─── Study card (flashcard 3D) ─── */
.study-card-container {
    perspective: 1200px;
    width: 100%;
    max-width: 640px;
    height: 300px;
    cursor: pointer;
}

.study-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(.4, 0, .2, 1);
}

.study-card-container.flipped .study-card {
    transform: rotateY(180deg);
}

.study-card-front,
.study-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border-2);
    padding: 32px 28px;
    text-align: center;
}

.study-card-back {
    transform: rotateY(180deg);
    justify-content: center;
}

.sc-hint {
    font-size: 11px;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.sc-word {
    font-family: 'Cormorant Garamond', serif;
    font-size: 56px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.sc-approx {
    font-size: 15px;
    color: var(--accent-2);
    font-weight: 500;
}

.sc-ipa {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--ink-4);
    background: var(--surface-2);
    padding: 3px 10px;
    border: 1px solid var(--border);
}

.sc-divider {
    border: none;
    border-top: 1px solid var(--border);
    width: 60%;
    margin: 4px 0;
}

.sc-translation {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

/* ─── Botones de respuesta ─── */
.response-btns {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 640px;
}

.resp-btn {
    flex: 1;
    padding: 14px 10px;
    border: 1px solid transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, filter 0.15s;
    letter-spacing: 0.2px;
}

.resp-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.15);
}

.resp-btn:active {
    transform: translateY(0);
}

.resp-btn--no {
    background: rgba(200, 80, 70, 0.15);
    border-color: rgba(200, 80, 70, 0.3);
    color: #d87878;
}

.resp-btn--almost {
    background: rgba(200, 160, 50, 0.15);
    border-color: rgba(200, 160, 50, 0.3);
    color: #c8a050;
}

.resp-btn--yes {
    background: rgba(80, 180, 100, 0.15);
    border-color: rgba(80, 180, 100, 0.3);
    color: #5ab46a;
}

/* ─── Opción múltiple ─── */
.mc-question {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mc-hint {
    font-size: 11px;
    color: var(--ink-4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.mc-word {
    margin-bottom: 0.5em;
    font-family: 'Cormorant Garamond', serif;
    font-size: 56px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.mc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 520px;
}

.mc-opt {
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--ink-2);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 18px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    text-align: center;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-opt:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--ink-4);
    color: var(--ink);
}

.mc-opt.correct {
    background: rgba(80, 180, 100, 0.15);
    border-color: rgba(80, 180, 100, 0.5);
    color: #5ab46a;
}

.mc-opt.incorrect {
    background: rgba(200, 80, 70, 0.12);
    border-color: rgba(200, 80, 70, 0.35);
    color: #d87878;
}

/* ─── Botón terminar sesión ─── */
.end-session-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--ink-4);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.18s;
    margin-top: 8px;
}

.end-session-btn:hover {
    border-color: var(--ink-4);
    color: var(--ink-3);
}

/* ─── Panel Favoritas ─── */
.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.favorites-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-4);
}

.favorites-empty-icon {
    font-size: 40px;
    opacity: 0.3;
}

.favorites-empty p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-4);
}

/* ─── RESPONSIVE MOBILE (≤600px) ─── */

/* ─── Cards de favoritas ─── */
.fav-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}

.fav-card:hover {
    border-color: var(--border-2);
}

.fav-word {
    font-size: 18px;
    font-weight: 500;
    color: var(--ink-2);
    flex: 1;
}

.fav-actions {
    display: flex;
    gap: 6px;
}

.fav-study-btn,
.fav-remove-btn {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--ink-4);
    font-size: 14px;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.fav-study-btn:hover {
    border-color: var(--accent);
    color: var(--accent-2);
    background: var(--accent-dim);
}

.fav-remove-btn:hover {
    border-color: rgba(200, 80, 70, 0.4);
    color: #d87878;
    background: rgba(200, 80, 70, 0.08);
}

/* ─── Actividad reciente ─── */
.recent-word {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-2);
    flex: 1;
}

.recent-level {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-2);
    background: rgba(177, 131, 32, 0.12);
    border: 1px solid rgba(177, 131, 32, 0.2);
    padding: 2px 7px;
    letter-spacing: 0.3px;
}

.recent-ago {
    font-size: 11px;
    color: var(--ink-4);
    white-space: nowrap;
}

/* ─── Botones de respuesta bloqueados (antes de flipear) ─── */
.resp-btn.locked {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ─── Resumen de sesión ─── */
.session-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 40px 20px;
    text-align: center;
    animation: fadeInUp 0.3s ease-out forwards;
}

.summary-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 26px;
    font-weight: 600;
    color: var(--ink);
}

.summary-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 20px 28px;
    min-width: 90px;
}

.summary-stat-num {
    font-family: 'Montserrat', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}

.summary-stat-num.summary-correct {
    color: #5ab46a;
}

.summary-stat-num.summary-incorrect {
    color: #d87878;
}

.summary-stat-label {
    font-size: 11px;
    color: var(--ink-4);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --- SEO --- */
.seo-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    /* Asumiendo que tenés variables, o usá un color claro */
    text-align: center;
}

.seo-static-content {
    max-width: 800px;
    margin: 4rem auto 2rem auto;
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    /* Color tenue para no distraer */
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    line-height: 1.6;
}

.seo-static-content h2,
.seo-static-content h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.seo-static-content p {
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════
   LANDING PAGE 
   ═══════════════════════════════════════════════════════ */

.landing-body {
    background: var(--bg);
}

.landing-nav {
    justify-content: space-between;
}

/* ── Hero Section ── */
.landing-hero {
    max-width: 1180px;
    margin: 4rem auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    gap: 3rem;
    align-items: flex-start;
}

.landing-title {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.landing-subtitle {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--ink-3);
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.hero-note {
    font-size: 1.2rem;
    color: var(--ink-4);
    font-family: var(--font-serif);
}

/* ── Mockup Visual (El cuadro oscuro de datos) ── */
.mockup-window {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.mockup-header {
    background: var(--surface-2);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-2);
}

.mockup-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-2);
}

.mockup-title {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-4);
}

.mockup-body {
    padding: 2rem;
}

.mockup-word {
    font-family: var(--font-serif);
    font-size: 3.5rem;
    color: var(--ink);
    margin-bottom: 1.5rem;
    line-height: 1;
}

.mockup-data p {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.m-key {
    color: var(--accent);
    font-weight: 600;
}

.m-val {
    color: var(--ink-2);
}

.m-divider {
    border: none;
    border-top: 1px dashed var(--border-2);
    margin: 1.5rem 0;
}

.m-text {
    color: var(--ink-4);
}

/* ── CTA Final ── */
.landing-bottom-cta {
    max-width: 800px;
    margin: 6rem auto;
    padding: 0 20px;
}

.cta-box {
    padding: 1rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.cta-box h2 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    color: var(--ink);
}

.cta-box p {
    font-size: 1.1rem;
    color: var(--ink-3);
    max-width: 500px;
    line-height: 1.6;
}

.cta-large {
    font-size: 1.1rem;
    padding: 16px 36px;
    margin-top: 1rem;
}

/* Responsive Landing */

/* ── Mockup Visual (UI Real) ── */
.hero-visual {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.landing-mockup {
    width: 112%;
    transform: scale(0.85);
    transform-origin: top right;
    margin-bottom: -15%;

    background: var(--bg);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.03);
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

/* Ajustes finos de padding para simular el layout principal */
.mockup-search {
    padding: 24px 24px 0 !important;
    max-width: 100% !important;
}

.mockup-results {
    padding: 24px 24px 32px !important;
    max-width: 100% !important;
}

/* Responsivo para el Mockup */


/* Oculto en desktop — activado dentro del @media 600px */
.mobile-bottom-nav {
    display: none;
}

.mobile-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--t-base) var(--ease-snappy);
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE — todos los @media en un solo lugar
   Breakpoints: 900px · 768px · 600px · 400px
   ═══════════════════════════════════════════════════════ */


/* ── 900px · Tablet · Landing ── */

@media (max-width: 900px) {

    /* --- Landing · hero y layout --- */

    .landing-hero {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .hero-actions {
        align-items: center;
        width: 100%;
    }

    .feature-grid-large {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .landing-title {
        font-size: 2.8rem;
    }


    /* --- Landing · mockup visual --- */

    .landing-hero {
        grid-template-columns: 1fr;
        align-items: center;
    }

    .hero-visual {
        justify-content: center;
    }

    .landing-mockup {
        width: 100%;
        transform: scale(0.90);
        transform-origin: top center;
        margin-bottom: -10%;
    }

}


/* ── 768px · Tablet · Resultado de palabra ── */

@media (max-width: 768px) {

    /* --- Resultado de palabra --- */

    .word-hero__main {
        grid-template-columns: 1fr;
    }

    .word-hero__right {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .word-grid {
        grid-template-columns: 1fr;
    }

}


/* ── 600px · Móvil ── */

@media (max-width: 600px) {

    /* --- Settings panel --- */


    .settings-action-btn {
        padding: 8px;
        font-size: 13px;
    }



    /* --- Modal · búsqueda · inputs · teclado --- */

    .modal {
        padding: 24px 18px;
        gap: 14px;
    }

    .search-box {
        display: grid;
    }

    .main-input,
    .dic-input {
        font-size: 16px;
        min-width: 0;
    }

    .examples-row,
    .history-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .logo-mark {
        width: auto;
        height: 30px;
    }

    .examples-row::-webkit-scrollbar,
    .history-row::-webkit-scrollbar {
        display: none;
    }

    .example-chip,
    .history-item {
        flex-shrink: 0;
    }

    .keyboard-toggle-btn span {
        display: none;
    }

    .kb-key {
        min-width: 30px;
        height: 36px;
        font-size: 13px;
    }

    .kb-key--wide {
        min-width: 50px;
    }

    .input-row {
        flex-wrap: wrap;
        padding: 6px 8px 6px 14px;
    }

    .main-input {
        flex: 1 1 100%;
        order: -1;
    }

    .keyboard-toggle-btn {
        flex: 0 0 auto;
    }

    .search-btn {
        flex: 1;
        text-align: center;
    }

    .word-title {
        font-size: 40px;
    }

    .word-title,
    .dic-detail-word,
    .dic-word {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .dic-word {
        font-size: 15px;
    }

    .dic-detail-word {
        font-size: 30px;
    }

    .dic-def {
        min-width: 0;
        flex-basis: 100%;
    }

    .seo-title {
        font-size: 1.5em;
    }

    .fw-sidebar {
        width: 100%;
        height: 72vh;
        top: auto;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid var(--border-2);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .fw-sidebar.open {
        transform: translateY(0);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, .5);
    }

    .fw-tab {
        top: auto;
        bottom: 24px;
        left: 16px;
        transform: none;
        flex-direction: row;
        padding: 9px 14px 9px 10px;
        border-radius: 5px;
        border: 1px solid var(--border-2);
        box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
    }

    .fw-tab.open {
        left: 16px;
        border-radius: 20px;
    }

    .fw-tab-label {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 10.5px;
    }

    .fw-tab-arrow {
        transform: rotate(-90deg);
    }

    .fw-tab.open .fw-tab-arrow {
        transform: rotate(90deg);
    }


    /* --- Study dashboard · flashcards · sesión --- */


    /* Modal fullscreen */
    .study-dashboard {
        width: 100vw;
        height: 100dvh;
        max-width: 100%;
        max-height: 100%;
        border: none;
        border-radius: 0;
    }

    /* study-dashboard-header se mantiene en su lugar */
    .study-dashboard-header {
        align-items: center;
        padding: 10px 20px;
    }

    /* study-tabs es nav interna del panel — permanece en el header, no va al fondo */
    .study-tabs {
        display: flex;
        gap: 0;
        width: 100%;
    }

    .study-tab {
        flex: 1;
        text-align: center;
        padding: 10px 6px;
        font-size: 12px;
    }

    .study-panel {
        padding: 18px 16px;
        padding-bottom: 24px;
    }

    /* Stat grid en 1 columna */
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        flex-direction: row;
        justify-content: space-between;
        padding: 14px 16px;
    }

    .stat-number {
        font-size: 28px;
    }

    /* Source/mode en columna */
    .source-options,
    .mode-options {
        grid-template-columns: 1fr;
    }

    /* Flashcard más compacta */
    .study-card-container {
        height: 200px;
    }

    .end-session-btn {
        margin-top: 0px;
    }

    .sc-word {
        font-size: 38px;
    }

    .sc-approx {
        font-size: 13px;
    }

    .sc-translation {
        font-size: 14px;
    }

    .mc-word {
        font-size: 40px;
    }

    /* Botones de respuesta en columna */
    .response-btns {
        flex-direction: column;
    }

    .mc-grid {
        grid-template-columns: 1fr;
    }

    .start-session-btn {
        align-self: stretch;
        text-align: center;
    }


    /* --- Resumen de sesión --- */

    .summary-stats {
        gap: 10px;
    }

    .summary-stat {
        padding: 14px 16px;
        min-width: 70px;
    }

    .summary-stat-num {
        font-size: 28px;
    }


    /* --- Landing · mockup --- */

    .landing-mockup {
        width: 100%;
        transform: scale(0.95);
        margin-bottom: -5%;
    }


    /* --- Nav móvil (bottom nav · fw-tab) --- */


    /* --- Settings panel --- */


    /* --- Settings panel --- */

    .settings-action-btn {
        padding: 8px;
        font-size: 13px;
    }

    /* --- Modal · búsqueda · inputs · teclado --- */

    .modal {
        padding: 24px 18px;
        gap: 14px;
    }

    .search-box {
        display: grid;
    }

    .main-input,
    .dic-input {
        font-size: 16px;
        min-width: 0;
    }

    .examples-row,
    .history-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .logo-mark {
        width: auto;
        height: 30px;
    }

    .examples-row::-webkit-scrollbar,
    .history-row::-webkit-scrollbar {
        display: none;
    }

    .example-chip,
    .history-item {
        flex-shrink: 0;
    }

    .keyboard-toggle-btn span {
        display: none;
    }

    .kb-key {
        min-width: 30px;
        height: 36px;
        font-size: 13px;
    }

    .kb-key--wide {
        min-width: 50px;
    }

    .input-row {
        flex-wrap: wrap;
        padding: 6px 8px 6px 14px;
    }

    .main-input {
        flex: 1 1 100%;
        order: -1;
    }

    .keyboard-toggle-btn {
        flex: 0 0 auto;
    }

    .search-btn {
        flex: 1;
        text-align: center;
    }

    .word-title {
        font-size: 40px;
    }

    .word-title,
    .dic-detail-word,
    .dic-word {
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .dic-word {
        font-size: 15px;
    }

    .dic-detail-word {
        font-size: 30px;
    }

    .dic-def {
        min-width: 0;
        flex-basis: 100%;
    }

    .fw-sidebar {
        width: 100%;
        height: 72vh;
        top: auto;
        bottom: 0;
        left: 0;
        border-right: none;
        border-top: 1px solid var(--border-2);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .fw-sidebar.open {
        transform: translateY(0);
        box-shadow: 0 -8px 32px rgba(0, 0, 0, .5);
    }

    .fw-tab {
        top: auto;
        bottom: 24px;
        left: 16px;
        transform: none;
        flex-direction: row;
        padding: 9px 14px 9px 10px;
        border-radius: 5px;
        border: 1px solid var(--border-2);
        box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
    }

    .fw-tab.open {
        left: 16px;
        border-radius: 20px;
    }

    .fw-tab-label {
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 10.5px;
    }

    .fw-tab-arrow {
        transform: rotate(-90deg);
    }

    .fw-tab.open .fw-tab-arrow {
        transform: rotate(90deg);
    }

    /* --- Resumen de sesión --- */

    .summary-stats {
        gap: 10px;
    }

    .summary-stat {
        padding: 14px 16px;
        min-width: 70px;
    }

    .summary-stat-num {
        font-size: 28px;
    }

    /* --- Landing · mockup --- */

    .landing-mockup {
        width: 100%;
        transform: scale(0.95);
        margin-bottom: -5%;
    }

    /* --- Nav móvil (bottom nav · fw-tab) --- */

    /* Ocultar solo el nav central del header, mantener brand y actions */
    .app-header__nav {
        display: none;
    }

    /* Ocultar fw-tab flotante — pasa a ser ítem del bottom nav */
    .fw-tab {
        display: none !important;
    }

    /* Padding para que el contenido no quede bajo el nav */
    .main-content {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
        min-height: 100dvh;
    }

    /* ── Bottom Nav ── */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: var(--z-overlay);
        background: var(--bg);
        border-top: 1px solid var(--border);
        height: calc(56px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        align-items: stretch;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: transparent;
        border: none;
        color: var(--ink-4);
        font-family: var(--font-sans);
        font-size: 9px;
        font-weight: 500;
        letter-spacing: var(--tracking-label);
        text-transform: uppercase;
        cursor: pointer;
        position: relative;
        transition: color var(--t-base) var(--ease-snappy);
        padding: 0;
    }

    .mobile-nav-item[aria-current="page"] {
        color: var(--accent);
        font-weight: 600;
    }

    .mobile-nav-item[aria-current="page"]::before {
        opacity: 1;
    }

    .mobile-nav-item svg,
    .mobile-nav-item i {
        width: 18px;
        height: 18px;
        color: inherit;
    }

    .mobile-nav-badge {
        position: absolute;
        top: 6px;
        left: calc(50% + 6px);
        background: var(--accent);
        color: #0D0D0C;
        font-family: var(--font-mono);
        font-size: 9px;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 3px;
        line-height: 1;
    }

    .footer {
        display: none;
    }

}


/* ── 400px · Móvil pequeño ── */

@media (max-width: 400px) {

    /* --- Pantallas muy pequeñas --- */
    .footer {
        display: none;
    }

    .main-input {
        font-size: 15px;
    }

    .api-key-input {
        min-width: 0;
        flex: 1 1 100%;
    }

    .save-key-btn,
    .clear-key-btn {
        flex: 1;
        margin-left: 0;
    }

    .logo-mark {
        width: auto;
        height: 20px;
    }


}