:root {
    --bg: #f5f7ff;
    --bg-soft: rgba(255, 255, 255, 0.72);
    --panel: rgba(255, 255, 255, 0.52);
    --panel-strong: rgba(255, 255, 255, 0.76);
    --line: rgba(111, 130, 190, 0.16);
    --line-strong: rgba(107, 92, 255, 0.28);
    --text: #13203a;
    --muted: #667390;
    --accent: #6b5cff;
    --accent-strong: #3d7dff;
    --shadow: 0 24px 80px rgba(86, 96, 140, 0.16);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 14%, rgba(106, 92, 255, 0.18), transparent 24%),
        radial-gradient(circle at 84% 10%, rgba(61, 125, 255, 0.2), transparent 22%),
        radial-gradient(circle at 72% 72%, rgba(174, 196, 255, 0.22), transparent 26%),
        linear-gradient(180deg, #fcfdff 0%, #eef3ff 52%, #f7f9ff 100%);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

button,
input,
a {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

.page-shell {
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(24px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
}

body.library-mode .site-header {
    display: none;
}

body.library-mode {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.library-mode .page-shell {
    padding-top: max(16px, env(safe-area-inset-top));
}

.ambient {
    position: fixed;
    border-radius: 999px;
    filter: blur(14px);
    opacity: 0.5;
    pointer-events: none;
}

.ambient-a {
    width: 300px;
    height: 300px;
    top: -70px;
    left: -60px;
    background: rgba(107, 92, 255, 0.16);
}

.ambient-b {
    width: 260px;
    height: 260px;
    right: -80px;
    top: 160px;
    background: rgba(61, 125, 255, 0.18);
}

.ambient-c {
    width: 220px;
    height: 220px;
    bottom: 30px;
    left: 18%;
    background: rgba(177, 167, 255, 0.22);
}

.site-header,
.landing-view,
.library-view {
    position: relative;
    z-index: 1;
}

.site-header {
    max-width: 1220px;
    margin: 0 auto 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--line);
    border-radius: 999px;
    backdrop-filter: blur(24px) saturate(155%);
    -webkit-backdrop-filter: blur(24px) saturate(155%);
    box-shadow:
        0 8px 30px rgba(108, 122, 170, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #07111f;
    background: linear-gradient(135deg, #6b5cff 0%, #3d7dff 100%);
    box-shadow:
        0 12px 30px rgba(107, 92, 255, 0.22),
        inset 0 1px 1px rgba(255, 255, 255, 0.6);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-note {
    display: inline-flex;
    align-items: center;
    padding: 11px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.brand small {
    color: var(--muted);
    font-size: 0.82rem;
}

.secondary-action,
.category-tab,
.download-link {
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.secondary-action {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
}

.secondary-action {
    color: var(--text);
    background: rgba(255, 255, 255, 0.48);
    border: 1px solid var(--line);
    box-shadow:
        0 10px 30px rgba(107, 123, 170, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.secondary-action:hover,
.category-tab:hover,
.download-link:hover {
    transform: translateY(-1px);
    border-color: rgba(107, 92, 255, 0.28);
}

main {
    max-width: 1220px;
    margin: 0 auto;
}

.hero-grid,
.intro-grid,
.instruction-band,
.library-hero,
.library-toolbar,
.section-heading {
    display: grid;
    gap: 22px;
}

.hero-grid,
.intro-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    align-items: stretch;
}

.hero-card,
.instruction-card,
.library-hero,
.library-toolbar,
.category-tabs,
.app-card,
.empty-state {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.48)),
        var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(24px) saturate(155%);
    -webkit-backdrop-filter: blur(24px) saturate(155%);
    box-shadow: var(--shadow);
}

.hero-card,
.instruction-card,
.library-hero,
.library-toolbar,
.empty-state {
    border-radius: var(--radius-xl);
}

.hero-main,
.hero-panel,
.instruction-card,
.library-hero,
.library-toolbar,
.empty-state {
    padding: 28px;
}

.eyebrow,
.panel-label,
.app-category {
    margin: 0 0 12px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
}

.hero-main h1,
.library-hero h2,
.section-heading h3,
.instruction-card h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    line-height: 0.98;
}

.hero-main h1 {
    max-width: 12ch;
    font-size: clamp(2.7rem, 5vw, 5.6rem);
}

.hero-copy,
.instruction-card p,
.step-list p,
.results-label,
.app-description {
    color: var(--muted);
    line-height: 1.65;
}

.hero-copy {
    max-width: 62ch;
    margin: 22px 0 0;
    font-size: 1.02rem;
}

.hero-actions,
.hero-badges,
.library-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions {
    margin-top: 28px;
}

.hero-badges {
    margin-top: 30px;
}

.hero-badges span,
.app-version {
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.46);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.showcase-card,
.install-flow-card {
    padding: 28px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.5)),
        var(--panel);
    backdrop-filter: blur(24px) saturate(155%);
    -webkit-backdrop-filter: blur(24px) saturate(155%);
    box-shadow: var(--shadow);
}

.showcase-card {
    display: grid;
    gap: 18px;
}

.showcase-card h2,
.install-flow-header h2 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    line-height: 1.02;
    font-size: clamp(1.7rem, 3vw, 2.65rem);
}

.showcase-card p,
.showcase-copy p,
.step-body p,
.guide-visual small {
    color: var(--muted);
    line-height: 1.6;
}

.showcase-shot {
    min-height: 420px;
}

.showcase-image {
    width: 100%;
    height: 100%;
    min-height: 220px;
    border-radius: 28px;
    object-fit: cover;
    border: 1px solid rgba(126, 141, 198, 0.18);
    background: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 14px 34px rgba(107, 92, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.shot-placeholder span,
.guide-visual span,
.install-steps strong,
.app-name {
    display: block;
    font-size: 1.02rem;
}

.install-flow-card {
    margin-top: 22px;
}

.install-flow-header {
    max-width: 760px;
}

.install-state-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 11px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(107, 92, 255, 0.12), rgba(61, 125, 255, 0.14));
    border: 1px solid rgba(107, 92, 255, 0.18);
    color: #4d43bf;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.install-flow-grid {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.install-list-card {
    padding: 24px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.36);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.install-steps {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: grid;
    gap: 14px;
}

.install-steps li {
    display: grid;
    grid-template-columns: minmax(84px, 112px) 1fr;
    gap: 16px;
    align-items: center;
}

.step-visual {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 24px;
    display: grid;
    place-items: center;
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(107, 92, 255, 0.1), rgba(61, 125, 255, 0.08)),
        rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(107, 92, 255, 0.16);
    box-shadow:
        0 10px 28px rgba(103, 107, 180, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.step-visual img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.step-body p,
.results-label,
.app-description {
    margin: 6px 0 0;
}

.library-view {
    display: grid;
    gap: 14px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    width: 100%;
    min-width: 0;
}

.library-hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.7fr);
    align-items: end;
}

.library-hero-copy {
    max-width: 760px;
}

.library-hero h2 {
    font-size: clamp(2rem, 4vw, 3.8rem);
    max-width: 11ch;
}

.library-summary article {
    flex: 1;
    min-width: 130px;
    padding: 18px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.34);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.library-summary strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 2rem;
}

.library-summary span {
    color: var(--muted);
}

.library-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.library-tabs-shell {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 20;
    padding: 10px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.58)),
        var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    box-shadow:
        0 14px 28px rgba(97, 108, 168, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.category-tabs-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    width: 100%;
}

