* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 32%),
        linear-gradient(135deg, #eef2ff, #f8fafc);
    color: #111827;
}

.page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 42px 18px;
}

.header {
    text-align: center;
    margin-bottom: 42px;
}

.header h1 {
    font-size: clamp(32px, 7vw, 48px);
    line-height: 1.1;
    margin-bottom: 12px;
    color: #0f172a;
}

.header p {
    max-width: 680px;
    margin: 0 auto;
    font-size: clamp(15px, 4vw, 18px);
    line-height: 1.5;
    color: #64748b;
}

.links-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
}

.menu-item {
    position: relative;
    z-index: 1;
}

.menu-item:hover,
.menu-item:focus-within {
    z-index: 100;
}

.main-card {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;

    min-height: 136px;
    padding: 26px;

    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 26px;

    color: inherit;
    text-decoration: none;

    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        border-radius 0.2s ease;
}

.main-card:hover,
.menu-item:focus-within .main-card {
    transform: translateY(-2px);
    border-color: #6366f1;
    box-shadow: 0 24px 52px rgba(15, 23, 42, 0.16);
}

.has-submenu:hover .main-card,
.has-submenu:focus-within .main-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.main-card-content {
    min-width: 0;
}

.main-card h2 {
    font-size: clamp(22px, 5vw, 28px);
    line-height: 1.15;
    margin-bottom: 9px;
    color: #0f172a;
    word-break: break-word;
}

.main-card p {
    font-size: clamp(14px, 3.8vw, 16px);
    line-height: 1.5;
    color: #64748b;
    word-break: break-word;
}

.main-arrow {
    flex: 0 0 auto;

    width: 44px;
    height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;

    font-size: 25px;
    font-weight: 700;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.has-submenu:hover .main-arrow,
.has-submenu:focus-within .main-arrow {
    transform: rotate(180deg);
    background: #e0e7ff;
}

.submenu {
    position: absolute;
    z-index: 1;

    top: calc(100% - 1px);
    left: 0;
    right: 0;

    max-height: min(520px, 60vh);
    overflow-y: auto;

    padding: 18px;

    background: #ffffff;
    border: 1px solid #6366f1;
    border-top: none;
    border-radius: 0 0 26px 26px;

    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.18);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    pointer-events: none;

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.submenu-title {
    display: inline-flex;
    align-items: center;

    margin-bottom: 12px;
    padding: 8px 13px;

    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;

    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.submenu-link {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;

    width: 100%;
    margin-top: 9px;
    padding: 14px 15px;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;

    color: #0f172a;
    text-decoration: none;

    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.submenu-link:hover {
    transform: translateX(5px);
    background: #eef2ff;
    border-color: #6366f1;
}

.submenu-name {
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}

.submenu-folder {
    font-size: 12px;
    color: #64748b;
    word-break: break-all;
}

.submenu-arrow {
    color: #4f46e5;
    font-size: 18px;
    font-weight: 800;
}

@media (min-width: 820px) {
    .page {
        padding: 58px 24px;
    }

    .links-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 700px) {
    .main-card {
        min-height: auto;
        padding: 22px;
    }

    .has-submenu .main-card {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .has-submenu .main-arrow {
        transform: rotate(180deg);
    }

    .submenu {
        position: static;

        max-height: none;
        overflow-y: visible;

        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;

        border: 1px solid #e2e8f0;
        border-top: none;
        border-radius: 0 0 26px 26px;

        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    }
}

@media (max-width: 420px) {
    .page {
        padding: 26px 12px;
    }

    .header {
        margin-bottom: 30px;
    }

    .main-card {
        align-items: flex-start;
        gap: 14px;
        padding: 18px;
    }

    .main-arrow {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .submenu {
        padding: 13px;
    }

    .submenu-link {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 13px;
    }

    .submenu-arrow {
        display: none;
    }

    .submenu-folder {
        font-size: 11px;
    }
}