@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/ubuntu.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --bg-1: #070715;
    --bg-2: #131b46;
    --bg-3: #341b63;
    --text-primary: #f2f5fb;
    --text-secondary: rgba(227, 233, 245, 0.76);
    --glass-bg: rgba(11, 20, 44, 0.48);
    --glass-bg-soft: rgba(34, 30, 70, 0.3);
    --glass-border: rgba(207, 220, 241, 0.27);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(198, 214, 242, 0.16);
    --card-hover: rgba(216, 228, 248, 0.46);
    --accent: #c6d6f5;
    --accent-warm: #d6bc8f;
}

html {
    position: relative;
}

html::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.78) 0 1px, transparent 2px),
        radial-gradient(circle at 26% 64%, rgba(207, 229, 255, 0.64) 0 1px, transparent 2px),
        radial-gradient(circle at 44% 36%, rgba(255, 255, 255, 0.72) 0 1px, transparent 2px),
        radial-gradient(circle at 58% 82%, rgba(210, 181, 255, 0.62) 0 1px, transparent 2px),
        radial-gradient(circle at 76% 28%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
        radial-gradient(circle at 88% 72%, rgba(194, 222, 255, 0.58) 0 1px, transparent 2px);
    background-size: 340px 340px, 460px 460px, 620px 620px, 760px 760px, 980px 980px, 1240px 1240px;
    opacity: 0.46;
    animation: starDrift 80s linear infinite, starTwinkleSlow 18s ease-in-out infinite alternate;
}

html::after {
    content: '';
    position: fixed;
    top: 12%;
    left: 78%;
    width: 180px;
    height: 2px;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transform: rotate(-24deg) translate3d(0, 0, 0);
    transform-origin: right center;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(210, 232, 255, 0.98) 55%, rgba(255, 255, 255, 0.1));
    filter: drop-shadow(0 0 8px rgba(181, 214, 255, 0.86));
    animation: shootingStar 19s linear infinite;
}

body {
    font-family: 'Ubuntu', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-1);
    background-image:
        radial-gradient(ellipse at 50% 46%, rgba(168, 120, 255, 0.34), transparent 56%),
        radial-gradient(circle at 8% 26%, rgba(92, 141, 255, 0.66), transparent 41%),
        radial-gradient(circle at 84% 24%, rgba(230, 96, 255, 0.58), transparent 43%),
        radial-gradient(circle at 42% 72%, rgba(96, 210, 255, 0.3), transparent 40%),
        linear-gradient(140deg, var(--bg-1) 0%, var(--bg-2) 52%, var(--bg-3) 100%);
    background-blend-mode: screen, screen, screen, screen, normal;
    background-repeat: no-repeat;
    background-size: 130% 130%, 125% 125%, 140% 140%, 130% 130%, 100% 100%;
    background-position: center center;
    transition: background-position 0.1s ease;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 2rem 1rem;
    position: relative;
    isolation: isolate;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body::before {
    background:
        radial-gradient(circle at 12% 20%, rgba(140, 188, 255, 0.46), transparent 26%),
        radial-gradient(circle at 82% 18%, rgba(239, 122, 255, 0.5), transparent 28%),
        radial-gradient(circle at 58% 82%, rgba(131, 110, 255, 0.4), transparent 26%);
    filter: blur(28px);
    mix-blend-mode: screen;
    animation: nebulaMove 18s ease-in-out infinite alternate;
}

body::after {
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.95) 0 1.4px, transparent 2.4px),
        radial-gradient(circle at 64% 38%, rgba(198, 225, 255, 0.9) 0 1.3px, transparent 2.3px),
        radial-gradient(circle at 42% 72%, rgba(255, 255, 255, 0.88) 0 1.3px, transparent 2.3px),
        radial-gradient(circle at 78% 18%, rgba(210, 181, 255, 0.8) 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 24% 58%, rgba(255, 255, 255, 0.82) 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 86% 76%, rgba(192, 220, 255, 0.78) 0 1.1px, transparent 2.1px),
        radial-gradient(circle at 34% 14%, rgba(255, 255, 255, 0.76) 0 1px, transparent 2px),
        radial-gradient(circle at 56% 54%, rgba(255, 255, 255, 0.68) 0 1px, transparent 2px),
        radial-gradient(circle at 92% 46%, rgba(210, 181, 255, 0.7) 0 1px, transparent 2px);
    background-size: 280px 280px, 380px 380px, 480px 480px, 560px 560px, 700px 700px, 840px 840px, 980px 980px, 1120px 1120px, 1260px 1260px;
    opacity: 0.72;
    animation: nebulaMove 20s ease-in-out infinite alternate-reverse, starPulse 14s ease-in-out infinite alternate;
}

.content-container {
    position: relative;
    overflow: hidden;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.2), var(--glass-bg-soft) 18%, var(--glass-bg) 68%);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(120%);
    -webkit-backdrop-filter: blur(22px) saturate(120%);
    padding: 46px;
    border-radius: 28px;
    box-shadow:
        0 30px 70px rgba(2, 8, 18, 0.58),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    text-align: center;
    width: min(1040px, 90vw);
}

.content-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
}

.content-container::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(120% 120% at 100% 0%, rgba(214, 188, 143, 0.1), transparent 36%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 26%);
}

.welcome-text {
    margin-bottom: 2.5rem;
}