.category-tabs-scroll::-webkit-scrollbar {
    display: none;
}

.category-tabs {
    display: flex;
    gap: 8px;
    padding: 2px;
    border-radius: 999px;
    scroll-snap-type: x proximity;
    width: max-content;
    min-width: 100%;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tabs::after {
    content: "";
    flex: 0 0 18px;
}

.category-tab {
    min-width: 108px;
    text-align: left;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.44);
    color: var(--text);
    border-radius: 999px;
    padding: 9px 11px;
    cursor: pointer;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.category-tab strong,
.category-tab span {
    display: block;
}

.category-tab strong {
    font-size: 0.84rem;
}

.category-tab span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.1;
}

.category-tab.active {
    background: linear-gradient(135deg, rgba(107, 92, 255, 0.14), rgba(61, 125, 255, 0.18));
    border-color: rgba(107, 92, 255, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.section-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
}

.section-heading h3 {
    font-size: clamp(1.45rem, 2.3vw, 2.2rem);
}

.apps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.app-card {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 0;
    border-radius: 18px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    box-shadow:
        0 18px 34px rgba(95, 107, 170, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.app-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 0;
}

.app-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    background:
        linear-gradient(180deg, rgba(107, 92, 255, 0.1), rgba(61, 125, 255, 0.06)),
        rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(107, 92, 255, 0.12);
    box-shadow:
        0 14px 28px rgba(107, 92, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.app-card-body {
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
    display: grid;
    gap: 2px;
    padding-top: 0;
}

.app-name {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.1;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.app-version-line {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.2;
}

.download-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 82px;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.74rem;
    color: #ffffff;
    background: linear-gradient(135deg, #6b5cff 0%, #3d7dff 100%);
    box-shadow: 0 14px 30px rgba(107, 92, 255, 0.22);
    white-space: nowrap;
}

.download-link.disabled {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.38);
    box-shadow: none;
}

.empty-state {
    padding: 24px;
}

.empty-state strong {
    display: block;
    font-size: 1.1rem;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
}

code {
    font-family: "Space Grotesk", sans-serif;
}

@media (max-width: 900px) {
    .site-header {
        border-radius: 28px;
        align-items: stretch;
        flex-direction: column;
    }

    .hero-grid,
    .intro-grid,
    .instruction-band,
    .install-flow-grid,
    .section-heading {
        grid-template-columns: 1fr;
    }

    .hero-main h1,
    .library-hero h2 {
        max-width: none;
    }

    .showcase-shot {
        min-height: 300px;
    }

    .library-tabs-shell {
        top: 8px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-main,
    .hero-panel,
    .instruction-card,
    .showcase-card,
    .install-flow-card,
    .install-list-card,
    .empty-state {
        padding: 22px;
    }

    .hero-actions,
    .library-summary {
        flex-direction: column;
    }

    .secondary-action {
        width: 100%;
        justify-content: center;
    }

    .header-note {
        justify-content: center;
    }

    .install-steps li {
        grid-template-columns: 72px 1fr;
        align-items: start;
    }

    .library-view {
        gap: 12px;
    }

    .library-tabs-shell {
        top: 6px;
        padding: 8px;
    }

    .category-tab {
        min-width: 96px;
        padding: 8px 9px;
    }

    .section-heading {
        gap: 6px;
    }

    .results-label {
        font-size: 0.88rem;
    }

    .apps-grid {
        gap: 8px;
    }

    .app-card {
        gap: 8px;
        padding: 10px;
        grid-template-columns: 46px 1fr auto;
    }

    .app-icon {
        width: 46px;
        height: 46px;
        border-radius: 14px;
        font-size: 1.15rem;
    }

    .app-card-footer {
        padding-top: 0;
    }

    .download-link {
        min-width: 76px;
        padding: 7px 9px;
        font-size: 0.7rem;
    }
}

/* ── Bloquear landscape en modo standalone ─────────────────── */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body.library-mode .page-shell,
    body.library-mode main {
        display: none;
    }

    body.library-mode::after {
        content: "Gira tu iPhone a modo vertical para usar DavidiOS Apps";
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 32px;
        height: 100vh;
        font-family: "Manrope", sans-serif;
        font-size: 1rem;
        color: var(--muted);
        background: var(--bg, #f5f7ff);
    }
}