.top-nav-shell {
    border-bottom: 1px solid var(--ui-border-subtle);
    margin: 0 -24px 18px;
    padding: 0 24px;
    background: var(--ui-surface);
}

.top-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.top-nav-brand {
    color: var(--ui-text-heading);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
}

.brand-title {
    display: inline-flex;
    align-items: baseline;
    font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: 0.015em;
    line-height: 1;
}

.brand-mark {
    font-size: 0.62em;
    vertical-align: super;
    margin-left: 0.08em;
    font-weight: 700;
}

.top-nav-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.top-nav-menu {
    position: relative;
    margin: 0;
}

.top-nav-menu > summary {
    list-style: none;
}

.top-nav-menu > summary::-webkit-details-marker {
    display: none;
}

.top-nav-menu-toggle {
    cursor: pointer;
}

.top-nav-menu-toggle::after {
    content: "▾";
    margin-left: 6px;
    font-size: 0.78em;
    line-height: 1;
    color: currentColor;
}

.top-nav-menu[open] > .top-nav-menu-toggle::after,
.top-nav-menu:hover > .top-nav-menu-toggle::after,
.top-nav-menu:focus-within > .top-nav-menu-toggle::after {
    transform: rotate(180deg);
}

.top-nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: none;
    min-width: 240px;
    padding: 8px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface);
    box-shadow: 0 12px 24px var(--ui-shadow-3);
}

.top-nav-menu[open] > .top-nav-dropdown,
.top-nav-menu:hover > .top-nav-dropdown,
.top-nav-menu:focus-within > .top-nav-dropdown {
    display: grid;
    gap: 2px;
}

.top-nav-dropdown-link {
    width: 100%;
    justify-content: flex-start;
    height: auto;
    min-height: 36px;
    padding: 8px 10px;
    border-color: transparent;
}

.top-nav-language {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.top-nav-language-label {
    font-size: 12px;
    color: var(--ui-text-muted);
    white-space: nowrap;
}

.top-nav-language-select {
    min-height: 32px;
    border: 1px solid var(--ui-border);
    border-radius: 6px;
    background: var(--ui-surface);
    color: var(--ui-text-heading);
    padding: 0 8px;
    font-size: 13px;
}

.top-nav-link {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    color: var(--ui-text);
    text-decoration: none;
    border: 1px solid transparent;
}

.top-nav-link:hover {
    background: var(--ui-surface-muted);
}

.top-nav-link:focus-visible {
    outline: 2px solid var(--ui-focus-ring);
    outline-offset: 2px;
}

.top-nav-link.is-active {
    color: var(--ui-text-heading);
    background: var(--ui-surface-muted);
    border-color: var(--ui-border);
    font-weight: 600;
}

@media (max-width: 760px) {
    .top-nav-shell {
        margin: 0 -16px 16px;
        padding: 0 16px;
    }

    .top-nav-inner {
        min-height: 52px;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 10px 0;
    }

    .top-nav-brand {
        font-size: 13px;
        flex: 1 0 100%;
    }

    .brand-title {
        font-size: 1.08rem;
    }

    .top-nav-list {
        flex-wrap: wrap;
    }

    .top-nav-link {
        height: 34px;
        padding: 0 10px;
        font-size: 13px;
    }

    .top-nav-menu {
        width: auto;
    }

    .top-nav-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        display: none;
        min-width: 0;
        width: min(240px, calc(100vw - 32px));
        max-width: calc(100vw - 32px);
        padding: 8px;
        box-shadow: 0 12px 24px var(--ui-shadow-3);
        z-index: 40;
        max-height: calc(100vh - 32px);
        overflow: auto;
    }

    .top-nav-menu[open] > .top-nav-dropdown,
    .top-nav-menu:hover > .top-nav-dropdown,
    .top-nav-menu:focus-within > .top-nav-dropdown {
        display: grid;
    }

    .top-nav-language {
        gap: 6px;
        margin-left: 0;
    }

    .top-nav-language-label {
        display: none;
    }

    .top-nav-language-select {
        min-height: 30px;
    }
}

@media (max-width: 430px) and (orientation: portrait) {
    html[lang="en"] .top-nav-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 8px;
        row-gap: 6px;
    }

    html[lang="en"] .top-nav-brand {
        grid-column: 1 / -1;
        flex: none;
    }

    html[lang="en"] .top-nav-list {
        width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        gap: 2px;
    }

    html[lang="en"] .top-nav-link {
        padding: 0 8px;
        min-width: 0;
    }

    html[lang="en"] .top-nav-menu {
        min-width: 0;
    }

    html[lang="en"] .top-nav-language {
        min-width: 0;
        gap: 6px;
        margin-left: 0;
    }

    html[lang="en"] .top-nav-language-select {
        width: clamp(96px, 24vw, 120px);
        min-width: 96px;
        padding: 0 6px;
    }
}

@media (max-width: 360px) and (orientation: portrait) {
    html[lang="en"] .top-nav-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    html[lang="en"] .top-nav-brand {
        flex: 1 0 100%;
    }

    html[lang="en"] .top-nav-list {
        width: auto;
        flex-wrap: wrap;
        gap: 2px;
    }

    html[lang="en"] .top-nav-link {
        padding: 0 8px;
    }

    html[lang="en"] .top-nav-language-select {
        width: auto;
        min-width: 96px;
    }
}