.welcome-text h1 {
    font-size: clamp(2.2rem, 4.7vw, 3.35rem);
    margin-bottom: 0.45rem;
    letter-spacing: 0.015em;
    text-wrap: balance;
    text-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}

.welcome-text p {
    margin: 0 auto;
    max-width: 640px;
    color: var(--text-secondary);
    font-size: clamp(1.02rem, 1.9vw, 1.18rem);
    line-height: 1.5;
}

.main-icons-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 1.1rem;
}

.main-icon {
    position: relative;
    isolation: isolate;
    text-align: center;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: linear-gradient(180deg, var(--card-bg), rgba(255, 255, 255, 0.01));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.11),
        0 8px 18px rgba(2, 8, 18, 0.26);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.main-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(214, 188, 143, 0.28), rgba(255, 255, 255, 0.08));
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    opacity: 0.72;
    pointer-events: none;
}

.main-icon a {
    min-height: 286px;
    padding: 1.3rem 1rem;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.65rem;
}

.main-icon img {
    width: clamp(112px, 13vw, 148px);
    height: clamp(112px, 13vw, 148px);
    transition: transform 0.22s ease, opacity 0.22s ease, filter 0.22s ease;
    filter: opacity(0.92) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
}

.main-icon:hover {
    transform: translateY(-4px);
    border-color: var(--card-hover);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.23),
        0 14px 28px rgba(1, 6, 14, 0.38);
}

.main-icon:hover img {
    transform: scale(1.05);
    filter: opacity(1) drop-shadow(0 14px 28px rgba(0, 0, 0, 0.44));
}

.main-icon h2 {
    margin-top: 0.5rem;
    color: var(--text-primary);
    font-size: clamp(1.58rem, 1.95vw, 1.95rem);
    font-weight: 700;
    letter-spacing: 0.015em;
    text-wrap: balance;
}

.main-icon a:focus-visible {
    outline: 2px solid var(--accent-warm);
    outline-offset: 3px;
    border-radius: 14px;
}

@media (max-width: 1080px) {
    .content-container {
        width: min(920px, 92vw);
        padding: 34px 22px;
    }

    .main-icons-container {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1.2rem 0.7rem;
        overflow-y: auto;
    }

    .content-container {
        padding: 22px 12px 18px;
        width: 94%;
        border-radius: 20px;
    }

    .main-icons-container {
        gap: 0.8rem;
    }

    .welcome-text {
        margin-bottom: 1.3rem;
    }

    .main-icon a {
        min-height: 194px;
        padding: 1rem 0.8rem;
    }
}

@media (max-width: 360px) {
    .main-icon a {
        min-height: 184px;
    }
}

@keyframes nebulaMove {
    from {
        transform: translate3d(-1.2%, -1%, 0) scale(1);
    }
    to {
        transform: translate3d(1.2%, 1%, 0) scale(1.06);
    }
}

@keyframes starPulse {
    from {
        opacity: 0.6;
    }
    to {
        opacity: 0.86;
    }
}

@keyframes starTwinkleSlow {
    from {
        opacity: 0.34;
    }
    to {
        opacity: 0.58;
    }
}

@keyframes starDrift {
    from {
        background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
    }
    to {
        background-position: 180px 90px, -140px 100px, 100px -120px, -90px -80px, 120px -60px, -110px 70px;
    }
}

@keyframes shootingStar {
    0% {
        opacity: 0;
        transform: rotate(-24deg) translate3d(0, 0, 0) scaleX(0.35);
    }
    78% {
        opacity: 0;
        transform: rotate(-24deg) translate3d(0, 0, 0) scaleX(0.35);
    }
    80% {
        opacity: 0.95;
        transform: rotate(-24deg) translate3d(-8px, 6px, 0) scaleX(1);
    }
    84% {
        opacity: 0.9;
        transform: rotate(-24deg) translate3d(-300px, 190px, 0) scaleX(1);
    }
    88% {
        opacity: 0;
        transform: rotate(-24deg) translate3d(-520px, 330px, 0) scaleX(0.75);
    }
    100% {
        opacity: 0;
        transform: rotate(-24deg) translate3d(-520px, 330px, 0) scaleX(0.75);
    }
}

/* Modo rendimiento para móvil / dispositivos modestos */
@media (max-width: 900px), (prefers-reduced-motion: reduce) {
    html::before,
    html::after,
    body::before,
    body::after {
        content: none !important;
        animation: none !important;
        filter: none !important;
    }

    body {
        background-color: var(--bg-1) !important;
        background-image:
            radial-gradient(circle at 16% 20%, rgba(92, 141, 255, 0.34), transparent 36%),
            radial-gradient(circle at 80% 24%, rgba(230, 96, 255, 0.26), transparent 38%),
            radial-gradient(circle at 56% 78%, rgba(96, 210, 255, 0.2), transparent 34%),
            linear-gradient(140deg, var(--bg-1) 0%, var(--bg-2) 52%, var(--bg-3) 100%) !important;
        background-blend-mode: normal !important;
        background-size: 100% 100% !important;
        background-position: center center !important;
        transition: none !important;
    }

    .content-container {
        background: rgba(11, 20, 44, 0.92) !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        box-shadow: 0 6px 14px rgba(2, 8, 18, 0.28) !important;
    }

    .main-icon,
    .main-icon:hover {
        transform: none !important;
        box-shadow: 0 2px 8px rgba(2, 8, 18, 0.22) !important;
    }

    .main-icon img,
    .main-icon:hover img {
        transform: none !important;
        filter: none !important;
    }
}
